Keystore Setup

Interacting with the API programmatically requires setting up a keystore. The only differentiating factor for setting up a keystore for use on Watr vs on other substrate based chains is the address prefix. For Watr the address prefix is 19 which results in all Watr addresses starting with the number 2

Keystore Setup

import { Keyring } from "@polkadot/api"

class Keystore {
    private keystore: Keyring
    constructor() {
                this.keystore = new Keyring({ type: 'sr25519' })
                // we set the kestore to Watr Format

Adding a Key via Mnemonic Seed

const mnemonic = "outer exit wish coconut category liberty fade diagram logic noodle frozen safe"
const account = keyring.addFromMnemonic(mnemonic)

Last updated