Learn how to use the checkApprove JSON-RPC method.
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_swap_checkApprove' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_swap_checkApprove",
"params": [
"0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8"
],
"chainId": 1
}
'{
"jsonrpc": "2.0",
"id": 1,
"result": {
"approved": true,
"tx": {
"to": "0x111111111117dC0aa78b770fA6A738034120C302",
"data": "0x095ea7b30000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d000000000000000000000000000000000000000000000000000000003b9aca00",
"value": "0x0"
}
},
"chainId": 1
}checkApprovecheckApprove returns a Boolean based upon whether a given address has approved spending of a specified amount for a particular ERC-20 token. It takes:
address - string.tokenAddress - string.amount - string.{
"id": 1,
"jsonrpc": "2.0",
"method": "particle_swap_checkApprove",
"params": [
"0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8", // wallet address
{
"tokenAddress": "0x111111111117dc0aa78b770fa6a738034120c302", // from token address
"amount": "1000000000"
}
]
}
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Request to check if a token is approved for swapping.
Version of the JSON-RPC protocol, should be 2.0.
"2.0"
The request identifier.
1
API method being called.
particle_swap_checkApprove Parameters for checking token approval.
User address.
"0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8"
The blockchain chain ID.
1
Successful response with approval status.
Was this page helpful?
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_swap_checkApprove' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_swap_checkApprove",
"params": [
"0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8"
],
"chainId": 1
}
'{
"jsonrpc": "2.0",
"id": 1,
"result": {
"approved": true,
"tx": {
"to": "0x111111111117dC0aa78b770fA6A738034120C302",
"data": "0x095ea7b30000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d000000000000000000000000000000000000000000000000000000003b9aca00",
"value": "0x0"
}
},
"chainId": 1
}