Search
K
Comment on page

Approval - Build-tx

Returns transaction data for approval of token spending

/v2/approval/build-tx

How this endpoint is to be used :
  • This endpoint generates the transaction data needed for a transaction to give Socket contracts approval/allowance to spend a token on behalf of the token holder.
  • The response also returns to address and from address as needed for a transaction
API-KEY param needs to be passed in the headers while making the GET request
get
https://api.socket.tech/v2
/approval/build-tx
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.

Description of response parameters :

Parameter
Description
data
Transaction data generated for approval of spending tokens by allowanceTarget for amount specified
to
Contract address of token, same as tokenAddress
from
Address of token holder, same as owner
NOTE : The token allowance is granted to Socket implementation contracts of bridges and DEXs, but bridging transactions need to be initiated via the Socket Registry contract
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 give Socket contracts approval to spend user tokens on behalf of user.