tronWeb.contract
Creates a contract object that wraps an ABI. Allows you to easily call functions on on the contract.
An optional ABI and address can be provided here, although all contracts on TRON contain the ABI on the blockchain, so ABI is not necessary.
Usage
tronWeb.contract()
Parameters
abi:Optionally provide the ABI for a contract.
address:Optionally provide the address for a contract.
Returns
Object
Example
tronWeb.contract([{"constant":false,"inputs":[{"name":"number","type":"uint256"}],"name":"constructor","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"number","type":"uint256"}],"name":"calculateValue","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"input","type":"uint256"},{"indexed":false,"name":"result","type":"uint256"}],"name":"Notify","type":"event"}])
> 71e71a84: ƒ ()
91c75a2e: ƒ ()
767b6190: ƒ ()
Notify: ƒ ()
Notify(uint256,uint256): ƒ ()
abi: (3) [{…}, {…}, {…}]
address: false
bytecode: false
calculateValue: ƒ ()
calculateValue(uint256): ƒ ()
constructor(uint256): ƒ ()
deployed: false
eventListener: false
injectPromise: (func, ...args) => {…}
lastBlock: false
methodInstances: {constructor: e, constructor(uint256): e, 767b6190: e, calculateValue: e, calculateValue(uint256): e, …}
methods: {constructor: ƒ, constructor(uint256): ƒ, 767b6190: ƒ, calculateValue: ƒ, calculateValue(uint256): ƒ, …}
props: (8) ["constructor(uint256)", "767b6190", "calculateValue", "calculateValue(uint256)", "91c75a2e", "Notify", "Notify(uint256,uint256)", "71e71a84"]
tronWeb: t {_events: Events, _eventsCount: 0, event: e, transactionBuilder: e, trx: e, …}
__proto__: Object
tronWeb.contract(["41a7837ce56da0cbb28f30bcd5bff01d4fe7e4c6e3"])
>abi: ["41a7837ce56da0cbb28f30bcd5bff01d4fe7e4c6e3"]
address: false
bytecode: false
deployed: false
eventListener: false
injectPromise: (func, ...args) => {…}
lastBlock: false
methodInstances: {}
methods: {}
props: []
tronWeb: t {_events: Events, _eventsCount: 0, event: e, transactionBuilder: e, trx: e, …}
__proto__: Object
tronWeb.contract(["TREwN2qRkME9TyQUz8dG6HfjEyKGMPHAS5"])
>abi: ["TREwN2qRkME9TyQUz8dG6HfjEyKGMPHAS5"]
address: false
bytecode: false
deployed: false
eventListener: false
injectPromise: (func, ...args) => {…}
lastBlock: false
methodInstances: {}
methods: {}
props: []
tronWeb: t {_events: Events, _eventsCount: 0, event: e, transactionBuilder: e, trx: e, …}
__proto__: Object