Я пытаюсь получить доступ к функциям контракта токена следующим образом:
const Web3 = require('web3')
const web3 = new Web3('http://localhost:7545') # Ganache running on that port
const abi = [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
const contract = new web3.eth.Contract(abi, "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07")
Теперь, когда я вызываю метод contract.methods, вместо получения списка методов, которые я могу вызвать, я получаю это
Proxy [
MethodsProxy {
contract: AbstractContract {
providerResolver: [ProviderResolver],
givenProvider: null,
_currentProvider: [HttpProvider],
_defaultAccount: undefined,
_defaultBlock: 'latest',
_transactionBlockTimeout: 50,
_transactionConfirmationBlocks: 24,
_transactionPollingTimeout: 750,
_defaultGasPrice: undefined,
_defaultGas: undefined,
BatchRequest: [Function],
contractModuleFactory: [ContractModuleFactory],
abiCoder: [AbiCoder],
utils: [Object],
formatters: [Object],
abiMapper: [AbiMapper],
options: [Object],
accounts: Proxy [Array],
methodFactory: [MethodFactory],
abiModel: [AbiModel],
transactionSigner: [TransactionSigner],
methods: Proxy [Array],
events: Proxy [Array]
},
methodFactory: MethodFactory {
utils: [Object],
formatters: [Object],
contractModuleFactory: [ContractModuleFactory],
abiCoder: [AbiCoder]
},
methodEncoder: MethodEncoder { abiCoder: [AbiCoder] },
methodOptionsValidator: MethodOptionsValidator { utils: [Object] },
methodOptionsMapper: MethodOptionsMapper { utils: [Object], formatters: [Object] }
},
{ get: [Function: get] }
]
Когда я запускаю какие-либо функции, он говорит, что не может вызывать функцию по контракту. Есть идеи, почему?