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
Operation {
id: 'mitum',
fact: ApproveFact {
hint: Hint { s: 'mitum-token-approve-operation-fact' },
token: Token { s: '2023-10-19 09:27:39.719 +0000 UTC' },
_hash: <Buffer 36 51 12 34 6d 9d 31 b0 fe 95 40 2f e4 58 fd aa 73 80 eb a3 ff e4 fb b6 b1 ba 9d 5f ce 48 d8 50>,
sender: Address {
s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
type: 'mitum'
},
contract: Address {
s: '0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca',
type: 'mitum'
},
currency: CurrencyID { s: 'MCC' },
approved: Address {
s: '0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca',
type: 'mitum'
},
amount: Big { big: 100000n }
},
hint: Hint { s: 'mitum-token-approve-operation' },
_factSigns: [],
_hash: <Buffer >
}
Last updated