Skip to main content
GET
/
api
/
{blockchain}
/
permit
/
data
TypeScript
const options = {method: 'GET'};

fetch('https://swap.ggp.gg/api/{blockchain}/permit/data', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "alreadyApproved": true,
  "alreadyPermit": true,
  "data": {
    "permit": {
      "details": {
        "amount": "0xffffffffffffffffffffffffffffffffffffffff",
        "expiration": "0x69daab1d",
        "nonce": "0x0",
        "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
      },
      "sigDeadline": "0x69b46f9d",
      "spender": "0xeee3fdcc5b9d7821570294b26070b2f45cfd8aec"
    },
    "typedData": {
      "domain": {
        "chainId": "0x1",
        "name": "Permit2",
        "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
      },
      "message": {
        "details": {
          "amount": "0xffffffffffffffffffffffffffffffffffffffff",
          "expiration": "0x69daab1d",
          "nonce": "0x0",
          "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
        },
        "sigDeadline": "0x69b46f9d",
        "spender": "0xeee3fdcc5b9d7821570294b26070b2f45cfd8aec"
      },
      "primaryType": "PermitSingle",
      "types": {
        "EIP712Domain": [
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "chainId",
            "type": "uint256"
          },
          {
            "name": "verifyingContract",
            "type": "address"
          }
        ],
        "PermitDetails": [
          {
            "name": "token",
            "type": "address"
          },
          {
            "name": "amount",
            "type": "uint160"
          },
          {
            "name": "expiration",
            "type": "uint48"
          },
          {
            "name": "nonce",
            "type": "uint48"
          }
        ],
        "PermitSingle": [
          {
            "name": "details",
            "type": "PermitDetails"
          },
          {
            "name": "spender",
            "type": "address"
          },
          {
            "name": "sigDeadline",
            "type": "uint256"
          }
        ]
      }
    }
  }
}

Path Parameters

blockchain
enum<string>
required
Available options:
ethereum,
bsc,
arbitrum

Query Parameters

addressTokenIn
string
required

Source token contract address (ERC20 or native token)

dstAddress
string
required

Destination/taker wallet or contract

amountIn
string
required

Amount of source token to swap (in token's normalized unit, e.g., eth for ETH)

Response

Permit/Approve info or EIP-2612 signature for maker address

alreadyApproved
boolean
required

Whether the token has already been approved

alreadyPermit
boolean
required

Whether the permit has already been signed

data
object
Example:
{
"permit": {
"details": {
"amount": "0xffffffffffffffffffffffffffffffffffffffff",
"expiration": "0x69daab1d",
"nonce": "0x0",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
},
"sigDeadline": "0x69b46f9d",
"spender": "0xeee3fdcc5b9d7821570294b26070b2f45cfd8aec"
},
"typedData": {
"domain": {
"chainId": "0x1",
"name": "Permit2",
"verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
},
"message": {
"details": {
"amount": "0xffffffffffffffffffffffffffffffffffffffff",
"expiration": "0x69daab1d",
"nonce": "0x0",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
},
"sigDeadline": "0x69b46f9d",
"spender": "0xeee3fdcc5b9d7821570294b26070b2f45cfd8aec"
},
"primaryType": "PermitSingle",
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitDetails": [
{ "name": "token", "type": "address" },
{ "name": "amount", "type": "uint160" },
{ "name": "expiration", "type": "uint48" },
{ "name": "nonce", "type": "uint48" }
],
"PermitSingle": [
{
"name": "details",
"type": "PermitDetails"
},
{ "name": "spender", "type": "address" },
{ "name": "sigDeadline", "type": "uint256" }
]
}
}
}