misc example changes to support v2

This commit is contained in:
Richard Holland
2022-06-07 09:43:19 +00:00
parent e3c792e68b
commit d6011350ee
4 changed files with 39 additions and 7 deletions

3
.gitignore vendored
View File

@@ -13,6 +13,9 @@ bin/project-cache.jam
# Ignore python compiled files. # Ignore python compiled files.
*.pyc *.pyc
# Ignore wasm files
*.wasm
# Ignore Macintosh Desktop Services Store files. # Ignore Macintosh Desktop Services Store files.
.DS_Store .DS_Store

View File

@@ -12,7 +12,6 @@
#ifndef HOOKAPI_INCLUDED #ifndef HOOKAPI_INCLUDED
#define HOOKAPI_INCLUDED 1 #define HOOKAPI_INCLUDED 1
#define KEYLET_HOOK 1 #define KEYLET_HOOK 1
#define KEYLET_HOOK_STATE 2 #define KEYLET_HOOK_STATE 2
#define KEYLET_ACCOUNT 3 #define KEYLET_ACCOUNT 3

View File

@@ -10,8 +10,8 @@
#define HOOKMACROS_INCLUDED 1 #define HOOKMACROS_INCLUDED 1
// hook developers should use this guard macro, simply GUARD(<maximum iterations>) // hook developers should use this guard macro, simply GUARD(<maximum iterations>)
#define GUARD(maxiter) _g(__LINE__, (maxiter)+1) #define GUARD(maxiter) _g((1ULL << 31U) + __LINE__, (maxiter)+1)
#define GUARDM(maxiter, n) _g(((__LINE__ << 16) + n), (maxiter)+1) #define GUARDM(maxiter, n) _g(( (1ULL << 31U) + (__LINE__ << 16) + n), (maxiter)+1)
#define SBUF(str) (uint32_t)(str), sizeof(str) #define SBUF(str) (uint32_t)(str), sizeof(str)

View File

@@ -298,7 +298,6 @@ module.exports = {
const randomAccount = ()=> const randomAccount = ()=>
{ {
const acc = xrpljs.Wallet.fromSeed(kp.generateSeed()); const acc = xrpljs.Wallet.fromSeed(kp.generateSeed());
console.log(acc)
return acc return acc
}; };
@@ -537,9 +536,40 @@ module.exports = {
console.dir(m, {depth:null}); console.dir(m, {depth:null});
} }
const hex_memos = (x) =>
{
if (!("Memos" in x))
return;
for (y in x["Memos"])
{
for (a in x["Memos"][y])
{
let Fields = ["MemoFormat", "MemoType", "MemoData"];
for (z in Fields)
{
if (Fields[z] in x["Memos"][y][a])
{
let u = x["Memos"][y][a][Fields[z]].toUpperCase()
if (u.match(/^[0-9A-F]+$/))
{
x["Memos"][y][a][Fields[z]] = u;
continue;
}
x["Memos"][y][a][Fields[z]] =
""+Buffer.from(x["Memos"][y][a][Fields[z]]).toString('hex').toUpperCase();
}
}
}
}
}
api.connect().then(()=> api.connect().then(()=>
{ {
resolve({ resolve({
hex_memos: hex_memos,
rbc: rbc, rbc: rbc,
api: api, api: api,
xrpljs: xrpljs, xrpljs: xrpljs,