Skip to main content
resources/bondToken.BondTokenClient The BondTokenClient provides an interface for interacting with the platform’s utility token, the Bond Token. This token is used for payments, staking, and other economic activities within the Spaceport and Cultura ecosystem. This client simplifies operations like checking balances, approving transfers, and minting new tokens.

Table of contents

Methods

constructor

new BondTokenClient(client): BondTokenClient

Parameters

Returns

BondTokenClient

Methods

balanceOf

balanceOf(address): Promise<bigint> Retrieves the balance of bond tokens for an address.

Parameters

Returns

Promise<bigint> The balance as a bigint

approve

approve(spender, amount): Promise<`0x${string}`> Approves a specific address to spend a certain amount of bond tokens.

Parameters

Returns

Promise<`0x${string}`> Transaction hash

allowance

allowance(owner, spender): Promise<bigint> Checks the current allowance granted to a spender.

Parameters

Returns

Promise<bigint> The current allowance as a bigint

checkFundsAndAllowance

checkFundsAndAllowance(walletAddress, spenderAddress, requiredAmount): Promise<void> Checks if a wallet has sufficient balance and allowance for a specific amount.

Parameters

Returns

Promise<void> Promise that resolves if checks pass, throws error if insufficient funds/allowance

mint

mint(to, amount): Promise<`0x${string}`> Mints new bond tokens to a specified address (admin function).

Parameters

Returns

Promise<`0x${string}`> Transaction hash

approveAllForAmount

approveAllForAmount(amount): Promise<Record<string, { hash: `0x${string}` ; status: "success" | "reverted" }>> Approves all Cultura and Spaceport contracts to spend a specific amount of tokens and waits for confirmations

Parameters

Returns

Promise<Record<string, { hash: `0x${string}` ; status: "success" | "reverted" }>> Object containing transaction receipts for each approval Example