Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/setHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
SetHookFlags,
} from 'xahau'
import { SetHookParams, iHook } from './types'
import { HookGrant, HookParameter } from 'xahau/dist/npm/models/common/xahau'
import {
HookFunction,
HookGrant,
HookParameter,
} from 'xahau/dist/npm/models/common/xahau'
import { readHookBinaryHexFromNS, hexNamespace } from './utils'
import { appTransaction } from './libs/xrpl-helpers/transaction'
import { appLogger } from './libs/logger'
Expand All @@ -19,6 +23,7 @@ export interface SetHookPayload {
hookOnArray?: string[] | null
hookParams?: HookParameter[] | null
hookGrants?: HookGrant[] | null
hookFunctions?: HookFunction[] | null
fee?: string | null
}

Expand Down Expand Up @@ -62,11 +67,13 @@ export function createHookPayload(payload: SetHookPayload): iHook {
if (payload.hookGrants) {
hook.HookGrants = payload.hookGrants
}
if (payload.hookFunctions) {
hook.HookFunctions = payload.hookFunctions
}
// DA: validate
return hook
}


export async function setHooksV3({ client, wallet, hooks }: SetHookParams) {
const tx: SetHook = {
TransactionType: `SetHook`,
Expand All @@ -87,7 +94,6 @@ export async function setHooksV3({ client, wallet, hooks }: SetHookParams) {
appLogger.debug(`\n3. SetHook Success...`)
}


export async function clearAllHooksV3({ client, wallet }: SetHookParams) {
const hook = {
CreateCode: '',
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Hook,
HookFunction,
HookGrant,
HookParameter,
} from 'xahau/dist/npm/models/common/xahau'
Expand All @@ -14,6 +15,7 @@ export type iHook = {
HookApiVersion?: number
HookParameters?: HookParameter[]
HookGrants?: HookGrant[]
HookFunctions?: HookFunction[]
Fee?: string
}

Expand Down
Loading