node-elements
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

node-elements

Typescript/node bindings for Elements, using bcrpc.

Installation:

$ node install --save node-elements

For typescript, you also want @types/node-elements.

Example:

// dict helper
const KV = (k, v) => {
    const kv = {};
    kv[k] = v;
    return kv;
};
// get a new confidential address from elements
const addr = await GetNewAddress();
// fetch the addressinfo, and get the scriptPubKey from it
const spk = (await GetAddressInfo(addr)).scriptPubKey;
// create a new raw transaction sending amount to the address
const crtres: string = await elements.CreateRawTransaction([], KV(addr, amount));
// fund it
const { hex, fee, changepos } = await elements.FundRawTransaction(crtres);
// ...

Readme

Keywords

none

Package Sidebar

Install

npm i node-elements

Weekly Downloads

1

Version

0.4.2

License

MIT

Unpacked Size

28.1 kB

Total Files

7

Last publish

Collaborators

  • kjalm