agoric 0.21.2-dev-7cc5def.0 → 0.21.2-u11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/lib/wallet.js CHANGED
@@ -9,6 +9,7 @@ import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js';
9
9
  /** @typedef {import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord} CurrentWalletRecord */
10
10
  /** @typedef {import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes} AgoricNamesRemotes */
11
11
 
12
+ const { values } = Object;
12
13
  const { Fail } = assert;
13
14
  const marshaller = boardSlottingMarshaller();
14
15
 
@@ -131,7 +132,6 @@ export const coalesceWalletState = async (follower, invitationBrand) => {
131
132
  * @param {import('@agoric/smart-wallet/src/smartWallet').BridgeAction} bridgeAction
132
133
  * @param {import('./rpc').MinimalNetworkConfig & {
133
134
  * from: string,
134
- * fees?: string,
135
135
  * verbose?: boolean,
136
136
  * keyring?: {home?: string, backend: string},
137
137
  * stdout: Pick<import('stream').Writable, 'write'>,
@@ -159,7 +159,7 @@ export const sendAction = async (bridgeAction, opts) => {
159
159
  assert(out); // not dry run
160
160
  const tx = JSON.parse(out);
161
161
  if (tx.code !== 0) {
162
- const err = Error(`failed to send tx: ${tx.raw_log} code: ${tx.code}`);
162
+ const err = Error(`failed to send action. code: ${tx.code}`);
163
163
  // @ts-expect-error XXX how to add properties to an error?
164
164
  err.code = tx.code;
165
165
  throw err;
@@ -247,6 +247,7 @@ export const makeWalletUtils = async (
247
247
  untilNumWantsSatisfied = false,
248
248
  ) => {
249
249
  const lookup = async () => {
250
+ // eslint-disable-next-line @jessie.js/no-nested-await, no-await-in-loop
250
251
  const { offerStatuses } = await storedWalletState(from, minHeight);
251
252
  const offerStatus = [...offerStatuses.values()].find(s => s.id === id);
252
253
  if (!offerStatus) throw Error('retry');
@@ -271,3 +272,44 @@ export const makeWalletUtils = async (
271
272
  pollOffer,
272
273
  };
273
274
  };
275
+
276
+ /**
277
+ * @param {{
278
+ * brand: Record<string, Brand>,
279
+ * vbankAsset: Record<string, { brand: Brand, displayInfo: DisplayInfo }>,
280
+ * }} agoricNames
281
+ * @param {(msg: string) => Error} makeError error constructor
282
+ * @returns {(a: string) => Amount<'nat'>}
283
+ */
284
+ export const makeParseAmount =
285
+ (agoricNames, makeError = msg => RangeError(msg)) =>
286
+ opt => {
287
+ assert.typeof(opt, 'string', 'parseAmount expected string');
288
+ const m = opt.match(/^(?<value>[\d_]+(\.[\d_]+)?)(?<brand>[A-Z]\w*?)$/);
289
+ if (!m || !m.groups) {
290
+ throw makeError(`invalid amount: ${opt}`);
291
+ }
292
+ const anyBrand = agoricNames.brand[m.groups.brand];
293
+ if (!anyBrand) {
294
+ throw makeError(`unknown brand: ${m.groups.brand}`);
295
+ }
296
+ const assetDesc = values(agoricNames.vbankAsset).find(
297
+ d => d.brand === anyBrand,
298
+ );
299
+ if (!assetDesc) {
300
+ throw makeError(`unknown brand: ${m.groups.brand}`);
301
+ }
302
+ const { displayInfo } = assetDesc;
303
+ if (!displayInfo.decimalPlaces || displayInfo.assetKind !== 'nat') {
304
+ throw makeError(`bad brand: ${displayInfo}`);
305
+ }
306
+ const value = BigInt(
307
+ Number(m.groups.value.replace(/_/g, '')) *
308
+ 10 ** displayInfo.decimalPlaces,
309
+ );
310
+ /** @type {Brand<'nat'>} */
311
+ // @ts-expect-error dynamic cast
312
+ const natBrand = anyBrand;
313
+ const amt = { value, brand: natBrand };
314
+ return amt;
315
+ };
@@ -31,9 +31,9 @@ const publishMain = async (progname, rawArgs, powers, opts) => {
31
31
  chainID,
32
32
  };
33
33
 
34
- await null;
35
34
  for (const bundlePath of rawArgs.slice(1)) {
36
35
  // AWAIT
36
+ // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
37
37
  const bundleText = await fs.readFile(bundlePath, 'utf-8');
38
38
  const bundle = parseLocatedJson(bundleText, bundlePath);
39
39
 
@@ -53,6 +53,7 @@ const publishMain = async (progname, rawArgs, powers, opts) => {
53
53
  });
54
54
 
55
55
  // AWAIT
56
+ // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
56
57
  const hashedBundle = await publishBundle(bundle, connectionSpec);
57
58
  process.stdout.write(`${JSON.stringify(hashedBundle)}\n`);
58
59
  }
package/src/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @jessie.js/no-nested-await */
1
2
  /* global process */
2
3
  import { Command } from 'commander';
3
4
  import path from 'path';
@@ -35,7 +36,6 @@ const main = async (progname, rawArgs, powers) => {
35
36
  const program = new Command();
36
37
 
37
38
  async function isNotBasedir() {
38
- await null;
39
39
  try {
40
40
  await fs.stat(STAMP);
41
41
  return false;
package/src/publish.js CHANGED
@@ -289,12 +289,14 @@ export const makeCosmosBundlePublisher = ({
289
289
  const endpoint = urlForRpcAddress(rpcAddress);
290
290
 
291
291
  // AWAIT
292
+ // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
292
293
  const stargateClient = await connectWithSigner(endpoint, wallet, {
293
294
  gasPrice: Agoric.gasPrice,
294
295
  registry,
295
296
  });
296
297
 
297
298
  // AWAIT
299
+ // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
298
300
  const result = await stargateClient
299
301
  .signAndBroadcast(from.address, encodeObjects, Agoric.fee)
300
302
  .catch(error => {
@@ -310,6 +312,7 @@ export const makeCosmosBundlePublisher = ({
310
312
  }
311
313
 
312
314
  // AWAIT
315
+ // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
313
316
  await E(leader).jitter('agoric CLI deploy');
314
317
  }
315
318
 
@@ -423,7 +426,6 @@ const publishBundle = async (
423
426
  )}, publishBundle supports only "endoZipBase64" with "endoZipBase64Sha512"`;
424
427
  }
425
428
 
426
- await null;
427
429
  if (connectionSpec === undefined && getDefaultConnection !== undefined) {
428
430
  connectionSpec = await getDefaultConnection();
429
431
  }
@@ -4,9 +4,6 @@
4
4
  export default [
5
5
  "@agoric/access-token",
6
6
  "@agoric/assert",
7
- "@agoric/base-zone",
8
- "@agoric/boot",
9
- "@agoric/builders",
10
7
  "@agoric/cache",
11
8
  "@agoric/casting",
12
9
  "@agoric/cosmic-proto",
@@ -19,10 +16,10 @@ export default [
19
16
  "@agoric/import-manager",
20
17
  "@agoric/inter-protocol",
21
18
  "@agoric/internal",
22
- "@agoric/network",
23
19
  "@agoric/notifier",
24
20
  "@agoric/pegasus",
25
21
  "@agoric/same-structure",
22
+ "@agoric/sharing-service",
26
23
  "@agoric/smart-wallet",
27
24
  "@agoric/solo",
28
25
  "@agoric/sparse-ints",
@@ -37,11 +34,13 @@ export default [
37
34
  "@agoric/swingset-xsnap-supervisor",
38
35
  "@agoric/telemetry",
39
36
  "@agoric/time",
37
+ "@agoric/ui-components",
40
38
  "@agoric/vat-data",
41
39
  "@agoric/vats",
42
- "@agoric/vm-config",
43
40
  "@agoric/wallet",
44
41
  "@agoric/wallet-backend",
42
+ "@agoric/wallet-connection",
43
+ "@agoric/web-components",
45
44
  "@agoric/xsnap",
46
45
  "@agoric/xsnap-lockdown",
47
46
  "@agoric/zoe",
@@ -42,7 +42,6 @@ export default async function setDefaultsMain(progname, rawArgs, powers, opts) {
42
42
  return fs.writeFile(fileName, contents);
43
43
  };
44
44
 
45
- await null;
46
45
  if (appFile) {
47
46
  log(`read ${appFile}`);
48
47
  const appToml = await fs.readFile(appFile, 'utf-8');
package/src/start.js CHANGED
@@ -40,7 +40,6 @@ const DELEGATE0_COINS = `50000000${STAKING_DENOM}`;
40
40
  const SOLO_COINS = `13000000${STAKING_DENOM},500000000${CENTRAL_DENOM}`;
41
41
  const CHAIN_ID = 'agoriclocal';
42
42
 
43
- const SERVERS_ROOT_DIR = '_agstate/agoric-servers';
44
43
  const FAKE_CHAIN_DELAY =
45
44
  process.env.FAKE_CHAIN_DELAY === undefined
46
45
  ? 0
@@ -152,7 +151,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
152
151
  ]);
153
152
 
154
153
  const exists = async file => {
155
- await null;
156
154
  try {
157
155
  await fs.stat(file);
158
156
  return true;
@@ -161,12 +159,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
161
159
  }
162
160
  };
163
161
 
164
- const rmVerbose = async filePath => {
165
- log(chalk.green(`removing ${filePath}`));
166
- // rm is available on all the unix-likes, so use it for speed.
167
- await pspawn('rm', ['-rf', filePath]);
168
- };
169
-
170
162
  let agSolo;
171
163
  let agSoloBuild;
172
164
  if (opts.dockerTag) {
@@ -179,11 +171,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
179
171
  const fakeDelay =
180
172
  popts.delay === undefined ? FAKE_CHAIN_DELAY : Number(popts.delay);
181
173
 
182
- const serverDir = `${SERVERS_ROOT_DIR}/${profileName}`;
174
+ const agServer = `_agstate/agoric-servers/${profileName}`;
183
175
 
184
- await null;
185
176
  if (popts.reset) {
186
- rmVerbose(serverDir);
177
+ log(chalk.green(`removing ${agServer}`));
178
+ // rm is available on all the unix-likes, so use it for speed.
179
+ await pspawn('rm', ['-rf', agServer]);
187
180
  }
188
181
 
189
182
  if (!opts.dockerTag) {
@@ -204,14 +197,14 @@ export default async function startMain(progname, rawArgs, powers, opts) {
204
197
  }
205
198
 
206
199
  const fakeGCI = 'sim-chain';
207
- const serverExists = await exists(serverDir);
200
+ const serverExists = await exists(agServer);
208
201
  if (!serverExists) {
209
202
  log(chalk.yellow(`initializing ${profileName}`));
210
203
  await pspawn(
211
204
  agSolo,
212
205
  ['init', profileName, '--egresses=fake', `--webport=${HOST_PORT}`],
213
206
  {
214
- cwd: SERVERS_ROOT_DIR,
207
+ cwd: '_agstate/agoric-servers',
215
208
  },
216
209
  );
217
210
  }
@@ -222,7 +215,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
222
215
  agSolo,
223
216
  ['set-fake-chain', `--delay=${fakeDelay}`, fakeGCI],
224
217
  {
225
- cwd: serverDir,
218
+ cwd: agServer,
226
219
  },
227
220
  );
228
221
  }
@@ -233,7 +226,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
233
226
  }
234
227
 
235
228
  const ps = pspawn(agSolo, [...debugOpts, 'start'], {
236
- cwd: serverDir,
229
+ cwd: agServer,
237
230
  env: nodeDebugEnv,
238
231
  });
239
232
  process.on('SIGINT', () => ps.childProcess.kill('SIGINT'));
@@ -253,7 +246,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
253
246
  }
254
247
 
255
248
  const { cosmosChain, cosmosChainBuild } = getSDKBinaries(sdkPrefixes);
256
- await null;
257
249
  if (popts.pull || popts.rebuild) {
258
250
  if (popts.dockerTag) {
259
251
  const exitStatus = await pspawn('docker', ['pull', SDK_IMAGE]);
@@ -271,15 +263,17 @@ export default async function startMain(progname, rawArgs, powers, opts) {
271
263
  }
272
264
  }
273
265
 
274
- const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
266
+ const agServer = `_agstate/agoric-servers/${profileName}-${portNum}`;
275
267
  if (popts.reset) {
276
- rmVerbose(serverDir);
268
+ log(chalk.green(`removing ${agServer}`));
269
+ // rm is available on all the unix-likes, so use it for speed.
270
+ await pspawn('rm', ['-rf', agServer]);
277
271
  }
278
272
 
279
273
  let chainSpawn;
280
274
  if (!popts.dockerTag) {
281
275
  chainSpawn = (args, spawnOpts = undefined) => {
282
- return pspawn(cosmosChain, [...args, `--home=${serverDir}`], spawnOpts);
276
+ return pspawn(cosmosChain, [...args, `--home=${agServer}`], spawnOpts);
283
277
  };
284
278
  } else {
285
279
  chainSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
@@ -293,13 +287,13 @@ export default async function startMain(progname, rawArgs, powers, opts) {
293
287
  ...terminalOnlyFlags(`-it`),
294
288
  SDK_IMAGE,
295
289
  ...args,
296
- `--home=/usr/src/dapp/${serverDir}`,
290
+ `--home=/usr/src/dapp/${agServer}`,
297
291
  ],
298
292
  spawnOpts,
299
293
  );
300
294
  }
301
295
 
302
- const serverExists = await exists(serverDir);
296
+ const serverExists = await exists(agServer);
303
297
  if (!serverExists) {
304
298
  const exitStatus = await chainSpawn([
305
299
  'init',
@@ -314,6 +308,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
314
308
  // Get or create the essential addresses.
315
309
  const addrs = {};
316
310
  for (const keyName of ['provision', 'delegate0']) {
311
+ /* eslint-disable no-await-in-loop */
317
312
  let statusOut = showKey(keyName);
318
313
  const exitStatusOut = await statusOut[0];
319
314
  if (exitStatusOut) {
@@ -336,7 +331,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
336
331
  /* eslint-enable no-await-in-loop */
337
332
  }
338
333
 
339
- const genesisFile = `${serverDir}/config/genesis.json`;
334
+ const genesisFile = `${agServer}/config/genesis.json`;
340
335
  const stampExists = await exists(`${genesisFile}.stamp`);
341
336
  if (!stampExists) {
342
337
  let exitStatus;
@@ -366,7 +361,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
366
361
  `--keyring-dir=${keysHome}`,
367
362
  '--keyring-backend=test',
368
363
  `--chain-id=${CHAIN_ID}`,
369
- DELEGATE0_COINS,
364
+ `${DELEGATE0_COINS}`,
370
365
  ]);
371
366
  if (exitStatus) {
372
367
  return exitStatus;
@@ -387,8 +382,8 @@ export default async function startMain(progname, rawArgs, powers, opts) {
387
382
 
388
383
  // Complete the genesis file and launch the chain.
389
384
  log('read ag-chain-cosmos config');
390
- const configFile = `${serverDir}/config/config.toml`;
391
- const appFile = `${serverDir}/config/app.toml`;
385
+ const configFile = `${agServer}/config/config.toml`;
386
+ const appFile = `${agServer}/config/app.toml`;
392
387
  const [genesisJson, configToml, appToml] = await Promise.all([
393
388
  fs.readFile(genesisFile, 'utf-8'),
394
389
  fs.readFile(configFile, 'utf-8'),
@@ -451,10 +446,9 @@ export default async function startMain(progname, rawArgs, powers, opts) {
451
446
  return 1;
452
447
  }
453
448
 
454
- const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
449
+ const agServer = `_agstate/agoric-servers/${profileName}-${portNum}`;
455
450
 
456
451
  const { cosmosClientBuild } = getSDKBinaries(sdkPrefixes);
457
- await null;
458
452
  if (popts.pull || popts.rebuild) {
459
453
  if (popts.dockerTag) {
460
454
  const exitStatus = await pspawn('docker', ['pull', SDK_IMAGE]);
@@ -480,7 +474,9 @@ export default async function startMain(progname, rawArgs, powers, opts) {
480
474
  }
481
475
 
482
476
  if (popts.reset) {
483
- rmVerbose(serverDir);
477
+ log(chalk.green(`removing ${agServer}`));
478
+ // rm is available on all the unix-likes, so use it for speed.
479
+ await pspawn('rm', ['-rf', agServer]);
484
480
  }
485
481
 
486
482
  let soloSpawn;
@@ -495,7 +491,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
495
491
  'run',
496
492
  `--volume=${process.cwd()}:/usr/src/dapp`,
497
493
  `--volume=${process.env.HOME}/.agoric:/root/.agoric`,
498
- `-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
494
+ `-eAG_SOLO_BASEDIR=/usr/src/dapp/${agServer}`,
499
495
  `--rm`,
500
496
  ...terminalOnlyFlags(`-it`),
501
497
  `--entrypoint=ag-solo`,
@@ -507,7 +503,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
507
503
  );
508
504
  }
509
505
 
510
- const serverExists = await exists(serverDir);
506
+ const serverExists = await exists(agServer);
511
507
  // Initialise the solo directory and key.
512
508
  if (!serverExists) {
513
509
  const initArgs = [`--webport=${portNum}`];
@@ -515,7 +511,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
515
511
  initArgs.push(`--webhost=0.0.0.0`);
516
512
  }
517
513
  const exitStatus = await soloSpawn(
518
- ['init', serverDir, ...initArgs],
514
+ ['init', agServer, ...initArgs],
519
515
  undefined,
520
516
  [`--workdir=/usr/src/dapp`],
521
517
  );
@@ -526,15 +522,15 @@ export default async function startMain(progname, rawArgs, powers, opts) {
526
522
 
527
523
  // Create the full economy chain config.
528
524
  const agServerResolve = spec =>
529
- require.resolve(spec, { paths: [serverDir] });
525
+ require.resolve(spec, { paths: [agServer] });
530
526
  const coreConfigPath = agServerResolve(
531
- '@agoric/vm-config/decentral-core-config.json',
527
+ '@agoric/vats/decentral-core-config.json',
532
528
  );
533
529
  const economyTemplPath = agServerResolve(
534
530
  '@agoric/cosmic-swingset/economy-template.json',
535
531
  );
536
532
  const [rawSoloAddr, coreConfigJson, economyTemplJson] = await Promise.all([
537
- fs.readFile(`${serverDir}/ag-cosmos-helper-address`, 'utf-8'),
533
+ fs.readFile(`${agServer}/ag-cosmos-helper-address`, 'utf-8'),
538
534
  fs.readFile(coreConfigPath, 'utf-8'),
539
535
  fs.readFile(economyTemplPath, 'utf-8'),
540
536
  ]);
@@ -545,7 +541,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
545
541
  const economyConfig = JSON.parse(coreConfigJson);
546
542
  economyConfig.coreProposals = economyProposals;
547
543
  await fs.writeFile(
548
- `${serverDir}/decentral-economy-config.json`,
544
+ `${agServer}/decentral-economy-config.json`,
549
545
  JSON.stringify(economyConfig, null, 2),
550
546
  );
551
547
 
@@ -553,12 +549,13 @@ export default async function startMain(progname, rawArgs, powers, opts) {
553
549
  return 0;
554
550
  }
555
551
 
556
- const gciFile = `${SERVERS_ROOT_DIR}/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`;
552
+ const gciFile = `_agstate/agoric-servers/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`;
557
553
  process.stdout.write(`Waiting for local-chain-${CHAIN_PORT} to start...`);
558
554
  let hasGci = false;
559
555
  for await (const _ of untilTrue(() => hasGci)) {
560
556
  process.stdout.write('.');
561
557
 
558
+ // eslint-disable-next-line no-await-in-loop
562
559
  await new Promise((resolve, reject) => {
563
560
  fs.stat(gciFile).then(
564
561
  _2 => {
@@ -579,7 +576,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
579
576
 
580
577
  const spawnOpts = {};
581
578
  if (!popts.dockerTag) {
582
- spawnOpts.cwd = serverDir;
579
+ spawnOpts.cwd = agServer;
583
580
  }
584
581
 
585
582
  const rpcAddrs = [`localhost:${CHAIN_PORT}`];
@@ -593,6 +590,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
593
590
  let bestRpcAddr;
594
591
  for await (const _ of untilTrue(() => bestRpcAddr)) {
595
592
  for await (const rpcAddr of rpcAddrs) {
593
+ // eslint-disable-next-line no-await-in-loop
596
594
  exitStatus = await keysSpawn([
597
595
  'query',
598
596
  'swingset',
@@ -641,6 +639,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
641
639
  ];
642
640
  for (/* await */ const cmd of provCmds) {
643
641
  const statusOut = capture(keysSpawn, cmd, true);
642
+ // eslint-disable-next-line no-await-in-loop
644
643
  exitStatus = await statusOut[0];
645
644
  if (!exitStatus) {
646
645
  const json = statusOut[1].replace(/^gas estimate: \d+$/m, '');
@@ -665,6 +664,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
665
664
  }
666
665
  }
667
666
  if (!bestRpcAddr) {
667
+ // eslint-disable-next-line no-await-in-loop
668
668
  await delay(2000);
669
669
  }
670
670
  }
@@ -690,7 +690,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
690
690
  }
691
691
 
692
692
  async function startTestnetDocker(profileName, startArgs, popts) {
693
- await null;
694
693
  if (popts.dockerTag && popts.pull) {
695
694
  const exitStatus = await pspawn('docker', ['pull', SOLO_IMAGE]);
696
695
  if (exitStatus) {
@@ -700,10 +699,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
700
699
 
701
700
  const port = startArgs[0] || PORT;
702
701
  const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
703
- const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
702
+ const agServer = `_agstate/agoric-servers/${profileName}-${port}`;
704
703
 
705
704
  if (popts.reset) {
706
- rmVerbose(serverDir);
705
+ log(chalk.green(`removing ${agServer}`));
706
+ // rm is available on all the unix-likes, so use it for speed.
707
+ await pspawn('rm', ['-rf', agServer]);
707
708
  }
708
709
 
709
710
  const setupRun = (...bonusArgs) =>
@@ -711,7 +712,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
711
712
  'run',
712
713
  `-p127.0.0.1:${HOST_PORT}:${port}`,
713
714
  `--volume=${process.cwd()}:/usr/src/dapp`,
714
- `-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
715
+ `-eAG_SOLO_BASEDIR=/usr/src/dapp/${agServer}`,
715
716
  `--rm`,
716
717
  ...terminalOnlyFlags(`-it`),
717
718
  SOLO_IMAGE,
@@ -726,38 +727,44 @@ export default async function startMain(progname, rawArgs, powers, opts) {
726
727
  async function startTestnetSdk(profileName, startArgs, popts) {
727
728
  const port = startArgs[0] || PORT;
728
729
  const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
729
- const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
730
+ const agServer = `_agstate/agoric-servers/${profileName}-${port}`;
730
731
 
731
- await null;
732
732
  if (popts.reset) {
733
- rmVerbose(serverDir);
733
+ log(chalk.green(`removing ${agServer}`));
734
+ // rm is available on all the unix-likes, so use it for speed.
735
+ await pspawn('rm', ['-rf', agServer]);
734
736
  }
735
737
 
736
738
  const setupRun = (...bonusArgs) =>
737
739
  pspawn(agSolo, [`--webport=${port}`, ...bonusArgs], {
738
- env: { ...pspawnEnv, AG_SOLO_BASEDIR: serverDir },
740
+ env: { ...pspawnEnv, AG_SOLO_BASEDIR: agServer },
739
741
  });
740
742
 
741
743
  return setupRun('setup', `--netconfig=${netconfig}`);
742
744
  }
743
745
 
744
746
  const profiles = {
745
- __proto__: null,
746
747
  dev: startFakeChain,
747
748
  'local-chain': startLocalChain,
748
749
  'local-solo': startLocalSolo,
749
750
  testnet: opts.dockerTag ? startTestnetDocker : startTestnetSdk,
750
751
  };
751
752
 
752
- const [_command = 'start', profileName = 'dev', ...args] = rawArgs;
753
+ const popts = opts;
754
+
755
+ const args = rawArgs.slice(1);
756
+ const profileName = args[0] || 'dev';
753
757
  const startFn = profiles[profileName];
754
758
  if (!startFn) {
755
- const profileNames = Object.keys(profiles).join(', ');
756
759
  log.error(
757
- `unrecognized profile name ${profileName}; use one of: ${profileNames}`,
760
+ `unrecognized profile name ${profileName}; use one of: ${Object.keys(
761
+ profiles,
762
+ )
763
+ .sort()
764
+ .join(', ')}`,
758
765
  );
759
766
  return 1;
760
767
  }
761
768
 
762
- return startFn(profileName, args, opts);
769
+ return startFn(profileName, args[0] ? args.slice(1) : args, popts);
763
770
  }