rusty-kaspa icon indicating copy to clipboard operation
rusty-kaspa copied to clipboard

subscribeUtxosChanged Method Invalid Types Issue: Throws RuntimeError with Account Object

Open emochka2007 opened this issue 1 year ago • 1 comments

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

emochka2007 avatar Mar 26 '24 10:03 emochka2007

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.

aspect avatar Apr 22 '24 19:04 aspect