# FeesApi

All URIs are relative to *http://localhost*

| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**boardFee**](FeesApi.md#boardfee) | **GET** /api/v1/fees/board | Estimate board fee |
| [**lightningReceiveFee**](FeesApi.md#lightningreceivefee) | **GET** /api/v1/fees/lightning/receive | Estimate Lightning receive fee |
| [**lightningSendFee**](FeesApi.md#lightningsendfee) | **GET** /api/v1/fees/lightning/pay | Estimate Lightning send fee |
| [**offboardAllFee**](FeesApi.md#offboardallfee) | **GET** /api/v1/fees/offboard-all | Estimate offboard-all fee |
| [**offboardFee**](FeesApi.md#offboardfee) | **POST** /api/v1/fees/offboard | Estimate offboard fee |
| [**onchainFeeRates**](FeesApi.md#onchainfeerates) | **GET** /api/v1/fees/onchain | Get on-chain fee rates |
| [**sendOnchainFee**](FeesApi.md#sendonchainfee) | **GET** /api/v1/fees/send-onchain | Estimate send-onchain fee |



## boardFee

> FeeEstimateResponse boardFee(amountSat)

Estimate board fee

Estimates the Ark protocol fee for boarding the specified amount of on-chain bitcoin. The net amount is what the user receives as a VTXO. Does not include the on-chain transaction fee for the board anchor transaction.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { BoardFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // number | The amount in satoshis to board
    amountSat: 789,
  } satisfies BoardFeeRequest;

  try {
    const data = await api.boardFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **amountSat** | `number` | The amount in satoshis to board | [Defaults to `undefined`] |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | Invalid amount |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## lightningReceiveFee

> FeeEstimateResponse lightningReceiveFee(amountSat)

Estimate Lightning receive fee

Estimates the fee for receiving the specified amount over Lightning. The gross amount is the Lightning payment amount, and the net amount is what the user receives as a VTXO after the Ark server deducts its fee.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { LightningReceiveFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // number | The amount in satoshis to receive over Lightning
    amountSat: 789,
  } satisfies LightningReceiveFeeRequest;

  try {
    const data = await api.lightningReceiveFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **amountSat** | `number` | The amount in satoshis to receive over Lightning | [Defaults to `undefined`] |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | Invalid amount |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## lightningSendFee

> FeeEstimateResponse lightningSendFee(amountSat)

Estimate Lightning send fee

Estimates the fee for sending the specified amount over Lightning. The net amount is what the recipient receives. The fee depends on the VTXOs selected and their expiry. If the wallet has insufficient funds, returns a worst-case fee estimate assuming the user acquires enough funds to cover the payment.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { LightningSendFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // number | The amount in satoshis to send over Lightning
    amountSat: 789,
  } satisfies LightningSendFeeRequest;

  try {
    const data = await api.lightningSendFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **amountSat** | `number` | The amount in satoshis to send over Lightning | [Defaults to `undefined`] |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | Invalid amount |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## offboardAllFee

> FeeEstimateResponse offboardAllFee(address)

Estimate offboard-all fee

Estimates the fee for offboarding the entire Ark balance to the given on-chain address. The gross amount is the total spendable balance, and the net amount is what the user receives on-chain after fees. The fee depends on the destination address type, current fee rates, and VTXO expiry.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { OffboardAllFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // string | The destination Bitcoin address
    address: address_example,
  } satisfies OffboardAllFeeRequest;

  try {
    const data = await api.offboardAllFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **address** | `string` | The destination Bitcoin address | [Defaults to `undefined`] |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | Invalid address |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## offboardFee

> FeeEstimateResponse offboardFee(offboardFeeEstimateRequest)

Estimate offboard fee

Estimates the fee for offboarding a specific set of VTXOs to the given on-chain address. Each VTXO is offboarded in full. The gross amount is the total value of the selected VTXOs, and the net amount is what the user receives on-chain after fees. The fee depends on the destination address type, current fee rates, and VTXO expiry.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { OffboardFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // OffboardFeeEstimateRequest
    offboardFeeEstimateRequest: ...,
  } satisfies OffboardFeeRequest;

  try {
    const data = await api.offboardFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **offboardFeeEstimateRequest** | [OffboardFeeEstimateRequest](OffboardFeeEstimateRequest.md) |  | |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: `application/json`
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | No VTXO IDs provided, or an invalid VTXO id or address |  -  |
| **404** | One of the VTXOs wasn\&#39;t found |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## onchainFeeRates

> OnchainFeeRatesResponse onchainFeeRates()

Get on-chain fee rates

Returns the current mempool fee rates from the chain source at three confirmation targets: fast (~1 block), regular (~3 blocks), and slow (~6 blocks). Rates are in sat/vB, rounded up.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { OnchainFeeRatesRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  try {
    const data = await api.onchainFeeRates();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters

This endpoint does not need any parameter.

### Return type

[**OnchainFeeRatesResponse**](OnchainFeeRatesResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns current mempool fee rates |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


## sendOnchainFee

> FeeEstimateResponse sendOnchainFee(amountSat, address)

Estimate send-onchain fee

Estimates the total fee for sending bitcoin from the Ark wallet to an on-chain address. The fee depends on the destination address type and current fee rates. The gross amount is what the user pays (including VTXOs spent), and the net amount is what the recipient receives on-chain.

### Example

```ts
import {
  Configuration,
  FeesApi,
} from '@secondts/barkd';
import type { SendOnchainFeeRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new FeesApi(config);

  const body = {
    // number | The amount in satoshis to send on-chain
    amountSat: 789,
    // string | The destination Bitcoin address
    address: address_example,
  } satisfies SendOnchainFeeRequest;

  try {
    const data = await api.sendOnchainFee(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **amountSat** | `number` | The amount in satoshis to send on-chain | [Defaults to `undefined`] |
| **address** | `string` | The destination Bitcoin address | [Defaults to `undefined`] |

### Return type

[**FeeEstimateResponse**](FeeEstimateResponse.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the fee estimate |  -  |
| **400** | Invalid amount or address |  -  |
| **500** | Internal server error |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

