Table of contents
Methods
constructor
• new BondTokenClient(client
): BondTokenClient
Parameters
Name | Type |
---|---|
client | SpaceportSDK |
Returns
BondTokenClient
Methods
balanceOf
▸ balanceOf(address
): Promise
<bigint
>
Retrieves the balance of bond tokens for an address.
Parameters
Name | Type | Description |
---|---|---|
address | `0x${string}` | The address to check balance for |
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
Name | Type | Description |
---|---|---|
spender | `0x${string}` | The address being approved to spend tokens |
amount | bigint | The amount of tokens to approve |
Returns
Promise
<`0x${string}`>
Transaction hash
allowance
▸ allowance(owner
, spender
): Promise
<bigint
>
Checks the current allowance granted to a spender.
Parameters
Name | Type | Description |
---|---|---|
owner | `0x${string}` | The owner of the tokens |
spender | `0x${string}` | The address with spending approval |
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
Name | Type | Description |
---|---|---|
walletAddress | `0x${string}` | The wallet address to check |
spenderAddress | `0x${string}` | The address that needs allowance to spend tokens |
requiredAmount | bigint | The amount of tokens required |
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
Name | Type | Description |
---|---|---|
to | `0x${string}` | The recipient of the minted tokens |
amount | bigint | The amount of tokens to mint |
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
Name | Type | Description |
---|---|---|
amount | bigint | Amount of tokens to approve for each contract |
Returns
Promise
<Record
<string
, { hash
: `0x${string}` ; status
: "success"
| "reverted"
}>>
Object containing transaction receipts for each approval
Example