From dc5b0d71ebbfa3e266f5fe006a2c45609a975716 Mon Sep 17 00:00:00 2001 From: Valtteri Karesto Date: Thu, 30 Jun 2022 08:54:43 +0300 Subject: [PATCH] Simplified hook state, since endpoint now works with hookhashes --- components/Accounts.tsx | 17 ++++++----------- state/index.ts | 8 +------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/components/Accounts.tsx b/components/Accounts.tsx index e2205d6..db53e43 100644 --- a/components/Accounts.tsx +++ b/components/Accounts.tsx @@ -249,12 +249,12 @@ export const AccountDialog = ({ ? activeAccount.hooks.map((i) => { return ( - {truncate(i.HookHash, 12)} + {truncate(i, 12)} ); }) @@ -349,15 +349,10 @@ const Accounts: FC = (props) => { (acc) => acc.address === address ); if (accountToUpdate) { - const hookObj = res.account_objects.find( - (ac: any) => ac?.LedgerEntryType === "Hook" - ); accountToUpdate.hooks = - hookObj?.Hooks?.map((oo: any) => ({ - HookHash: oo.Hook?.HookHash, - HookNamespace: oo.Hook?.HookNamespace, - index: hookObj.index, - })) || []; + res.account_objects + .find((ac: any) => ac?.LedgerEntryType === "Hook") + ?.Hooks?.map((oo: any) => oo.Hook.HookHash) || []; } }); } diff --git a/state/index.ts b/state/index.ts index bfe1dd3..d33427b 100644 --- a/state/index.ts +++ b/state/index.ts @@ -26,19 +26,13 @@ export interface FaucetAccountRes { code: string; } -export interface IHooks { - HookHash: string; - HookNamespace: string; - index: string; -} - export interface IAccount { name: string; address: string; secret: string; xrp: string; sequence: number; - hooks: IHooks[]; + hooks: string[]; isLoading: boolean; version?: string; error?: {