Skip to content

Commit ef7bf84

Browse files
authored
chore: add Zoe invite issuer and purse to wallet (#1176)
1 parent 6172b42 commit ef7bf84

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function setup(syscall, state, helpers) {
9191
),
9292
);
9393

94-
// Register all of the starting issuers.
94+
// Register the moola and simolean issuers
9595
const issuerInfo = await Promise.all(
9696
issuerNames.map(async (issuerName, i) =>
9797
harden({
@@ -104,6 +104,21 @@ export default function setup(syscall, state, helpers) {
104104
}),
105105
),
106106
);
107+
108+
// Add the Zoe invite issuer.
109+
const zoeInviteIssuer = await E(zoe).getInviteIssuer();
110+
const zoeInvitePetname = 'zoe invite';
111+
issuerInfo.push(
112+
harden({
113+
issuer: zoeInviteIssuer,
114+
petname: zoeInvitePetname,
115+
brandRegKey: await E(registry).register(
116+
zoeInvitePetname,
117+
await E(zoeInviteIssuer).getBrand(),
118+
),
119+
}),
120+
);
121+
107122
return harden({
108123
async createUserBundle(_nickname) {
109124
// Bind to some fresh ports (unspecified name) on the IBC implementation
@@ -246,6 +261,7 @@ export default function setup(syscall, state, helpers) {
246261
const pursePetnames = {
247262
moola: 'Fun budget',
248263
simolean: 'Nest egg',
264+
'zoe invite': 'Default Zoe invite purse',
249265
};
250266
await Promise.all(
251267
issuerInfo.map(({ petname: issuerPetname }) => {

packages/cosmic-swingset/test/test-home.js

+24
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ test('home.mailboxAdmin', async t => {
107107
}
108108
});
109109

110+
test('home.wallet', async t => {
111+
try {
112+
const { wallet, zoe } = E.G(home);
113+
114+
const zoeInviteIssuer = await E(zoe).getInviteIssuer();
115+
const issuers = await E(wallet).getIssuers();
116+
const issuersMap = new Map(issuers);
117+
t.deepEquals(
118+
issuersMap.get('zoe invite'),
119+
zoeInviteIssuer,
120+
`wallet knows about the Zoe invite issuer`,
121+
);
122+
const invitePurse = await E(wallet).getPurse('Default Zoe invite purse');
123+
t.deepEquals(
124+
await E(invitePurse).getAllegedBrand(),
125+
await E(zoeInviteIssuer).getBrand(),
126+
);
127+
} catch (e) {
128+
t.isNot(e, e, 'unexpected exception');
129+
} finally {
130+
t.end();
131+
}
132+
});
133+
110134
// =========================================
111135
// This runs after all the tests.
112136
test('teardown', async t => {

0 commit comments

Comments
 (0)