ChainSig.js Documentation - v1.1.6
    Preparing search index...

    Implementation of the ChainAdapter interface for Cosmos-based networks. Handles interactions with Cosmos SDK chains like Cosmos Hub, Osmosis, etc.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new Cosmos chain instance

      Parameters

      • params: {
            contract: ChainSignatureContract;
            chainId: string;
            endpoints?: { rpcUrl?: string; restUrl?: string };
        }

        Configuration parameters

        • contract: ChainSignatureContract

          Instance of the chain signature contract for MPC operations

        • chainId: string

          Chain id for the Cosmos network

        • Optionalendpoints?: { rpcUrl?: string; restUrl?: string }

          Optional RPC and REST endpoints

          • OptionalrpcUrl?: string

            Optional RPC endpoint URL

          • OptionalrestUrl?: string

            Optional REST endpoint URL

      Returns Cosmos

    Methods

    • Gets the native token balance and decimals for a given address

      Parameters

      • address: string

        The address to check

      Returns Promise<{ balance: bigint; decimals: number }>

      Promise resolving to an object containing: - balance: The balance as a bigint, in the chain's base units - decimals: The number of decimals used to format the balance

    • Uses Sig Network Key Derivation Function to derive the address and public key. from a signer ID and string path.

      Parameters

      • predecessor: string

        The id/address of the account requesting signature

      • path: string

        The string path used to derive the key

      Returns Promise<{ address: string; publicKey: string }>

      Promise resolving to the derived address and public key

    • Serializes an unsigned transaction to a string format. This is useful for storing or transmitting the transaction.

      Parameters

      • transaction: TxRaw

        The unsigned transaction to serialize

      Returns string

      The serialized transaction string

    • Deserializes a transaction string back into an unsigned transaction object. This reverses the serialization done by serializeTransaction().

      Parameters

      • serialized: string

        The serialized transaction string

      Returns TxRaw

      The deserialized unsigned transaction

    • Prepares a transaction for Sig Network MPC signing by creating the necessary payloads. This method handles chain-specific transaction preparation including:

      • Fee calculation
      • Nonce/sequence management
      • UTXO selection (for UTXO-based chains)
      • Transaction encoding

      Parameters

      Returns Promise<{ transaction: TxRaw; hashesToSign: contracts.HashToSign[] }>

      Promise resolving to an object containing: - transaction: The unsigned transaction - hashesToSign: Array of payloads to be signed by MPC. The order of these payloads must match the order of signatures provided to finalizeTransactionSigning()

    • Adds Sig Network MPC-generated signatures to an unsigned transaction.

      Parameters

      • params: { transaction: TxRaw; rsvSignatures: RSVSignature[] }

        Parameters for adding signatures

        • transaction: TxRaw

          The unsigned transaction to add signatures to

        • rsvSignatures: RSVSignature[]

          Array of RSV signatures generated through MPC. Must be in the same order as the payloads returned by prepareTransactionForSigning()

      Returns string

      The serialized signed transaction ready for broadcast

    • Broadcasts a signed transaction to the network.

      Parameters

      • txSerialized: string

        The serialized signed transaction

      Returns Promise<string>

      Promise resolving to an object containing the transaction hash/ID