xpop

1.1.2 • Public • Published

XPOP Fetching / Generation npm version

This lib. fetches a ready to use xPOP, fetches and encodes a JSON xPOP or even generates the entire xPOP based on sources running the xPOP source data service: "Validation Ledger & Transaction Store"

Methods to retrieve/generate, in order (unless params provided, see below):

  1. Fetch ready to use HEX XPOP
  2. Fetch JSON XPOP and encode to HEX
  3. Fetch source files & compile XPOP & encode to HEX

Samples

Sample to generate & submit a B2M transaction on Testnet, resulting in an xPOP:

Sample to use this script in the browser:

Output

null (failed) or HEX encoded XPOP ready to use for import in the Blob field.

NPM, CDN

Example browser implementation:

Methods

  • setVerbose(bool) » console.log verbose info if true
  • setEndpoints(string[]) » [ Mandatory ] - the URLs where the collector is running
  • xpop(tx hash [, ledger index, network id, force ])

JS/Browser

Note: a list of recent endpoints can be found here:

const {setVerbose, setEndpoints, xpop} = require('xpop')

// setVerbose(true)
// setEndpoints((await (await fetch('https://xrpl.ws-stats.com/xpop/list?json=true')).json()).bestguess)

setEndpoints([
  'https://xpop.xrplwin.com/',  // Twitter: @XRPLWin
  'http://xpop.katczynski.org', // Twitter: @realkatczynski
  'https://xpop.xrpl-labs.com', // Twitter: @XRPLLabs
])

xpop('20D193C6E615D86BCC13A5DAB781852A6672F3E627D33FBAE62053F1178740BB', 41815218, 1, true)
  .then(console.log)

Pre-generated XPOP only:

// tx hash
xpop('20D193C6E615D86BCC13A5DAB781852A6672F3E627D33FBAE62053F1178740BB')

Pre-generated XPOP with fallback to pre-generated JSON

// tx hash, ledger index, network id
xpop('20D193C6E615D86BCC13A5DAB781852A6672F3E627D33FBAE62053F1178740BB', 41815218, 1)

Forced pre-generated / client side generated (fallback) JSON

// tx hash, ledger index, network id, true (force)
xpop('20D193C6E615D86BCC13A5DAB781852A6672F3E627D33FBAE62053F1178740BB', 41815218, 1, true)

Readme

Keywords

none

Package Sidebar

Install

npm i xpop

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

1.23 MB

Total Files

5

Last publish

Collaborators

  • wietsewind