LEA Web3 SDK

Updated: 2026-01-26

The LEA Web3 SDK is is the JavaScript SDK specific to the LEA BasePOD.

INFO

This section is currently under heavy development and may change frequently.

If you have recommendations or improvement tipps, please contact us: info@getlea.org

It provides programmatic access to:

  • BasePOD system functions,
  • account and signing flows,
  • BasePOD-native balances and transfers,
  • and future BasePOD programs such as token issuance.

The SDK is not a generic client for arbitrary PODs.

Scope: Custom PODs and SDK support

Custom PODs are only required when developing an independent blockchain environment on top of LEA’s consensus layer.

This includes cases where you want to define:

  • a fully custom execution model,
  • a custom transaction decoder,
  • non-BasePOD cryptography,
  • or a completely independent fee and validation logic.

In such cases, the LEA Web3 SDK is not sufficient.

Developing against a Custom POD requires:

  • implementing your own decoder and execution semantics,
  • and either forking the LEA Web3 SDK or building a custom JavaScript wrapper.

The LEA Web3 SDK intentionally does not attempt to abstract or support arbitrary Custom POD execution environments.

BasePOD as the supported execution environment

All functionality exposed by the LEA Web3 SDK targets the first, system-defined LEA BasePOD.

This includes:

  • BasePOD balance and transfer operations,
  • BasePOD system programs,
  • and future BasePOD-native programs such as token programs.

From a developer perspective, this means:

  • you can build applications and smart contracts on the BasePOD without managing POD concepts explicitly,
  • you cannot use this SDK to interact with Custom PODs that define their own execution or cryptographic rules.

Support for additional BasePOD-level programs will be added over time as part of the BasePOD feature set.

Sources & Downloads

GitHub Source | Download GitHub Main ZIP | @getlea/web3 npm

Installation

The LEA Web3 SDK is distributed via npm.

Requirements

  • Node.js 18 or newer
  • npm or compatible package manager

Install via npm

npm install @getlea/web3

Usage

Import packages

import {
  Connection,
  Wallet,
  basePodGetBalance,
  basePodTransfer,
  basePodMint,
  basePodBurn,
  basePodGetCurrentSupply,
  SystemProgram,
  validateSignedTimestamp,
} from '@getlea/web3';

Connection

A Connection represents an RPC connection to a LEA node.

🔹Create a connection

import { Connection } from '@getlea/web3';
const connection = await Connection('devnet');

The argument can be:

  • "mainnet-beta"
  • "devnet"
  • "testnet"
  • "local" / "localhost"
  • or a full HTTP(S) RPC URL

🔹generateMnemonic(strength?)

Generates a BIP-39 mnemonic.

  • strength is entropy strength in bits (default 128)
  • Common values:
    • 128 → 12 words
    • 256 → 24 words

Returns: string (mnemonic phrase)

import { generateMnemonic } from '@getlea/web3';

const mnemonic12 = await generateMnemonic();      // default 128-bit entropy
const mnemonic24 = await generateMnemonic(256);   // 256-bit entropy

Wallet

The SDK includes an HD wallet implementation based on a BIP-39 mnemonic.

🔹Create a wallet from mnemonic

import { Wallet } from '@getlea/web3';

const wallet = await Wallet.fromMnemonic(
  'twelve word mnemonic',
  'optional passphrase'
);

This returns a WalletImpl instance.

🔹Derive an account

const account = await wallet.getAccount(0);
console.log(account.address);
  • Accounts are derived by index
  • Addresses are returned in LEA format
  • Keys remain client-side

Timestamp signing

The SDK supports creating and validating signed timestamp transactions.

🔹Sign a timestamp

const signed = await wallet.signTimestamp(
  Math.floor(Date.now() / 1000)
);

This returns a Base64URL-encoded transaction.

🔹Validate a signed timestamp

import { validateSignedTimestamp } from '@getlea/web3';

const feePayer = await validateSignedTimestamp(signed, 60);
console.log(feePayer);

Validation checks:

  • correct decoding

  • valid signature

  • timestamp within the allowed drift window

BasePOD helpers

The SDK provides helpers for common BasePOD operations.

INFO

All basePOD operations are executed in the BasePOD by default.

🔹Get balance

const balance = await basePodGetBalance(connection, account.address);

Returns: bigint

🔹Transfer

const txId = await basePodTransfer(
  connection,
  account,
  'lea1destinationaddress',
  1_000n
);

Returns: TxId (string subclass). txId.result contains the decoded BasePOD entry from the response.

🔹Mint

const txId = await basePodMint(
  connection,
  account,
  'lea1destinationaddress',
  1_000n
);

Returns: TxId (string subclass). txId.result contains the decoded BasePOD entry from the response.

🔹Burn

const txId = await basePodBurn(
  connection,
  account,
  10n
);

Returns: TxId (string subclass). txId.result contains the decoded BasePOD entry from the response.

🔹Get current supply

const supply = await basePodGetCurrentSupply(connection);

Returns: bigint

Network interaction

The SDK communicates with LEA nodes to:

  • submit signed transactions
  • retrieve execution results
  • observe ordering and finality Consensus and data availability are handled by the protocol and are not exposed at the application level.

Utilities

The SDK exports helper utilities for working with raw data:

  • toBase64Url
  • fromBase64Url
  • base64ToUint8Array
  • uint8ArrayToBase64
  • combineUint8Arrays
  • areUint8ArraysEqual

These are useful when handling transaction bytes directly.