@kadena/client-utils
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

@kadena/client-utils

Utility functions build as a wrapper around @kadena/client

kadena.js logo

Kadena client utils

Introducing @kadena/client-utils, a library that aims to provide a higher-level API for interacting with smart contracts. The library includes helpers for the coin module, which can be imported using @kadena/client-utils/coin. The library also exports utilities under /core for smart contract developers to develop APIs, including some functions that can be used for any kind of smart contracts.

  • asyncPipe
  • submitClient
  • preflightClient
  • dirtyReadClient
  • crossChainClient

examples

import { getBalance, transferCrossChain } from "@kadena/client-utils/coin"
import { signWithChainweaver } from "@kadena/client"

const balance = await getBalance(
  accountOne.account,
  'fast-development',
  '0',
  'http://localhost:8080',
 );

 const result = await createAccount(
  {
    account: 'javad',
    keyset: {
      pred: 'keys-all',
      keys: ['key-a', 'key-b'],
    },
    gasPayer: { account: 'gasPayer', publicKeys: [''] },
    chainId: '0',
  },
  {
    host: 'https://api.testnet.chainweb.com',
    defaults: {
      networkId: 'testnet04',
    },
    sign: signWithChainweaver,
  },
)
   // signed Tx
  .on('sign', (data) => console.log(data))
  // preflight result
  .on('preflight', (data) => console.log(data))
  // submit result
  .on('submit', (data) => console.log(data))
  // listen result
  .on('listen', (data) => console.log(data))
  .execute();

Future work

  • npx create @kadena/client-utils

    • to allow community members to create their own interfaces for their smart-contracts
  • @kadena/client-utils/

    • faucet
    • marmalade
    • principles
    • namespace

Readme

Keywords

none

Package Sidebar

Install

npm i @kadena/client-utils

Weekly Downloads

43

Version

0.4.1

License

MIT

Unpacked Size

615 kB

Total Files

251

Last publish

Collaborators

  • kadena-lars
  • alber70g
  • takadenoshi
  • ash_vd
  • randynamic
  • buckie
  • heekyun