Skip to content

Typescript/node bindings for Elements, using bcrpc

License

Notifications You must be signed in to change notification settings

andreabonel/node-elements

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
// ...

About

Typescript/node bindings for Elements, using bcrpc

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 95.3%
  • JavaScript 4.7%