Closed akanoce closed 1 month ago
There is something odd in the ABI that was provided, if I load the one from the vebetterdao package, the typings works as expected.
@akanoce can you confirm it's still a bug and not a problem with the ABI provided?
Waiting for @akanoce feedback
@Valazan @fabiorigam it's still not working on my side guys. I tried with lot of different abis, without luck (i.e https://github.com/vechain/b32/blob/master/ABIs/VeBetterDAO-b3tr.json)
Also, i really think we should infer the type instead of having the user manually declare it like
Contract<type of json.abi>
which, is trowing type errors in my case
@akanoce we have to check it better because the type is directly imported from abitype https://abitype.dev/, so it's not something implemented by SDK.
As for the loading, the standard way to load a contract is:
const loadedContract = thorSoloClient.contracts.load(
contract.address,
contract.abi
);
In this case type will be inferred. But we can also see it implemented also for a new contract object instantiation
Opened a new PR with a releted issue, this one is working
Description
Looks like some methods of the class returned via
new Contract(....)
are not typed, making it difficult to work with such methods, requiring differentts-ignore
to silence ts.As you can see in both screenshots, the Contract is just a generic
Contract<Abi>
. I tried with multiple abis and contracts achieving the same resultReproduction URL
No response
Reproduction steps
const abi = [...]
const address = "0x89A00Bb0947a30FF95BEeF77a66AEdE3842Fe5B7"
const thorClient = ThorClient.fromUrl("https://mainnet.vechain.org");
.read
and.clause
Screenshots
No response
Logs
No response
OS
Mac