This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { XrplClient } from "xrpl-client" | |
const tx = { | |
"id": 4, | |
"command": "book_offers", | |
"taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", | |
"taker_gets": { | |
"currency": "XRP" | |
}, | |
"taker_pays": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const deriveOffer = async (tx, address) => { | |
let hash = tx.hash || tx.transaction.hash | |
let taker = tx.Account || tx.transaction.Account | |
for(let affected of (tx.meta || tx.metaData).AffectedNodes){ | |
let node = affected.ModifiedNode || affected.DeletedNode || affected.CreatedNode | |
if(!node || node.LedgerEntryType !== 'Offer') | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pass tx as returned from ledger | |
ntfDeriveSale(tx) { | |
let hash = tx.hash || tx.transaction.hash | |
let trade = {} | |
let taker = tx.Account | |
for(let affected of (tx.meta || tx.metaData).AffectedNodes){ | |
let node = affected.DeletedNode | |
if(!node || node.LedgerEntryType !== 'NFTokenOffer') | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to start off call pathFind() that will get all paths to what you define in the command aka what currency you want ouy. | |
// then you will need to render a button for each paths result (commented below) I use vue so can get boiler plate as well for that but wietses example where i took it from | |
// so when user selects pair it then calls into makepathingPayment(path) with the path they are paying with. | |
rand(size) { | |
return [...Array(size)] | |
.map(() => Math.floor(Math.random() * 16).toString(16)) | |
.join(''); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { XrplClient } from "xrpl-client" | |
const client = new XrplClient("wss://xrplcluster.com") // add node ws here you want to connect to | |
const res = await client.send({ | |
"id": 2, | |
"command": "account_info", | |
"account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn", | |
"strict": true, | |
"ledger_index": "current", | |
"queue": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { XrplClient } = require('xrpl-client') | |
const client = new XrplClient() | |
const account = 'rJeBz69krYh8sXb8uKsEE22ADzbi1Z4yF2' | |
const account_tx = { | |
'id': 2, | |
'command': 'account_tx', | |
'account': account, | |
'ledger_index_min': -1, | |
'ledger_index_max': -1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const socketURL = 'wss://three-dev.panicbot.xyz' | |
const socket = new WebSocket(socketURL) | |
socket.onopen = function (message) { | |
//connection string | |
socket.send(JSON.stringify({ | |
op: 'subscribe', | |
channel: 'threexrp' | |
})) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/** | |
* Keep a transaction window. | |
*/ | |
module.exports = class TransactionWindow { | |
// First in First out | |
constructor(name, time = null) { | |
this.name = name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocketServer = require('ws').Server | |
// dissable the perMessageDeflate this causes memory fragmentation!!!!! | |
const wss = new WebSocketServer({ port: process.env.APP_PORT, perMessageDeflate: false }) | |
wss.on('connection', (ws, req) => { | |
ws.on('message', (data) => { | |
// do something | |
}) | |
ws.on('close', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "hookapi.h" | |
#define MIN_XRP_AMOUNT 100000000 // 100 XRP in drops | |
#define ISSUER_ACCOUNT "rL4usRexjgCPTG8RoZvVHXmUjuYdWbRx2T" | |
#define MY_ACCOUNT "rL4usRexjgCPTG8RoZvVHXmUjuYdWbRx2T" | |
int64_t hook(uint32_t reserved) { | |
TRACESTR("HookOnURITokenCreateSellOffer: Start."); |
OlderNewer