Approve to Send Token

Grants authority to spender to send a certain amount of tokens from the owner's account.

To send the token as an authorized spender, use Send Token on Behalf of Owner.

NOTE

spender is the address that will be granted the authority. It needs to be managed by Wallet API in order to be use Send Token on Behalf of Owner.

Owner

The account that owns the token, and grants authority to spender. If you leave it blank, it will automatically be set to the deployer address as default . You can find the deployer address by KIP7Deployer.

You can omit the KRN if the owner address is managed by the KIP-7 or Wallet Service account-pool.
Otherwise you have to provide the KRN object in the header (x-krn: krn:{chain-id}:wallet:{account-id}:account-pool:{pool name}).

Request
Security:
path Parameters
contract-address-or-alias
required
string

Contract address (in hex.) or alias.

header Parameters
x-chain-id
required
string

Kaia Network Chain ID (1001 or 8217)

Request Body schema: application/json
owner
string

The Kaia account address to grant the authority. The default value is the deployer's address'.

spender
required
string

The Kaia account address to be granted authority.

amount
required
string

Approved token amount (in hex.)

Responses
200

Your request was successful.

400

Your request is not valid.

401

The credential you entered is invalid.

404

The resource you requested doesn't exist.

post/v1/contract/{contract-address-or-alias}/approve
Request samples
application/json
{
  • "owner": "0x1eb15b3ccb2add3bfe132a4f6ad21ca62cf94e6d",
  • "spender": "0xfb7ead209e113ff15f588852f112cf331d02b4bf",
  • "amount": "0x5c2"
}
Response samples
application/json

Your request was successful.

{
  • "status": "Submitted",
  • "transactionHash": "0x60412f876bfb8ae9953caa47be11cd5961a591198e09c25bb8cc3b26e416a862"
}