1.3.3 • Published 10 months ago

@klever/sdk-web v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

npm version

Kleverchain SDK library

The SDK module provides a quick and easy interface to make contract calls to the blockchain via the Klever wallet's injected methods.

For a more detailed and organized documentation, please visit the official Kleverchain SDK Documentation website.

Installation

$ npm install @klever/sdk-web

or

$ yarn add @klever/sdk-web

Basic usage

import { web, ITransfer, TransactionType } from "@klever/sdk-web";

const payload: ITransfer = {
  amount: 100 * 10 ** 6,
  receiver: "receiverAddress",
  kda: "KLV",
};

const unsignedTx = await web.buildTransaction([
  {
    payload,
    type: TransactionType.Transfer,
  },
]);

const signedTx = await web.signTransaction(unsignedTx);

const response = await web.broadcastTransactions([signedTx]);

Changing Network

The default network is the Kleverchain Mainnet, but if you want to use the Kleverchain Testnet or a local version of the Kleverchain, you can change the kleverWeb provider object by setting it before calling the initialize function.

import { web, IProvider } from '@klever/sdk-web';
...
  const provider:IProvider = {
      api: 'https://api.testnet.klever.finance',
      node: 'https://node.testnet.klever.finance'
  };

  window.kleverWeb.provider = provider;

  web.initialize();
...

Transactions

All available transactions:

  • Transfer
  • Freeze
  • Unfreeze
  • Delegate
  • Undelegate
  • Claim
  • Withdraw
  • CreateAsset
  • AssetTrigger
  • ConfigITO
  • CreateMarketplace
  • ConfigMarketplace
  • Sell
  • Buy
  • CancelMarketOrder
  • Proposal
  • Vote
  • CreateValidator
  • ConfigValidator
  • Unjail
  • SetAccountName
  • UpdateAccountPermission
1.3.3

10 months ago

1.3.2

11 months ago

1.2.3

1 year ago

1.3.0

1 year ago

2.0.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.7

1 year ago

1.1.6-beta.0

1 year ago

1.1.6

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago