Submitting the Transaction
Once the user has prepared approval (non-BTC origin) or HTLC lock data (BTC origin), it’s time to construct the submit request to the Kima Transaction Backend. Use transactionValues returned by the /submit/fees endpoint.
Again, like for message signing, select the appropriate submit amount based on whether the user is paying fees from the origin or target chain.
If the user is paying fees from the origin, use
transactionValues.feeFromOrigin.submitAmount.If the user is paying fees from the target, use
transactionValues.feeFromTarget.submitAmount.
Submitting the Transaction
POST /submit/transfer (or POST /submit/swap for swaps)
Request Body:
originAddress(Address): sending user addressoriginChain(string): sending chainoriginSymbol(string): sending token symboltargetAddress(Address): receiving user addresstargetChain(string): receiving chaintargetSymbol(string): receiving token symbolamount(bigint string): amount of token received by the target addressfee(bigint string): amount of token that Kima consumes to pay gas fees for pulling & releasing token transactionsdecimals(number): the number of decimals for the bigint amounts. This must match the decimals of the token to be transferred. For fiat transactions fix it to 2 decimals. For details please refer to the Supported Tokens referenceoptions(string- JSON stringified object)chargeFeeAtTarget(boolean): true if the user should pay fees on the target chain, false otherwisefeeId(string): the fee id obtained from/submit/feessignature(string): for non-BTC origin, the signature from the user's wallet from signing the approval messagepermit2(object): additionally required when selected origin token hasisPermit2=truer(string)s(string)v(number)deadline(number)
BTC-origin fields (required when originChain=BTC)
originChain=BTC)For non-BTC origin transactions, omit these fields.
htlcCreationHash
string
BTC tx hash that created the HTLC output
POST /btc/htlc/record response
htlcCreationVout
number
output index in the lock transaction
POST /btc/htlc/record response
htlcExpirationTimestamp
string
HTLC timeout value
POST /btc/htlc/record response
htlcVersion
string
HTLC script version identifier (currently p2wsh-sha256-cltv-v1)
POST /btc/htlc/record response
senderPubKey
string
sender public key (hex)
POST /btc/htlc/record response
htlcAddress
string
HTLC destination address
POST /btc/htlc/lock-intent response
htlcAmountSats
string
locked BTC amount in sats
selected lock amount (amountSats)
htlcLockId
string
backend lock intent id
POST /btc/htlc/lock-intent response
For BTC-origin swap requests (POST /submit/swap), use the same HTLC fields above in addition to swap fields (amountIn, amountOut, dex, slippage).
See the list of chain short names in the Supported Assets section.
Non-BTC origin example (/submit/transfer)
/submit/transfer)BTC-origin example (/submit/transfer)
/submit/transfer)Make sure the decimals for the bigint amounts are all the same. You may need to convert the value for feeTotalBigint to the same decimals as the submitAmount before passing it to the backend.
Success Response:
height: numbertxIndex: numbercode: number: error code; will be zero when successfultransactionHash: stringevents: Event[]type: stringattributes: Attribute[]key: stringvalue: string
rawLog?: stringdata?: MsgData[]msgResponses: Uint8ArraygasUsed: bigintgasWanted: bigint
Get Transaction Id
The transaction Id will be needed to fetch the transaction status. The following code can be used to extract the Id from the submit response.
Validation
If provided, the Kima Backend will use the url defined in the ENV var COMPLIANCE_URL to get the risk score for the origin and target user addresses. If the score is anything other than low it will respond with a 500 error.
Last updated