Compose transaction to finalize a PACT
Composes a finalization transaction for a specific execution request (PACT). This endpoint is used by market makers to finalize a swap by sending the destination tokens to the user. The transaction is composed for the swap destination blockchain. For Bitcoin-like transactions (BTC, LTC, DOGE), you must provide UTXO information and a public key. The response includes the raw transaction data and optional EVM-specific fields (chainId, value, to, type) for EVM-compatible blockchains. The composed transaction can then be signed by the market maker's wallet and broadcast to the blockchain to finalize the swap and complete the execution request.
Query Parameters
The unique identifier of the execution request (PACT) to finalize. This is the ID of the swap execution request that was created when the user initiated the swap. The finalization transaction will complete the swap by sending the L1 tokens to the user.
The wallet address on the source blockchain that will send the finalization transaction. This should be a valid address for the source blockchain type (e.g., Bitcoin address for BTC, Ethereum address for ETH). This is typically the market maker's wallet address that will finalize the swap.
The C2 contract address for the destination token. This is the L2 contract address of the C2 (market maker) contract that handles the destination token in the swap. The finalization transaction will interact with this contract to complete the swap.
The amount to finalize in the smallest unit of the destination token (e.g., satoshis for BTC, wei for ETH). This is the amount of destination tokens that will be sent to the user to complete the swap. This should match the amount specified in the PACT execution request.
The type of the source token blockchain. Used to determine the blockchain type for the source token (e.g., "btc", "eth", "usdc", "ltc", "doge"). This determines which blockchain the finalization transaction will be created for.
"eth""eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"The type of the destination token blockchain. Used to determine the blockchain type for the destination token (e.g., "btc", "eth", "usdc", "ltc", "doge"). This determines which blockchain will receive the finalization transaction.
"btc""eth" | "btc" | "ltc" | "doge" | "bnb" | "pol" | "trx" | "usdt_trx" | "usdt_bnb" | "usdc_bnb" | "usd1_bnb" | "wbtc_bnb" | "usdt_eth" | "wbtc_eth" | "usdc_eth" | "usd1_eth" | "usdt_pol"The public key for the source wallet. Required only when fromType is "btc" (or other UTXO-based chains). This is used to construct the finalization transaction for Bitcoin-like blockchains. Should be a hex string without 0x prefix.
JSON string containing UTXO information for Bitcoin-like transactions. Required only when fromType is "btc", "ltc", or "doge". Format: JSON array of objects with structure: [{txid: string, vout: number, value: number}, ...]. Each object represents an unspent transaction output that will be used to fund the finalization transaction.
Backend URL. Default is https://api-cloud.coinweb.io/wallet. This URL is used to query the PACT state and compose the finalization transaction.
uriResponse Body
curl -X GET "https://cwap-api.coinhq.store/pactswap_cm/composeFinalizeTx?pactId=string&fromWalletAddress=string&toC2ContractId=0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85&finilizeAmount=0&fromType=eth&toType=eth&fromPublicKey=020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876&utxos=%5B%7B%22txid%22%3A%22a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d%22%2C%22vout%22%3A0%2C%22value%22%3A50000000%7D%5D&backendUrl=https%3A%2F%2Fapi-cloud.coinweb.io%2Fwallet"{
"rawTx": "0100000001...",
"chainId": 1,
"value": "0",
"to": "0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85",
"type": "eip1559"
}Was this documentation helpful? Any suggestions?