npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ravenrebels/ravencoin-history-list

v1.2.4

Published

A human understandable list of in or outgoing transactions

Downloads

14

Readme

ravencoin-history-list

A human understandable list of in or outgoing transactions

What do we mean by human understandable?

Example. Alice transfer one LEMONADE token to Bob. Now Alice expects her history to show that she sent one LEMONADE token to Bob.

Technically, a transaction has been broadcasted on the network. That transaction typically contains

  • One or more unspent transaction outputs (UTXOs) to cover the miner fee, Alice needs to pay some RVN to send an asset.
  • One or more UTXOs for the LEMONADE transfer, like input 20 LEMONADE, output one to BOB and 19 back to a change address.

Install

npm install @ravenrebels/ravencoin-history-list

How to use

As a developer, you have to ask a Ravencoin node for the address deltas (getaddressdelta). The address deltas represents everything that has come in and out from your addresses.

import {getHistory } from "@ravenrebels/ravencoin-history-list";

OK so you invoke the method getHistory with deltas as argument. const history = getHistory(deltas); history is a list. Each item in the list represents a transaction in or out of the wallet (list of addresses). An item in the history list has an assets property. assetsis a list with objects of type {assetName, value, satoshis} For example

"assets": [
      { "assetName": "LEMONADE", "satoshis": 1000000000, "value": 10 }
    ]

Example user received 5 RVN

 {
    "isSent": false,
    "fee": 0,
    "assets": [{ "assetName": "RVN", "satoshis": 500000000, "value": 5 }],
    "blockHeight": 914584,
    "transactionId": "4729236e883325878665a3d5bb989de3a65341f3c6d7a43b4ce58522773f2548"
  }

Example user sent 1 LEMONADE token

 {
  "assets": [
    { "assetName": "LEMONADE", "satoshis": -100000000, "value": -1 }
  ],
  "blockHeight": 914603,
  "transactionId": "1c776b263ad75d46f25d19b5330882fad020a46e220799877b982ff2c259a3be",
  "isSent": true,
  "fee": 0
}

Unfortunately, it looks like the user intentionally sent 0.01 RVN, that is not true, that was the transaction fee. This will be fixed in a later version

Example how to use

Checkout example.js

const { getHistory } = require("../ravencoin-history-list"); //Replace with  @ravenrebels/ravencoin-history-list
const aliceDeltas = require("./example/alice_deltas_after_sending.json");

const history = getHistory(aliceDeltas);
const stuff = [];
for (let item of history) {
  item.assets.map((asset) => {
    asset.transactionId = item.transactionId.substring(0, 10) + "..";
    stuff.push(asset);
  });
}
console.table(stuff);

image