Initia.js

Initia.js is the JavaScript SDK for Initia, written in Typescript.

Main Features

  • Improve user-friendly Typescript definitions with Initia core data structures integration

  • Core Layer: key management, BCS serialization, support initia.proto

  • Client Layer: API request generation, LCD provider

Prerequisites

Initia.js requires the installation of the following packages in order to function properly

  • node.js v14+

  • npm

Installation

npm install @initia/initia.js

Usage

LCD Client

LCD (Light Client Daemon) class facilitates interaction with the Initia blockchain

Key

An abstract key interface that enables transaction signing and provides bech32 address and public key derivation from a public key

BCS

BCS (Binary Canonical Serialization) is the binary encoding for Move resources and other non-module values published on-chain

Supported types for BCS

`u8`, `u16`, `u32`, `u64`, `u128`, `u256`, `bool`, `vector`, `address`, `string`, `option`, 'fixed_point32', 'fixed_point64', 'decimal128', 'decimal256'

Msg

Msgs are objects whose end-goal is to trigger state-transitions. They are wrapped in transactions, which may contain one or more of them

  • MsgSend(): send coins to others

  • MsgDelegate(): delegate governance coin to validators (staking)

  • MsgExecute(): execute move contract entry functions

Tx broadcasting

  • createAndSignTx(): create and sign transaction

When sending coins with MsgSend, sender address should be the wallet address

  • broadcast(): send/broadcast your transaction to the blockchain

Queries

  • balance(): query balance of the account

  • viewfunction(): query the move contract view functions

Last updated