From 68db0820e113ce6e622b0c35b545690334295870 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 20 Aug 2025 13:50:42 -0700 Subject: [PATCH] Avoid calling account rep endpoint many times if account has no frontier anyway. --- src/lib/wallet/refresh.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/wallet/refresh.ts b/src/lib/wallet/refresh.ts index bd6372d..8347907 100644 --- a/src/lib/wallet/refresh.ts +++ b/src/lib/wallet/refresh.ts @@ -36,8 +36,9 @@ export async function _refresh (wallet: Wallet, rpc: unknown, from: unknown, to: for (const account of accounts) { account.balance = balances[account.address]?.balance account.receivable = balances[account.address]?.receivable - account.representative = representatives?.[account.address] ?? (await rpc.call('account_representative', { account: account.address }))?.representative + account.representative = representatives?.[account.address] if (frontiers[account.address] != null) { + account.representative ??= (await rpc.call('account_representative', { account: account.address }))?.representative account.frontier = frontiers[account.address] const { subtype, contents: { balance, link, previous, representative, signature } } = blocks[account.frontier] const frontierBlock = new Block(account, balance, previous, representative) -- 2.47.3