routerchain

package
v1.3.21 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 73 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimedOut       = errors.New("tx timed out")
	ErrQueueClosed    = errors.New("queue is closed")
	ErrEnqueueTimeout = errors.New("enqueue timeout")
	ErrReadOnly       = errors.New("client is in read-only mode")
)

Functions

func InitCosmosKeyring

func InitCosmosKeyring(
	cosmosKeyringDir string,
	cosmosKeyringAppName string,
	cosmosKeyringBackend string,
	cosmosKeyFrom string,
	cosmosKeyPassphrase string,
	cosmosPrivKey string,
	cosmosUseLedger bool,
) (cosmtypes.AccAddress, keyring.Keyring, error)

func InitEthereumAccountsManager added in v1.2.85

func InitEthereumAccountsManager(
	ethChainID uint64,
	ethKeystoreDir *string,
	ethKeyFrom *string,
	ethPassphrase *string,
	ethPrivKey *string,
	ethUseLedger *bool,
) (
	ethKeyFromAddress ethcmn.Address,
	signerFn bind.SignerFn,
	personalSignFn keystore.PersonalSignFn,
	err error,
)

func InitEthereumSginerAccountManager added in v1.2.85

func InitEthereumSginerAccountManager(
	ethKeystoreDir *string,
	ethKeyFrom *string,
	ethPassphrase *string,
	ethPrivKey *string,
	ethUseLedger *bool,
) (
	ethKeyFromAddress ethcmn.Address,
	personalSignFn keystore.PersonalSignFn,
	err error,
)

func KeyringForPrivKey

func KeyringForPrivKey(cdc codec.Codec, name string, privKey cryptotypes.PrivKey) (keyring.Keyring, error)

KeyringForPrivKey creates a temporary in-mem keyring for a PrivKey. Allows to init Context when the key has been provided in plaintext and parsed.

func NewClientContext

func NewClientContext(
	chainId, fromSpec string, kb keyring.Keyring,
) (client.Context, error)

NewClientContext creates a new Cosmos Client context, where chainID corresponds to Cosmos chain ID, fromSpec is either name of the key, or bech32-address of the Cosmos account. Keyring is required to contain the specified key.

func NewCodec

func NewCodec() (*codec.ProtoCodec, types.InterfaceRegistry)

func NewTxConfig

func NewTxConfig(signModes []signingtypes.SignMode) client.TxConfig

NewTxConfig initializes new Cosmos TxConfig with certain signModes enabled.

func NewTxFactory

func NewTxFactory(clientCtx client.Context) tx.Factory

Types

type ChainClient

type ChainClient interface {
	CanSignTransactions() bool
	FromAddress() sdk.AccAddress
	QueryClient() *grpc.ClientConn
	ClientContext() client.Context

	SimulateMsg(clientCtx client.Context, msgs ...sdk.Msg) (*txtypes.SimulateResponse, error)
	AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error)
	SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error)
	QueueBroadcastMsg(msgs ...sdk.Msg) error

	// bank
	GetBankBalances(ctx context.Context, address string) (*banktypes.QueryAllBalancesResponse, error)
	GetBankBalance(ctx context.Context, address string, denom string) (*banktypes.QueryBalanceResponse, error)
	GetAccount(ctx context.Context, address string) (*authtypes.QueryAccountResponse, error)

	// staking
	GetValidator(ctx context.Context, validatorAddr string) (*stakingtypes.QueryValidatorResponse, error)
	GetAllValidators(ctx context.Context, status string, pagination *query.PageRequest) (*stakingtypes.QueryValidatorsResponse, error)

	// MultiChain
	GetAllChainConfig(ctx context.Context, pagination *query.PageRequest) (*multichainTypes.QueryAllChainConfigResponse, error)
	GetChainConfig(ctx context.Context, chainId string) (*multichainTypes.QueryGetChainConfigResponse, error)
	GetContractConfig(ctx context.Context, chainId string, contract string) (*multichainTypes.QueryGetContractConfigResponse, error)
	GetAllContractConfig(ctx context.Context, pagination *query.PageRequest) (*multichainTypes.QueryAllContractConfigResponse, error)
	GetAllContractConfigByChainId(ctx context.Context, chainId string) (*multichainTypes.QueryAllContractConfigByChainIdResponse, error)
	GetNonceObservedStatus(ctx sdk.Context, chainId string, contractAddress string, nonce uint64) (*multichainTypes.QueryGetNonceObservedStatusResponse, error)

	// Attestation
	GetOrchestratorValidator(ctx context.Context, orchestratorAddr sdk.AccAddress) (*attestationTypes.QueryFetchOrchestratorValidatorResponse, error)
	GetValsetByNonce(c context.Context, valsetNonce uint64) (*attestationTypes.QueryGetValsetResponse, error)
	GetLastEventByValidator(ctx context.Context, chainId string, contract string, validator sdk.ValAddress) (*attestationTypes.QueryLastEventNonceResponse, error)
	GetLatestValset(ctx context.Context) (*attestationTypes.QueryLatestValsetResponse, error)
	GetLatestValsetNonce(ctx context.Context) (*attestationTypes.QueryLatestValsetNonceResponse, error)
	GetAllAttestations(ctx context.Context, pagination *query.PageRequest) (*attestationTypes.QueryAllAttestationResponse, error)
	GetAllObservedAttestations(ctx context.Context, pagination *query.PageRequest) (*attestationTypes.QueryAllObservedAttestationResponse, error)
	GetAllOrchestrators(ctx context.Context) (*attestationTypes.QueryListOrchestratorsResponse, error)
	GetAllValsets(ctx context.Context, pagination *query.PageRequest) (*attestationTypes.QueryAllValsetResponse, error)
	GetAllValsetConfirms(ctx context.Context, valsetNonce uint64, pagination *query.PageRequest) (*attestationTypes.QueryAllValsetConfirmationResponse, error)
	GetValsetConfirm(ctx context.Context, valsetNonce uint64, orchestrator string) (*attestationTypes.QueryGetValsetConfirmationResponse, error)

	// PriceFeed
	GetPriceBySymbol(ctx context.Context, symbol string) (*pricefeedTypes.QueryGetPriceResponse, error)
	GetAllSymbolPrices(ctx context.Context, pagination *query.PageRequest) (*pricefeedTypes.QueryAllPriceResponse, error)
	GetSymbolRequest(ctx context.Context, symbol string) (*pricefeedTypes.QueryGetSymbolRequestResponse, error)
	GetAllSymbolRequest(ctx context.Context, pagination *query.PageRequest) (*pricefeedTypes.QueryAllSymbolRequestResponse, error)
	GetPriceFeederInfo(ctx context.Context, priceFeederName string) (*pricefeedTypes.QueryGetPriceFeederInfoResponse, error)
	GetAllPriceFeederInfo(ctx context.Context, pagination *query.PageRequest) (*pricefeedTypes.QueryAllPriceFeederInfoResponse, error)
	GetGasPriceByChainId(ctx context.Context, chainId string) (*pricefeedTypes.QueryGetGasPriceResponse, error)
	GetAllGasPrice(ctx context.Context, pagination *query.PageRequest) (*pricefeedTypes.QueryAllGasPriceResponse, error)
	GetAllWhitelistedIBCChannels(ctx context.Context) (*pricefeedTypes.QueryWhitelistedIBCChannelsResponse, error)

	// Crosschain
	GetCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetCrosschainRequestResponse, error)
	GetAllCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllCrosschainRequestResponse, error)
	GetValidatedCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetValidCrosschainRequestResponse, error)
	GetAllValidCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllValidCrosschainRequestResponse, error)
	GetNativeTransferedCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetNativeTransferedCrosschainRequestResponse, error)
	GetAllNativeTransferedCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllNativeTransferedCrosschainRequestResponse, error)
	GetReadyToExecuteCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetReadyToExecuteCrosschainRequestResponse, error)
	GetAllReadyToExecuteCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllReadyToExecuteCrosschainRequestResponse, error)
	GetAllReadyToExecuteCrosschainRequestsByWorkflow(ctx context.Context, workflowType crosschainTypes.WorkflowType, pagination *query.PageRequest) (*crosschainTypes.QueryReadyToExecuteCrosschainRequestByWorkflowResponse, error)
	GetAllReadyToExecuteCrosschainRequestsByWorkflowAndRelayer(ctx context.Context, workflowType crosschainTypes.WorkflowType, relayerType crosschainTypes.RelayerType, pagination *query.PageRequest) (*crosschainTypes.QueryReadyToExecuteCrosschainRequestByWorkflowAndRelayerResponse, error)
	GetAllReadyToExecuteCrosschainAckRequestsByWorkflow(ctx context.Context, ackWorkflowType crosschainTypes.WorkflowType, pagination *query.PageRequest) (*crosschainTypes.QueryReadyToExecuteCrosschainAckRequestByWorkflowResponse, error)
	GetAllReadyToExecuteCrosschainAckRequestsByWorkflowAndRelayer(ctx context.Context, ackWorkflowType crosschainTypes.WorkflowType, ackRelayerType crosschainTypes.RelayerType, pagination *query.PageRequest) (*crosschainTypes.QueryReadyToExecuteCrosschainAckRequestByWorkflowAndRelayerResponse, error)
	GetBlockedCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetBlockedCrosschainRequestResponse, error)
	GetAllBlockedCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllBlockedCrosschainRequestResponse, error)
	GetExpiredCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetExpiredCrosschainRequestResponse, error)
	GetAllExpiredCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllExpiredCrosschainRequestResponse, error)
	GetExecutedCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetExecutedCrosschainRequestResponse, error)
	GetAllExecutedCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllExecutedCrosschainRequestResponse, error)
	GetFeesSettledCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetFeesSettledCrosschainRequestResponse, error)
	GetAllFeesSettledCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllFeesSettledCrosschainRequestResponse, error)
	GetCompletedCrosschainRequest(ctx context.Context, srcChainId string, requestIdentifier uint64) (*crosschainTypes.QueryGetCompletedCrosschainRequestResponse, error)
	GetAllCompletedCrosschainRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllCompletedCrosschainRequestResponse, error)

	// CrosschainAck
	GetCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetCrosschainAckRequestResponse, error)
	GetAllCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllCrosschainAckRequestResponse, error)
	GetValidCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetValidCrosschainAckRequestResponse, error)
	GetAllValidCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllValidCrosschainAckRequestResponse, error)
	GetBlockedCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetBlockedCrosschainAckRequestResponse, error)
	GetAllBlockedCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllBlockedCrosschainAckRequestResponse, error)
	GetReadyToExecuteCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetReadyToExecuteCrosschainAckRequestResponse, error)
	GetAllReadyToExecuteCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllReadyToExecuteCrosschainAckRequestResponse, error)
	GetExecutedCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetExecutedCrosschainAckRequestResponse, error)
	GetAllExecutedCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllExecutedCrosschainAckRequestResponse, error)
	GetFeesSettledCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetFeesSettledCrosschainAckRequestResponse, error)
	GetAllFeesSettledCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllFeesSettledCrosschainAckRequestResponse, error)
	GetCompletedCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetCompletedCrosschainAckRequestResponse, error)
	GetAllCompletedCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllCompletedCrosschainAckRequestResponse, error)
	GetExpiredCrosschainAckRequest(ctx context.Context, ackSrcChainId string, ackRequestIdentifier uint64) (*crosschainTypes.QueryGetExpiredCrosschainAckRequestResponse, error)
	GetAllExpiredCrosschainAckRequests(ctx context.Context, pagination *query.PageRequest) (*crosschainTypes.QueryAllExpiredCrosschainAckRequestResponse, error)

	GetAllCrosschainRequestConfirmations(ctx context.Context, pagination *query.PageRequest, sourceChainId string, requestIdentifier uint64, claimHash []byte) (*crosschainTypes.QueryAllCrosschainRequestConfirmResponse, error)
	GetAllCrosschainRequestAckConfirmations(ctx context.Context, pagination *query.PageRequest, ackSrcChainId string, ackRequestIdentifier uint64, claimHash []byte) (*crosschainTypes.QueryAllCrosschainAckRequestConfirmResponse, error)
	GetCrosschainRequestConfirmation(ctx context.Context, pagination *query.PageRequest, sourceChainId string, requestIdentifier uint64, claimHash []byte, orchestrator string) (*crosschainTypes.QueryGetCrosschainRequestConfirmResponse, error)
	GetCrosschainAckRequestConfirmation(ctx context.Context, pagination *query.PageRequest, ackSrcChainId string, ackRequestIdentifier uint64, claimHash []byte, orchestrator string) (*crosschainTypes.QueryGetCrosschainAckRequestConfirmResponse, error)
	GetCrosschainAckReceipt(ctx context.Context, ackReceiptSrcChainId string, ackReceiptIdentifier uint64) (*crosschainTypes.QueryGetCrosschainAckReceiptResponse, error)

	// MetaStore
	GetAllMetaInfo(ctx context.Context, pagination *query.PageRequest) (*metastoreTypes.QueryAllMetaInfoResponse, error)
	GetMetaInfo(ctx context.Context, chainId string, dappAddress []byte) (*metastoreTypes.QueryAllMetaInfoResponseByChainAndAddress, error)

	// Wasm
	StoreCode(file string, sender sdk.AccAddress) (int64, error)
	InstantiateContract(codeID uint64, label string, amountStr string, initMsg string, adminStr string, noAdmin bool, sender sdk.AccAddress) (string, error)
	ExecuteContract(amountStr string, sender sdk.AccAddress, contractAddr string, execMsg string) error
	SmartContractState(ctx context.Context, contractAddress string, queryData []byte) (*wasmTypes.QuerySmartContractStateResponse, error)
	RawContractState(ctx context.Context, contractAddress string, queryData []byte) (*wasmTypes.QueryRawContractStateResponse, error)

	GetGasFee() (string, error)
	Close()
}

func InitialiseChainClient

func InitialiseChainClient(networkName string, networkTmRpc, networkGRpc, keyringFrom string, passphrase string, privateKey string, keyringDir string, keyringBackend string) ChainClient

func NewChainClient

func NewChainClient(
	ctx client.Context,
	protoAddr string,
	options ...common.ClientOption,
) (ChainClient, error)

NewCosmosClient creates a new gRPC client that communicates with gRPC server at protoAddr. protoAddr must be in form "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock", protocol is required.

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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