Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
nitowa a9cfe2986c add .npmignore il y a 2 ans
src hopefully fix websockets closing from over-use il y a 2 ans
test hopefully fix websockets closing from over-use il y a 2 ans
.drone.yml npm access token il y a 2 ans
.gitignore fix doc generation il y a 2 ans
.npmignore add .npmignore il y a 2 ans
LICENSE.md rebase to npm-packages, add README and LICENSE il y a 2 ans
README.md Update readme to reflect on how badly tested this is il y a 2 ans
package-lock.json hopefully fix websockets closing from over-use il y a 2 ans
package.json hopefully fix websockets closing from over-use il y a 2 ans
tsconfig.json update testnet node address because it moved il y a 3 ans

README.md

Overview

Build Status Current Version Weekly Downloads License Type

xrpio is a library that allows you to write and read arbitrary data in the ripple blockchain.

How to install

npm i xrpio

Caution

This library is in an early stage of development and breaking changes may occur spontaneously and without regard of semantic versioning until the v1.0.0 release.

Operation on the main-net is untested and should not be used in production!


Quickstart

import {RippleAPI} from 'ripple-lib'
import {treeRead, treeWrite} from 'xrpio'

const api = new RippleAPI({ server: "..." }) 
await api.connect()

const dataRootHash = await treeWrite(
    api, 
    "Arbitrary string data 123", 
    { 
        address: "Sender address", 
        secret: "Sender private key"
    }, 
    "Receiver address"
)

const data = await treeRead(api, [dataRootHash])
console.log(data) //"Arbitrary string data 123"

A simple ready-to-run example for the testnet

import { treeRead, treeWrite, Wallet } from 'xrpio'
import { RippleAPI } from 'ripple-lib'
import fetch from 'node-fetch'

export const makeTestnetWallet = () : Promise<Wallet> => fetch('https://faucet.altnet.rippletest.net/accounts', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
}).then((raw:any) => {
    return raw.json().then(content => content.account)
});

(async()=>{
    const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'})
    await api.connect()
    const fromWallet = await makeTestnetWallet()
    const toWallet = await makeTestnetWallet()
    await new Promise((res, rej) => setTimeout(res, 10000)) //it takes a moment for the wallets to become active

    const rootHash = await treeWrite(api, "test123", fromWallet, toWallet.address)
    const data = await treeRead(api, [rootHash])
    console.log(data)    
})()

Full documentation