-
As subject, let abi: ethers.ContractInterface
let address: string
let contract = new Contract(address, abi)
//... pass contract as prop to a Svelte component
let iface: Interface = contract.interface
iface instanceof ethers.utils.Interface //false |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I looked at the source (master branch) it seems that the |
Beta Was this translation helpful? Give feedback.
-
The As for the example you give, that may depend on your environment and set up. For example, if you are using a bundler or This is why ethers doesn't use > contract.interface instanceof utils.Interface
true Hope that helps. |
Beta Was this translation helpful? Give feedback.
The
ContractInterface
is a type, so cannot be instantiated, in general; it just defines a "shape" as TypeScript calls it.As for the example you give, that may depend on your environment and set up. For example, if you are using a bundler or
npm link
it will affect the reliability ofinstanceof
.This is why ethers doesn't use
instanceof
internally, because it is quite unreliable in a large variety of situations.Hope that helps.