Skip to content

Commit

Permalink
feat: support builderOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Nov 26, 2024
1 parent 7dd647e commit acf271c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion multichain-testing/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const commonSetup = async (t: ExecutionContext) => {
const startContract = async (
contractName: string,
contractBuilder: string,
builderOpts?: Record<string, string>,
) => {
const { vstorageClient } = tools;
const instances = Object.fromEntries(
Expand All @@ -98,7 +99,7 @@ export const commonSetup = async (t: ExecutionContext) => {
return t.log('Contract found. Skipping installation...');
}
t.log('bundle and install contract', contractName);
await deployBuilder(contractBuilder);
await deployBuilder(contractBuilder, builderOpts);
await retryUntilCondition(
() => vstorageClient.queryData(`published.agoricNames.instance`),
res => contractName in Object.fromEntries(res),
Expand Down
13 changes: 10 additions & 3 deletions multichain-testing/tools/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { createRequire } from 'module';
import type { AgdTools } from './agd-tools.js';
import type { CoreEvalPlan } from '@agoric/deploy-script-support/src/writeCoreEvalParts.js';
import { flags } from './agd-lib.js';

const nodeRequire = createRequire(import.meta.url);

Expand All @@ -10,10 +11,16 @@ export const makeDeployBuilder = (
readJSON: typeof import('fs-extra').readJSON,
execa: typeof import('execa').execa,
) =>
async function deployBuilder(builder: string) {
async function deployBuilder(
builder: string,
builderOpts?: Record<string, string>,
) {
console.log(`building plan: ${builder}`);
// build the plan
const { stdout } = await execa`agoric run ${builder}`;
const args = ['run', builder];
if (builderOpts) {
args.push(...flags(builderOpts));
}
const { stdout } = await execa('agoric', args);
const match = stdout.match(/ (?<name>[-\w]+)-permit.json/);
if (!(match && match.groups)) {
throw Error('no permit found');
Expand Down

0 comments on commit acf271c

Please sign in to comment.