Skip to content

Team-Kujira/kujira.js

Repository files navigation

kujira.js

JS interface for the Kujira Blockchain

Quickstart

See a demo trading bot at https://github.com/Team-Kujira/fin-bot-demo

Install required packages via your preferred package manager

  • kujira.js (via GitHub)
  • @cosmjs/stargage
  • @cosmjs/proto-signing

Import tx client tx and type registry registry from kujira.js

import { tx, registry } from "kujira.js";

Create a signing client with Stargate

import { GasPrice, SigningStargateClient } from "@cosmjs/stargate";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";

const RPC_ENDPOINT = "https://rpc-harpoon.kujira.app";
const MNEMONIC = "...";

const signer = await DirectSecp256k1HdWallet.fromMnemonic(MNEMONIC);

const client = await SigningStargateClient.connectWithSigner(
  RPC_ENDPOINT,
  signer,
  {
    registry,
    gasPrice: GasPrice.fromString("0.00125ukuji"),
  }
);

Finally construct and send txs

const FIN_KUJI_DEMO =
  "kujira1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsqq4jjh";

const [account] = await signer.getAccounts();

const msg = tx.wasm.msgExecuteContract({
  sender: account.address,
  contract: FIN_KUJI_DEMO,
  msg: Buffer.from(JSON.stringify({ submit_order: { price: "210.5" } })),
  funds: coins(1000000, "ukuji"),
});

await client.signAndBroadcast(account.address, [msg], "auto");

About

JS Interfaces for the Kujira Blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published