]> git.codecow.com Git - libnemo.git/commitdiff
Start fixing Sony version required for epoch blocks during refresh.
authorChris Duncan <chris@codecow.com>
Sat, 8 Aug 2026 15:54:17 +0000 (08:54 -0700)
committerChris Duncan <chris@codecow.com>
Sat, 8 Aug 2026 15:54:17 +0000 (08:54 -0700)
src/lib/wallet/refresh.ts

index 23a9ac91e501e55cf4f5ebb44453229fe7d47706..5b15b7764f8aa24bfb03c91c68e20f4e06b08c8e 100644 (file)
@@ -33,6 +33,17 @@ export async function _refresh (wallet: Wallet, rpc: unknown, from: unknown, to:
                const { frontiers } = await rpc.post('accounts_frontiers', data)
                const { blocks } = await rpc.post('blocks_info', { json_block: true, include_not_found: true, hashes: Object.values(frontiers ?? {}) })
                for (const account of accounts.values()) {
+               const reqAccountInfo: AccountInfoRequest = {
+               account: account.address,
+               include_confirmed: true,
+               receivable: true,
+               representative: true,
+               weight: true
+       }
+       const accountInfo = await rpc.post('account_info', reqAccountInfo)
+       for (const [k, v] of Object.entries(accountInfo)) {
+               account[k] = v
+       }
                        account.balance = balances?.[account.address]?.balance ?? 0
                        account.receivable = balances?.[account.address]?.receivable ?? 0
                        if (frontiers?.[account.address] != null) {
@@ -44,7 +55,8 @@ export async function _refresh (wallet: Wallet, rpc: unknown, from: unknown, to:
                                        if (typeof frontierBlock[subtype] !== 'function') {
                                                throw new TypeError('Unknown frontier block subtype', { cause: subtype })
                                        }
-                                       frontierBlock[subtype](link === BURN_PUBLIC_KEY ? representative : link, 0).signature = signature
+                                       const arg = subtype === 'epoch' ? account.version : subtype === 'change' ? representative : link
+                                       frontierBlock[subtype](arg, 0).signature = signature
                                        account.frontier_block = frontierBlock
                                }
                        }