1.2.2 • Published 1 month ago
@klever/sdk-web v1.2.2
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.2.2
1 month ago
1.2.1
1 month ago
1.2.0
3 months ago
1.1.7
3 months ago
1.1.6-beta.0
3 months ago
1.1.6
3 months ago
1.1.1
3 months ago
1.1.0
3 months ago
1.1.4
3 months ago
1.1.3
3 months ago
1.1.2
3 months ago
1.0.7
4 months ago
1.0.6
4 months ago
1.0.5
4 months ago
1.0.4
10 months ago
1.0.3
12 months ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago