Skip to content

Commit

Permalink
WIP: refactor bid list to take an ERef<WalletView>
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Dec 3, 2023
1 parent 831f365 commit e1c5592
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
6 changes: 6 additions & 0 deletions packages/ag-trade/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ PET=$(STATE)/pet-store
where:
@echo state: $(STATE)

bid-list: $(PET)/gov1-view

$(PET)/gov1-view: $(PET)/query-tool
endo eval "E(hub).walletView('agoric1acfcen6peh9ed9tyrj5wyqtfrf7hthrh5smddy')" \
hub:query-tool -n gov1-view

reserve-add: $(PET)/reserve-tool $(PET)/user1-kit $(PET)/u1-ist
@echo ++ Add to reserve
endo eval "E(reserve).addToReserve(kit.smartWallet, \
Expand Down
18 changes: 3 additions & 15 deletions packages/ag-trade/src/inter-bid.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,10 @@ import { E, Far } from '@endo/far';
* @returns
*/
export const main = async (powers, ...args) => {
const x = await powers;
// console.log({ powers: x });
/** @type { ERef<import('./smartWallet').WalletView> } */
const focus = await E(powers).request('HOST', 'wallet view', 'wallet');

/** @type { ERef<import('./smartWallet').QueryTool> } */
const vstorage = await E(powers).request(
'HOST',
'vstorage query tool',
'vstorage',
);

// console.log({ vstorage });
// const istBrand = await E(vstorage).lookup('agoricNames', 'brand', 'IST');
// console.log('Hello, World!', args, istBrand);
const gov1 = 'agoric1acfcen6peh9ed9tyrj5wyqtfrf7hthrh5smddy'; // XXX
const focus = E(vstorage).walletView(gov1);
const { liveOffers } = await E(focus).current();
// console.log(liveOffers);
const bids = new Map();
Expand All @@ -45,13 +34,12 @@ export const main = async (powers, ...args) => {
bids.set(id, { offerSpec: spec });
}
}

const visitor = Far('Visitor', {
visit: update => {
console.log('@@@@@', update);
if (update.updated === 'offerStatus') {
const { status } = update;
if (bids.has(status.id)) {
console.log('@@@', status);
bids.set(status.id, { ...bids.get(status.id), status });
}
}
Expand Down

0 comments on commit e1c5592

Please sign in to comment.