0

I'm building a Monero Wallet using monero-javascript with React.js.

I'm updating a subaddress label, but when fetching all subaddresses from the wallet afterwards, I see that the subaddress label was not updated.

I've summarized the steps I'm taking:

I appreciate any help 👍

import monerojs, { MoneroNetworkType } from 'monero-javascript';

// I recover a wallet using the mnemonic.
let walletFull = await monerojs.createWalletFull({
        networkType: MoneroNetworkType.STAGENET,
        password: "passwordgoeshere",
        mnemonic: "seedphrase goes here"
      });

// I create a subaddress with some initial label
await walletFull.createSubaddress(0, "My Subaddress Label")

// Then my WebApp would fetch the list of subaddresses, using getSubaddresses(0) to get all the 
// subaddress in an account, to show the newly created one.
// But for this example let's directly get that newly created subadress by its ID (1)
const theNewSubaddress = await walletFull.getSubaddress(0, 1)

// I update the label
theNewSubaddress.setLabel("Hello World")

// Once again my WebApp would fetch and reload the list of all subaddresses from the wallet to get an updated view.
// But let's get it by id.
const theUpdatedSubaddress = await walletFull.getSubaddress(0, 1)

//  At this point theUpdatedSubaddress label is still the initial one. 🙁

It seems that doing theNewSubaddress.setLabel("Hello World") only updates the object theNewSubaddress.

What's missing so that I can see the new subaddress label when calling walletFull.getAddresses(accountid) ?

Thanks in advance.

1 Answer 1

0

Woodser's response to the GitHub issue you created (for others benefit):

The libraries do not currently support setting the label on the subaddress after creation, but it can be added since it's supported in monero-project. I've taken the todo to include it in the next release (prs are also welcome).

theNewSubaddress.setLabel("Hello World")

This will only set the label on the local model, not in the source wallet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.