@iov/starname-npm
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

@iov/starname-npm npm version

Client library for Starname blockchain.

Packs in a StarnameClient class that can be used to interact with the Starname blockchain and a Wallet class that can be used to sign transactions.

Installation

yarn add @iov/starname-npm

Initialization

import { SeedPhraseSigner, StarnameClient, Wallet } from "@iov/starname-npm";

const client = await StarnameClient.createConnected(rpcUrl, apiUrl, ...);
// Now for creating a wallet you need a signer
// Lets create and use a mnemonic/seed-phrase signer
const signer = new SeedPhraseSigner();
// Now we need to initialize this signer
// Every signer implementing the Signer interface needs to be initialized
// This is where the signer will be asked to provide authorization for the wallet
// Here we are using random method which can auto generate a random seed phrase
await signer.initializeRandom();
const wallet = new Wallet(signer, starnameClient);
// Our wallet is ready to perform transactions

Usage

Now that we have a client and a wallet...
We can use our client to (For eg.) resolve a starname.

const task = client.resolveStarname("alice*iov");
task.run().then((result) => {
  console.log(result);
});

And can use our wallet instance to sign and broadcast transactions.

const result = await wallet.registerDomain("helloworld");

For more info you can check out this.

Also check out @iov/wallet-providers if you are planning on building a web application.

Readme

Keywords

none

Package Sidebar

Install

npm i @iov/starname-npm

Weekly Downloads

0

Version

1.1.2

License

Apache-2.0

Unpacked Size

2.04 MB

Total Files

479

Last publish

Collaborators

  • xpt1x
  • iovdave
  • iharob