chains

package
v0.0.1-gowrapper-test Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArbitrumChainID

func GetArbitrumChainID() []byte

GetArbitrumChainID returns Arbitrum One mainnet chain ID

func GetAvalancheChainID

func GetAvalancheChainID() []byte

GetAvalancheChainID returns Avalanche C-Chain mainnet chain ID

func GetBSCChainID

func GetBSCChainID() []byte

GetBSCChainID returns BSC mainnet chain ID

func GetBaseChainID

func GetBaseChainID() []byte

GetBaseChainID returns Base mainnet chain ID

func GetEthereumChainID

func GetEthereumChainID() []byte

GetEthereumChainID returns Ethereum mainnet chain ID

func GetOptimismChainID

func GetOptimismChainID() []byte

GetOptimismChainID returns Optimism mainnet chain ID

func GetPolygonChainID

func GetPolygonChainID() []byte

GetPolygonChainID returns Polygon mainnet chain ID

Types

type ArbitrumChain

type ArbitrumChain struct {
	*EthereumCompatibleChain
}

ArbitrumChain represents the Arbitrum One mainnet

func NewArbitrumChain

func NewArbitrumChain() *ArbitrumChain

NewArbitrumChain creates a new Arbitrum One chain instance

type AvalancheChain

type AvalancheChain struct {
	*EthereumCompatibleChain
}

AvalancheChain represents the Avalanche C-Chain mainnet

func NewAvalancheChain

func NewAvalancheChain() *AvalancheChain

NewAvalancheChain creates a new Avalanche C-Chain instance

type BSCChain

type BSCChain struct {
	*EthereumCompatibleChain
}

BSCChain represents the Binance Smart Chain mainnet

func NewBSCChain

func NewBSCChain() *BSCChain

NewBSCChain creates a new BSC chain instance

type BaseChain

type BaseChain struct {
	*EthereumCompatibleChain
}

BaseChain represents the Base mainnet with specific transaction validation

func NewBaseChain

func NewBaseChain() *BaseChain

NewBaseChain creates a new Base chain instance

type EIP1559SigningInput

type EIP1559SigningInput struct {
	Nonce                 []byte `json:"nonce"`
	MaxInclusionFeePerGas []byte `json:"max_inclusion_fee_per_gas"`
	MaxFeePerGas          []byte `json:"max_fee_per_gas"`
	GasLimit              []byte `json:"gas_limit"`
	ToAddress             string `json:"to_address"`
	Amount                []byte `json:"amount"`
	Data                  []byte `json:"data"`
	ChainID               []byte `json:"chain_id"`
}

EIP1559SigningInput represents parameters for building an EIP-1559 transaction

type ERC20EIP1559SigningInput

type ERC20EIP1559SigningInput struct {
	Nonce                 []byte `json:"nonce"`
	MaxInclusionFeePerGas []byte `json:"max_inclusion_fee_per_gas"`
	MaxFeePerGas          []byte `json:"max_fee_per_gas"`
	GasLimit              []byte `json:"gas_limit"`
	TokenContract         string `json:"token_contract"`
	ToAddress             string `json:"to_address"`
	Amount                []byte `json:"amount"`
	ChainID               []byte `json:"chain_id"`
}

ERC20EIP1559SigningInput represents parameters for building an EIP-1559 ERC20 token transfer

type ERC20TransferInput

type ERC20TransferInput struct {
	Nonce         []byte `json:"nonce"`
	GasPrice      []byte `json:"gas_price"`
	GasLimit      []byte `json:"gas_limit"`
	TokenContract string `json:"token_contract"`
	ToAddress     string `json:"to_address"`
	Amount        []byte `json:"amount"`
	ChainID       []byte `json:"chain_id"`
}

ERC20TransferInput represents parameters for building an ERC20 token transfer

type EthereumChain

type EthereumChain struct {
	*EthereumCompatibleChain
}

EthereumChain represents the Ethereum mainnet

func NewEthereumChain

func NewEthereumChain() *EthereumChain

NewEthereumChain creates a new Ethereum chain instance

type EthereumCompatibleChain

type EthereumCompatibleChain struct {
	*chain_abstraction.BaseChain
}

EthereumCompatibleChain provides a complete base implementation for all EVM-compatible chains This includes Ethereum, Polygon, BSC, Avalanche, Arbitrum, Optimism, Base, Fantom, etc. It implements the chain_abstraction.Chain interface.

func NewEthereumCompatibleChain

func NewEthereumCompatibleChain(coinType core.CoinType) *EthereumCompatibleChain

NewEthereumCompatibleChain creates a new Ethereum-compatible chain instance Only requires coinType - all other info is derived from core

func (*EthereumCompatibleChain) BuildEIP1559SigningInput

func (e *EthereumCompatibleChain) BuildEIP1559SigningInput(
	nonce []byte,
	maxInclusionFeePerGas []byte,
	maxFeePerGas []byte,
	gasLimit []byte,
	toAddress string,
	amount []byte,
	data []byte,
	chainID []byte,
) (*ethereum.SigningInput, error)

BuildEIP1559SigningInput creates a signing input for an EIP-1559 transaction

func (*EthereumCompatibleChain) BuildEIP1559SigningInputFromStruct

func (e *EthereumCompatibleChain) BuildEIP1559SigningInputFromStruct(params EIP1559SigningInput) (*ethereum.SigningInput, error)

BuildEIP1559SigningInputFromStruct builds a signing input for an EIP-1559 transaction using a struct

func (*EthereumCompatibleChain) BuildERC20EIP1559SigningInput

func (e *EthereumCompatibleChain) BuildERC20EIP1559SigningInput(
	nonce []byte,
	maxInclusionFeePerGas []byte,
	maxFeePerGas []byte,
	gasLimit []byte,
	tokenContract string,
	toAddress string,
	amount []byte,
	chainID []byte,
) (*ethereum.SigningInput, error)

BuildERC20EIP1559SigningInput creates a signing input for an EIP-1559 ERC20 token transfer

func (*EthereumCompatibleChain) BuildERC20EIP1559SigningInputFromStruct

func (e *EthereumCompatibleChain) BuildERC20EIP1559SigningInputFromStruct(params ERC20EIP1559SigningInput) (*ethereum.SigningInput, error)

BuildERC20EIP1559SigningInputFromStruct builds a signing input for an EIP-1559 ERC20 token transfer using a struct

func (*EthereumCompatibleChain) BuildERC20TransferInput

func (e *EthereumCompatibleChain) BuildERC20TransferInput(
	nonce []byte,
	gasPrice []byte,
	gasLimit []byte,
	tokenContract string,
	toAddress string,
	amount []byte,
	chainID []byte,
) (*ethereum.SigningInput, error)

BuildERC20TransferInput creates a signing input for an ERC20 token transfer

func (*EthereumCompatibleChain) BuildERC20TransferInputFromStruct

func (e *EthereumCompatibleChain) BuildERC20TransferInputFromStruct(params ERC20TransferInput) (*ethereum.SigningInput, error)

BuildERC20TransferInputFromStruct builds a signing input for an ERC20 token transfer using a struct

func (*EthereumCompatibleChain) BuildLegacySigningInputFromStruct

func (e *EthereumCompatibleChain) BuildLegacySigningInputFromStruct(params LegacySigningInput) (*ethereum.SigningInput, error)

BuildLegacySigningInputFromStruct builds a signing input for a basic transaction using a struct

func (*EthereumCompatibleChain) BuildSigningInput

func (e *EthereumCompatibleChain) BuildSigningInput(
	nonce []byte,
	gasPrice []byte,
	gasLimit []byte,
	toAddress string,
	amount []byte,
	data []byte,
	chainID []byte,
) (*ethereum.SigningInput, error)

BuildSigningInput creates a signing input for a basic ETH transfer

func (*EthereumCompatibleChain) CompileTransaction

func (e *EthereumCompatibleChain) CompileTransaction(
	input *chain_abstraction.TransactionInput,
	signatures [][]byte,
	publicKeys [][]byte,
) ([]byte, error)

CompileTransaction compiles a transaction with signatures

func (*EthereumCompatibleChain) CreateAndSignTransaction

func (e *EthereumCompatibleChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)

CreateAndSignTransaction creates and signs a transaction

func (*EthereumCompatibleChain) CreateWalletWithPrivateKey

func (e *EthereumCompatibleChain) CreateWalletWithPrivateKey(privateKey string) (*chain_abstraction.Wallet, error)

CreateWalletWithPrivateKey creates a wallet from private key Override BaseChain's implementation to handle Ethereum-specific private key format

func (*EthereumCompatibleChain) GetDecimals

func (e *EthereumCompatibleChain) GetDecimals() int

GetDecimals returns the number of decimals (18 for all EVM chains) Override BaseChain's GetDecimals to ensure it's always 18 for EVM chains

func (*EthereumCompatibleChain) GetPreimageHash

func (e *EthereumCompatibleChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)

GetPreimageHash gets the preimage hash for the transaction

func (*EthereumCompatibleChain) GetTransactionHash

func (e *EthereumCompatibleChain) GetTransactionHash(encodedTx []byte) (string, error)

GetTransactionHash gets the transaction hash for the transaction

func (*EthereumCompatibleChain) PrepareTransaction

func (e *EthereumCompatibleChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)

PrepareTransaction prepares a transaction for external signing

func (*EthereumCompatibleChain) Sign

func (e *EthereumCompatibleChain) Sign(preimage []byte, privateKey []byte) ([]byte, error)

Sign signs a preimage with the given private key

func (*EthereumCompatibleChain) ValidateTransactionInput

func (e *EthereumCompatibleChain) ValidateTransactionInput(input interface{}) error

ValidateTransactionInput validates transaction input

type LegacySigningInput

type LegacySigningInput struct {
	Nonce     []byte `json:"nonce"`
	GasPrice  []byte `json:"gas_price"`
	GasLimit  []byte `json:"gas_limit"`
	ToAddress string `json:"to_address"`
	Amount    []byte `json:"amount"`
	Data      []byte `json:"data"`
	ChainID   []byte `json:"chain_id"`
}

LegacySigningInput represents parameters for building a legacy transaction

type OptimismChain

type OptimismChain struct {
	*EthereumCompatibleChain
}

OptimismChain represents the Optimism mainnet with specific transaction validation

func NewOptimismChain

func NewOptimismChain() *OptimismChain

NewOptimismChain creates a new Optimism chain instance

type PolygonChain

type PolygonChain struct {
	*EthereumCompatibleChain
}

PolygonChain represents the Polygon mainnet with specific transaction validation

func NewPolygonChain

func NewPolygonChain() *PolygonChain

NewPolygonChain creates a new Polygon chain instance

Jump to

Keyboard shortcuts

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