Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Wietse Wind WietseWind

🎯
Focusing
View GitHub Profile
@WietseWind
WietseWind / 1-accountset.json
Last active Mar 6, 2021
Issue tokens (NFT) on the XRPL as discussed in XLS-14d - https://github.com/XRPLF/XRPL-Standards/discussions/30
View 1-accountset.json
{
"TransactionType": "AccountSet",
"Account": "rIssuingAccount...",
"SetFlag": 8
}
@WietseWind
WietseWind / index.js
Created Feb 20, 2021
Recover 2 chars Family Seed
View index.js
// Ugly
const kp = require('ripple-keypairs')
// Enter your (faulty) secret here.
let secret = 's...'
let len = secret.length + 1
let alph = 'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz'
let alphlen = alph.length
@WietseWind
WietseWind / nft.js
Last active Feb 26, 2021
NFT XRPL Balance Parser - as discussed in XLS-14d - https://github.com/XRPLF/XRPL-Standards/discussions/30
View nft.js
// XLS-14d Sample implementation
const xrplValueToNft = value => {
const data = String(Number(value)).split(/e/i)
const finish = returnValue => {
if (data.length > 1 && returnValue.slice(0, 2) === '0.' && Number(data[1]) < -70) {
// Positive below zero amount, could be NFT
return Number(
(returnValue.slice(2) + '0'.repeat(83 - returnValue.length))
@WietseWind
WietseWind / closedledger.json
Created Feb 5, 2021
Hooks Blog 5 - Consensus
View closedledger.json
{
"accountState" : [
{
"EmittedTxn" : {
"Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"Amount" : "16125240",
"Destination" : "rfCarbonVNTuXckX6x2qTMFmFSnm6dEWGX",
"DestinationTag" : 0,
"EmitDetails" : {
"EmitBurden" : "0000000000000003",
@WietseWind
WietseWind / gist.js
Last active Feb 2, 2021
Convert address/secret from non XRPL to XRPL (if different alphabet)
View gist.js
const bx = require('base-x')
const cCSC = bx('cpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2brdeCg65jkm8oFqi1tuvAxyz')
const cXRP = bx('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz')
const csc_decoded = cCSC.decode('sssssssssssssssssssssss')
console.log({csc_decoded})
const xrp_encoded = cXRP.encode(csc_decoded)
@WietseWind
WietseWind / index.js
Last active Nov 20, 2020
Generate ETH account from XRPL Secret Numbers (node)
View index.js
const {Account} = require('xrpl-secret-numbers')
const EthWallet = require('ethereumjs-wallet').default
const XrplAccount = new Account() // Empty = generate, input = derive
console.log(`\n Imported/generated account secret numbers\n `,
XrplAccount.getSecret().join(' '))
console.log(`\n Imported/generated account address\n `,
XrplAccount.getAddress())
console.log(`\n Imported/generated account family seed\n `,
@WietseWind
WietseWind / logs.sh
Created Nov 18, 2020
Hooks snippets (dev.to blog) Hooked 3
View logs.sh
docker exec -it xrpld-hooks tail -f log
@WietseWind
WietseWind / decode.js
Created Oct 27, 2020
Cobo Vault encode/decode full XRPL tx QR signing (terminal)
View decode.js
const {decodeUR} = require('@cvbb/bc-ur')
const {decode} = require('ripple-binary-codec')
const {verifySignature} = require('verify-xrpl-signature')
const str = 'UR:BYTES/TPHPYQQ5WVSSYC8SDSZEP3RSULNL480RM859KXP9UXGEDKYF8HVYGV0KA9Y3WWDVW3RRQ3QZYQAR3HWPCEW6T9ZWGAU0FDSW5U9PSL4G8NE98YZA4TFUMUJUMU34VQ3QZZA5WYPH54WWNQK295W7GYYVV4AD0P5D6XTWENTCFZC8KKGVW2CQS2A5YK'
const data = decodeUR([str]).toUpperCase()
console.log(data)
console.log(decode(data))
@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",