mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
begin rework for js tests and hook examples
This commit is contained in:
40
hook/tests/hookapi/test-root.js
Normal file
40
hook/tests/hookapi/test-root.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const wasmFn = 'root.wasm';
|
||||
|
||||
require('../hookset/utils-tests.js').TestRig('ws://localhost:6005').then(t=>
|
||||
{
|
||||
const account = t.randomAccount();
|
||||
t.fundFromGenesis(account).then(()=>
|
||||
{
|
||||
t.feeSubmit(account.seed,
|
||||
{
|
||||
Account: account.classicAddress,
|
||||
TransactionType: "SetHook",
|
||||
Hooks: [
|
||||
{
|
||||
Hook: {
|
||||
CreateCode: t.wasm(wasmFn),
|
||||
HookApiVersion: 0,
|
||||
HookNamespace: "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF",
|
||||
HookOn: "0000000000000000"
|
||||
}
|
||||
}
|
||||
]
|
||||
}).then(x=>
|
||||
{
|
||||
t.assertTxnSuccess(x)
|
||||
console.log(x);
|
||||
t.feeSubmit(account.seed,
|
||||
{
|
||||
TransactionType: "AccountSet",
|
||||
Account: account.classicAddress
|
||||
}).then(x=>
|
||||
{
|
||||
t.assertTxnSuccess(x)
|
||||
process.exit(0);
|
||||
}).catch(t.err);
|
||||
}).catch(t.err);
|
||||
}).catch(t.err);
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user