tutorials
tutorials copied to clipboard
fix an "invalid address" error coming from client.open()
in the 03 tutorial
when client.open()
is called I get an Invalid address
error
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