Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-utils #992

Merged
merged 44 commits into from
Oct 25, 2023
Merged

client-utils #992

merged 44 commits into from
Oct 25, 2023

Conversation

javadkh2
Copy link
Collaborator

@javadkh2 javadkh2 commented Oct 5, 2023

Introducing @kadena/client-utils, a library that aims to provide a higher-level API for interacting with smart contracts. This PR 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();

@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2023

🦋 Changeset detected

Latest commit: 0d3daad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@kadena/client Patch
@kadena/graph Patch
@kadena/immutable-records Patch
@kadena/client-examples Patch
@kadena/client-utils Patch
@kadena/cookbook Patch
@kadena/pactjs-generator Patch
@kadena/pactjs-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 3:02pm
docs-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 3:02pm
immutable-records ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 3:02pm
react-ui ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 3:02pm
tools ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 3:02pm

@javadkh2 javadkh2 force-pushed the type-utils branch 2 times, most recently from 14ec9b8 to 6a51e73 Compare October 11, 2023 12:21
@javadkh2 javadkh2 marked this pull request as ready for review October 12, 2023 13:05
@javadkh2 javadkh2 requested a review from webpro as a code owner October 12, 2023 13:05
@javadkh2 javadkh2 force-pushed the type-utils branch 2 times, most recently from 5adbbc3 to c261143 Compare October 16, 2023 12:01
@alber70g alber70g merged commit f6c52c3 into main Oct 25, 2023
9 checks passed
@alber70g alber70g deleted the type-utils branch October 25, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants