tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

fix an "invalid address" error coming from client.open()

Open imaman opened this issue 9 months ago • 0 comments

in the 03 tutorial when client.open() is called I get an Invalid address error

image

After some debugging I realized that this is due to Address.isAddress() (in ton-core) using instanceof for determining that the given object is an address. The packing/bunding process of the code creates to a situation where there are two different Address classes at runtime, thereby making the instanceof check evaluate to false.

This was fixed by importing the Address class from @ton/ton (instead of @ton/core)

https://github.com/ton-core/ton-core/blob/main/src/contract/openContract.ts#L27 https://github.com/ton-core/ton-core/blob/main/src/address/Address.ts#L65

imaman avatar May 21 '24 14:05 imaman