The transaction generation API allows the server to quickly fill in cross-chain parameters and return cross-chain transaction data that is ready for user signing.
If unsuccessful, success: false, and the reason for the error is returned.
The tx in the return value is the transaction body that can be used for wallet signing. Only the necessary parts are filled in, and the remaining parts can be automatically filled in by estimation on the chain.
If the approveCheck field exists, the ERC20 allowance must be checked first according to its contents. If the allowance is insufficient, an approve transaction needs to be sent first, followed by the tx.
receiveAmount is the expected amount of tokens to be received on the target chain.
txDataDetail is the detailed information of the packed transaction data field.
feeAndQuota is the details of the current cross-chain quota and fees, used for UI display.
Moreover, Partners can use the following API to record partner information for cross-chain initiations:
You must fill in the partner's name within the body data.
The response data format is the same as the regular createTx. In the returned transaction, the to address is replaced with crossWrapper to record the cross-chain partner information. Currently, the chains that support recording partner information include: WAN, ARETH, AVAX, ETH, MATIC, LINEAETH, PLYR, MOVR, GLMR, FTM, OETH, OKB, VC, ZEN, MATICETH, METIS, BLASTETH, XDC, FX, BASEETH, OPBNB, BNB, SGB.
TRX Chain Transaction
Transactions from the TRX chain differ from those from EVM-compatible chains.
The API response doesn't return the data for tx, but it returns ABI, smart contract (SC) address, function name and function params for TronLink to use. You can use the ABI and SC address to call the function by TronLink in your frontend code. Here is an exaple:
import { decodeFunctionData, parseAbi } from 'viem';
async function sendTronTx({
toAddr,
functionSelector,
callValue,
data, // raw tx.data
params, // arrays, function params
}) {
if (!window.tronWeb?.ready) {
console.log('[TRON_TX] Requesting TronLink authorization...');
const res = await window.tronLink.request({ method: 'tron_requestAccounts' });
console.log('[TRON_TX] TronLink authorization result:', res);
if (res.code !== 200) {
throw new Error(`TronLink authorization failed: ${res.message}`);
}
}
const isMobile = window.innerWidth <= 768;
const abi = parseAbi(['function ' + functionSelector]);
let decoded;
if (data) {
decoded = decodeFunctionData({
abi,
data: data
});
} else if (params) {
decoded = {args: params};
}
console.log('function args', abi, decoded.args);
abi[0].stateMutability = "payable";
const sendParams = {
feeLimit: 300_000_000,
callValue: Number(callValue),
shouldPollResponse: !isMobile,
keepTxID: true,
};
console.log('sendParams', sendParams);
const contract = await window.tronWeb.contract(abi, toAddr);
const result = await contract[functionSelector.split('(')[0]](...decoded.args).send(
sendParams
);
console.log('send tx', result);
return result;
}
let txResult = await sendTronTx({
toAddr: tx.to,
functionSelector: tx.functionSelector,
callValue: tx.value,
params: tx.params,
});
console.log('tron tx result', txResult);
let txHash = Array.isArray(txResult) ? txResult[0] : txResult;
2.2.3 Bitcoin Chain Cross-chain API
2.2.3.1 Using Unisat Extension Wallet
(This method currently supports cross-chain transactions between EVM chains and Bitcoin.)
Failed return with HTTP status code: 400 (Input parameter error) or 500 (Internal server error).
Failed return with data: {success: false, error: "XXXXXXX"}
Step 2: Submit cross-chain ID (txHash)
After completing the BTC transfer to the one-time address using the front-end wallet (e.g., OKX extension wallet), this API is used to submit the transaction ID (txid) for tracking and monitoring.
Please fill in the correct values as required. The information is the same as the previous step, with the addition of the ota and txid fields:
fromChainType: Fixed as BTC.
toAddress: Recipient's address. Ensure the address is correct to avoid asset loss.
toChainType: Destination chain type.
amount: Amount to transfer (in BTC).
tokenPairID: Cross-chain pair ID.
ota: One-time address generated in Step 1.
txid: Transaction ID of the user's transfer to the one-time address.
2) Response Request
Success
Successful return with HTTP status code:200
Successful return with data:
{
"success":true
}
Failure
Failed return with HTTP status code:400 (Input parameter error) or 500 (Internal server error).
Failed return with data:{success: false, error: "XXXXXXX"}
Step 3: Query cross-chain status
The status query API uses the transaction ID (txid) as the key for querying the cross-chain status.
The query interface and return value rules for cross-chain status are the same as those for other cross-chain status queries, with TXID as the key value for querying.
This section details the API for transferring tokens from a user's Cardano account to another blockchain. The Cardano account can be either a payment address or a base address (also referred to as an enterprise address, which combines payment and stake addresses).
{
 "fromChain": "ADA",
 "toChain": "ETH",
 "fromAccount": "addr_test1vq......",
 "toAccount": "0x1bBdd8f.....",
 "amount": "1.118",
 "fromToken": "0x0000000000000000000000000000000000000000",
 "toToken": "0xfdee9454b39419a17b151e2922778df3712d0026",
 "partner": "newDex"
}
Parameters:
fromChain: The source chain, fixed as ADA.
toChain: The destination chain name. Refer to Section 2.2.1 or retrieve it from token-pair information.
fromAccount: The user's Cardano wallet address, which can be either a payment address or a base address.
toAccount: The recipient's address on the destination chain. Ensure the address is correct to avoid asset loss.
amount: The transfer amount, which supports decimal values (e.g., "1.12345").
fromToken: The coin or token address on the ADA chain. Use 0x0000000000000000000000000000000000000000 for ADA coins or the encoded unit value for tokens. Retrieve this from token-pair information.
toToken: The token address on the destination chain. Ensure it matches the token-pair information.
partner: Optional field for partner identification.
Response Example:
{
"success": true,
"data": {
 "tx": "84a50081825...7479706501",
 "receiveAmount": "1.118",
 "chainId": "0x385",
 "feeAndQuota": {
  "symbol": "ADA",
  "minQuota": "400000",
  "maxQuota": "7174693343715",
  "networkFee": {
   "value": "100000",
   "isPercent": false
  },
  "operationFee": {
   "value": "0.002",
   "isPercent": true,
   "minFeeLimit": "200000",
   "maxFeeLimit": "100000000"
  }
 }
}
}
The data.tx field is the full transaction hex string.
Usage:
import * as CardanoWasm from "@emurgo/cardano-serialization-lib-asmjs-gc";
// Example for reference to process the txHex return from endpoint
async function signAndSendTransaction(txHex) {
if (window.cardano && window.cardano.lace) {
const handler = async function (walletApi) {
try {
const tx = CardanoWasm.Transaction.from_hex(txHex);
// 1) sign transaction
const witnessSetHex = await walletApi.signTx(txHex);
const witnessSet = CardanoWasm.TransactionWitnessSet.from_hex(witnessSetHex);
const redeemers = tx.witness_set().redeemers();
if (redeemers) {
witnessSet.set_redeemers(redeemers);
}
const signedTx = CardanoWasm.Transaction.new(tx.body(), witnessSet, tx.auxiliary_data());
// 2) send
let txHash = await walletApi.submitTx(signedTx.to_hex());
console.debug("sendTransaction() got txHash: %O", txHash);
return txHash;
} catch (error) {
console.error("Failed to sign transaction:", error);
throw error; // Re-throw error for handling in the caller
}
}
const walletApi = await window.cardano.lace.enable().catch((err) => {
console.error("Cardano wallet is not enabled");
throw new Error("Cardano wallet not enabled");
});
return handler(walletApi);
} else {
console.error("Cardano wallet is not found");
throw new Error("Cardano wallet not found");
}
}
You need to install "@emurgo/cardano-serialization-lib-asmjs-gc": "^12.0.1" to process the transaction hex string returned by this API. Other versions may fail when submitting transactions, so please verify compatibility on your own.
2.2.6 Vechain Cross-chain
Testnet API path: https://bridge-api.wanchain.org/api/testnet/createTx2