Nomos SDK

Nomos typescript sdk to interact with the multisig smart contracts.

Our sdk can help utilize our contracts and abstract the user of some of its complexity. You can use it both in the browser or in nodejs.

Installation

To install it you will need nodejs and a package manager. We recommend using pnpm. You will also need to install the cosmwasmjs to interact with any cosmos based chain.

pnpm

pnpm install nomosjs

npm

npm install nomosjs

yarn

yarn add nomosjs

Usage

To use nomojs you will need to create a client/provider using cosmwasm. The type nomojs accepts is SigningCosmWasmClient which is used to also sign transactions.

Browser

Our documentation only uses Keplr wallet. To use other wallets, refer to cosmwasmjs documentation.

import {Nomos} from "nomosjs"
import { setupWebKeplr } from "cosmwasm";

const config = {
  chainId: 'constantine-3',
  rpcEndpoint: "https://rpc.constantine.archway.tech",
  prefix: "archway",
};

async function main() {
  const client = await setupWebKeplr(config);
  const nomos = new Nomos();
  
  await nomos.init(client);
}

main();

NodeJS

For backend applications, transactions need to specify gas price on the client creation.

import {Nomos} from "nomosjs"
import { SigningCosmWasmClient, Secp256k1HdWallet } from "cosmwasm";

// This is your rpc endpoint
const rpcEndpoint = "https://rpc.constantine.archway.tech";

// Using a random generated mnemonic
const mnemonic = "<YOUR MNEMONIC>";

async function main() {
  const wallet = await Secp256k1HdWallet.fromMnemonic(mnemonic);
  const client = await SigningCosmWasmClient.connectWithSigner(
    rpcEndpoint,
    wallet,
    {
        gasPrice: GasPrice.fromString('<YOUR GAS PRICE>'),
    }
  );

  const nomos = new Nomos();
  await nomos.init(client);
}

main();

Last updated