@nexajs/wallet
v24.11.1
Published
Manage a collection of assets spread across multiple blockchains.
Downloads
234
Readme
NEXA.js Wallet
Quickly and easily create a Nexa-compatible wallet to manage your "native" assets.
This is a FULLY-managed wallet offering the following features:
- send & receive NEX
- send & receive ALL "native" tokens
Auto-generated Wallet
import { Wallet } from '@nexajs/wallet'
const wallet = await Wallet.init()
// {
// mnemonic: '<randomly generated 12-word seed phrase>',
// path: `m/44'/29223'/0'`,
// index: 0,
// ...
// updatedAt: 1234567890,
// }
const address = wallet.address
console.log(address)
// nexa:nqtsq5g59vw9p29wupxtnrff0u8ny2tn3j8n63j5akmsk58z
const balance = wallet.balance
console.log(balance)
// {
// confirmed: 1337,
// unconfirmed: 0,
// }
Mnemonic Wallet
import { Wallet } from '@nexajs/wallet'
const wallet = await Wallet.init('correct horse battery staple')
// {
// mnemonic: 'correct horse battery staple',
// path: `m/44'/29223'/0'`,
// index: 0,
// ...
// updatedAt: 1234567890,
// }
const address = wallet.address
console.log(address)
// nexa:nqtsq5g59vw9p29wupxtnrff0u8ny2tn3j8n63j5akmsk58z
const balance = wallet.balance
console.log(balance)
// {
// confirmed: 1337,
// unconfirmed: 0,
// }
Entropy Wallet
import { Wallet } from '@nexajs/wallet'
const wallet = await Wallet.init(0xdeadbeef)
// {
// mnemonic: null,
// path: `m/44'/29223'/0'`,
// index: 0,
// ...
// updatedAt: 1234567890,
// }
const address = wallet.address
console.log(address)
// nexa:nqtsq5g59vw9p29wupxtnrff0u8ny2tn3j8n63j5akmsk58z
const balance = wallet.balance
console.log(balance)
// {
// confirmed: 1337,
// unconfirmed: 0,
// }
Email + Password Wallet
import { Wallet } from '@nexajs/wallet'
const wallet = await Wallet.init('[email protected]', 'Setec Astronomy')
// {
// mnemonic: null,
// path: `m/44'/29223'/0'`,
// index: 0,
// ...
// updatedAt: 1234567890,
// }
const address = wallet.address
console.log(address)
// nexa:nqtsq5g59vw9p29wupxtnrff0u8ny2tn3j8n63j5akmsk58z
const balance = wallet.balance
console.log(balance)
// {
// confirmed: 1337,
// unconfirmed: 0,
// }