ENSC Business API
Business DashboardWebsite
  • Introduction
    • Use Cases
    • Configurations
  • Ready To Integrate?
  • Getting Started
    • Security
      • Generating Keys
      • Encrypting / Decrypting Request
  • Integrations
    • Contract Address
    • Enums
    • Authorization
    • Endpoints
      • Get Bank Lists
      • Token Balance
      • Token Approval
      • Mint
      • Mint Allocation
      • Redeem
      • Transfer
      • Withdraw
      • Verify Payout/Withdrawal
  • Libraries/SDKs
    • Client Libraries
Powered by GitBook
On this page
  1. Integrations
  2. Endpoints

Token Approval

POST /approve

This endpoint generates an unsigned transaction for approving token spending. The approval transaction lets a smart contract (or a specified sender address) spend a given amount of tokens on behalf of the recipient. If a sender is provided, the approval will be generated using that address (and only the ENSC asset type is allowed in that case). Otherwise, the recipient’s address is used.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <api_key>

Body

Name
Type
Description

recipient

string

The wallet address that will receive the approval.

assetType

string

The asset type, provided as an enum value (e.g., ENSC, USDC, USDT, etc.).

amount

number

The amount to approve.

sender

string

Optional. If provided, the approval will be generated using this address instead of the recipient. When provided, only ENSC is allowed as the asset type.

Example 1: Approval for Redeeming Assets (No Sender Provided)

Request

{
  "recipient": "0xRecipientAddressABC123",
  "assetType": "USDC",
  "amount": 50
}
{
  "status": 200,
  "message": "Unsigned approve transaction generated successfully",
  "data": {
    "to": "0xTokenContractAddressXYZ",
    "value": 0,
    "gasLimit": "0x186a0",
    "gasPrice": "20000000000",
    "nonce": "5",
    "data": "0x095ea7b3000000000000000000000000DEXContractAddressDEF4560000000000000000000000000000000000000000000000000000000000000032",
    "from": "0xRecipientAddressABC123",
    "spender": "0xDEXContractAddressDEF456"
  }
}
{
  "status": 400,
  "error": "Invalid Request",
  "message": "Invalid recipient address",
  "data": null
}

Example 2: Approval for Transfers (Sender Provided)

Response

{
  "recipient": "0xRecipientAddressABC123",
  "sender": "0xSenderAddress987654",
  "assetType": "ENSC",
  "amount": 10
}
{
  "status": 200,
  "message": "Unsigned approve transaction generated successfully",
  "data": {
    "to": "0xTokenContractAddressXYZ",
    "value": 0,
    "gasLimit": "0x186a0",
    "gasPrice": "20000000000",
    "nonce": "12",
    "data": "0x095ea7b3000000000000000000000000SenderAddress987654000000000000000000000000000000000000000000000000000000000000000a",
    "from": "0xSenderAddress987654",
    "spender": "0xSenderAddress987654"
  }
}
{
  "status": 400,
  "error": "Invalid Asset",
  "message": "When a sender is provided, only ENSC asset type is allowed",
  "data": null
}
PreviousToken BalanceNextMint

Last updated 2 months ago