Class BlazeClient

High-level, typed client for the Blaze HTTP API.

Constructors

Properties

baseUrl: string

Methods

  • Estimate fees for a set of instructions.

    Parameters

    Returns Promise<FeeEstimate>

    const est = await client.estimateFees([
    { type: 'transfer', from, to, amount: '100000000', data: { token_address } }
    ]);
    console.log(est.estimated_fee);
  • Fetch token balances for an address (zero balances omitted).

    Parameters

    • address: string

    Returns Promise<AccountBalances>

    const { balances } = await client.getBalances('DeuRsUJAcAnS...');
    console.log(balances[0].token_symbol, balances[0].balance);
  • Get a block by hash (hex, lowercase).

    Parameters

    • hash: string

    Returns Promise<Block>

    const b = await client.getBlockByHash('be5c7feb45e2...');
    
  • Get a block by height (0-based).

    Parameters

    • height: number

    Returns Promise<Block>

    const b0 = await client.getBlockByHeight(0);
    
  • Get validator schedule for a given epoch.

    Parameters

    • epoch: number

    Returns Promise<EpochValidators>

  • Fetch node health and sync status.

    Returns Promise<Health>

  • Fetch chain info (ids, limits, heights).

    Returns Promise<Info>

    const info = await client.getInfo();
    console.log(info.chain_id, info.native_token);
  • Get the latest confirmed block.

    Returns Promise<Block>

  • Get NFT details and transfer history by token address.

    Parameters

    • address: string

    Returns Promise<NFT>

  • Get liquidity pool details by address.

    Parameters

    • address: string

    Returns Promise<PoolDetail>

  • Get high-level network statistics (counts, TPS, market cap, etc.).

    Returns Promise<StatsOverview>

  • Get supply and inflation statistics for the native token.

    Returns Promise<StatsSupply>

  • Get token metadata and stats by address.

    Parameters

    • address: string

    Returns Promise<TokenDetail>

  • Parameters

    • hash: string

    Returns Promise<Transaction>

  • Get validator details by address.

    Parameters

    • address: string

    Returns Promise<ValidatorDetail>

  • List NFTs owned by an address.

    Parameters

    • address: string
    • Optionalparams: {
          limit?: number;
      }
      • Optionallimit?: number

    Returns Promise<Paged<NFT>>

  • List recent transactions involving an address.

    Parameters

    • address: string
    • Optionalparams: {
          limit?: number;
      }
      • Optionallimit?: number

        Max items (newest-first)

    Returns Promise<Paged<AccountTx>>

    const txs = await client.listAccountTransactions(addr, { limit: 10 });
    console.log(txs.items.map(t => t.hash));
  • List blocks with pagination (newest-first).

    Parameters

    • Optionalparams: {
          after?: number;
          before?: number;
          limit?: number;
      }
      • Optionalafter?: number
      • Optionalbefore?: number
      • Optionallimit?: number

    Returns Promise<Paged<BlockSummary>>

    const page = await client.listBlocks({ limit: 5 });
    for await (const b of page.asIterable()) {
    console.log(b.height, b.hash);
    }
  • Parameters

    • address: string
    • Optionalparams: {
          limit?: number;
      }
      • Optionallimit?: number

    Returns Promise<Paged<NFT>>

  • Parameters

    • Optionalparams: {
          limit?: number;
          search?: string;
      }
      • Optionallimit?: number
      • Optionalsearch?: string

    Returns Promise<Paged<NFTCollection>>

  • Returns Promise<{
        count: number;
        transactions: MempoolTx[];
    }>

  • List all liquidity pools (AMM).

    Returns Promise<{
        pools: PoolSummary[];
    }>

  • List tokens with optional search over symbol/name.

    Parameters

    • Optionalparams: {
          limit?: number;
          search?: string;
      }
      • Optionallimit?: number
      • Optionalsearch?: string

    Returns Promise<Paged<Token>>

    const page = await client.listTokens({ search: 'blaze', limit: 5 });
    
  • List current validator set and epoch metadata.

    Returns Promise<Validators>

  • Parameters

    • pool: string
    • inputToken: string
    • outputToken: string
    • inputAmount: string

    Returns Promise<SwapQuote>

  • Submit a signed transaction.

    Parameters

    Returns Promise<{
        hash: string;
        message: string;
        status: "submitted";
    }>

    Submission receipt including transaction hash.

    BlazeError on validation failure or duplicates (409).

    const receipt = await client.submitTransaction(signed);
    await client.waitForConfirmed(receipt.hash, { minConfirmations: 1 });
  • Wait until a transaction reaches the desired confirmations. Polls at pollMs (default 1s) up to timeoutMs.

    Parameters

    • hash: string
    • Optionalopts: {
          minConfirmations?: number;
          pollMs?: number;
          timeoutMs?: number;
      }
      • OptionalminConfirmations?: number
      • OptionalpollMs?: number
      • OptionaltimeoutMs?: number

    Returns Promise<Transaction>

    Error if the timeout elapses.

    const confirmed = await client.waitForConfirmed(txHash, { minConfirmations: 2, timeoutMs: 60_000 });