Documentation
¶
Index ¶
- Constants
- func AddressFromKey(kr keyring.Keyring, keyName, hrp string) (string, error)
- func GetKey(kr keyring.Keyring, keyName string) (*keyring.Record, error)
- func ImportKey(kr keyring.Keyring, keyName, mnemonicFile, hrp string, keyType KeyType) ([]byte, string, error)
- func LoadKeyring(keyName, mnemonicFile string, keyType KeyType) (keyring.Keyring, []byte, string, error)
- func NewDefaultTxConfig() client.TxConfig
- func NewKeyring(p KeyringParams) (keyring.Keyring, error)
- func SignTxWithKeyring(ctx context.Context, txCfg client.TxConfig, kr keyring.Keyring, keyName string, ...) error
- type KeyType
- type KeyringParams
Constants ¶
const (
// EVMBIP44HDPath is the default Ethereum derivation path (coin type 60).
EVMBIP44HDPath = "m/44'/60'/0'/0/0"
)
Variables ¶
This section is empty.
Functions ¶
func AddressFromKey ¶
AddressFromKey derives an account address for the given HRP from the public key stored in the keyring under keyName, without mutating the global bech32 prefix configuration.
func ImportKey ¶ added in v1.0.9
func ImportKey(kr keyring.Keyring, keyName, mnemonicFile, hrp string, keyType KeyType) ([]byte, string, error)
ImportKey imports a mnemonic into an existing keyring using the specified key type, returning the pubkey bytes and address for the provided HRP.
If a key with the same name already exists, ImportKey verifies that its algorithm matches the requested keyType and returns an error on mismatch.
func LoadKeyring ¶ added in v1.0.9
func LoadKeyring(keyName, mnemonicFile string, keyType KeyType) (keyring.Keyring, []byte, string, error)
LoadKeyring creates a test keyring in a temporary directory under os.TempDir(), imports the mnemonic using the specified key type, and returns the keyring, pubkey bytes, and Lumera address.
The temporary directory is cleaned up by the OS on reboot. For production use, prefer NewKeyring with an explicit directory and import keys via kr.NewAccount directly.
func NewDefaultTxConfig ¶
NewDefaultTxConfig constructs a client.TxConfig backed by a protobuf codec, registering Lumera action message interfaces as required for signing/encoding.
func NewKeyring ¶
func NewKeyring(p KeyringParams) (keyring.Keyring, error)
NewKeyring creates a new keyring that supports both Cosmos (secp256k1) and EVM (eth_secp256k1) key types. The key type used is determined when importing or creating keys, not at keyring creation time.
func SignTxWithKeyring ¶
func SignTxWithKeyring( ctx context.Context, txCfg client.TxConfig, kr keyring.Keyring, keyName string, builder client.TxBuilder, chainID string, accountNumber uint64, sequence uint64, overwrite bool, ) error
SignTxWithKeyring signs the provided TxBuilder using the given keyring identity. The caller must supply chainID, account number and sequence. Set overwrite=false for the first signature; true for subsequent signers on the same tx.
Types ¶
type KeyType ¶ added in v1.0.9
type KeyType int
KeyType represents the cryptographic key algorithm and HD derivation path to use for a chain. Controller and host chains can each be configured with an independent KeyType.
func (KeyType) HDPath ¶ added in v1.0.9
HDPath returns the BIP44 HD derivation path for this key type.
func (KeyType) SigningAlgo ¶ added in v1.0.9
func (kt KeyType) SigningAlgo() keyring.SignatureAlgo
SigningAlgo returns the keyring signing algorithm for this key type.
type KeyringParams ¶
type KeyringParams struct {
// AppName names the keyring namespace. Default: "lumera"
AppName string
// Backend selects the keyring backend ("os" | "file" | "test"). Default: "os"
Backend string
// Dir is the root directory for the keyring (if Backend="file"). Default: $HOME/.lumera
Dir string
// Input is an optional io.Reader for interactive backends (nil for non-interactive)
Input io.Reader
}
KeyringParams holds configuration for initializing a Cosmos keyring.
func DefaultKeyringParams ¶
func DefaultKeyringParams() KeyringParams
DefaultKeyringParams returns sensible defaults:
- AppName: "lumera"
- Backend: "os"
- Dir: $HOME/.lumera
Directories
¶
| Path | Synopsis |
|---|---|
|
sdk-go/pkg/crypto/ethsecp256k1/ethsecp256k1.go
|
sdk-go/pkg/crypto/ethsecp256k1/ethsecp256k1.go |