Wallets | Official Paloma Protocol Documentation

Wallets

Use LCDClient.wallet() to create a Wallet from a Key. Check the available networks to chose the right chainID.

Create a wallet

import { LCDClient, MnemonicKey } from "@paloma/Paloma.js";

const lcd = new LCDClient({
  URL: "https://lcd.testnet.palomaswap.com",
  chainId: "<paloma chain id>",
  classic: true,
});

const new_mk = new MnemonicKey();
const new_wallet = Paloma.wallet(new_mk);

Copied!

In the above example, a MnemonicKey was specified for the wallet, but any type of Key implementation can be used instead.

Recover a wallet from a mnemonic

import { LCDClient, MnemonicKey } from "@paloma/Paloma.js";

const lcd = new LCDClient({
  URL: "https://lcd.testnet.palomaswap.com",
  chainId: "<paloma chain id>",
  classic: true,
});

const mk = new MnemonicKey({
  mnemonic:
    'YOUR MNEMONIC HERE',
});

const wallet = lcd.wallet(mk);

Copied!

Usage

Encrypt Key

import { LCDClient, Crypt } from "@paloma/Paloma.js";

const crypt = new Crypt();
const encrypted_key_to_store = crypt.encrypt('KEY_VALUE', 'PASSWORD');

const key_value = crypt.decrypt(encrypted_key_to_store, 'PASSWORD');

Copied!

Checking the wallet balance

let address = wallet.key.accAddress;
let [balance] = await lcd.bank.balance(address);
console.log(balance.toData());

Copied!

Getting account number and sequence

A wallet is connected to the Paloma blockchain and can poll the values of an account's account number and sequence directly:

console.log(await wallet.accountNumber());
console.log(await wallet.sequence());

Copied!