Skip to main content

Wallet

Interfaces for managing the Mystiko wallet, including creating, checking, updating, and exporting operations.

Data Structure

Wallet data structure is as follows:

PropertyTypeDescription
idstring
The wallet ID.
createdAtbigint
The creation time of the wallet.
updatedAtbigint
The last update time of the wallet.
encryptedEntropystring
The encrypted entropy of the wallet.
hashedPasswordstring
The hashed password of the wallet.
accountNoncenumber
The account nonce of the wallet.
mnemonicTypeMnemonicType
The account mnemonic type.

List of supported MnemonicType:

# Represents a mnemonic phrase used in web wallets, typically consisting of 12 words.
MnemonicType.WEB;
# Represents a mnemonic phrase used in Rust-based wallets, typically consisting of 24 words.
MnemonicType.RUST;

Create

Create a Mystiko Wallet.

import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';

const options = new core.handler.v1.CreateWalletOptions({
password: 'walletPassword',
mnemonic: {
mnemonicPhrase: "valley canyon ...",
mnemonicType: core.v1.MnemonicType.RUST,
},
});
const wallet = mystiko.wallet?.create(options);

The parameter list for CreateWalletOptions:

ParameterRequiredDescription
passwordtrue
The password for the wallet.
mnemonictrue
MnemonicOptions for the wallet.

The parameter list for MnemonicOptions:

ParameterRequiredDescription
mnemonicPhrasetrue
Mnemonic phrase for the wallet.
mnemonicTypetrue
MnemonicType for the wallet.

Check

CheckCurrent

Check current wallet.

import mystiko from '@mystikonetwork/node';

const wallet = mystiko.wallet?.checkCurrent();

CheckPassword

Check the password of the wallet.

import mystiko from '@mystikonetwork/node';

const wallet = mystiko.wallet?.checkPassword(walletPassword);

UpdatePassword

Update the password of the wallet.

import mystiko from '@mystikonetwork/node';

const wallet = mystiko.wallet?.updatePassword(oldPassword, newPassword);

ExportMnemonicPhrase

Export the mnemonic phrase of the wallet.

import mystiko from '@mystikonetwork/node';

const phrase = mystiko.wallet?.exportMnemonicPhrase(walletPassword);