sdk
sdk copied to clipboard
Create new contract will point to wrong address.
Steps
Create new contract with abi and address as params: hmy.contracts.createContract(abi, contractAddress);
What expected?
New contract instance will send to contractAddress
What happend?
New contract instance will send to options addresss.
Suggestion
Check if constructor with address will using this param don't using in options.address
Code line?
https://github.com/harmony-one/sdk/blob/ab95524bd0f873dc8d5ed15910f492eb07f73908/packages/harmony-contract/src/contract.ts#L42
I had also faced the same issue, and workaround was to use 'to' parameter explicitly in the methods call.
Steps Create new contract with abi and address as params:
hmy.contracts.createContract(abi, contractAddress);
What expected? New contract instance will send to contractAddress What happend? New contract instance will send to options addresss. Suggestion Check if constructor with address will using this param don't using in options.address Code line? https://github.com/harmony-one/sdk/blob/ab95524bd0f873dc8d5ed15910f492eb07f73908/packages/harmony-contract/src/contract.ts#L42
what's your code?
this.options.address
should be undefined
, so this.address
is the contractAddress
.