> For the complete documentation index, see [llms.txt](https://docs-core.allbridge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-core.allbridge.io/sdk/guides/solana/swap.md).

# Swap

Swap makes the same way as a transfer, but you have to specify tokens from the one chain

```typescript
// initiate transfer using Messenger.WORMHOLE
const amount = "10";
const transaction = (await sdk.bridge.rawTxBuilder.send({
  amount: amount,
  fromAccountAddress: accountAddress,
  toAccountAddress: accountAddress,
  sourceToken: sourceTokenInfo,
  destinationToken: destinationTokenInfo,
  minimumReceiveAmount: await sdk.getAmountToBeReceived(amount, sourceTokenInfo, destinationTokenInfo),
})) as RawSolanaTransaction;

const keypair = solanaWeb3.Keypair.fromSecretKey(bs58.decode(privateKey));
transaction.sign([keypair]);

const connection = new solanaWeb3.Connection(nodeUrlsDefault.solanaRpcUrl, "confirmed");
const txId = await connection.sendTransaction(transaction);
console.log(`https://explorer.solana.com/tx/${txId}`);
```

[Full example](https://github.com/allbridge-io/allbridge-core-js-sdk/blob/main/examples/src/examples/bridge/solana/sol-build-swap-tx.ts)
