> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spaceport.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: BondToken

[resources/bondToken](../modules/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

* [balanceOf](#balanceof)
* [approve](#approve)
* [allowance](#allowance)
* [checkFundsAndAllowance](#checkfundsandallowance)
* [mint](#mint)
* [approveAllForAmount](#approveallforamount)

### constructor

• **new BondTokenClient**(`client`): [`BondTokenClient`](./bond-token)

#### Parameters

| Name     | Type                               |
| :------- | :--------------------------------- |
| `client` | [`SpaceportSDK`](../spaceport-sdk) |

#### Returns

[`BondTokenClient`](./bond-token)

## 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`**

```typescript theme={null}
// Approve all Cultura and Spaceport contracts to spend tokens
import { parseEther } from 'viem'
await sdk.bondToken.approveAllForAmount(parseEther('1'));
```
