Skip to content

Commit

Permalink
feat(tools): bundleAndInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed May 17, 2024
1 parent 2235c6a commit 3cf87b7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/zoe/tools/setup-zoe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { makeLoopback } from '@endo/captp';
import { E, makeLoopback } from '@endo/captp';

import { makeScalarBigMapStore } from '@agoric/vat-data';
import bundleSource from '@endo/bundle-source';
import { makeDurableZoeKit } from '../src/zoeService/zoe.js';
import fakeVatAdmin, { makeFakeVatAdmin } from './fakeVatAdmin.js';

Expand Down Expand Up @@ -53,9 +54,23 @@ export const setUpZoeForTest = async ({
zoeBaggage: makeScalarBigMapStore('zoe baggage', { durable: true }),
}),
);

/**
* @param {string} path
* @returns {Promise<Installation>}
*/
const bundleAndInstall = async path => {
const bundle = await bundleSource(path);
const id = `b1-${path}`;
assert(vatAdminState, 'installBundle called before vatAdminState defined');
vatAdminState.installBundle(id, bundle);
return E(zoeService).installBundleID(id);
};

return {
zoe: zoeService,
feeMintAccessP: feeMintAccess,
bundleAndInstall,
vatAdminSvc,
vatAdminState,
};
Expand Down

0 comments on commit 3cf87b7

Please sign in to comment.