1.1.1 • Published 1 year ago

@wavesenterprise/sdk v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@wavesenterprise/sdk

SDK for transactions signing and broadcasting in the Waves Enterprise network and interact with Node REST API.

Install

npm i @wavesenterprise/sdk @wavesenterprise/transactions-factory @wavesenterprise/signer

Transfer Example

import {We} from "@wavesenterprise/sdk";
import {TRANSACTIONS, TRANSACTION_TYPES} from "@wavesenterprise/transactions-factory";
import {Keypair} from '@wavesenterprise/signer';

const SEED = 'copper venture ...'
const NODE_URL = 'https://client.wavesenterprise.com/node-0';

const sdk = new We(NODE_URL);
const keypair = await Keypair.fromExistingSeedPhrase(SEED)

const config = await sdk.node.config()
const fee = config.minimumFee[TRANSACTION_TYPES.Transfer]

const tx = TRANSACTIONS.Transfer.V3({
    attachment: "",
    senderPublicKey: await keypair.publicKey(),
    amount: 100000000,
    fee,
})

const signedTx = sdk.signer.getSignedTx(tx, SEED);
const res = await tx.broadcast(signedTx);

const txInfo = await sdk.transactions.info(res.id)