Skip to content

Instantly share code, notes, and snippets.

@spirobel
Last active January 14, 2022 23:34
Show Gist options
  • Save spirobel/5669497d4c2192fae98cb69e9743af3a to your computer and use it in GitHub Desktop.
Save spirobel/5669497d4c2192fae98cb69e9743af3a to your computer and use it in GitHub Desktop.
opening multiple wallets with monero-javascript - a chat excerpt from #monero-dev:monero.social

spirobel: @woodser I was reading this issue: woodser/monero-ts#58 does this also apply to createWalletFull? Can I only open one wallet at a time? Or did I read this part of the test right: https://github.com/monero-ecosystem/monero-javascript/blob/ff92010b0d2df89025166f54ec1d00ce88357b60/src/test/TestMoneroWalletFull.js#L170 seems like many wallets are opened and synced in a for loop and then they run in parallel until close is called. What happens when close doesnt happen and the program crashes? https://github.com/monero-ecosystem/monero-javascript/blob/778473a4e081f03c74697e6ace3a0d416fe03888/src/main/cpp/monero_wasm_bridge.cpp#L1221 it is just a clean up to prevent memory leaks, right? so it should be no big deal.

woodser: @spirobel you can open more than one full wallet at a time if it's not saved before closing, any data since the last save would be lost

spirobel: thanks! this makes a lot of sense! I saw the wallet.getData() call in the wallet save method. https://github.com/monero-ecosystem/monero-javascript/blob/fcc00324538975817d4524b9a337e95a9b68f441/src/main/js/wallet/MoneroWalletFull.js#L1911 still need to research how I would reopen from this data ... 🙂

woodser: ah, that can be done too, by providing keysData and cacheData to the openWallet() config https://moneroecosystem.org/monero-javascript/global.html#openWalletFull

woodser: can just call monerojs.openWallet() with the path

spirobel: Great! Thank you so much! 🙂

woodser: np :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment