ONT Contract API
Index
Methods
BalanceOf
BalanceOfFetch the balance of a specific address.
ontSdk.Native.Ont.BalanceOf(address common.Address) (uint64, error)BalanceOfV2
BalanceOfV2Fetch the balance of a specific address.
ONT has 9 decimals.
ontSdk.Native.Ont.BalanceOfV2(address common.Address) (*big.Int, error)Transfer
TransferInitiate a transaction.
ontSdk.Native.Ont.Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)Emit a corresponding contract event. For example:
{
"ContractAddress": "0100000000000000000000000000000000000000",
"States": [
"transfer",
"APS1wGGVUjsJYLUvncckzgsdqGT3KRqMtx",
"AFmseVrdL9f9oyCzZefL9tG6UbviEH9ugK",
200
]
}TransferV2
TransferV2 Initiate a transaction.
ONT has 9 decimals.
ontSdk.Native.Ont.TransferV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)If the transfer amount is divisible by 10^9, the event emitted will be the same as the one by Transfer.
Otherwise, the amount consists of two integers. The first one represents amount/10^9, and the second one represents amount%10^9. For example, if the transaction amount is 123.4567 ONT, the event looks like:
{
"ContractAddress": "0100000000000000000000000000000000000000",
"States": [
"transfer",
"APS1wGGVUjsJYLUvncckzgsdqGT3KRqMtx",
"AFmseVrdL9f9oyCzZefL9tG6UbviEH9ugK",
123,
4567
]
}MultiTransfer
MultiTransferInitiate a batch transfer from one address to multiple addresses.
ontSdk.Native.Ont.MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)MultiTransferV2
MultiTransferV2Initiate a batch transfer from one address to multiple addresses.
ONT has 9 decimals.
ontSdk.Native.Ont.MultiTransferV2(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)Approve
ApproveApprove tokens to be withdrawn as allowance.
ontSdk.Native.Ont.Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)ApproveV2
ApproveV2Approve tokens to be withdrawn as allowance.
ONT has 9 decimals.
ontSdk.Native.Ont.ApproveV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)Allowance
AllowanceReturn the allowance from the from account to the to account.
ontSdk.Native.Ont.Allowance(from, to common.Address) (uint64, error)AllowanceV2
AllowanceV2Return the allowance from the from account to the to account.
ONT has 9 decimals.
ontSdk.Native.Ont.AllowanceV2(from, to common.Address) (*big.Int, error)TransferFrom
TransferFromAllow tokens to be transferred from allowance.
ontSdk.Native.Ont.TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount uint64) (common.Uint256, error)TransferFromV2
TransferFromV2Allow tokens to be transferred from allowance.
ONT has 9 decimals.
ontSdk.Native.Ont.TransferFromV2(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount *big.Int) (common.Uint256, error)Last updated