Options
All
  • Public
  • Public/Protected
  • All
Menu

@cosmjs/amino Documentation

Index

Type Aliases

Algo: "secp256k1" | "ed25519" | "sr25519"

Variables

pubkeyType: { ed25519: "tendermint/PubKeyEd25519"; multisigThreshold: "tendermint/PubKeyMultisigThreshold"; secp256k1: "tendermint/PubKeySecp256k1"; sr25519: "tendermint/PubKeySr25519" } = ...

Type declaration

Functions

  • coin(amount: string | number, denom: string): Coin
  • Creates a coin.

    If your values do not exceed the safe integer range of JS numbers (53 bit), you can use the number type here. This is the case for all typical Cosmos SDK chains that use the default 6 decimals.

    In case you need to supportr larger values, use unsigned integer strings instead.

    Parameters

    • amount: string | number
    • denom: string

    Returns Coin

  • coins(amount: string | number, denom: string): Coin[]
  • Creates a list of coins with one element.

    Parameters

    • amount: string | number
    • denom: string

    Returns Coin[]

  • decodeAminoPubkey(data: Uint8Array): Pubkey
  • Decodes a pubkey in the Amino binary format to a type/value object.

    Parameters

    • data: Uint8Array

    Returns Pubkey

  • decodeBech32Pubkey(bechEncoded: string): Pubkey
  • Decodes a bech32 pubkey to Amino binary, which is then decoded to a type/value object. The bech32 prefix is ignored and discareded.

    Parameters

    • bechEncoded: string

      the bech32 encoded pubkey

    Returns Pubkey

  • decodeSignature(signature: StdSignature): { pubkey: Uint8Array; signature: Uint8Array }
  • Parameters

    Returns { pubkey: Uint8Array; signature: Uint8Array }

    • Readonly pubkey: Uint8Array
    • Readonly signature: Uint8Array
  • encodeAminoPubkey(pubkey: Pubkey): Uint8Array
  • Encodes a public key to binary Amino.

    Parameters

    Returns Uint8Array

  • encodeBech32Pubkey(pubkey: Pubkey, prefix: string): string
  • Encodes a public key to binary Amino and then to bech32.

    Parameters

    • pubkey: Pubkey

      the public key to encode

    • prefix: string

      the bech32 prefix (human readable part)

    Returns string

  • Takes an Edd25519 public key as raw bytes and returns the Amino JSON representation of it (the type/value wrapper object).

    Parameters

    • pubkey: Uint8Array

    Returns Ed25519Pubkey

  • Takes a Secp256k1 public key as raw bytes and returns the Amino JSON representation of it (the type/value wrapper object).

    Parameters

    • pubkey: Uint8Array

    Returns Secp256k1Pubkey

  • encodeSecp256k1Signature(pubkey: Uint8Array, signature: Uint8Array): StdSignature
  • Takes a binary pubkey and signature to create a signature object

    Parameters

    • pubkey: Uint8Array

      a compressed secp256k1 public key

    • signature: Uint8Array

      a 64 byte fixed length representation of secp256k1 signature components r and s

    Returns StdSignature

  • executeKdf(password: string, configuration: KdfConfiguration): Promise<Uint8Array>
  • isStdTx(txValue: unknown): txValue is StdTx
  • makeCosmoshubPath(a: number): HdPath
  • The Cosmos Hub derivation path in the form m/44'/118'/0'/0/a with 0-based account index a.

    Parameters

    • a: number

    Returns HdPath

  • makeSignDoc(msgs: readonly AminoMsg[], fee: StdFee, chainId: string, memo: undefined | string, accountNumber: string | number, sequence: string | number): StdSignDoc
  • parseCoins(input: string): Coin[]
  • Takes a coins list like "819966000ucosm,700000000ustake" and parses it.

    A Stargate-ready variant of this function is available via:

    import { parseCoins } from "@cosmjs/proto-signing";
    // or
    import { parseCoins } from "@cosmjs/stargate";

    Parameters

    • input: string

    Returns Coin[]

  • pubkeyToAddress(pubkey: Pubkey, prefix: string): string
  • pubkeyToRawAddress(pubkey: Pubkey): Uint8Array
  • rawEd25519PubkeyToRawAddress(pubkeyData: Uint8Array): Uint8Array
  • Parameters

    • pubkeyData: Uint8Array

    Returns Uint8Array

  • rawSecp256k1PubkeyToRawAddress(pubkeyData: Uint8Array): Uint8Array
  • Parameters

    • pubkeyData: Uint8Array

    Returns Uint8Array

Generated using TypeDoc