multiversx / mx-sdk-js-wallet

Core wallet components (generation, signing) for TypeScript (JavaScript).
Other
6 stars 2 forks source link

Automatically handle both kinds of keystores in "UserWallet.loadSecretKey(), "UserSigner.fromWallet()" #37

Closed andreibancioiu closed 1 year ago

andreibancioiu commented 1 year ago

Automatically handle both kinds of keystore files (with secret key vs. with mnemonic), similar to how it's done in the Python SDK:

Also see:

andreibancioiu commented 1 year ago

Temporary workaround:

const walletObject = JSON.parse(fileContent);
const mnemonic = UserWallet.decryptMnemonic(walletObject, "your keystore password");
const secretKey = mnemonic.deriveKey(0);
const signer = new UserSigner(secretKey);