kaspanet / rusty-kaspa

Kaspa full-node and related libraries in the Rust programming language. This is a Beta version at the final testing phases.
ISC License
350 stars 105 forks source link

subscribeUtxosChanged Method Invalid Types Issue: Throws RuntimeError with Account Object #443

Open emochka2007 opened 1 month ago

emochka2007 commented 1 month ago

Describe the bug When attempting to use the subscribeUtxosChanged method with an Account object, despite the documentation suggesting it accepts either an account object or a string, a runtime error is thrown indicating a memory access out of bounds. This issue occurs when running the method with a new Account(string) as an argument.

To Reproduce Instantiate an Account object using a string identifier. derivedAddresses.push(new Address(address)) Call the subscribeUtxosChanged method with the newly created Account object. await this.wsRpc.subscribeUtxosChanged(addresses) Error:

RuntimeError: memory access out of bounds
    at null.<anonymous> (wasm://wasm/01be8a16:1:2782986)
    at null.<anonymous> (wasm://wasm/01be8a16:1:4883531)

Expected behavior The subscribeUtxosChanged method should accept an Account object as its documentation indicates, without throwing a runtime error.

Desktop (please complete the following information): OS: macOS M2 Environment: WebAssembly version 0.13.5

aspect commented 3 weeks ago

Please refer to and use examples from https://github.com/kaspanet/rusty-kaspa/pull/459. (examples are available in the development WASM SDK release archive at https://kaspa.aspectron.org/nightly/downloads/ source at https://github.com/aspectron/rusty-kaspa/tree/typescript/wasm/examples)

Please note that the Account class is a part of the Wallet API, not Wallet SDK (it only functions with the integrated Wallet class implementation, not with RPC). OTOH while you mention this, your code example subscribes to addresses correctly.

If you still encounter an issue after switching to the updated SDK please cc me here or get help on Discord#development.