npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thalalabs/multisig-utils

v0.1.4

Published

Utility functions for managing multisig transactions on Aptos

Downloads

4

Readme

@thalalabs/multisig-utils

A TypeScript utility library for managing multisig transactions on Aptos blockchain. This library provides tools for fetching, decoding, encoding, and analyzing multisig transactions.

Installation

npm install @thalalabs/multisig-utils

Usage

import {
  fetchPendingTxns,
  numPendingTxns,
  decode,
  encode,
  getCoinBalance,
  getCoinDecimals,
  getCoinSymbol,
  getFABalance,
  getFaDecimals,
  getFaSymbol,
  getBalanceChangesData
} from '@thalalabs/multisig-utils';
import { Aptos } from '@aptos-labs/ts-sdk';

// Initialize Aptos client
const aptos = new Aptos();

// Fetch pending transactions
const pendingTxns = await fetchPendingTxns(aptos, multisigAddress);

// Get number of pending transactions
const count = await numPendingTxns(aptos, multisigAddress);

// Decode a transaction payload
const decoded = await decode(aptos, hexPayload);

// Encode a transaction payload
const encoded = await encode(aptos, functionId, typeArgs, args);

// Get balance changes from simulation
const balanceChanges = await getBalanceChangesData(aptos, simulationChanges);

// Get coin information
const balance = await getCoinBalance(aptos, coinType, accountAddress);
const decimals = await getCoinDecimals(aptos, coinType);
const symbol = await getCoinSymbol(aptos, coinType);

// Get fungible asset information
const faBalance = await getFABalance(aptos, faMetadata, accountAddress);
const faDecimals = await getFaDecimals(aptos, assetType);
const faSymbol = await getFaSymbol(aptos, assetType);

API Reference

Transaction Management

fetchPendingTxns(aptos, multisig, sequence_number?)

Fetches pending transactions for a multisig account.

Parameters:

  • aptos: Aptos client instance
  • multisig: Multisig account address
  • sequence_number (optional): Specific sequence number to fetch

Returns: Array of decoded multisig transactions with simulation results

numPendingTxns(aptos, multisig)

Gets the number of pending transactions for a multisig account.

Parameters:

  • aptos: Aptos client instance
  • multisig: Multisig account address

Returns: Number of pending transactions

Payload Encoding/Decoding

decode(aptos, hexStrWithPrefix)

Decodes a hex transaction payload into a structured format.

Parameters:

  • aptos: Aptos client instance
  • hexStrWithPrefix: Hex string with 0x prefix

Returns: Decoded transaction data with function ID, type arguments, and function arguments

encode(aptos, functionId, typeArgs, args)

Encodes transaction arguments into a payload.

Parameters:

  • aptos: Aptos client instance
  • functionId: Function identifier (e.g., "0x1::coin::transfer")
  • typeArgs: Type arguments array
  • args: Function arguments array

Returns: Encoded transaction payload

Transaction Analysis

getBalanceChangesData(aptos, changes)

Extracts balance change data from transaction simulation results.

Parameters:

  • aptos: Aptos client instance
  • changes: Write set changes from simulation

Returns: Array of BalanceChange objects with address, asset, symbol, and before/after balances

Coin Utilities

getCoinBalance(aptos, assetType, accountAddress)

Gets the balance of a specific coin for an account.

Parameters:

  • aptos: Aptos client instance
  • assetType: Coin type (e.g., "0x1::aptos_coin::AptosCoin")
  • accountAddress: Account address

Returns: Coin balance as a number

getCoinDecimals(aptos, assetType)

Gets the decimal places for a coin type.

Parameters:

  • aptos: Aptos client instance
  • assetType: Coin type

Returns: Number of decimal places

getCoinSymbol(aptos, assetType)

Gets the symbol for a coin type.

Parameters:

  • aptos: Aptos client instance
  • assetType: Coin type

Returns: Coin symbol as string

Fungible Asset Utilities

getFABalance(aptos, faMetadata, accountAddress)

Gets the balance of a fungible asset for an account.

Parameters:

  • aptos: Aptos client instance
  • faMetadata: Fungible asset metadata address
  • accountAddress: Account address

Returns: Fungible asset balance as a number

getFaDecimals(aptos, assetType)

Gets the decimal places for a fungible asset type.

Parameters:

  • aptos: Aptos client instance
  • assetType: Fungible asset type

Returns: Number of decimal places

getFaSymbol(aptos, assetType)

Gets the symbol for a fungible asset type.

Parameters:

  • aptos: Aptos client instance
  • assetType: Fungible asset type

Returns: Fungible asset symbol as string

Validation Utilities

The library also includes validation functions for CLI applications:

  • validateAddress(value): Validates and returns an Aptos address
  • validateAddresses(value): Validates a comma-separated list of addresses
  • validateUInt(value): Validates a non-negative integer
  • validateBool(value): Validates a boolean value
  • validateAsset(value): Validates and categorizes asset types

Requirements

  • Node.js >= 20
  • TypeScript support

Dependencies

  • @aptos-labs/ts-sdk: Aptos TypeScript SDK
  • chalk: Terminal styling

License

MIT