Basic- Creating Private Wallet
In this lesson, we will show you how to create or init Anonymous wallet and Stealth wallet.
Anonymous Wallet
quras-js module supports generating an anonymous wallet feature. Then let's see this example.
import * as Quras from 'quras-js'

const myAnonymousAccount = new Quras.wallet.AnonymousAccount();
myAnonymousAccount.init(Quras.CONST.QURAS_NETWORK.DEV)
    .then((res) => {
        console.log('Spending Key : ' + myAnonymousAccount.spendingKey);
        console.log('Viewing Key : ' + myAnonymousAccount.viewingKey);
        console.log('Receiving Key : ' + myAnonymousAccount.receivingKey);
        console.log('Address : ' + myAnonymousAccount.address);
    })
    .catch((err) => {
        console.log('Initialization failed: ' + err);
    });
quras-js module supports initializing an anonymous wallet with wallet information which has been already generated. Then let's see this example.
import * as Quras from 'quras-js'

const myAnonymousAccountData = {
    address: 'JmKHQpaEXqAWxkA7XJnn6xLnfTgo7vK94TsT8eK4czncMppNFtbncaYE7i6GuAfFAad1TByn2CGb5iSt5m94AEusyCSJxD',
    receivingKey: '70570583865a185b721b7a41bcad35108385a62c5d4eb45beb657c80d7463a51',
    spendingKey: '9ff105f042e7d83c387b3885f992386efe1a75d1df1dde2b78b77556c1c76704',
    viewingKey: undefined
};

var myAnonymousAccount = new Quras.wallet.AnonymousAccount(myAnonymousAccountData);
Stealth Wallet
quras-js module supports generating a stealth wallet feature. Then let's see this example.
import * as Quras from 'quras-js'

const myStealthAccount = new Quras.wallet.StealthAccount();
myStealthAccount.init(Quras.CONST.QURAS_NETWORK.DEV)
    .then((res) => {
        console.log(res);
    })
    .catch((err) => {
        console.log('Initialization failed: ' + err);
    });
quras-js module supports initializing a stealth wallet with wallet information which has been already generated. Then let's see this example.
import * as Quras from 'quras-js'

var stealthAccountData = {
    address: 'JTbzqRbzEedZBqULehQ9QGzwRTJvfhYN2dDtGuSf5yZq3TJvzQoLGh4NirVzEjuSfc8csA3zCamvxLQtQ3EXkFHWDWwwMRcCK',
    payloadPrikey: 'acd704905b5b1484d65f1a736f26b041fe64b1e9bf12327cf611e69e54f1070f',
    payloadPubkey: '031d1bf5ebfb36b880e94d9c357ffd9b2ab93792afd559b125c4126b0b1271f9d0',
    viewPrikey: '0087a954198710a47cfe55b97e71b621a95045b97340be112d00041669a085b2',
    viewPubkey: '025ebfe5d9b50e38b43921c1519b38783a8885fd1a028c7de151875c22823b9d33'
};

myStealthAccount = new Quras.wallet.StealthAccount(stealthAccountData);