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

ripple-rest-client

v1.16.1

Published

A Node.js client library for interacting with Ripple REST servers.

Downloads

32

Readme

Build Status

Ripple REST Node.js Client Library

The Ripple REST Api Server software simplifies interaction with the Ripple payment network. This libraryaims to provide the most simplified service for using the REST api in node.js.

Installation

npm install ripple-rest-client

Usage

var RippleRestClient = require("ripple-rest-client").Client;

var client = new RippleRestClient({
  api: 'http://localhost:5990',
  account: 'rw6qnMHxqg1m3xki7Y89H45BjU7LnAYyoL',
  secret: 'shgL7M1kbgrBkkkQwwRGHBmbLamxe' 
});

There are two primary payemnt functions, sending payments and listening to incoming payments.

Sending a Payment:

client.sendPayment({
  recipient: 'rfZqa3caUggfV2p1K19HHMnQbJcAposMNc',
  amount: 10,
  currency: 'XAG',
  issuer: 'rNipPmQdFMm8SwtsqjjiupRHo8KBwQrDbk' 
}, function(err, response){
  console.log('payment submitted');
  console.log(response);
});

Proposed API actions

http://dev.ripple.com/rest-api-tool.html#get-payment-history

const ripple = new RippleAPI({
  adapter: 'rest',
  url: 'http://127.0.0.1:5990'
})

Adapters are planned for rest, rpc, and websocket.

The following API methods return an instance of Promise

Generate Account

ripple.generateAccount()

Get Account Balances

ripple.getAccountBalances({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk'
})

Get Account Settings

ripple.getAccountSettings({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk'
})

Update Account Settings

ripple.updateAccountSettings({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk'
  require_destination_tag: false,
  require_authorization: false,
  disallow_xrp: true,
  disable_master: false,
  email_hash: "98b4375e1d753e5b91627516f6d70977"
  secret: 'sssssssssssssssssssssss'
}) 

Prepare Payment

ripple.preparePayment({
  source_account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk',
  source_amount: {
    "value": "1",
    "currency": "USD"
  },
  destination_account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
  destination_amount: {
    value: "1",
    currency: "USD",
    issuer: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
  },
  invoice_id: 1234
})

Submit Payment

ripple.submitPayment({
  source_account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
  source_amount: {
    "value": "1",
    "currency": "USD"
  },
  destination_account: "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  destination_tag: 567,
  destination_amount: {
    value: "1",
    currency: "USD",
    issuer: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
  },
  invoice_id: 1234,
  paths: [],
  secret: "sssssssssssssssssssssssssssss",
})

Confirm Payment

ripple.confirmPayment({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk',
  hash: 'A7C3B03663C205C84C7A91730A3E7874A88969B50D80471D8E62BFC04D2EA07A'
}) 

Get Payment History

ripple.getPaymentHistory({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk',
  direction: 'incoming'
})

Get Trustlines

ripple.getTrustlines({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk',
  counterparty: 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q'
  currency: 'USD'
})

Grant Trustline

ripple.grantTrustline({
  limit: 110,
  currency: "USD",
  counterparty: "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
  allows_rippling: false,
  secret: 'sssssssssssssssssssssss'
})

Check Notifications

ripple.checkNotifications({
  account: 'r4EwBWxrx5HxYRyisfGzMto3AT8FZiYdWk',
  hash: 'A7C3B03663C205C84C7A91730A3E7874A88969B50D80471D8E62BFC04D2EA07A'
})

Retrive Ripple Transaction

ripple.retrieveRippleTransaction({
  hash: 'A7C3B03663C205C84C7A91730A3E7874A88969B50D80471D8E62BFC04D2EA07A'
})

Generate UUID

ripple.generateUUID()