# SwapperUtils\<T>

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:24](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L24)

Utility class providing helper methods for address parsing, token balances, serialization and other miscellaneous things.

## Type Parameters

| Type Parameter             |
| -------------------------- |
| `T` *extends* `MultiChain` |

## Constructors

### Constructor

```
new SwapperUtils<T>(root): SwapperUtils<T>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:29](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L29)

#### Parameters

| Parameter | Type                                                                                               |
| --------- | -------------------------------------------------------------------------------------------------- |
| `root`    | [`Swapper`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/classes/Swapper.md)<`T`> |

#### Returns

`SwapperUtils`<`T`>

## Properties

### bitcoinNetwork

```
readonly bitcoinNetwork: BTC_NETWORK;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:26](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L26)

## Methods

### deserializeSignedTransaction()

```
deserializeSignedTransaction<ChainIdentifier>(chainIdentifier, tx): Promise<T[ChainIdentifier]["SignedTXType"]>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:606](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L606)

Deserializes a signed smart chain transaction

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type              | Description                   |
| ----------------- | ----------------- | ----------------------------- |
| `chainIdentifier` | `ChainIdentifier` | Smart chain string identifier |
| `tx`              | `string`          | Serialized signed transaction |

#### Returns

`Promise`<`T`\[`ChainIdentifier`]\[`"SignedTXType"`]>

***

### deserializeUnsignedTransaction()

```
deserializeUnsignedTransaction<ChainIdentifier>(chainIdentifier, tx): Promise<T[ChainIdentifier]["TX"]>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:584](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L584)

Deserializes an unsigned smart chain transaction

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type              | Description                     |
| ----------------- | ----------------- | ------------------------------- |
| `chainIdentifier` | `ChainIdentifier` | Smart chain string identifier   |
| `tx`              | `string`          | Serialized unsigned transaction |

#### Returns

`Promise`<`T`\[`ChainIdentifier`]\[`"TX"`]>

***

### destinationTokenSupportsGasDrop()

```
destinationTokenSupportsGasDrop<ChainIdentifier>(token): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:478](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L478)

Returns whether when swapping to the provided token a gas drop can be requested

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter | Type                                                                                                                  | Description |
| --------- | --------------------------------------------------------------------------------------------------------------------- | ----------- |
| `token`   | [`SCToken`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/SCToken.md)<`ChainIdentifier`> |             |

#### Returns

`boolean`

***

### getBitcoinSpendableBalance()

```
getBitcoinSpendableBalance(

   wallet, 

   targetChain?, 

   options?): Promise<{

  balance: TokenAmount;

  feeRate: number;

}>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:379](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L379)

Returns the spendable balance of a bitcoin wallet

#### Parameters

| Parameter             | Type                                                                                                                                                                                                                                                                            | Description                                                                                                                                                               |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `wallet`              | \| `string` \| [`IBitcoinWallet`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/IBitcoinWallet.md) \| [`MinimalBitcoinWalletInterface`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/MinimalBitcoinWalletInterface.md) | Bitcoin wallet to check the spendable balance for, can either be a simple bitcoin address string or a wallet object                                                       |
| `targetChain?`        | `ChainIds`<`T`>                                                                                                                                                                                                                                                                 | Destination smart chain for the swap, the ensures proper spendable balance is estimated taking into consideration different swap primitives available on different chains |
| `options?`            | { `feeRate?`: `number`; `gasDrop?`: `boolean`; `minFeeRate?`: `number`; }                                                                                                                                                                                                       | Additional options                                                                                                                                                        |
| `options.feeRate?`    | `number`                                                                                                                                                                                                                                                                        | -                                                                                                                                                                         |
| `options.gasDrop?`    | `boolean`                                                                                                                                                                                                                                                                       | -                                                                                                                                                                         |
| `options.minFeeRate?` | `number`                                                                                                                                                                                                                                                                        | -                                                                                                                                                                         |

#### Returns

`Promise`<{ `balance`: [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md); `feeRate`: `number`; }>

***

### getLightningInvoiceValue()

```
getLightningInvoiceValue(lnpr): bigint;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:115](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L115)

Returns satoshi value of BOLT11 bitcoin lightning invoice WITH AMOUNT, returns null otherwise

#### Parameters

| Parameter | Type     | Description |
| --------- | -------- | ----------- |
| `lnpr`    | `string` |             |

#### Returns

`bigint`

***

### getLNURLTypeAndData()

```
getLNURLTypeAndData(lnurl, shouldRetry?): Promise<

  | LNURLPay

| LNURLWithdraw>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:106](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L106)

Returns type and data about an LNURL

#### Parameters

| Parameter      | Type      | Description                                                 |
| -------------- | --------- | ----------------------------------------------------------- |
| `lnurl`        | `string`  | LNURL link to check, can be either `pay` or `withdraw` type |
| `shouldRetry?` | `boolean` | Optional whether HTTP requests should retried on failure    |

#### Returns

`Promise`< | [`LNURLPay`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/LNURLPay.md) | [`LNURLWithdraw`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/LNURLWithdraw.md)>

***

### getNativeToken()

```
getNativeToken<ChainIdentifier>(chainIdentifier): SCToken<ChainIdentifier>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:468](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L468)

Returns the address of the native currency of the smart chain

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type              |
| ----------------- | ----------------- |
| `chainIdentifier` | `ChainIdentifier` |

#### Returns

[`SCToken`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/SCToken.md)<`ChainIdentifier`>

***

### getRandomSpvVaultPsbt()

```
getRandomSpvVaultPsbt<ChainIdentifier>(chainIdentifier, includeGasToken?): Transaction;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:364](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L364)

Returns a random PSBT that can be used for fee estimation for SPV vault (UTXO-controlled vault) based swaps [SwapType.SPV\_VAULT\_FROM\_BTC](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#spv_vault_from_btc), the last output (the LP output) is omitted to allow for coinselection algorithm to determine maximum sendable amount there

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter          | Type              | Description                                                                          |
| ------------------ | ----------------- | ------------------------------------------------------------------------------------ |
| `chainIdentifier`  | `ChainIdentifier` | Smart chain to swap to                                                               |
| `includeGasToken?` | `boolean`         | Whether to return the PSBT also with the gas token amount (increases the vSize by 8) |

#### Returns

`Transaction`

***

### getSpendableBalance()

```
getSpendableBalance<ChainIdentifier>(

   wallet, 

   token, 

options?): Promise<TokenAmount>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:418](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L418)

Returns the maximum spendable balance of the smart chain wallet, deducting the fee needed to initiate a swap for native balances

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter                | Type                                                                                                                  |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `wallet`                 | \| `string` \| `T`\[`ChainIdentifier`]\[`"Signer"`] \| `T`\[`ChainIdentifier`]\[`"NativeSigner"`]                     |
| `token`                  | [`SCToken`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/SCToken.md)<`ChainIdentifier`> |
| `options?`               | { `feeMultiplier?`: `number`; `feeRate?`: `any`; }                                                                    |
| `options.feeMultiplier?` | `number`                                                                                                              |
| `options.feeRate?`       | `any`                                                                                                                 |

#### Returns

`Promise`<[`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md)>

***

### isLightningInvoice()

```
isLightningInvoice(address): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:56](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L56)

Checks whether an address is a valid BOLT11 bitcoin lightning invoice

#### Parameters

| Parameter | Type     | Description      |
| --------- | -------- | ---------------- |
| `address` | `string` | Address to check |

#### Returns

`boolean`

***

### isValidBitcoinAddress()

```
isValidBitcoinAddress(address): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:69](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L69)

Checks whether an address is a valid bitcoin address

#### Parameters

| Parameter | Type     | Description      |
| --------- | -------- | ---------------- |
| `address` | `string` | Address to check |

#### Returns

`boolean`

***

### isValidLightningInvoice()

```
isValidLightningInvoice(address): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:83](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L83)

Checks whether an address is a valid BOLT11 bitcoin lightning invoice WITH AMOUNT

#### Parameters

| Parameter | Type     | Description      |
| --------- | -------- | ---------------- |
| `address` | `string` | Address to check |

#### Returns

`boolean`

***

### isValidLNURL()

```
isValidLNURL(address): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:96](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L96)

Checks whether an address is a valid LNURL (no checking on type is performed)

#### Parameters

| Parameter | Type     | Description      |
| --------- | -------- | ---------------- |
| `address` | `string` | Address to check |

#### Returns

`boolean`

***

### isValidSmartChainAddress()

```
isValidSmartChainAddress(address, chainId?): boolean;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:40](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L40)

Checks whether a passed address is a valid address on the smart chain

#### Parameters

| Parameter  | Type            | Description                                            |
| ---------- | --------------- | ------------------------------------------------------ |
| `address`  | `string`        | Address                                                |
| `chainId?` | `ChainIds`<`T`> | Smart chain identifier string to check the address for |

#### Returns

`boolean`

***

### parseAddress()

```
parseAddress(addressString): Promise<{

  address: string;

  amount?: TokenAmount;

  lnurl?:   | LNURLPay

     | LNURLWithdraw;

  max?: TokenAmount;

  min?: TokenAmount;

  swapType:   | FROM_BTCLN

     | TO_BTC

     | TO_BTCLN

     | SPV_VAULT_FROM_BTC;

  type: "BITCOIN" | "LIGHTNING" | ChainIds<T> | "LNURL";

}>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:257](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L257)

General parser for bitcoin addresses, LNURLs, lightning invoices, smart chain addresses. Also fetches LNURL data (hence async and returns Promise).

#### Parameters

| Parameter       | Type     | Description      |
| --------------- | -------- | ---------------- |
| `addressString` | `string` | Address to parse |

#### Returns

`Promise`<{ `address`: `string`; `amount?`: [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md); `lnurl?`: | [`LNURLPay`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/LNURLPay.md) | [`LNURLWithdraw`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/LNURLWithdraw.md); `max?`: [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md); `min?`: [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md); `swapType`: | [`FROM_BTCLN`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#from_btcln) | [`TO_BTC`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#to_btc) | [`TO_BTCLN`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#to_btcln) | [`SPV_VAULT_FROM_BTC`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#spv_vault_from_btc); `type`: `"BITCOIN"` | `"LIGHTNING"` | `ChainIds`<`T`> | `"LNURL"`; }>

Address data or `null` if address doesn't conform to any known format

#### Throws

Error in address parsing

***

### parseAddressSync()

```
parseAddressSync(addressString): object;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:303](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L303)

Synchronous general parser for bitcoin addresses, LNURLs, lightning invoices, smart chain addresses, doesn't fetch LNURL data, returns `swapType: null` instead to prevent returning a Promise

#### Parameters

| Parameter       | Type     | Description      |
| --------------- | -------- | ---------------- |
| `addressString` | `string` | Address to parse |

#### Returns

`object`

Address data or `null` if address doesn't conform to any known format

| Name       | Type                                                                                                                                                                                                                                                                                                                                                               | Defined in                                                                                                                                                            |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `address`  | `string`                                                                                                                                                                                                                                                                                                                                                           | [atomiq-sdk/src/swapper/SwapperUtils.ts:304](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L304) |
| `amount?`  | [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md)                                                                                                                                                                                                                                                         | [atomiq-sdk/src/swapper/SwapperUtils.ts:309](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L309) |
| `max?`     | [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md)                                                                                                                                                                                                                                                         | [atomiq-sdk/src/swapper/SwapperUtils.ts:308](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L308) |
| `min?`     | [`TokenAmount`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/TokenAmount.md)                                                                                                                                                                                                                                                         | [atomiq-sdk/src/swapper/SwapperUtils.ts:307](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L307) |
| `swapType` | \| [`TO_BTC`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#to_btc) \| [`TO_BTCLN`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#to_btcln) \| [`SPV_VAULT_FROM_BTC`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md#spv_vault_from_btc) | [atomiq-sdk/src/swapper/SwapperUtils.ts:306](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L306) |
| `type`     | `"BITCOIN"` \| `"LIGHTNING"` \| `ChainIds`<`T`> \| `"LNURL"`                                                                                                                                                                                                                                                                                                       | [atomiq-sdk/src/swapper/SwapperUtils.ts:305](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L305) |

#### Throws

Error in address parsing

***

### prepareUnsignedTransactions()

```
prepareUnsignedTransactions<ChainIdentifier>(chainIdentifier, txs): Promise<T[ChainIdentifier]["TX"][]>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:557](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L557)

Prepares a set of unsigned transactions for signing, by adding required nonces or recent blockhashes, might also add hints of account deployment on e.g. Starknet

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type                                | Description                          |
| ----------------- | ----------------------------------- | ------------------------------------ |
| `chainIdentifier` | `ChainIdentifier`                   | A chain for which to prepare the txs |
| `txs`             | `T`\[`ChainIdentifier`]\[`"TX"`]\[] | Transactions to prepare              |

#### Returns

`Promise`<`T`\[`ChainIdentifier`]\[`"TX"`]\[]>

***

### randomAddress()

```
randomAddress<ChainIdentifier>(chainIdentifier): string;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:500](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L500)

Returns a random address for a given smart chain or bitcoin

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type                             | Description |
| ----------------- | -------------------------------- | ----------- |
| `chainIdentifier` | `"BITCOIN"` \| `ChainIdentifier` |             |

#### Returns

`string`

***

### randomSigner()

```
randomSigner<ChainIdentifier>(chainIdentifier): T[ChainIdentifier]["Signer"];
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:490](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L490)

Returns a random signer for a given smart chain

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type              | Description |
| ----------------- | ----------------- | ----------- |
| `chainIdentifier` | `ChainIdentifier` |             |

#### Returns

`T`\[`ChainIdentifier`]\[`"Signer"`]

***

### sendAndConfirm()

```
sendAndConfirm<ChainIdentifier>(

   chainIdentifier, 

   signer, 

   txs, 

   abortSignal?, 

onBeforePublish?): Promise<string[]>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:521](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L521)

Signs and broadcasts the supplied smart chain transaction

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter          | Type                                                                                  | Description                                                                              |
| ------------------ | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `chainIdentifier`  | `ChainIdentifier`                                                                     | Smart chain identifier string                                                            |
| `signer`           | \| `T`\[`ChainIdentifier`]\[`"NativeSigner"`] \| `T`\[`ChainIdentifier`]\[`"Signer"`] | Signer to use for signing the transactions                                               |
| `txs`              | `T`\[`ChainIdentifier`]\[`"TX"`]\[]                                                   | An array of transactions to sign                                                         |
| `abortSignal?`     | `AbortSignal`                                                                         | Abort signal                                                                             |
| `onBeforePublish?` | (`txId`, `rawTx`) => `Promise`<`void`>                                                | Callback invoked before a transaction is sent (invoked for every transaction to be sent) |

#### Returns

`Promise`<`string`\[]>

***

### sendSignedAndConfirm()

```
sendSignedAndConfirm<ChainIdentifier>(

   chainIdentifier, 

   txs, 

   abortSignal?, 

onBeforePublish?): Promise<string[]>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:540](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L540)

Broadcasts already signed smart chain transactions

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter          | Type                                          | Description                                                                              |
| ------------------ | --------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `chainIdentifier`  | `ChainIdentifier`                             | Smart chain identifier string                                                            |
| `txs`              | `T`\[`ChainIdentifier`]\[`"SignedTXType"`]\[] | An array of already signed transactions                                                  |
| `abortSignal?`     | `AbortSignal`                                 | Abort signal                                                                             |
| `onBeforePublish?` | (`txId`, `rawTx`) => `Promise`<`void`>        | Callback invoked before a transaction is sent (invoked for every transaction to be sent) |

#### Returns

`Promise`<`string`\[]>

***

### serializeSignedTransaction()

```
serializeSignedTransaction<ChainIdentifier>(chainIdentifier, tx): Promise<string>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:595](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L595)

Serializes a signed smart chain transaction

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type                                       | Description                       |
| ----------------- | ------------------------------------------ | --------------------------------- |
| `chainIdentifier` | `ChainIdentifier`                          | Smart chain string identifier     |
| `tx`              | `T`\[`ChainIdentifier`]\[`"SignedTXType"`] | A signed transaction to serialize |

#### Returns

`Promise`<`string`>

***

### serializeUnsignedTransaction()

```
serializeUnsignedTransaction<ChainIdentifier>(chainIdentifier, tx): Promise<string>;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:573](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L573)

Serializes an unsigned smart chain transaction

#### Type Parameters

| Type Parameter                       |
| ------------------------------------ |
| `ChainIdentifier` *extends* `string` |

#### Parameters

| Parameter         | Type                             | Description                          |
| ----------------- | -------------------------------- | ------------------------------------ |
| `chainIdentifier` | `ChainIdentifier`                | Smart chain string identifier        |
| `tx`              | `T`\[`ChainIdentifier`]\[`"TX"`] | An unsigned transaction to serialize |

#### Returns

`Promise`<`string`>

***

### stripAddress()

```
stripAddress(addressString): string;
```

Defined in: [atomiq-sdk/src/swapper/SwapperUtils.ts:347](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/swapper/SwapperUtils.ts#L347)

Strips the URL encoding around `bitcoin:` and `lightning:` addresses, leaving just the raw address

#### Parameters

| Parameter       | Type     | Description      |
| --------------- | -------- | ---------------- |
| `addressString` | `string` | Address to strip |

#### Returns

`string`

Raw clean address
