web3 code generator can't connect to account address to call method of contract
The automatically generated code of Web3 cannot possibly send a transaction, since it doesn’t provide a caller address or a private key. So, it just calls a method with no one to pay for the gas. So, connection to RPC is not established.
result: {
call: [Function: bound _executeMethod] {
request: [Function: bound _executeMethod]
},
send: [Function: bound _executeMethod] {
request: [Function: bound _executeMethod]
},
encodeABI: [Function: bound _encodeMethodABI],
estimateGas: [Function: bound _executeMethod],
createAccessList: [Function: bound _executeMethod],
arguments: [],
_method: {
type: 'function',
name: 'greet',
stateMutability: 'view',
inputs: [],
outputs: [ [Object] ],
constant: true,
payable: undefined,
signature: '0xcfae3217'
},
_parent: Contract {
setProvider: [Function (anonymous)],
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: false,
host: 'https://rpc-mumbai.maticvigil.com/',
httpsAgent: [Agent]
},
setRequestManager: [Function (anonymous)],
BatchRequest: [Function: bound Batch],
extend: [Function: ex] {
formatters: [Object],
utils: [Object],
Method: [Function: Method]
},
clearSubscriptions: [Function (anonymous)],
options: { address: [Getter/Setter], jsonInterface: [Getter/Setter] },
handleRevert: [Getter/Setter],
defaultCommon: [Getter/Setter],
defaultHardfork: [Getter/Setter],
defaultChain: [Getter/Setter],
transactionPollingTimeout: [Getter/Setter],
transactionPollingInterval: [Getter/Setter],
transactionConfirmationBlocks: [Getter/Setter],
transactionBlockTimeout: [Getter/Setter],
blockHeaderTimeout: [Getter/Setter],
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
methods: {
greet: [Function: bound _createTxObject],
'0xcfae3217': [Function: bound _createTxObject],
'greet()': [Function: bound _createTxObject]
},
events: { allEvents: [Function: bound ] },
_address: '0x43a35f6D0AEA7bdcD07E12aA4769353241ef1433',
_jsonInterface: [ [Object] ]
},
_ethAccounts: <ref *1> Accounts {
currentProvider: [Getter/Setter],
_requestManager: RequestManager {
provider: [HttpProvider],
providers: [Object],
subscriptions: Map(0) {}
},
givenProvider: null,
providers: {
WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider]
},
_provider: HttpProvider {
withCredentials: false,
timeout: 0,
headers: undefined,
agent: undefined,
connected: false,
host: 'https://rpc-mumbai.maticvigil.com/',
httpsAgent: [Agent]
},
setProvider: [Function (anonymous)],
setRequestManager: [Function (anonymous)],
_ethereumCall: {
getNetworkId: [Function],
getChainId: [Function],
getGasPrice: [Function],
getTransactionCount: [Function],
getBlockByNumber: [Function]
},
wallet: Wallet {
_accounts: [Circular *1],
length: 0,
defaultKeyName: 'web3js_wallet'
}
}
}
Subscribe to post
Get email updates when post changes