Documentation ¶
Index ¶
- Variables
- func BuildSimTx(pubKey cryptotypes.PubKey, txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)
- func CreateMnemonic() (string, error)
- func KeyringAlgoOptions() keyring.Option
- type Codec
- type CosmosProvider
- func (cc *CosmosProvider) AccountInfo(ctx context.Context, address string) (authtypes.AccountI, error)
- func (cc *CosmosProvider) AddKey(name string, coinType uint32, signingAlgorithm string) (output *KeyOutput, err error)
- func (cc *CosmosProvider) Broadcast(ctx context.Context, sequence uint64, walletState *WalletState, txBz []byte) (*coretypes.ResultBroadcastTxCommit, error)
- func (cc *CosmosProvider) CreateKeystore() error
- func (cc *CosmosProvider) DeleteKey(name string) error
- func (cc *CosmosProvider) EncodeTxJSON(txb client.TxBuilder) ([]byte, error)
- func (cc *CosmosProvider) EnsureWalletState(address string) *WalletState
- func (cc *CosmosProvider) EstimateGas(ctx context.Context, txf tx.Factory, pubKey cryptotypes.PubKey, ...) (uint64, error)
- func (cc *CosmosProvider) ExportPrivKeyArmor(keyName string) (armor string, err error)
- func (cc *CosmosProvider) GetBlockAtHeight(ctx context.Context, height int64) (*coretypes.ResultBlock, error)
- func (cc *CosmosProvider) GetKeyAddress(key string) (sdk.AccAddress, error)
- func (cc *CosmosProvider) Invoke(ctx context.Context, method string, req, reply interface{}, ...) (err error)
- func (cc *CosmosProvider) KeyAddOrRestore(keyName string, coinType uint32, signingAlgorithm string, mnemonic ...string) (*KeyOutput, error)
- func (cc *CosmosProvider) KeyExists(name string) bool
- func (cc *CosmosProvider) KeyFromKeyOrAddress(keyOrAddress string) (string, error)
- func (cc *CosmosProvider) KeystoreCreated() bool
- func (cc *CosmosProvider) ListAddresses(bech32Prefix string) (map[string]string, error)
- func (cc *CosmosProvider) LoadKeystore(keyring keyring.Keyring)
- func (cc *CosmosProvider) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
- func (cc *CosmosProvider) QueryABCI(ctx context.Context, req abci.RequestQuery) (abci.ResponseQuery, error)
- func (cc *CosmosProvider) QueryChainID(ctx context.Context) (string, error)
- func (cc *CosmosProvider) QueryLatestHeight(ctx context.Context) (int64, error)
- func (cc *CosmosProvider) RestoreKey(name, mnemonic string, coinType uint32, signingAlgorithm string) (address sdk.AccAddress, err error)
- func (cc *CosmosProvider) SaveLedgerKey(keyName string, coinType uint32, bech32Prefix string) (*KeyOutput, error)
- func (cc *CosmosProvider) SaveOfflineKey(keyName string, pubKey cryptotypes.PubKey) (*KeyOutput, error)
- func (cc *CosmosProvider) ShowAddress(name string, bech32Prefix string) (address string, err error)
- func (cc *CosmosProvider) Sign(ctx context.Context, walletState *WalletState, chainID string, ...) (uint64, []byte, error)
- func (cc *CosmosProvider) SignAndBroadcast(ctx context.Context, chainID string, gasPrices string, gasAdjustment float64, ...) (*coretypes.ResultBroadcastTxCommit, error)
- type KeyOutput
- type RPCClient
- func (r RPCClient) ABCIInfo(ctx context.Context) (*coretypes.ResultABCIInfo, error)
- func (r RPCClient) ABCIQuery(ctx context.Context, path string, data bytes.HexBytes) (*coretypes.ResultABCIQuery, error)
- func (r RPCClient) ABCIQueryWithOptions(ctx context.Context, path string, data bytes.HexBytes, ...) (*coretypes.ResultABCIQuery, error)
- func (r RPCClient) Block(ctx context.Context, height *int64) (*coretypes.ResultBlock, error)
- func (r RPCClient) BlockByHash(ctx context.Context, hash []byte) (*coretypes.ResultBlock, error)
- func (r RPCClient) BlockResults(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error)
- func (r RPCClient) BlockSearch(ctx context.Context, query string, page, perPage *int, orderBy string) (*coretypes.ResultBlockSearch, error)
- func (r RPCClient) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error)
- func (r RPCClient) BroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTx, error)
- func (r RPCClient) BroadcastTxCommit(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error)
- func (r RPCClient) BroadcastTxSync(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTx, error)
- func (r RPCClient) Commit(ctx context.Context, height *int64) (*coretypes.ResultCommit, error)
- func (r RPCClient) Status(ctx context.Context) (*coretypes.ResultStatus, error)
- func (r RPCClient) Tx(ctx context.Context, hash []byte, prove bool) (*coretypes.ResultTx, error)
- func (r RPCClient) TxSearch(ctx context.Context, query string, prove bool, page, perPage *int, ...) (*coretypes.ResultTxSearch, error)
- func (r RPCClient) Validators(ctx context.Context, height *int64, page, perPage *int) (*coretypes.ResultValidators, error)
- type WalletState
Constants ¶
This section is empty.
Variables ¶
var ( // SupportedAlgorithms defines the list of signing algorithms used on Evmos: // - secp256k1 (Cosmos) // - sr25519 (Cosmos) // - eth_secp256k1 (Ethereum, Injective) SupportedAlgorithms = keyring.SigningAlgoList{hd.Secp256k1} // SupportedAlgorithmsLedger defines the list of signing algorithms used on Evmos for the Ledger device: // - secp256k1 (Cosmos) // - sr25519 (Cosmos) // - eth_secp256k1 (Ethereum, Injective) SupportedAlgorithmsLedger = keyring.SigningAlgoList{hd.Secp256k1} )
var ModuleBasics = []module.AppModuleBasic{ auth.AppModuleBasic{}, authz.AppModuleBasic{}, distribution.AppModuleBasic{}, }
Functions ¶
func BuildSimTx ¶
BuildSimTx creates an unsigned tx with an empty single signature and returns the encoded transaction or an error if the unsigned transaction cannot be built.
func CreateMnemonic ¶
CreateMnemonic generates a new mnemonic.
func KeyringAlgoOptions ¶
KeyringAlgoOptions defines a function keys options for the ethereum Secp256k1 curve. It supports secp256k1 and eth_secp256k1 keys for accounts.
Types ¶
type Codec ¶
type Codec struct { InterfaceRegistry types.InterfaceRegistry Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino }
type CosmosProvider ¶
type CosmosProvider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
NewProvider validates the CosmosProviderConfig, instantiates a ChainClient and then instantiates a CosmosProvider
func (*CosmosProvider) AccountInfo ¶
func (*CosmosProvider) AddKey ¶
func (cc *CosmosProvider) AddKey(name string, coinType uint32, signingAlgorithm string) (output *KeyOutput, err error)
AddKey generates a new mnemonic which is then converted to a private key and BIP-39 HD Path and persists it to the keystore. It fails if there is an existing key with the same address.
func (*CosmosProvider) Broadcast ¶
func (cc *CosmosProvider) Broadcast( ctx context.Context, sequence uint64, walletState *WalletState, txBz []byte, ) (*coretypes.ResultBroadcastTxCommit, error)
func (*CosmosProvider) CreateKeystore ¶
func (cc *CosmosProvider) CreateKeystore() error
CreateKeystore initializes a new instance of a keyring at the specified path in the local filesystem.
func (*CosmosProvider) DeleteKey ¶
func (cc *CosmosProvider) DeleteKey(name string) error
DeleteKey removes a key from the keystore for the specified name.
func (*CosmosProvider) EncodeTxJSON ¶
func (cc *CosmosProvider) EncodeTxJSON(txb client.TxBuilder) ([]byte, error)
func (*CosmosProvider) EnsureWalletState ¶
func (cc *CosmosProvider) EnsureWalletState(address string) *WalletState
func (*CosmosProvider) EstimateGas ¶
func (cc *CosmosProvider) EstimateGas(ctx context.Context, txf tx.Factory, pubKey cryptotypes.PubKey, msgs ...sdk.Msg) (uint64, error)
EstimateGas simulates a tx to generate the appropriate gas settings before broadcasting a tx.
func (*CosmosProvider) ExportPrivKeyArmor ¶
func (cc *CosmosProvider) ExportPrivKeyArmor(keyName string) (armor string, err error)
ExportPrivKeyArmor returns a private key in ASCII armored format. It returns an error if the key does not exist or a wrong encryption passphrase is supplied.
func (*CosmosProvider) GetBlockAtHeight ¶
func (cc *CosmosProvider) GetBlockAtHeight(ctx context.Context, height int64) (*coretypes.ResultBlock, error)
GetBlockAtHeight queries the block at a given height
func (*CosmosProvider) GetKeyAddress ¶
func (cc *CosmosProvider) GetKeyAddress(key string) (sdk.AccAddress, error)
GetKeyAddress returns the account address representation for the currently configured key.
func (*CosmosProvider) Invoke ¶
func (cc *CosmosProvider) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)
Invoke implements the grpc ClientConn.Invoke method
func (*CosmosProvider) KeyAddOrRestore ¶
func (cc *CosmosProvider) KeyAddOrRestore(keyName string, coinType uint32, signingAlgorithm string, mnemonic ...string) (*KeyOutput, error)
KeyAddOrRestore either generates a new mnemonic or uses the specified mnemonic and converts it to a private key and BIP-39 HD Path which is then persisted to the keystore. It fails if there is an existing key with the same address.
func (*CosmosProvider) KeyExists ¶
func (cc *CosmosProvider) KeyExists(name string) bool
KeyExists returns true if a key with the specified name exists in the keystore, it returns false otherwise.
func (*CosmosProvider) KeyFromKeyOrAddress ¶
func (cc *CosmosProvider) KeyFromKeyOrAddress(keyOrAddress string) (string, error)
func (*CosmosProvider) KeystoreCreated ¶
func (cc *CosmosProvider) KeystoreCreated() bool
KeystoreCreated returns true if there is an existing keystore instance at the specified path, it returns false otherwise.
func (*CosmosProvider) ListAddresses ¶
func (cc *CosmosProvider) ListAddresses(bech32Prefix string) (map[string]string, error)
ListAddresses returns a map of bech32 encoded strings representing all keys currently in the keystore.
func (*CosmosProvider) LoadKeystore ¶
func (cc *CosmosProvider) LoadKeystore(keyring keyring.Keyring)
func (*CosmosProvider) NewStream ¶
func (cc *CosmosProvider) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
NewStream implements the grpc ClientConn.NewStream method
func (*CosmosProvider) QueryABCI ¶
func (cc *CosmosProvider) QueryABCI(ctx context.Context, req abci.RequestQuery) (abci.ResponseQuery, error)
QueryABCI performs an ABCI query and returns the appropriate response and error sdk error code.
func (*CosmosProvider) QueryChainID ¶
func (cc *CosmosProvider) QueryChainID(ctx context.Context) (string, error)
QueryChainID queries the chain ID from the RPC client
func (*CosmosProvider) QueryLatestHeight ¶
func (cc *CosmosProvider) QueryLatestHeight(ctx context.Context) (int64, error)
QueryLatestHeight queries the latest height from the RPC client
func (*CosmosProvider) RestoreKey ¶
func (cc *CosmosProvider) RestoreKey(name, mnemonic string, coinType uint32, signingAlgorithm string) (address sdk.AccAddress, err error)
RestoreKey converts a mnemonic to a private key and BIP-39 HD Path and persists it to the keystore. It fails if there is an existing key with the same address.
func (*CosmosProvider) SaveLedgerKey ¶
func (cc *CosmosProvider) SaveLedgerKey(keyName string, coinType uint32, bech32Prefix string) (*KeyOutput, error)
SaveLedgerKey persists a ledger key to the keystore with the specified name.
func (*CosmosProvider) SaveOfflineKey ¶
func (cc *CosmosProvider) SaveOfflineKey(keyName string, pubKey cryptotypes.PubKey) (*KeyOutput, error)
SaveOfflineKey persists a public key to the keystore with the specified name.
func (*CosmosProvider) ShowAddress ¶
func (cc *CosmosProvider) ShowAddress(name string, bech32Prefix string) (address string, err error)
ShowAddress retrieves a key by name from the keystore and returns the bech32 encoded string representation of that key.
func (*CosmosProvider) SignAndBroadcast ¶
type KeyOutput ¶
type KeyOutput struct { Mnemonic string `json:"mnemonic"` CoinType uint32 `json:"coin_type"` Account sdk.AccAddress }
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient wraps our slimmed down CometBFT client and converts the returned types to the upstream CometBFT types. This is useful so that it can be used in any function calls that expect the upstream types.
func NewRPCClient ¶
func (RPCClient) ABCIQueryWithOptions ¶
func (RPCClient) BlockByHash ¶
func (RPCClient) BlockResults ¶
func (RPCClient) BlockSearch ¶
func (RPCClient) BlockchainInfo ¶
func (RPCClient) BroadcastTxAsync ¶
func (RPCClient) BroadcastTxCommit ¶
func (RPCClient) BroadcastTxSync ¶
func (RPCClient) Validators ¶
type WalletState ¶
func (*WalletState) HandleAccountSequenceMismatchError ¶
func (ws *WalletState) HandleAccountSequenceMismatchError(err error)
handleAccountSequenceMismatchError will parse the error string, e.g.: "account sequence mismatch, expected 10, got 9: incorrect account sequence" and update the next account sequence with the expected value.