harmony-one / sdk

Javascript SDK of Harmony protocol.
MIT License
92 stars 43 forks source link

Create new contract will point to wrong address. #32

Open HiroKryptor opened 4 years ago

HiroKryptor commented 4 years ago

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

ajaya-man commented 4 years ago

I had also faced the same issue, and workaround was to use 'to' parameter explicitly in the methods call.

peekpi commented 4 years ago

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.