Comment on page
Check Allowance
check-allowance returns the allowed spending of tokens by an address on behalf of the token holder.
/v2/approval/check-allowance
- Socket contracts need spending allowance of a user's sending token in order to swap/bridge it
- This endpoint is used to check whether the contracts have the allowance needed to bridge the sending token
- This is only applicable to ERC-20 tokens and not native tokens (gas paying asset) of a chain.
NOTE :
Token allowance needs to be re-checked every time a user updates the input amount of token they want to bridge
API-KEY param needs to be passed in the headers while making the
GET
requestget
https://api.socket.tech/v2
/approval/check-allowance
Returns the value of tokens approved
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 contractParameter | Description |
---|---|
success | Indicates successful response from endpoint, as intended. |
value | Amount of token an address is allowed to spend on behalf of token holder |
tokenAddress | Contract address of token on the specified chain |
TEST QUERY :
- If the Socket contracts have allowance to spend user token, the transaction data for bridging from the route chosen by the user needs to be generated from
v2/build-tx
- In case
value
is 0 or less than the amount the user is trying to bridge, an approval transaction is needed to give Socket contracts approval to spend user tokens. Transaction data for this transaction can be generated fromv2/approval/build-tx
Last modified 1yr ago