diff --git a/.gitignore b/.gitignore index f3e234eec..26965e443 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ bin/project-cache.jam # Ignore python compiled files. *.pyc +# Ignore wasm files +*.wasm + # Ignore Macintosh Desktop Services Store files. .DS_Store diff --git a/hook/examples/hookapi.h b/hook/examples/hookapi.h index 20a4adee0..113e48e53 100644 --- a/hook/examples/hookapi.h +++ b/hook/examples/hookapi.h @@ -12,7 +12,6 @@ #ifndef HOOKAPI_INCLUDED #define HOOKAPI_INCLUDED 1 - #define KEYLET_HOOK 1 #define KEYLET_HOOK_STATE 2 #define KEYLET_ACCOUNT 3 diff --git a/hook/examples/macro.h b/hook/examples/macro.h index dc42dda41..1b54df5c7 100644 --- a/hook/examples/macro.h +++ b/hook/examples/macro.h @@ -10,8 +10,8 @@ #define HOOKMACROS_INCLUDED 1 // hook developers should use this guard macro, simply GUARD() -#define GUARD(maxiter) _g(__LINE__, (maxiter)+1) -#define GUARDM(maxiter, n) _g(((__LINE__ << 16) + n), (maxiter)+1) +#define GUARD(maxiter) _g((1ULL << 31U) + __LINE__, (maxiter)+1) +#define GUARDM(maxiter, n) _g(( (1ULL << 31U) + (__LINE__ << 16) + n), (maxiter)+1) #define SBUF(str) (uint32_t)(str), sizeof(str) diff --git a/hook/utils-tests.js b/hook/utils-tests.js index 0794dc0f2..525ce00ce 100644 --- a/hook/utils-tests.js +++ b/hook/utils-tests.js @@ -64,7 +64,7 @@ module.exports = { }; - + const fee = (tx_blob) => { @@ -192,13 +192,13 @@ module.exports = { const wasm = (x) => { console.log('wasm(' + x + ')'); - try + try { return fs.readFileSync(x).toString('hex').toUpperCase(); } catch (e) {} - try + try { return fs.readFileSync('wasm/' + x).toString('hex').toUpperCase(); } @@ -298,7 +298,6 @@ module.exports = { const randomAccount = ()=> { const acc = xrpljs.Wallet.fromSeed(kp.generateSeed()); - console.log(acc) return acc }; @@ -537,9 +536,40 @@ module.exports = { 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(()=> { resolve({ + hex_memos: hex_memos, rbc: rbc, api: api, xrpljs: xrpljs,