codegen

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChainConfigByID = map[string]*ChainConfig{
	"mainnet": {
		DisplayName:      "Ethereum Mainnet",
		ExplorerLink:     "https://etherscan.io",
		FirehoseEndpoint: "mainnet.eth.streamingfast.io:443",
		Network:          "mainnet",
		SupportsCalls:    true,
	},
	"bnb": {
		DisplayName:      "BNB",
		ExplorerLink:     "https://bscscan.com",
		FirehoseEndpoint: "bnb.streamingfast.io:443",
		Network:          "bsc",
		SupportsCalls:    true,
	},
	"polygon": {
		DisplayName:      "Polygon",
		ExplorerLink:     "https://polygonscan.com",
		FirehoseEndpoint: "polygon.streamingfast.io:443",
		Network:          "polygon",
		SupportsCalls:    true,
	},
	"amoy": {
		DisplayName:      "Polygon Amoy Testnet",
		ExplorerLink:     "https://www.okx.com/web3/explorer/amoy",
		FirehoseEndpoint: "amoy.substreams.pinax.network:443",
		Network:          "amoy",
		SupportsCalls:    true,
	},
	"arbitrum": {
		DisplayName:      "Arbitrum",
		ExplorerLink:     "https://arbiscan.io",
		FirehoseEndpoint: "arb-one.streamingfast.io:443",
		Network:          "arbitrum",
		SupportsCalls:    true,
	},
	"holesky": {
		DisplayName:      "Holesky",
		ExplorerLink:     "https://holesky.etherscan.io/",
		FirehoseEndpoint: "holesky.eth.streamingfast.io:443",
		Network:          "holesky",
		SupportsCalls:    true,
	},
	"sepolia": {
		DisplayName:      "Sepolia Testnet",
		ExplorerLink:     "https://sepolia.etherscan.io",
		FirehoseEndpoint: "sepolia.streamingfast.io:443",
		Network:          "sepolia",
		SupportsCalls:    true,
	},
	"optimism": {
		DisplayName:      "Optimism Mainnet",
		ExplorerLink:     "https://optimistic.etherscan.io",
		FirehoseEndpoint: "opt-mainnet.streamingfast.io:443",
		Network:          "optimism",
		SupportsCalls:    false,
	},
	"avalanche": {
		DisplayName:      "Avalanche C-chain",
		ExplorerLink:     "https://subnets.avax.network/c-chain",
		FirehoseEndpoint: "avalanche-mainnet.streamingfast.io:443",
		Network:          "avalanche",
		SupportsCalls:    false,
	},
	"chapel": {
		DisplayName:      "BNB Chapel Testnet",
		ExplorerLink:     "https://testnet.bscscan.com/",
		FirehoseEndpoint: "chapel.substreams.pinax.network:443",
		Network:          "chapel",
		SupportsCalls:    true,
	},
	"injective-mainnet": {
		DisplayName:      "Injective Mainnet",
		ExplorerLink:     "https://explorer.injective.network/",
		FirehoseEndpoint: "mainnet.injective.streamingfast.io:443",
		Network:          "injective-mainnet",
	},
	"injective-testnet": {
		DisplayName:      "Injective Testnet",
		ExplorerLink:     "https://testnet.explorer.injective.network/",
		FirehoseEndpoint: "testnet.injective.streamingfast.io:443",
		Network:          "injective-testnet",
	},
	"starknet-mainnet": {
		DisplayName:      "Starknet Mainnet Transactions",
		ExplorerLink:     "https://starkscan.co/",
		FirehoseEndpoint: "mainnet.starknet.streamingfast.io:443",
		Network:          "starknet-mainnet",
	},
	"starknet-testnet": {
		DisplayName:      "Starknet Testnet Transactions",
		ExplorerLink:     "",
		FirehoseEndpoint: "testnet.starknet.streamingfast.io:443",
		Network:          "starknet-testnet",
	},
	"solana": {
		DisplayName:      "Solana Mainnet",
		Network:          "solana",
		FirehoseEndpoint: "mainnet.solana.streamingfast.io:443",
	},
	"vara-mainnet": {
		DisplayName:      "Vara Mainnet",
		ExplorerLink:     "https://vara.subscan.io/",
		FirehoseEndpoint: "mainnet.vara.streamingfast.io:443",
		Network:          "vara-mainnet",
	},
	"vara-testnet": {
		DisplayName:      "Vara Testnet",
		ExplorerLink:     "",
		FirehoseEndpoint: "testnet.vara.streamingfast.io:443",
		Network:          "vara-testnet",
	},
}
View Source
var Cmd = &cobra.Command{Use: "codegen", Short: "Code generator for substreams"}
View Source
var SQLCmd = &cobra.Command{
	Use:   "subgraph <manifest_url> <module_name>",
	Short: "Generate subgraph dev environment from substreams manifest",
	Args:  cobra.ExactArgs(3),
	RunE:  generateSQLEnv,
}
View Source
var SubgraphCmd = &cobra.Command{
	Use:   "subgraph [<manifest_url>]",
	Short: "Generate subgraph dev environment from substreams manifest",
	Args:  cobra.RangeArgs(0, 1),
	RunE:  generateSubgraphEnv,
}

Functions

func ParseFS added in v1.10.0

func ParseFS(myFuncs template.FuncMap, fsys fs.FS, pattern string) (*template.Template, error)

Types

type ChainConfig added in v1.10.0

type ChainConfig struct {
	ID               string // Public
	DisplayName      string // Public
	ExplorerLink     string
	ApiEndpoint      string
	FirehoseEndpoint string
	Network          string
	SupportsCalls    bool
}

type ExampleEntity added in v1.10.0

type ExampleEntity struct {
	Name             string
	NameAsProtoField string
	NameAsEntity     string
	ID               string
}

type Project added in v1.10.0

type Project struct {
	Name             string
	Network          string
	Module           *pbsubstreams.Module
	OutputDescriptor *descriptorpb.DescriptorProto

	ExampleEntity   *ExampleEntity
	SpkgProjectName string
	// contains filtered or unexported fields
}

func NewProject added in v1.10.0

func NewProject(name, spkgProjectName, network string, module *pbsubstreams.Module, outputDescriptor *descriptorpb.DescriptorProto, protoTypeMapping map[string]*descriptorpb.DescriptorProto) *Project

func (*Project) BuildExampleEntity added in v1.10.0

func (p *Project) BuildExampleEntity() error

func (*Project) ChainEndpoint added in v1.10.0

func (p *Project) ChainEndpoint() (string, error)

func (*Project) ExampleEntityHasID added in v1.10.0

func (p *Project) ExampleEntityHasID() bool

func (*Project) GetModuleName added in v1.10.0

func (p *Project) GetModuleName() string

func (*Project) GetOutputProtoPath added in v1.10.0

func (p *Project) GetOutputProtoPath() string

func (*Project) GetOutputProtobufPath added in v1.10.0

func (p *Project) GetOutputProtobufPath() string

func (*Project) HasExampleEntity added in v1.10.0

func (p *Project) HasExampleEntity() bool

func (*Project) OutputName added in v1.10.0

func (p *Project) OutputName() string

func (*Project) ProtoOutputName added in v1.10.0

func (p *Project) ProtoOutputName() string

func (*Project) ProtoOutputNameToSnake added in v1.10.0

func (p *Project) ProtoOutputNameToSnake() string

func (*Project) Render added in v1.10.0

func (p *Project) Render(outputType string, withDevEnv bool) (projectFiles map[string][]byte, err error)

func (*Project) SubstreamsKebabName added in v1.10.0

func (p *Project) SubstreamsKebabName() string

type ProtoGenerator

type ProtoGenerator struct {
	// contains filtered or unexported fields
}

func NewProtoGenerator

func NewProtoGenerator(outputPath string, excludedPaths []string, generateMod bool) *ProtoGenerator

func (*ProtoGenerator) GenerateProto added in v0.1.0

func (g *ProtoGenerator) GenerateProto(pkg *pbsubstreams.Package, showBufContent bool) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL