Skip to content

Commit

Permalink
fix(wallet-tools): select among >1 pending invitations
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Mar 12, 2024
1 parent 9f71230 commit 8154484
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions contract/test/wallet-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export const mockWalletFactory = (
throw Error(`brand not known/supported: ${pBrand}`);
const purse = purseByBrand.get(pBrand);
assert(purse);
return E(purse).deposit(pmt);
const amt = await E(purse).deposit(pmt);
console.log('receive', address, amt);
return amt;
},
});
await E(addressAdmin).default(DEPOSIT_FACET_KEY, depositFacet);
Expand All @@ -83,12 +85,17 @@ export const mockWalletFactory = (
const getPurseInvitation = async invitationSpec => {
// const { instance, description } = invitationSpec;
const invitationAmount = await E(invitationPurse).getCurrentAmount();
console.log(
'TODO: check invitation amount against instance',
invitationAmount,
invitationSpec,
// TODO: check instance too
const detail = invitationAmount.value.find(
d => d.description === invitationSpec.description,
);
detail ||
Fail`${q(invitationSpec.description)} not found in ${q(
invitationAmount,
)}`;
return E(invitationPurse).withdraw(
harden({ brand: invitationAmount.brand, value: [detail] }),
);
return E(invitationPurse).withdraw(invitationAmount);
};

const offerToInvitationMakers = new Map();
Expand Down

0 comments on commit 8154484

Please sign in to comment.