Lib: JS client library for waves (waves-transactions)


#1

Behold waves-transactions an npm package that simplifies creating and signing transactions for Waves blockchain.

This is the library WavesIDE and REPL are based on.

Enough words, just an example:

const { transfer } = require("waves-transactions")

const seed = 'mySecretSeed'

transfer(seed, { 
  amount: 1,
  recipient: '3P6fVra21KmTfWHBdib45iYV6aFduh4WwC2',
  //attachment?: 'string',
  //feeAssetId?: 'ID',
  //assetId: '8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS', //WBTC
  //fee?: 100000,
  //timestamp?: Date.now(),
})

RUNRepl.it

You have your transfer signed with privateKey generated from seed.

  • Fee is calculated for you.
  • Timestamp fallbacks to Date.now().
  • Sender public key is created from seed you provided.

Everything can be overrided on your desire, but this is simplistic example to dive you in.

Check out full docs on GitHub Pages.
Check out sources on GitHub.
Questions are welcome!
Thoughts are welcome!
Criticism is welcome!


#2

You can also play around with an example here.


#4

Hi, is this lib still maintained ? i tested it 2 month ago and thing were working well, now it seem that the assetId isnt working anymore for exemple in transfer() TX signing, why ? we cannot use it anymore for custom token ?
Params have also switcher from transfer(seed, params) to transfer(params, seed) i think.

Any way to still use assetId ? if i add it like this:

    const tx = {
        type,
        version,
        senderPublicKey,
        recipient: paramsOrTx.recipient,
        amount: paramsOrTx.amount,
        **assetId: paramsOrTx.assetId,**
        attachment: paramsOrTx.attachment || '',
        fee: generic_1.fee(paramsOrTx, 100000),
        timestamp: paramsOrTx.timestamp || Date.now(),
        proofs: paramsOrTx.proofs || [],
        id: ''
    };

In transactions/transfer.js then its working, why this have been remove ? any particular reason ?