approve(contract, sender, currency, approved, amount)

Feature

Returns raw operation to approve certain amount of token to approved account. Note: If you want to cancel the approve operation, execute approve function again with amount : 0.

Parameters

string contract address, string sender, string currency ID, string approved, string | int amount

Return Value

object approve token operation

example

const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const currencyID = "MCC"
const approved = "0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca";
const amount = 100000;

const Operation = mitum.token.approve(contractAddress, sender, currencyID, approved, amount);
console.log(Operation);

// output
BaseOperation {
  id: 'mitum',
  fact: ApproveFact {
    hint: Hint { s: 'mitum-token-approve-operation-fact' },
    token: Token { s: '2026-02-19 03:21:09.553 +0000 UTC' },
    _hash: <Buffer 7d 5a a1 e9 47 90 aa 77 bd d5 c5 e7 e8 60 20 99 df 82 c3 fb 97 17 9f 1e 94 a5 32 00 cb 6c 73 c2>,
    sender: Address {
      s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
      type: 'mitum'
    },
    items: [ [ApproveItem] ]
  },
  hint: Hint { s: 'mitum-token-approve-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated