Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Wietse Wind WietseWind

🎯
Focusing
View GitHub Profile
@WietseWind
WietseWind / index.js
Created Oct 20, 2020
XUMM Sign Request & on ledger transaction balance changes
View index.js
const {XummSdk} = require('xumm-sdk')
const {TxData} = require('xrpl-txdata')
const Sdk = new XummSdk('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', '...')
const Verify = new TxData()
const main = async () => {
const appInfo = await Sdk.ping()
console.log(appInfo.application.name)
@WietseWind
WietseWind / index.js
Created Oct 20, 2020
Sign request push notification
View index.js
const {XummSdk} = require('xumm-sdk')
const Sdk = new XummSdk('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', '...')
const main = async () => {
const appInfo = await Sdk.ping()
console.log(appInfo.application.name)
const request = {
"txjson": {
"TransactionType": "Payment",
@WietseWind
WietseWind / index.js
Last active Oct 20, 2020
XUMM SDK: payload create & subscribe, await signed payload & retrieve user token (to Push our next payload)
View index.js
const {XummSdk} = require('xumm-sdk')
const Sdk = new XummSdk('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', '...')
const main = async () => {
const appInfo = await Sdk.ping()
console.log(appInfo.application.name)
// Please change the destination account to an account (and possibly: DestinationTag)
// you own, or you'll be testing sending a small amount of XRP to the XRPL Labs team ;)
@WietseWind
WietseWind / index.js
Last active Oct 20, 2020
XUMM SDK payload & subscription
View index.js
const {XummSdk} = require('xumm-sdk')
const Sdk = new XummSdk('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', '...')
const main = async () => {
const appInfo = await Sdk.ping()
console.log(appInfo.application.name)
// Please change the destination account to an account (and possibly: DestinationTag)
// you own, or you'll be testing sending a small amount of XRP to the XRPL Labs team ;)
@WietseWind
WietseWind / xumm-sdk-example.ts
Created Sep 18, 2020
XUMM SDK - Subscription - Async process after returning data in the callback function
View xumm-sdk-example.ts
import {XummSdk} from 'xumm-sdk'
const Sdk = new XummSdk()
const main = async () => {
const payloadByUuid = '1289e9ae-7d5d-4d5f-b89c-18633112ce09'
const subscription = await Sdk.payload.subscribe(payloadByUuid, event => {
console.log(`Payload ${event.uuid} data:`, event.data)
// If the transaction resolved:
@WietseWind
WietseWind / xumm-sdk-example.ts
Created Sep 18, 2020
XUMM SDK - Subscription - Await based on resolving without using a callback function
View xumm-sdk-example.ts
import {XummSdk} from 'xumm-sdk'
import type WebSocket from 'ws'
const Sdk = new XummSdk()
const main = async () => {
const payloadByUuid = '1289e9ae-7d5d-4d5f-b89c-18633112ce09'
const subscription = await Sdk.payload.subscribe(payloadByUuid)
subscription.websocket.onmessage = (message: WebSocket.MessageEvent) => {
@WietseWind
WietseWind / xumm-sdk-example.ts
Last active Sep 18, 2020
XUMM SDK - Subscription - Await based on resolving a callback event
View xumm-sdk-example.ts
import {XummSdk} from 'xumm-sdk'
const Sdk = new XummSdk()
const main = async () => {
const payloadByUuid = '1289e9ae-7d5d-4d5f-b89c-18633112ce09'
const subscription = await Sdk.payload.subscribe(payloadByUuid, event => {
console.log(`Payload ${event.uuid} data:`, event.data)
// If the transaction is signed:
@WietseWind
WietseWind / xumm-sdk-example.ts
Created Sep 18, 2020
XUMM SDK - Subscription - Await based on returning data in the callback function
View xumm-sdk-example.ts
import {XummSdk} from 'xumm-sdk'
const Sdk = new XummSdk()
const main = async () => {
const payloadByUuid = '1289e9ae-7d5d-4d5f-b89c-18633112ce09'
const subscription = await Sdk.payload.subscribe(payloadByUuid, event => {
console.log(`Payload ${event.uuid} data:`, event.data)
// If the transaction is signed:
@WietseWind
WietseWind / recover.js
Created Sep 17, 2020
Recover one row of XRPL Secret Numbers
View recover.js
const {Account, Utils} = require('xrpl-secret-numbers')
// Enter the expected r-address
const ra = 'r...SomeAddress'
// Enter the known secret numbrers, with a question mark `?` for the unknown chunk of 6 digits
const sn = 'XXXXXX XXXXXX ? XXXXXX XXXXXX XXXXXX XXXXXX XXXXXX'
// Don't change anything below this line
const mi = sn.split(' ').indexOf('?')
@WietseWind
WietseWind / dev.ts
Created Sep 15, 2020
XUMM SDK Sample development file (`samples/dev.ts`)
View dev.ts
import Debug from 'debug'
import {XummSdk, XummTypes} from '../src/'
const log = Debug('xumm-sdk:sample')
const main = async () => {
try {
const Sdk = new XummSdk('someAppKey', 'someAppSecret')
const pong = await Sdk.ping()
log({pong})
You can’t perform that action at this time.