-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
153 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// (c) Cartesi and individual authors (see AUTHORS) | ||
// SPDX-License-Identifier: Apache-2.0 (see LICENSE) | ||
|
||
package mine | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
|
||
"github.com/cartesi/rollups-node/pkg/ethutil" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "mine", | ||
Short: "Mine a new block", | ||
Example: examples, | ||
Run: run, | ||
} | ||
|
||
const examples = `# Mine a new block: | ||
cartesi-rollups-cli mine` | ||
|
||
var ( | ||
anvilEndpoint string | ||
) | ||
|
||
func init() { | ||
|
||
Cmd.Flags().StringVar(&anvilEndpoint, "anvil-endpoint", "http://localhost:8545", | ||
"address of anvil endpoint to be used to send the mining request") | ||
} | ||
|
||
func run(cmd *cobra.Command, args []string) { | ||
|
||
blockNumber, err := ethutil.MineNewBlock(context.Background(), anvilEndpoint) | ||
|
||
cobra.CheckErr(err) | ||
|
||
slog.Info("Ok", "block number", blockNumber) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## cartesi-rollups-cli mine | ||
|
||
Mine a new block | ||
|
||
``` | ||
cartesi-rollups-cli mine [flags] | ||
``` | ||
|
||
### Examples | ||
|
||
``` | ||
# Mine a new block: | ||
cartesi-rollups-cli mine | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
--anvil-endpoint string address of anvil endpoint to be used to send the mining request (default "http://localhost:8545") | ||
-h, --help help for mine | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [cartesi-rollups-cli](cartesi-rollups-cli.md) - Command line interface for Cartesi Rollups | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters