Secp256k1HdWallet
HD wallet using BIP-39 mnemonic with Amino JSON signing. ImplementsOfflineAminoSigner.
Static Methods
| Method | Parameters | Returns |
|---|---|---|
generate | length?: 12 | 15 | 18 | 21 | 24, options?: Partial<Secp256k1HdWalletOptions> | Promise<Secp256k1HdWallet> |
fromMnemonic | mnemonic: string, options?: Partial<Secp256k1HdWalletOptions> | Promise<Secp256k1HdWallet> |
deserialize | serialization: string, password: string | Promise<Secp256k1HdWallet> |
deserializeWithEncryptionKey | serialization: string, encryptionKey: Uint8Array | Promise<Secp256k1HdWallet> |
Instance Methods
| Method | Parameters | Returns |
|---|---|---|
getAccounts | — | Promise<readonly AccountData[]> |
signAmino | signerAddress: string, signDoc: StdSignDoc | Promise<AminoSignResponse> |
serialize | password: string | Promise<string> |
serializeWithEncryptionKey | encryptionKey: Uint8Array, kdfConfiguration: KdfConfiguration | Promise<string> |
Instance Properties
| Property | Type |
|---|---|
mnemonic | string |
Options
Usage
Secp256k1Wallet
Single-key wallet for Amino JSON signing. ImplementsOfflineAminoSigner.
| Method | Parameters | Returns |
|---|---|---|
fromKey (static) | privkey: Uint8Array, prefix?: string | Promise<Secp256k1Wallet> |
getAccounts | — | Promise<readonly AccountData[]> |
signAmino | signerAddress: string, signDoc: StdSignDoc | Promise<AminoSignResponse> |
Address Functions
| Function | Parameters | Returns |
|---|---|---|
pubkeyToAddress | pubkey: Pubkey, prefix: string | string |
pubkeyToRawAddress | pubkey: Pubkey | Uint8Array |
rawSecp256k1PubkeyToRawAddress | pubkeyRaw: Uint8Array | Uint8Array |
rawEd25519PubkeyToRawAddress | pubkeyRaw: Uint8Array | Uint8Array |
rawEthSecp256k1PubkeyToRawAddress | pubkeyRaw: Uint8Array | Uint8Array |
Coin Utilities
| Function | Parameters | Returns |
|---|---|---|
coin | amount: number | string, denom: string | Coin |
coins | amount: number | string, denom: string | Coin[] |
parseCoins | input: string | Coin[] |
addCoins | lhs: Coin, rhs: Coin | Coin |
Pubkey Encoding
| Function | Parameters | Returns |
|---|---|---|
encodeSecp256k1Pubkey | pubkey: Uint8Array | Secp256k1Pubkey |
encodeEd25519Pubkey | pubkey: Uint8Array | Ed25519Pubkey |
encodeEthSecp256k1Pubkey | pubkey: Uint8Array | EthSecp256k1Pubkey |
encodeAminoPubkey | pubkey: Pubkey | Uint8Array |
decodeAminoPubkey | amino: Uint8Array | Pubkey |
encodeBech32Pubkey | pubkey: Pubkey, prefix: string | string |
decodeBech32Pubkey | bechEncoded: string | Pubkey |
Signature Functions
| Function | Parameters | Returns |
|---|---|---|
encodeSecp256k1Signature | pubkey: Uint8Array, signature: Uint8Array | StdSignature |
encodeEthSecp256k1Signature | pubkey: Uint8Array, signature: Uint8Array | StdSignature |
decodeSignature | signature: StdSignature | { pubkey: Uint8Array; signature: Uint8Array } |
Sign Document Functions
| Function | Parameters | Returns |
|---|---|---|
makeSignDoc | msgs: readonly AminoMsg[], fee: StdFee, chainId: string, memo: string | undefined, accountNumber: number | string, sequence: number | string, timeout_height?: bigint | StdSignDoc |
serializeSignDoc | signDoc: StdSignDoc | Uint8Array |
Multisig
| Function | Parameters | Returns |
|---|---|---|
createMultisigThresholdPubkey | pubkeys: readonly SinglePubkey[], threshold: number, nosort?: boolean | MultisigThresholdPubkey |
nosort is false (default), pubkeys are sorted by their raw address to match the Cosmos SDK client behavior. Pass true to preserve the input order.
Key Types
Coin
StdFee
AminoMsg
StdSignDoc
AccountData
OfflineAminoSigner
AminoSignResponse
StdSignature
Pubkey Types
Other Exports
| Function/Type | Purpose |
|---|---|
makeCosmoshubPath(account) | Creates HD path m/44'/118'/0'/0/{account} |
omitDefault(value) | Omit protobuf default values |
isStdTx(value) | Type guard for StdTx |
makeStdTx(signDoc, signature) | Create StdTx from sign doc and signature |
extractKdfConfiguration(serialization) | Extract KDF config from serialized wallet |
executeKdf(password, config) | Execute key derivation function |
isEthereumSecp256k1Account(account) | Check if account uses Ethereum secp256k1 |
getAminoPubkey(account) | Get amino pubkey from account data |