Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chain cli #90

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Add chain cli #90

wants to merge 16 commits into from

Conversation

Andrei-Dolgolev
Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev commented Oct 9, 2024

Merge moonstreamdb-v3 to seer.
Add chain cli.

Chain cli work as chain specific so command run only for 1 chain.

go run *.go generates blockchain chain --RPC

Request RPC node for feel chain info structure:

type ChainInfo struct {
	ChainType string                 `json:"chainType"` // L1 or L2
	ChainID   *big.Int               `json:"chainID"`   // Chain ID
	Block     *seer_common.BlockJson `json:"block"`
}

By requesting eth_getBlock and eth_chainID.

parameters:

Generate definitions for various blockchains

Usage:
  seer generates blockchain chain [flags]

Flags:
      --chain string    The name of the blockchain (required)
      --definitions     Generate definitions (Optional)
      --full            Generate all  (Optional)
  -h, --help            help for chain
      --interfaces      Generate interfaces (Optional)
      --migrations      Generate migrations (Optional)
      --models          Generate models (Optional)
      --output string   The path to the output file(chain Info include lates block and transactions) (Optional)
      --rpc string      The RPC URL for the blockchain (required)
      --subscription    Generate subscription type (Optional)
      --deploy          Generate deploy scripts (Optional)
  • --output Dump chain info to file.

Each Optional flag decide what will be generated as output:

  • --definitions

Generate Protobf definitions file for chain(depend on if chain detect L2 fields in RPC response will ad extra field.
Create files:
seer/blockchain/<chain_name_lower>

   /<chain_name_lover>.proto

Template: seer/blockchain/common/evm_proto_template.proto.tmpl

  • --interfaces same as seer blockchain generate -n $BLOCKCHAIN --side-chain but side chain dected from RPC
    required: Proto definitions must exits in blockchain folder for that chain name
    Create files:
    seer/blockchain/<chain_name_lower>
  /<chain_name_lover>.go
  /<chain_name_lover>.pb.go
  • --models generate databases models

seer/moonstreamdb-v3/moonstreamdbv3

/models/<chain_name_lower>_labels.py
/models_indexes/<chain_name_lower>_indexes.py
  • --migrations create igration files with alembic revisiom --autogenerate -m 'add-<chain_name_lower>'

seer/moonstreamdb-v3/moonstreamdbv3

/alembic/<new revision file>
/alembic_indexes/<new revision file>
  • --deploy Generate deploy scripts

seer/deploy

/seer-crawler-<chain_name_lower_dash>.service
/seer-historical-synchronizer-<chain_name_lower_dash>.service
/seer-historical-synchronizer-<chain_name_lower_dash>.timer
/seer-synchronizer-<chain_name_lower_dash>.service
  • --subscription

Generate subscription resource.

Command examples:

@Andrei-Dolgolev Andrei-Dolgolev changed the title Add chain type cli Add chain cli Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant