mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-25 14:45:48 +00:00
update hook
update hook add test and validation add estimate fee func fix estimated fee error add hook utils
This commit is contained in:
58
packages/xrpl/test/utils/hooks.test.ts
Normal file
58
packages/xrpl/test/utils/hooks.test.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import {
|
||||
calculateHookOn,
|
||||
hexNamespace,
|
||||
hexHookParameters,
|
||||
TTS,
|
||||
} from '../../src'
|
||||
|
||||
describe('test hook on', function () {
|
||||
it('all', function () {
|
||||
const result = calculateHookOn([])
|
||||
assert.equal(
|
||||
result,
|
||||
'000000000000000000000000000000000000000000000000000000003E3FF5BF',
|
||||
)
|
||||
})
|
||||
it('one', function () {
|
||||
const invokeOn: Array<keyof TTS> = ['ttACCOUNT_SET']
|
||||
const result = calculateHookOn(invokeOn)
|
||||
assert.equal(
|
||||
result,
|
||||
'000000000000000000000000000000000000000000000000000000003E3FF5B7',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('test hook namespace', function () {
|
||||
it('basic', async function () {
|
||||
const result = await hexNamespace('starter')
|
||||
assert.equal(
|
||||
result,
|
||||
'4FF9961269BF7630D32E15276569C94470174A5DA79FA567C0F62251AA9A36B9',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('test hook parameters', function () {
|
||||
it('basic', async function () {
|
||||
const parameters = [
|
||||
{
|
||||
HookParameter: {
|
||||
HookParameterName: 'name1',
|
||||
HookParameterValue: 'value1',
|
||||
},
|
||||
},
|
||||
]
|
||||
const result = hexHookParameters(parameters)
|
||||
assert.deepEqual(result, [
|
||||
{
|
||||
HookParameter: {
|
||||
HookParameterName: '6E616D6531',
|
||||
HookParameterValue: '76616C756531',
|
||||
},
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user