Simplified hook state, since endpoint now works with hookhashes

This commit is contained in:
Valtteri Karesto
2022-06-30 08:54:43 +03:00
parent 3fd6c3f50e
commit dc5b0d71eb
2 changed files with 7 additions and 18 deletions

View File

@@ -249,12 +249,12 @@ export const AccountDialog = ({
? activeAccount.hooks.map((i) => {
return (
<a
key={i.index}
href={`https://${process.env.NEXT_PUBLIC_EXPLORER_URL}/${i.index}`}
key={i}
href={`https://${process.env.NEXT_PUBLIC_EXPLORER_URL}/${i}`}
target="_blank"
rel="noopener noreferrer"
>
{truncate(i.HookHash, 12)}
{truncate(i, 12)}
</a>
);
})
@@ -349,15 +349,10 @@ const Accounts: FC<AccountProps> = (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) || [];
}
});
}

View File

@@ -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?: {