Search…
Build-Tx (GET)

/v2/build-tx

How this endpoint is to be used :
  • This endpoint is same as previous /build-tx endpoint, but it accepts a GET request with query params instead.
  • This endpoint is to be used only in case of Single Transaction Bridging flow.
  • For a Refuel + Bridge transaction, bridgeWithGas param needs to be passed as a query param and set to true
get
https://api.socket.tech/v2
/build-tx
Returns the transaction data for bridging assets
IMPORTANT : amount parameter in the query needs to be decimal adjusted. For example 1 USDC = 1000000 as USDC supports upto 6 decimal places. Where as 1 UNI = 1000000000000000000 as UNI supports upto 18 decimal places.
API-KEY needs to be passed in the headers while making the GET request

Description of response parameters :

Parameter
Description
success
Status of the api response.
result.userTxType
The type of transaction being done. Indicates if it is a bridging tx, dex tx etc.
result.txType
The type of transaction from wallet's context. Indicates if it is a send tx, sign tx etc.
result.txData
The raw data that should be sent to the contract for making a transaction. Includes the encoded function signature and params.
result.txTarget
The contract address where transaction has to be sent.
result.chainId
The chainId where transaction has to be sent.
result.value
The amount of native tokens that need to be sent as value along with the transaction.
result.approvalData
Details about approval needed before the main transaction. In case approval is not needed this will be null.
result.approvalData.minimumApprovalAmount
The minimum amount of approval required.
result.approvalData.approvalTokenAddress
Address of the token that needs to be given approval.
result.approvalData.allowanceTarget
The contract that needs approval in order to transfer user tokens.
​
TEST QUERY :

NEXT STEP

  • Once the transaction data is retrieved on the frontend, a contract call needs to be made using the returned data to send callData to Socket contracts. The Socket contracts then swap (only if needed and specified by middlewareRoute response param) and bridge in a single transaction.
  • Once the user has initiated a transaction, the status of the transaction can be tracked using Socket Bridge Status APIs
Copy link
On this page
get
Returns the transaction data for bridging assets
Description of response parameters :