Skip to content

Commit

Permalink
fix: backwards compatible without boardAux
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Aug 25, 2023
1 parent dfa49e2 commit 97733aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 9 additions & 5 deletions packages/rpc/src/chainStorageWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,15 @@ export const makeAgoricChainStorageWatcher = (
};

const queryOnce = <T>(path: [AgoricChainStoragePathKind, string]) =>
new Promise<T>(res => {
const stop = watchLatest<T>(path, val => {
stop();
res(val);
});
new Promise<T>((res, rej) => {
const stop = watchLatest<T>(
path,
val => {
stop();
res(val);
},
e => rej(e),
);
});

// Assumes argument is an unserialized presence.
Expand Down
16 changes: 10 additions & 6 deletions packages/web-components/src/wallet-connection/watchWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,16 @@ export const watchWallet = async (chainStorageWatcher, address) => {
await null;
if (purses.length !== nonBankPurses?.length) {
const brands = purses.map(p => p.brand);
const boardAux = await Promise.all(
chainStorageWatcher.queryBoardAux(brands),
);
brandToBoardAux = new Map(
brands.map((brand, index) => [brand, boardAux[index]]),
);
try {
const boardAux = await Promise.all(
chainStorageWatcher.queryBoardAux(brands),
);
brandToBoardAux = new Map(
brands.map((brand, index) => [brand, boardAux[index]]),
);
} catch (e) {
console.error('Error getting boardAux for brands', brands, e);
}
}

nonBankPurses = purses;
Expand Down

0 comments on commit 97733aa

Please sign in to comment.