|
1 | 1 | /// <reference types="ses" /> |
2 | 2 | /* eslint-env node */ |
| 3 | +import { inspect } from 'node:util'; |
3 | 4 | import { q, Fail } from '@endo/errors'; |
4 | 5 | import { fromUniqueEntries } from '@agoric/internal'; |
5 | 6 | import type { CosmosCommand } from './cosmos-cmd.js'; |
@@ -123,6 +124,10 @@ export const startEngine = async ({ |
123 | 124 | // Continue with limited functionality |
124 | 125 | } |
125 | 126 |
|
| 127 | + const agoricInfo = await cosmosRest.getChainInfo('agoric'); |
| 128 | + const agoricChainId = (agoricInfo as any)?.default_node_info?.network; |
| 129 | + console.warn('Retrieved info for Agoric chain', agoricChainId); |
| 130 | + |
126 | 131 | await rpc.opened(); |
127 | 132 | try { |
128 | 133 | // console.warn('RPC client opened:', rpc); |
@@ -152,6 +157,7 @@ export const startEngine = async ({ |
152 | 157 | ...(respEvents['transfer.sender'] || []), |
153 | 158 | ]), |
154 | 159 | ]; |
| 160 | + |
155 | 161 | const eventRecords = Object.entries(respData).flatMap( |
156 | 162 | ([key, value]: [string, any]) => { |
157 | 163 | // We care about result_begin_block/result_end_block/etc. |
@@ -191,7 +197,24 @@ export const startEngine = async ({ |
191 | 197 | return [{ path, value: attributes.value }]; |
192 | 198 | }); |
193 | 199 |
|
194 | | - console.log({ addrsWithActivity, portfolioVstorageEvents }); |
| 200 | + const addrBalances = Object.fromEntries( |
| 201 | + await Promise.all( |
| 202 | + addrsWithActivity.map(async addr => { |
| 203 | + const balancesResp = await cosmosRest.getAccountBalances( |
| 204 | + 'agoric', |
| 205 | + addr, |
| 206 | + ); |
| 207 | + return [addr, balancesResp?.balances]; |
| 208 | + }), |
| 209 | + ), |
| 210 | + ); |
| 211 | + |
| 212 | + console.log( |
| 213 | + inspect( |
| 214 | + { addrsWithActivity, addrBalances, portfolioVstorageEvents }, |
| 215 | + { depth: 10 }, |
| 216 | + ), |
| 217 | + ); |
195 | 218 | } |
196 | 219 | } finally { |
197 | 220 | console.warn('Terminating...'); |
|
0 commit comments