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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lthn/rxjs-wallet-rpc

v1.1.2

Published

Client for the lethean-wallet-rpc using rxjs

Downloads

24

Readme

Client Monero wallet RPC TypeScript

Client for the monero-wallet-rpc using rxjs

install using npm

npm i @lthn/rxjs-wallet-rpc

Examples

initialize the wallet object

import { makeUrl, Wallet, Atomic, Xmr, generatePaymentId } from '@lthn/rxjs-wallet-rpc'
const url = makeUrl('http', '127.0.0.1', '18082', 'json_rpc');
const wallet = Wallet(url)

then query the address of the current wallet

wallet.getaddress()
  .map((res) => res.address)
  .subscribe(console.log)
9wq792k9sxVZiLn66S3Qzv8QfmtcwkdXgM5cWGsXAPxoQeMQ79md51PLPCijvzk1iHbuHi91pws5B7iajTX9KTtJ4bh2tCh

if you prefer working with Promise, query the address with

wallet.getaddress()
  .map((res) => res.address) //optional line, but demonstrates the advantage of Observable over Promise
  .toPromise()
  .then(console.log)
9wq792k9sxVZiLn66S3Qzv8QfmtcwkdXgM5cWGsXAPxoQeMQ79md51PLPCijvzk1iHbuHi91pws5B7iajTX9KTtJ4bh2tCh

which is equivalent to:

wallet.getaddress()
  .toPromise()
  .then((res) => console.log(res.address))
9wq792k9sxVZiLn66S3Qzv8QfmtcwkdXgM5cWGsXAPxoQeMQ79md51PLPCijvzk1iHbuHi91pws5B7iajTX9KTtJ4bh2tCh

listen to transfers send to the current wallet in mempool

  • the 3 arguments for .subscribe are the following callbacks: onNext, onError and onComplete
  • 1000 is the interval to wait between requests in ms
const autoRefresher = (refreshInterval: number) =>
  Observable.timer(0, refreshInterval)
const streamtransfers = () => autoRefresher(1000)
  .flatMap(() => wallet.get_transfers({ pool: true }))
  .map((res) => res.pool)
  .filter((pool) => pool != undefined)
  .subscribe(console.log,
             console.error,
             () => console.log('finished'))

streamtransfers()
[ { amount: 1000000000000,
    fee: 0,
    height: 0,
    note: '',
    payment_id: '0000000000000000',
    timestamp: 1498741571,
    txid: '21018c28384df394eca65a0bece75ae52611551b458757c844381663bfbad029',
    type: 'pool' } ]

create a block height change detector

const autoRefresher = (refreshInterval: number) =>
  Observable.timer(0, refreshInterval)

const heightChangeDetector = (lastHeight = 0) => autoRefresher(1000)
  .flatMap(() => wallet.getheight())
  .map((res) => res.height)
  .filter((height) => height !== lastHeight)
  .map((height) => lastHeight = height)

const streamheight = () => heightChangeDetector()
  .subscribe(
  console.log,
  (err) => { console.error(err); streamheight() }, // i recover from errors
  () => console.log('finished'))

streamheight()
20838
20839
20840
20842
20843

get the wallets balance

wallet.getbalance()
  .map((res) => new Atomic(res.balance).toXmr().toString())
  .subscribe(console.log)
'707.446307580127'

make an integrated address

wallet.make_integrated_address({ payment_id: generatePaymentId(16) })
  .subscribe(console.log)
{ integrated_address: 'A7Xn9qZeVE1ZiLn66S3Qzv8QfmtcwkdXgM5cWGsXAPxoQeMQ79md51PLPCijvzk1iHbuHi91pws5B7iajTX9KTtJ6HrNTTbikgW5Zm1CGn',
  payment_id: 'a14ba0c1f740c728' }

get payments using a list of payment ids

  • only one payment~id~ used on this example
wallet.get_bulk_payments({ payment_ids: ['1234567890123456'],
                           min_block_height: 0 })
  .map((res) => res.payments)
  .subscribe(console.log)
[ { amount: 1000000000000,
    block_height: 12132,
    payment_id: '1234567890123456',
    tx_hash: 'ccd72c2394ad840fc6f0d475ac612e6cbe983ab9db953d7f3c7831c4caa40699',
    unlock_time: 0 } ]

Donation

if the library is useful for you, consider throwing XMR to:

42Eky2DHrD5NYyrgfB48dBJ8YPBN1MBxTTWb5V9KgPT2SSBkmukzW4pJnkWuGomc1u7Mw28FNTW6a7TUaZHdAcVD2CHvmc5

if it annoys you, try to steal from that wallet.

References

Reference for using monero’s wallet rpc from which this library derives: https://getmonero.org/knowledge-base/developer-guides/wallet-rpc

It might fit together with https://github.com/cryptoshrimpi/monerod-js that communicates with the monero daemon with typescript

I based myself on https://github.com/PsychicCat/monero-nodejs for the utils

Types and Typescript and Observables

I added most of the types, thus please use a text editor with decent support for typescript for getting all the autocompletion and typechecking magic, and enjoy the coding experience without having to console.log everything

I wrote this library using functional reactive programming (to learn about it), in special the Observable monad. There’s a real benefit to have a type system when using Observables, as one can map over objects (with autocompletion) that were not yet observed.