Wrap & Swap (BTC → EVM/TON/Solana)
wrapAndSwap takes BTC on Bitcoin and delivers a token on a target network (an ERC-20 on
EVM, a Jetton on TON, or an SPL token on Solana).
1. Estimate the output
Quote the output amount and fees before building anything.
const amountInBTC = 0.001;
const networkName = "optimism";
const outputTokenAddress = undefined; // undefined → native token
const estimate = await sdk.wrapAndSwapEstimate(
amountInBTC,
networkName,
outputTokenAddress
);
console.log(estimate.outputAmount, estimate.teleswapFee);
See Estimating output & fees for the full response shape.
2. Build the unsigned transaction
Provide the recipient EVM address and the Bitcoin signer info to get an unsigned Bitcoin transaction back.
const amountInBTC = 0.001;
const evmAddress = "0x...";
const networkName = "ethereum";
const exchangeTokenAddress = "0x..."; // undefined → native token
const signerInfo = {
addressType: "p2wpkh", // 'p2wpkh' | 'p2pkh' | 'p2sh-p2wpkh'
publicKey: "...",
address: "...",
};
const unsigned = await sdk.wrapAndSwapUnsigned(
evmAddress,
amountInBTC,
signerInfo,
networkName,
exchangeTokenAddress
);
Solana destination
Use networkName: "solana" with the same two calls. Addresses are base58: the recipient is
the user's Solana address, and outputToken is the SPL mint address. outputToken is
required on Solana — there is no "omit for the native token" shortcut.
const unsigned = await sdk.wrapAndSwapUnsigned(
"7xKX...", // recipient Solana address
0.001,
signerInfo,
"solana",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" // USDC mint
);
3. Sign & broadcast
Sign the returned transaction with your Bitcoin wallet and broadcast it to the Bitcoin
network. Once it's seen by the protocol, track it with
getRequestStatusByTxId.
REST equivalents
| Stage | Endpoint |
|---|---|
| Estimate | POST /api/v2/teleswap/utils/wrap-and-swap-estimate |
| Build | POST /api/v2/teleswap/utils/wrap-and-swap-unsigned |
See the API reference.