Skip to content

Commit

Permalink
chore: startContract stringifies builderOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Dec 3, 2024
1 parent cb20c92 commit a706d28
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions multichain-testing/test/auto-stake-it.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test.before(async t => {
t.context = { ...common, wallets };

await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/basic-flows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ test.before(async t => {
const wallets = await setupTestKeys(accounts);
t.context = { ...common, wallets };
await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/deposit-withdraw-lca.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ test.before(async t => {
const wallets = await setupTestKeys(accounts);
t.context = { ...common, wallets };
await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/deposit-withdraw-portfolio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ test.before(async t => {
const wallets = await setupTestKeys(accounts);
t.context = { ...common, wallets };
await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/ica-channel-close.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ test.before(async t => {
const wallets = await setupTestKeys(accounts);
t.context = { ...common, wallets };
await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/send-anywhere.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test.before(async t => {
t.context = { ...common, wallets };

await startContract(contractName, contractBuilder, {
chainInfo: JSON.stringify(chainInfo),
assetInfo: JSON.stringify(assetInfo),
chainInfo,
assetInfo,
});
});

Expand Down
16 changes: 14 additions & 2 deletions multichain-testing/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { execa } from 'execa';
import fse from 'fs-extra';
import childProcess from 'node:child_process';
import { withChainCapabilities } from '@agoric/orchestration';
import { objectMap } from '@endo/patterns';
import { makeAgdTools } from '../tools/agd-tools.js';
import { type E2ETools } from '../tools/e2e-tools.js';
import {
Expand Down Expand Up @@ -94,7 +95,7 @@ export const commonSetup = async (t: ExecutionContext) => {
const startContract = async (
contractName: string,
contractBuilder: string,
builderOpts?: Record<string, string>,
builderOpts?: Record<string, unknown>,
) => {
const { vstorageClient } = tools;
const instances = Object.fromEntries(
Expand All @@ -104,7 +105,18 @@ export const commonSetup = async (t: ExecutionContext) => {
return t.log('Contract found. Skipping installation...');
}
t.log('bundle and install contract', contractName);
await deployBuilder(contractBuilder, builderOpts);

const formattedOpts = builderOpts
? objectMap(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
builderOpts as Record<string, any>,
value => {
if (typeof value === 'string') return value;
return JSON.stringify(value);
},
)
: undefined;
await deployBuilder(contractBuilder, formattedOpts);
await retryUntilCondition(
() => vstorageClient.queryData(`published.agoricNames.instance`),
res => contractName in Object.fromEntries(res),
Expand Down

0 comments on commit a706d28

Please sign in to comment.