Skip to main content
Version: main branch

Alphabill JavaScript SDK

The Alphabill JavaScript SDK provides the option to connect to Alphabill JSON-RPC server.

Prerequisites

To use the Alphabill JavaScript SDK, you need to set up a JavaScript development environment and have a package manager installed.

The SDK package is available at https://www.npmjs.com/package/@alphabill/alphabill-js-sdk

Installation

Installation is straightforward; use one of the following commands based on your package manager:

npm install @alphabill/alphabill-js-sdk

Client Usage

After creating the client, you can call the following functions based on the client type. For a better overview of how to use these functions, refer to the examples that demonstrate the usage of different transactions within the Alphabill JavaScript SDK.

createMoneyClient

This client also contains general transactions and fee credit transactions.

  • lockBill (link to example)
  • splitBill (link to example)
  • transferBillToDustCollector (link to example)
  • swapBillsWithDustCollector (link to example)
  • transferBill (link to example)
  • unlockBill (link to example)
  • reclaimFeeCredit (link to example)
  • transferToFeeCredit (link to example)

createTokenClient

This client also contains general transactions and fee credit transactions.

  • createNonFungibleTokenType (link to example)
  • createNonFungibleToken (link to example)
  • transferNonFungibleToken (link to example)
  • updateNonFungibleToken (link to example)
  • createFungibleTokenType (link to example)
  • createFungibleToken (link to example)
  • transferFungibleToken (link to example)
  • splitFungibleToken (link to example)
  • burnFungibleToken (link to example)
  • joinFungibleTokens (link to example)
  • lockToken (link to example)
  • unlockToken (link to example)

General Transactions for All Partition Clients

  • getRoundNumber - Get current round number for given partition (link to example).
  • getUnitsByOwnerId - Get all unit identifiers for given owner ID on selected partition (link to example).
  • getUnit - Get unit information for given unit ID on selected partition (link to example).
  • getBlock - Get block for given block number on selected partition (link to example).
  • getTransactionProof - Get transaction proof for given transaction hash on selected partition.
  • waitTransactionProof - Wait for a transaction proof to be available.
  • sendTransaction - Sends a raw CBOR encoded signed transaction to the network. Returns the transaction hash that can be used with getTransactionProof method to confirm the execution of the transaction.

Fee Credit Transactions

Permissioned User Token Partition Transactions

The Permissioned User Token Partition allows most transactions from the User Token Partition except fee credit related transactions that are replaced with following fees transactions.

Verification

The SDK allows verifying the transaction proof. Link to example.