From bb8d2cdca94e1353c6c3f338146e79794439c453 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 13:33:29 -0500 Subject: [PATCH 1/9] chore(a3p-integration): Clean up tryISTBalances --- .../z:acceptance/test-lib/psm-lib.js | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index b2a157691f5..c568230bbb6 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -427,27 +427,29 @@ const extractBalance = (balances, targetDenom) => { /** * Checking IST balances can be tricky because of the execution fee mentioned in - * https://github.com/Agoric/agoric-sdk/issues/6525. Here we first check with - * whatever is passed in. If the first attempt fails we try again to see if - * there was an execution fee charged. If still fails, we throw. + * https://github.com/Agoric/agoric-sdk/issues/6525. So we first check for + * equality, but if that fails we recheck against an assumption that a fee of + * the default "minFeeDebit" has been charged. * * @param {import('ava').ExecutionContext} t * @param {number} actualBalance * @param {number} expectedBalance */ export const tryISTBalances = async (t, actualBalance, expectedBalance) => { - const firstTry = await t.try( - (tt, actual, expected) => { - tt.deepEqual(actual, expected); - }, - actualBalance, - expectedBalance, - ); + const firstTry = await t.try(tt => { + tt.is(actualBalance, expectedBalance); + }); + if (firstTry.passed) { + firstTry.commit(); + return; + } - if (!firstTry.passed) { - firstTry.discard(); - t.deepEqual(actualBalance + 200000, expectedBalance); - } else firstTry.commit(); + firstTry.discard(); + t.log('tryISTBalances assuming no batched IST fee', firstTry.errors); + // See golang/cosmos/x/swingset/types/default-params.go + // and `ChargeBeans` in golang/cosmos/x/swingset/keeper/keeper.go. + const minFeeDebit = 200_000; + t.is(actualBalance + minFeeDebit, expectedBalance); }; /** From fd9394b33ed9f12e229e9914d7efe3ca10980f0c Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 14:07:51 -0500 Subject: [PATCH 2/9] fix(client-utils): Retry at least every other interval ...even when a backing operation hangs (e.g., `follow` of an unprovisioned wallet) --- packages/client-utils/src/sync-tools.js | 70 ++++++++++++++++++------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/packages/client-utils/src/sync-tools.js b/packages/client-utils/src/sync-tools.js index a2aa6db98d8..bf67c2e4abf 100644 --- a/packages/client-utils/src/sync-tools.js +++ b/packages/client-utils/src/sync-tools.js @@ -16,6 +16,7 @@ * @typedef {object} RetryOptions * @property {number} [maxRetries] * @property {number} [retryIntervalMs] + * @property {boolean} [reusePromise] * * @typedef {RetryOptions & {errorMessage: string}} WaitUntilOptions * @@ -48,19 +49,51 @@ export const retryUntilCondition = async ( operation, condition, message, - { maxRetries = 6, retryIntervalMs = 3500, log = console.log, setTimeout }, + { + maxRetries = 6, + retryIntervalMs = 3500, + reusePromise = false, + // XXX mixes ocaps with configuration options + log = console.log, + setTimeout, + }, ) => { - console.log({ maxRetries, retryIntervalMs, message }); - let retries = 0; + console.log({ maxRetries, retryIntervalMs, reusePromise, message }); await null; // separate sync prologue + const timedOut = Symbol('timed out'); + let retries = 0; + /** @type {Promise | undefined } */ + let resultP; while (retries < maxRetries) { try { - const result = await operation(); - log('RESULT', result); - if (condition(result)) { - return result; + if (!reusePromise || !resultP) { + resultP = operation(); + const makeCleanup = ref => { + const cleanup = () => { + if (resultP === ref) { + resultP = undefined; + } + }; + return cleanup; + }; + // eslint-disable-next-line @typescript-eslint/no-floating-promises + resultP.finally(makeCleanup(resultP)); + } + const result = await Promise.race([ + resultP, + // Overload the retryIntervalMs to apply both *to* and *between* iterations + sleep(retryIntervalMs, { log() {}, setTimeout }).then(() => timedOut), + ]); + if (result === timedOut) { + log(`Attempt ${retries + 1} timed out`); + if (!reusePromise) resultP = undefined; + } else { + log('RESULT', result); + if (condition(result)) { + return result; + } } } catch (error) { if (error instanceof Error) { @@ -82,13 +115,14 @@ export const retryUntilCondition = async ( /** * @param {WaitUntilOptions} options + * @returns {WaitUntilOptions & {log?: typeof console.log}} */ const overrideDefaultOptions = options => { const defaultValues = { maxRetries: 6, retryIntervalMs: 3500, - log: console.log, errorMessage: 'Error', + log: console.log, }; return { ...defaultValues, ...options }; @@ -118,14 +152,13 @@ export const waitUntilContractDeployed = ( ) => { const { follow, setTimeout } = ambientAuthority; const getInstances = makeGetInstances(follow); - const { maxRetries, retryIntervalMs, errorMessage, log } = - overrideDefaultOptions(options); + const { errorMessage, ...resolvedOptions } = overrideDefaultOptions(options); return retryUntilCondition( getInstances, instanceObject => Object.keys(instanceObject).includes(contractName), errorMessage, - { maxRetries, retryIntervalMs, log, setTimeout }, + { setTimeout, ...resolvedOptions }, ); }; @@ -156,14 +189,13 @@ const checkCosmosBalance = (balances, threshold) => { export const waitUntilAccountFunded = (destAcct, io, threshold, options) => { const { query, setTimeout } = io; const queryCosmosBalance = makeQueryCosmosBalance(query); - const { maxRetries, retryIntervalMs, errorMessage, log } = - overrideDefaultOptions(options); + const { errorMessage, ...resolvedOptions } = overrideDefaultOptions(options); return retryUntilCondition( async () => queryCosmosBalance(destAcct), balances => checkCosmosBalance(balances, threshold), errorMessage, - { maxRetries, retryIntervalMs, log, setTimeout }, + { setTimeout, ...resolvedOptions }, ); }; @@ -211,14 +243,13 @@ export const waitUntilOfferResult = ( ) => { const { follow, setTimeout } = io; const queryWallet = makeQueryWallet(follow); - const { maxRetries, retryIntervalMs, errorMessage, log } = - overrideDefaultOptions(options); + const { errorMessage, ...resolvedOptions } = overrideDefaultOptions(options); return retryUntilCondition( async () => queryWallet(addr), status => checkOfferState(status, waitForPayouts, offerId), errorMessage, - { maxRetries, retryIntervalMs, log, setTimeout }, + { reusePromise: true, setTimeout, ...resolvedOptions }, ); }; @@ -247,13 +278,12 @@ const checkForInvitation = update => { export const waitUntilInvitationReceived = (addr, io, options) => { const { follow, setTimeout } = io; const queryWallet = makeQueryWallet(follow); - const { maxRetries, retryIntervalMs, errorMessage, log } = - overrideDefaultOptions(options); + const { errorMessage, ...resolvedOptions } = overrideDefaultOptions(options); return retryUntilCondition( async () => queryWallet(addr), checkForInvitation, errorMessage, - { maxRetries, retryIntervalMs, log, setTimeout }, + { reusePromise: true, setTimeout, ...resolvedOptions }, ); }; From 2ced1d57817e012935e3788e1b4c5356517eade3 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 18:42:22 -0500 Subject: [PATCH 3/9] chore(a3p-integration): Increase the verbosity of psmSwap --- .../z:acceptance/test-lib/psm-lib.js | 34 +++- packages/agoric-cli/src/commands/wallet.js | 33 +++- packages/agoric-cli/src/lib/chain.js | 2 +- packages/internal/src/index.js | 1 + packages/internal/src/node-utils.js | 154 ++++++++++++++++++ .../test/snapshots/exports.test.js.md | 2 + .../test/snapshots/exports.test.js.snap | Bin 664 -> 678 bytes 7 files changed, 211 insertions(+), 15 deletions(-) create mode 100644 packages/internal/src/node-utils.js diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index c568230bbb6..13eeb4b209c 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -8,6 +8,7 @@ import { waitUntilOfferResult, } from '@agoric/client-utils'; import { AmountMath } from '@agoric/ertp'; +import { makeRunCommand, commandResultData } from '@agoric/internal'; import { addUser, agd, @@ -22,14 +23,20 @@ import { mkTemp, VALIDATORADDR, } from '@agoric/synthetic-chain'; +import { spawn } from 'node:child_process'; import fsp from 'node:fs/promises'; +import { Readable } from 'node:stream'; import { NonNullish } from './errors.js'; import { getBalances } from './utils.js'; +/** @import {CommandResult} from '@agoric/internal'; */ + // Export these from synthetic-chain? const USDC_DENOM = NonNullish(process.env.USDC_DENOM); const PSM_PAIR = NonNullish(process.env.PSM_PAIR).replace('.', '-'); +const runCommand = makeRunCommand({ Buffer, Readable, setImmediate, spawn }); + /** * @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js'; */ @@ -356,27 +363,31 @@ export const initializeNewUser = async (name, fund, io) => { }; /** - * Similar to https://github.com/Agoric/agoric-3-proposals/blob/422b163fecfcf025d53431caebf6d476778b5db3/packages/synthetic-chain/src/lib/commonUpgradeHelpers.ts#L123-L139 - * However, in the case where "address" is not provisioned "agoric wallet send" is needed because - * "agops perf satisfaction" tries to follow ":published.wallet.${address}" which blocks the execution because no such path exists in - * vstorage. In situations like this "agoric wallet send" seems a better choice as it doesn't depend on following user's vstorage wallet path + * Similar to + * https://github.com/Agoric/agoric-3-proposals/blob/422b163fecfcf025d53431caebf6d476778b5db3/packages/synthetic-chain/src/lib/commonUpgradeHelpers.ts#L123-L139 + * However, for an address that is not provisioned, `agoric wallet send` is + * needed because `agops perf satisfaction` hangs when trying to follow + * nonexistent vstorage path ":published.wallet.${address}". * * @param {string} address * @param {Promise} offerPromise + * @returns {Promise} */ export const sendOfferAgoric = async (address, offerPromise) => { const offerPath = await mkTemp('agops.XXX'); const offer = await offerPromise; await fsp.writeFile(offerPath, offer); - await agoric.wallet( + return runCommand('agoric', [ + 'wallet', '--keyring-backend=test', 'send', '--offer', offerPath, '--from', address, - ); + '--verbose', + ]); }; /** @@ -393,7 +404,16 @@ export const psmSwap = async (address, params, io) => { const offerId = `${address}-psm-swap-${now}`; const newParams = ['psm', ...params, '--offerId', offerId]; const offerPromise = executeCommand(agopsLocation, newParams); - await sendOfferAgoric(address, offerPromise); + const sendResult = await sendOfferAgoric(address, offerPromise); + const { status, stdout, stderr, signal, error } = sendResult; + if (status !== 0 || signal || error) { + console.error('psmSwap tx send failed', commandResultData(sendResult)); + throw Error( + `agoric wallet send failed: ${JSON.stringify({ status, signal })}`, + { cause: error }, + ); + } + console.log('psmSwap tx send results', stdout.toString(), stderr.toString()); await waitUntilOfferResult(address, offerId, true, io, { errorMessage: `${offerId} not succeeded`, diff --git a/packages/agoric-cli/src/commands/wallet.js b/packages/agoric-cli/src/commands/wallet.js index d6cac6fb2ee..c0cefc1bc9c 100644 --- a/packages/agoric-cli/src/commands/wallet.js +++ b/packages/agoric-cli/src/commands/wallet.js @@ -135,23 +135,42 @@ export const makeWalletCommand = async command => { ) .requiredOption('--offer [filename]', 'path to file with prepared offer') .option('--dry-run', 'spit out the command instead of running it') + .option('--verbose', 'print command output') .action(function (opts) { - /** @typedef {{ from: string, offer: string, dryRun: boolean }} Opts */ + /** @typedef {{ from: string, offer: string, dryRun: boolean, verbose: boolean }} Opts */ const { dryRun, from, offer, home, + verbose, keyringBackend: backend, } = /** @type {SharedTxOptions & Opts} */ ({ ...wallet.opts(), ...opts }); const offerBody = fs.readFileSync(offer).toString(); - execSwingsetTransaction(['wallet-action', '--allow-spend', offerBody], { - from, - dryRun, - keyring: { home, backend }, - ...networkConfig, - }); + const out = execSwingsetTransaction( + ['wallet-action', '--allow-spend', offerBody, '-ojson'], + { + ...networkConfig, + keyring: { home, backend }, + from, + dryRun, + verbose, + }, + ); + + // see sendAction in {@link ../lib/wallet.js} + if (dryRun || !verbose) return; + try { + const tx = JSON.parse(/** @type {string} */ (out)); + if (tx.code !== 0) { + console.error('failed to send tx', tx); + } + console.log(tx); + } catch (err) { + console.error('unexpected output', JSON.stringify(out)); + throw err; + } }); wallet diff --git a/packages/agoric-cli/src/lib/chain.js b/packages/agoric-cli/src/lib/chain.js index ac8ecd8b0af..d8f76a142e1 100644 --- a/packages/agoric-cli/src/lib/chain.js +++ b/packages/agoric-cli/src/lib/chain.js @@ -82,7 +82,7 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => { stdout.write('\n'); } else { const yesCmd = cmd.concat(['--yes']); - if (verbose) console.log('Executing ', yesCmd); + if (verbose) console.log('Executing ', agdBinary, yesCmd); const out = execFileSync(agdBinary, yesCmd, { encoding: 'utf-8' }); // agd puts this diagnostic on stdout rather than stderr :-/ diff --git a/packages/internal/src/index.js b/packages/internal/src/index.js index 457c35502e3..c4f290845e4 100644 --- a/packages/internal/src/index.js +++ b/packages/internal/src/index.js @@ -7,6 +7,7 @@ export * from './debug.js'; export * from './errors.js'; export * from './utils.js'; export * from './method-tools.js'; +export * from './node-utils.js'; export * from './typeCheck.js'; export * from './typeGuards.js'; diff --git a/packages/internal/src/node-utils.js b/packages/internal/src/node-utils.js new file mode 100644 index 00000000000..87f32d750cc --- /dev/null +++ b/packages/internal/src/node-utils.js @@ -0,0 +1,154 @@ +/// +// @ts-check +// @jessie-check +/** + * @file Node.js utility functions that are compatible with but not dependent + * upon a hardened environment. + */ + +import { makePromiseKit } from '@endo/promise-kit'; + +/** @import {PromiseKit} from '@endo/promise-kit'; */ + +const { stringify } = JSON; + +/** + * @typedef {object} CommandResult + * @property {number | null} status + * @property {Buffer | null} stdout + * @property {Buffer | null} stderr + * @property {string | null} signal + * @property {Error | null} error + */ + +/** + * @param {{ + * Buffer: typeof Buffer; + * Readable: typeof import('node:stream').Readable; + * setImmediate: typeof setImmediate; + * spawn: import('node:child_process').spawn; + * }} powers + */ +export const makeRunCommand = ({ Buffer, Readable, setImmediate, spawn }) => { + /** + * Launch a child process with optional standard input and wait for its + * termination. + * + * @param {string} cmd + * @param {string[]} args + * @param {{ + * input?: Parameters[0]; + * } & Parameters[2]} [options] + * @returns {Promise< + * CommandResult & + * ({ error: Error } | { status: number } | { signal: string }) + * >} + */ + const runCommand = async (cmd, args, { input, ...options } = {}) => { + const child = spawn(cmd, args, options); + /** @type {{ stdout: Buffer[]; stderr: Buffer[] }} */ + const outChunks = { stdout: [], stderr: [] }; + const exitKit = makePromiseKit(); + const inKit = child.stdin && makePromiseKit(); + const outKit = child.stdout && makePromiseKit(); + const errKit = child.stderr && makePromiseKit(); + // cf. https://nodejs.org/docs/latest/api/child_process.html#child_processspawnsynccommand-args-options + /** @type {CommandResult} */ + const result = { + status: null, + stdout: null, + stderr: null, + signal: null, + error: null, + }; + child.on('error', err => { + result.error = err; + // An exit event *might* be coming, so wait a tick. + setImmediate(() => exitKit.resolve('done')); + }); + child.on('exit', (exitCode, signal) => { + if (!Object.isFrozen(result)) { + result.status = exitCode; + result.signal = signal; + } + exitKit.resolve('done'); + }); + /** + * @type {( + * emitter: + * | import('node:stream').Readable + * | import('node:stream').Writable, + * kit: PromiseKit, + * msg: string, + * ) => void} + */ + const rejectOnError = (emitter, kit, msg) => { + emitter.on('error', err => kit.reject(Error(msg, { cause: err }))); + }; + /** + * @typedef {[ + * string, + * import('node:stream').Readable | null, + * Buffer[], + * PromiseKit, + * ]} ReadableKit + */ + for (const [label, stream, chunks, kit] of /** @type {ReadableKit[]} */ ([ + ['stdout', child.stdout, outChunks.stdout, outKit], + ['stderr', child.stderr, outChunks.stderr, errKit], + ])) { + if (!stream) { + continue; + } + rejectOnError( + stream, + kit, + `failed reading from ${stringify(cmd)} ${label}`, + ); + stream.on('data', chunk => chunks.push(chunk)); + stream.on('end', () => kit.resolve('done')); + } + if (child.stdin) { + const actualInKit = /** @type {PromiseKit} */ (inKit); + rejectOnError( + child.stdin, + actualInKit, + `failed writing to ${stringify(cmd)} stdin`, + ); + Readable.from(input || []).pipe(child.stdin); + child.stdin.on('finish', () => actualInKit.resolve('done')); + } else if (input) { + throw Error(`missing ${stringify(cmd)} stdin`); + } + await Promise.all( + [exitKit, inKit, outKit, errKit].map(kit => kit?.promise), + ); + if (outKit) { + result.stdout = Buffer.concat(outChunks.stdout); + } + if (errKit) { + result.stderr = Buffer.concat(outChunks.stderr); + } + Object.freeze(result); + // @ts-expect-error result really is a CommandResult + return result; + }; + return runCommand; +}; + +/** + * Decode stdout and/or stderr buffers. + * + * @param {CommandResult} commandResult + * @returns {Pick & { + * stdout: string | null; + * stderr: string | null; + * }} + */ +export const commandResultData = commandResult => ({ + status: commandResult.status, + stdout: commandResult.stdout?.toString() ?? null, + stderr: commandResult.stderr?.toString() ?? null, + signal: commandResult.signal, + error: commandResult.error, +}); diff --git a/packages/internal/test/snapshots/exports.test.js.md b/packages/internal/test/snapshots/exports.test.js.md index 683deeab0dc..eec22407552 100644 --- a/packages/internal/test/snapshots/exports.test.js.md +++ b/packages/internal/test/snapshots/exports.test.js.md @@ -23,6 +23,7 @@ Generated by [AVA](https://avajs.dev). 'assertAllDefined', 'bindAllMethods', 'cast', + 'commandResultData', 'deepMapObject', 'deeplyFulfilledObject', 'forever', @@ -30,6 +31,7 @@ Generated by [AVA](https://avajs.dev). 'getMethodNames', 'getStringMethodNames', 'makeMeasureSeconds', + 'makeRunCommand', 'makeTracer', 'mustMatch', 'objectMap', diff --git a/packages/internal/test/snapshots/exports.test.js.snap b/packages/internal/test/snapshots/exports.test.js.snap index a4732587e9f76b1e7e73450cca3f44570a587173..035108d95ef0e50cdc93a69208056542fbe0de59 100644 GIT binary patch literal 678 zcmV;X0$Ke*RzV98T)9+RC4tq$?rTz_ zV}dR-kspf)00000000ARlFM#WF%X9BCcTn2O)r#tVZj0xJOk-XL?}tsq(z7Ya*rn` zratz;_MxOJx?&IF0m=fg0-l4*W0XB_z=U?(f{64f(fR)P%#7!#x2tWk=MUdQP(cGI zBjKg;M&!P4gFifyQUvk1{I0~t+3>?B_^prl{R#Po93wNFvAakM$&ok67vwwg3#p7S zb`NPG5_ye$Kz<-Uk;xKccaS#Xk+;Za1GDom0s<*@+dWWC{&QW`xYrs`Z)m4Wq(C z7RPwmx^vcf%8XKGwiB!qDYUGFPG96eiLsd2 zHfbT81o;4T4z59o@z~_fiZFZiB(a4FWG7;UkA&6`S|W>QPm-G#Y3d*q0lIFmp$sMm z6q=&YBtG2{x`0^yg;<;L9$df%*Py2i#Q9VxF|&)Cg}w=)Z)H4TntVACKGr-#Piu+I zGGXKv_(F#@+(e30DKaeq@}|h!yU!qrC(M#w9BMt-D0EL@`||Htjbh_H>)-`A5_7SF z9^T!yQO^rlH^Hg1=I3K;DTI@@hO>=+f&2pc4*u1o|4A*zCCS7dG(q^nK?f3R&W3a` zzG;}*D$MH1RLC#ID<1l;6UkX4m*VYZg%3>;lDMCjqq2X7fI zFiGE8qYglJAuiUncr&6zS3}B-H7YBuRlr~QIo-XC^#+| z+v3irk{^o*00000000ARlFM!rF%*V>&!ksc(ljmQj)V|zzyqY0r~xIdl(Yy53Ay8w z8B@m&wuh3kK;7~PtY{aAS3oS`DUe{#1F%IXP`d>&D{H<_$NxD#$NfEJvVC`SLSA}B zB(Q09X^P)X9BD9 zJhzl{Pdz(oO3jrT1!*=&GhC@%u1bpOFT`xzIkLW?)H?O0rZ}IuU|igjS~QeulP`>j z73Kr4WZcEf7sKCqK{Rah;nv<$$|9}?ygbHg)GSqBDn;UNZ6Rn=ePii4*#K$*)cV#8 zcC>s}(uVd{o^`eubLZs$WF8ML@_OJ)Ir*-)Qs@7%mf{8s_&&9XyV6pZGNaEXupHlK z?DQ763-{2aa#aMg`;R#>CuA&DNvt+*OX ym)c9!vt>lrB04CfqVwo_+@%BQi*@RgwItRQab3o{Zv-hll*3<3$PuG-1ONd3>^kWH From 0389a21b85c783f70f4a2af30d5ee96ccea5cb47 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 18:43:45 -0500 Subject: [PATCH 4/9] feat(agoric-cli): Block `agoric wallet send` on tx inclusion --- packages/agoric-cli/src/commands/wallet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agoric-cli/src/commands/wallet.js b/packages/agoric-cli/src/commands/wallet.js index c0cefc1bc9c..ef137119b15 100644 --- a/packages/agoric-cli/src/commands/wallet.js +++ b/packages/agoric-cli/src/commands/wallet.js @@ -149,7 +149,7 @@ export const makeWalletCommand = async command => { const offerBody = fs.readFileSync(offer).toString(); const out = execSwingsetTransaction( - ['wallet-action', '--allow-spend', offerBody, '-ojson'], + ['wallet-action', '--allow-spend', offerBody, '-ojson', '-bblock'], { ...networkConfig, keyring: { home, backend }, From 1369e6b870b85a06017df089f0b226e0208135a4 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 18:47:47 -0500 Subject: [PATCH 5/9] test(a3p-integration): Update "swap into IST" to force the default gas limit --- .../proposals/z:acceptance/package.json | 1 + .../proposals/z:acceptance/psm.test.js | 5 +- .../z:acceptance/test-lib/psm-lib.js | 56 +- .../proposals/z:acceptance/yarn.lock | 963 +++++++++++++++++- packages/agoric-cli/src/helpers.js | 2 + 5 files changed, 999 insertions(+), 28 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/package.json b/a3p-integration/proposals/z:acceptance/package.json index 03282e517d3..c9a25480907 100644 --- a/a3p-integration/proposals/z:acceptance/package.json +++ b/a3p-integration/proposals/z:acceptance/package.json @@ -21,6 +21,7 @@ "@endo/far": "^1.1.5", "@endo/init": "^1.1.4", "@endo/marshal": "^1.5.3", + "agoric": "dev", "ava": "^6.1.2", "execa": "^9.3.1", "tsx": "^4.17.0" diff --git a/a3p-integration/proposals/z:acceptance/psm.test.js b/a3p-integration/proposals/z:acceptance/psm.test.js index c902bce305e..45dfaac55b7 100644 --- a/a3p-integration/proposals/z:acceptance/psm.test.js +++ b/a3p-integration/proposals/z:acceptance/psm.test.js @@ -33,6 +33,7 @@ import { initializeNewUser, maxMintBelowLimit, psmSwap, + sendOfferAgd, } from './test-lib/psm-lib.js'; import { getBalances } from './test-lib/utils.js'; @@ -128,7 +129,7 @@ test.serial('initialize new user', async t => { t.pass(); }); -test.serial('swap into IST', async t => { +test.serial('swap into IST using agd with default gas', async t => { const { newUser: { name }, anchor, @@ -161,7 +162,7 @@ test.serial('swap into IST', async t => { '--feePct', wantMintedFeeVal, ], - psmSwapIo, + { ...psmSwapIo, sendOffer: sendOfferAgd }, ); await checkSwapSucceeded(t, metricsBefore, balancesBefore, { diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index 13eeb4b209c..fe7d9286f09 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -1,5 +1,6 @@ /* eslint-env node */ +import { getNetworkConfig } from 'agoric/src/helpers.js'; import { boardSlottingMarshaller, makeFromBoard, @@ -390,21 +391,68 @@ export const sendOfferAgoric = async (address, offerPromise) => { ]); }; +/** + * A variant of {@link sendOfferAgoric} that uses `agd` directly to e.g. + * control gas calculation. + * + * @param {string} address + * @param {Promise} offerPromise + * @returns {Promise} + */ +export const sendOfferAgd = async (address, offerPromise) => { + const offer = await offerPromise; + const networkConfig = await getNetworkConfig({ env: process.env, fetch }); + const { chainName, rpcAddrs } = networkConfig; + const args = [ + `--node=${rpcAddrs[0]}`, + `--chain-id=${chainName}`, + `--keyring-backend=test`, + `--from=${address}`, + 'tx', + 'swingset', + 'wallet-action', + '--allow-spend', + offer, + '-bblock', + '--yes', + '-ojson', + ]; + const result = await runCommand('agd', args); + // Mimic --verbose + // https://github.com/Agoric/agoric-sdk/blob/master/packages/agoric-cli/src/lib/wallet.js + if (result.status === 0 && !result.signal && !result.error) { + const out = result.stdout.toString(); + try { + const tx = JSON.parse(out); + if (tx.code !== 0) { + console.error('failed to send tx', tx); + return { ...result, error: Error(`code ${tx.code}`) }; + } + console.log(tx); + } catch (err) { + console.error('unexpected output', JSON.stringify(out)); + return { ...result, error: err }; + } + } + return result; +}; + /** * @param {string} address * @param {Array} params * @param {{ * follow: (...params: string[]) => Promise; + * sendOffer?: (address: string, offerPromise: Promise) => Promise; * setTimeout: typeof global.setTimeout; * now: () => number * }} io */ export const psmSwap = async (address, params, io) => { - const now = io.now(); - const offerId = `${address}-psm-swap-${now}`; + const { now, sendOffer = sendOfferAgoric, ...waitIO } = io; + const offerId = `${address}-psm-swap-${now()}`; const newParams = ['psm', ...params, '--offerId', offerId]; const offerPromise = executeCommand(agopsLocation, newParams); - const sendResult = await sendOfferAgoric(address, offerPromise); + const sendResult = await sendOffer(address, offerPromise); const { status, stdout, stderr, signal, error } = sendResult; if (status !== 0 || signal || error) { console.error('psmSwap tx send failed', commandResultData(sendResult)); @@ -415,7 +463,7 @@ export const psmSwap = async (address, params, io) => { } console.log('psmSwap tx send results', stdout.toString(), stderr.toString()); - await waitUntilOfferResult(address, offerId, true, io, { + await waitUntilOfferResult(address, offerId, true, waitIO, { errorMessage: `${offerId} not succeeded`, }); }; diff --git a/a3p-integration/proposals/z:acceptance/yarn.lock b/a3p-integration/proposals/z:acceptance/yarn.lock index 85e82e2435c..744dce4afda 100644 --- a/a3p-integration/proposals/z:acceptance/yarn.lock +++ b/a3p-integration/proposals/z:acceptance/yarn.lock @@ -5,6 +5,16 @@ __metadata: version: 8 cacheKey: 10c0 +"@agoric/access-token@portal:../../agoric-sdk/packages/access-token::locator=root-workspace-0b6124%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@agoric/access-token@portal:../../agoric-sdk/packages/access-token::locator=root-workspace-0b6124%40workspace%3A." + dependencies: + n-readlines: "npm:^1.0.0" + proper-lockfile: "npm:^4.1.2" + tmp: "npm:^0.2.1" + languageName: node + linkType: soft + "@agoric/babel-generator@npm:^7.17.6": version: 7.17.6 resolution: "@agoric/babel-generator@npm:7.17.6" @@ -30,6 +40,19 @@ __metadata: languageName: node linkType: soft +"@agoric/cache@portal:../../agoric-sdk/packages/cache::locator=root-workspace-0b6124%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@agoric/cache@portal:../../agoric-sdk/packages/cache::locator=root-workspace-0b6124%40workspace%3A." + dependencies: + "@agoric/internal": "npm:^0.3.2" + "@agoric/notifier": "npm:^0.6.2" + "@agoric/store": "npm:^0.9.2" + "@agoric/vat-data": "npm:^0.5.2" + "@endo/far": "npm:^1.1.8" + "@endo/marshal": "npm:^1.6.1" + languageName: node + linkType: soft + "@agoric/casting@portal:../../agoric-sdk/packages/casting::locator=root-workspace-0b6124%40workspace%3A.": version: 0.0.0-use.local resolution: "@agoric/casting@portal:../../agoric-sdk/packages/casting::locator=root-workspace-0b6124%40workspace%3A." @@ -543,6 +566,13 @@ __metadata: languageName: node linkType: hard +"@colors/colors@npm:1.6.0": + version: 1.6.0 + resolution: "@colors/colors@npm:1.6.0" + checksum: 10c0/9328a0778a5b0db243af54455b79a69e3fb21122d6c15ef9e9fcc94881d8d17352d8b2b2590f9bdd46fac5c2d6c1636dcfc14358a20c70e22daf89e1a759b629 + languageName: node + linkType: hard + "@confio/ics23@npm:^0.6.8": version: 0.6.8 resolution: "@confio/ics23@npm:0.6.8" @@ -553,6 +583,38 @@ __metadata: languageName: node linkType: hard +"@confio/relayer@npm:^0.11.3": + version: 0.11.3 + resolution: "@confio/relayer@npm:0.11.3" + dependencies: + "@cosmjs/cosmwasm-stargate": "npm:^0.32.1" + "@cosmjs/crypto": "npm:^0.32.1" + "@cosmjs/encoding": "npm:^0.32.1" + "@cosmjs/faucet-client": "npm:^0.32.1" + "@cosmjs/math": "npm:^0.32.1" + "@cosmjs/proto-signing": "npm:^0.32.1" + "@cosmjs/stargate": "npm:^0.32.1" + "@cosmjs/stream": "npm:^0.32.1" + "@cosmjs/tendermint-rpc": "npm:^0.32.1" + "@cosmjs/utils": "npm:^0.32.1" + ajv: "npm:7.1.1" + axios: "npm:^1.6.7" + commander: "npm:7.1.0" + cosmjs-types: "npm:^0.9.0" + fast-safe-stringify: "npm:2.0.4" + js-yaml: "npm:4.0.0" + lodash: "npm:4.17.21" + prom-client: "npm:13.1.0" + table: "npm:^6.7.1" + triple-beam: "npm:1.3.0" + winston: "npm:3.3.3" + bin: + ibc-relayer: build/binary/ibc-relayer/index.js + ibc-setup: build/binary/ibc-setup/index.js + checksum: 10c0/f6519a21a7e2b7d79835558305bbac6f6712b90f0e10f2c156ae74583ca170da0b97ec456272c25a2ffdcbe0343ad425e67886b792f2aed1f5303e34b93edf40 + languageName: node + linkType: hard + "@cosmjs/amino@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/amino@npm:0.32.4" @@ -565,7 +627,25 @@ __metadata: languageName: node linkType: hard -"@cosmjs/crypto@npm:^0.32.4": +"@cosmjs/cosmwasm-stargate@npm:^0.32.1": + version: 0.32.4 + resolution: "@cosmjs/cosmwasm-stargate@npm:0.32.4" + dependencies: + "@cosmjs/amino": "npm:^0.32.4" + "@cosmjs/crypto": "npm:^0.32.4" + "@cosmjs/encoding": "npm:^0.32.4" + "@cosmjs/math": "npm:^0.32.4" + "@cosmjs/proto-signing": "npm:^0.32.4" + "@cosmjs/stargate": "npm:^0.32.4" + "@cosmjs/tendermint-rpc": "npm:^0.32.4" + "@cosmjs/utils": "npm:^0.32.4" + cosmjs-types: "npm:^0.9.0" + pako: "npm:^2.0.2" + checksum: 10c0/f7e285c51ef8b1098a9ea5ca2546a1e226b4fa0a990d95faa6f3b752f3638b6c55f36a56b6f4b11f0a66fd61e3ae8772921d8e99418218df0b2205efe1c82f37 + languageName: node + linkType: hard + +"@cosmjs/crypto@npm:^0.32.1, @cosmjs/crypto@npm:^0.32.3, @cosmjs/crypto@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/crypto@npm:0.32.4" dependencies: @@ -580,7 +660,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/encoding@npm:^0.32.3, @cosmjs/encoding@npm:^0.32.4": +"@cosmjs/encoding@npm:^0.32.1, @cosmjs/encoding@npm:^0.32.3, @cosmjs/encoding@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/encoding@npm:0.32.4" dependencies: @@ -591,6 +671,15 @@ __metadata: languageName: node linkType: hard +"@cosmjs/faucet-client@npm:^0.32.1": + version: 0.32.4 + resolution: "@cosmjs/faucet-client@npm:0.32.4" + dependencies: + axios: "npm:^1.6.0" + checksum: 10c0/1651cb370eb5fa2b12b6f94e06d1dc9a6306e34cad3fc87d9263d8b8a225d500449e10a9f6e326534f65261778208dab7fada6a70efb63195589ad08f58e1008 + languageName: node + linkType: hard + "@cosmjs/json-rpc@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/json-rpc@npm:0.32.4" @@ -601,7 +690,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/math@npm:^0.32.4": +"@cosmjs/math@npm:^0.32.1, @cosmjs/math@npm:^0.32.3, @cosmjs/math@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/math@npm:0.32.4" dependencies: @@ -610,7 +699,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/proto-signing@npm:^0.32.3, @cosmjs/proto-signing@npm:^0.32.4": +"@cosmjs/proto-signing@npm:^0.32.1, @cosmjs/proto-signing@npm:^0.32.3, @cosmjs/proto-signing@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/proto-signing@npm:0.32.4" dependencies: @@ -636,7 +725,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/stargate@npm:^0.32.3": +"@cosmjs/stargate@npm:^0.32.1, @cosmjs/stargate@npm:^0.32.3, @cosmjs/stargate@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/stargate@npm:0.32.4" dependencies: @@ -654,7 +743,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/stream@npm:^0.32.4": +"@cosmjs/stream@npm:^0.32.1, @cosmjs/stream@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/stream@npm:0.32.4" dependencies: @@ -663,7 +752,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/tendermint-rpc@npm:^0.32.3, @cosmjs/tendermint-rpc@npm:^0.32.4": +"@cosmjs/tendermint-rpc@npm:^0.32.1, @cosmjs/tendermint-rpc@npm:^0.32.3, @cosmjs/tendermint-rpc@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/tendermint-rpc@npm:0.32.4" dependencies: @@ -681,13 +770,24 @@ __metadata: languageName: node linkType: hard -"@cosmjs/utils@npm:^0.32.4": +"@cosmjs/utils@npm:^0.32.1, @cosmjs/utils@npm:^0.32.4": version: 0.32.4 resolution: "@cosmjs/utils@npm:0.32.4" checksum: 10c0/d5ff8b235094be1150853a715116049f73eb5cdfeea8ce8e22ecccc61ec99792db457404d4307782b1a2f935dcf438f5c485beabfcfbc1dc5df26eb6e6da9062 languageName: node linkType: hard +"@dabh/diagnostics@npm:^2.0.2": + version: 2.0.3 + resolution: "@dabh/diagnostics@npm:2.0.3" + dependencies: + colorspace: "npm:1.1.x" + enabled: "npm:2.0.x" + kuler: "npm:^2.0.0" + checksum: 10c0/a5133df8492802465ed01f2f0a5784585241a1030c362d54a602ed1839816d6c93d71dde05cf2ddb4fd0796238c19774406bd62fa2564b637907b495f52425fe + languageName: node + linkType: hard + "@endo/base64@npm:^1.0.8": version: 1.0.8 resolution: "@endo/base64@npm:1.0.8" @@ -1161,6 +1261,13 @@ __metadata: languageName: node linkType: hard +"@iarna/toml@npm:^2.2.3": + version: 2.2.5 + resolution: "@iarna/toml@npm:2.2.5" + checksum: 10c0/d095381ad4554aca233b7cf5a91f243ef619e5e15efd3157bc640feac320545450d14b394aebbf6f02a2047437ced778ae598d5879a995441ab7b6c0b2c2f201 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -1518,6 +1625,13 @@ __metadata: languageName: node linkType: hard +"@types/triple-beam@npm:^1.3.2": + version: 1.3.5 + resolution: "@types/triple-beam@npm:1.3.5" + checksum: 10c0/d5d7f25da612f6d79266f4f1bb9c1ef8f1684e9f60abab251e1261170631062b656ba26ff22631f2760caeafd372abc41e64867cde27fba54fafb73a35b9056a + languageName: node + linkType: hard + "@vercel/nft@npm:^0.27.5": version: 0.27.5 resolution: "@vercel/nft@npm:0.27.5" @@ -1609,6 +1723,93 @@ __metadata: languageName: node linkType: hard +"agoric@portal:../../agoric-sdk/packages/agoric-cli::locator=root-workspace-0b6124%40workspace%3A.": + version: 0.0.0-use.local + resolution: "agoric@portal:../../agoric-sdk/packages/agoric-cli::locator=root-workspace-0b6124%40workspace%3A." + dependencies: + "@agoric/access-token": "npm:^0.4.21" + "@agoric/cache": "npm:^0.3.2" + "@agoric/casting": "npm:^0.4.2" + "@agoric/client-utils": "npm:^0.1.0" + "@agoric/cosmic-proto": "npm:^0.4.0" + "@agoric/ertp": "npm:^0.16.2" + "@agoric/governance": "npm:^0.10.3" + "@agoric/inter-protocol": "npm:^0.16.1" + "@agoric/internal": "npm:^0.3.2" + "@agoric/network": "npm:^0.1.0" + "@agoric/smart-wallet": "npm:^0.5.3" + "@agoric/store": "npm:^0.9.2" + "@agoric/swingset-vat": "npm:^0.32.2" + "@agoric/vats": "npm:^0.15.1" + "@agoric/zoe": "npm:^0.26.2" + "@agoric/zone": "npm:^0.2.2" + "@confio/relayer": "npm:^0.11.3" + "@cosmjs/crypto": "npm:^0.32.3" + "@cosmjs/encoding": "npm:^0.32.3" + "@cosmjs/math": "npm:^0.32.3" + "@cosmjs/proto-signing": "npm:^0.32.3" + "@cosmjs/stargate": "npm:^0.32.3" + "@endo/bundle-source": "npm:^3.4.2" + "@endo/captp": "npm:^4.4.2" + "@endo/compartment-mapper": "npm:^1.3.1" + "@endo/env-options": "npm:^1.1.7" + "@endo/errors": "npm:^1.2.7" + "@endo/far": "npm:^1.1.8" + "@endo/init": "npm:^1.1.6" + "@endo/marshal": "npm:^1.6.1" + "@endo/nat": "npm:^5.0.12" + "@endo/patterns": "npm:^1.4.6" + "@endo/promise-kit": "npm:^1.1.7" + "@endo/zip": "npm:^1.0.8" + "@iarna/toml": "npm:^2.2.3" + anylogger: "npm:^0.21.0" + chalk: "npm:^5.2.0" + commander: "npm:^12.1.0" + deterministic-json: "npm:^1.0.5" + esm: "agoric-labs/esm#Agoric-built" + inquirer: "npm:^8.2.2" + opener: "npm:^1.5.2" + tmp: "npm:^0.2.1" + ws: "npm:^7.2.0" + bin: + agops: src/bin-agops.js + agoric: src/entrypoint.js + languageName: node + linkType: soft + +"ajv@npm:7.1.1": + version: 7.1.1 + resolution: "ajv@npm:7.1.1" + dependencies: + fast-deep-equal: "npm:^3.1.1" + json-schema-traverse: "npm:^1.0.0" + require-from-string: "npm:^2.0.2" + uri-js: "npm:^4.2.2" + checksum: 10c0/328a86011a67dc10eff41e3e2ef412f88f5de546ad2288c8a3d2a563c203dd4dd479660c07f99fd9499e36c723afee212704b25f5599815991409528fd638329 + languageName: node + linkType: hard + +"ajv@npm:^8.0.1": + version: 8.17.1 + resolution: "ajv@npm:8.17.1" + dependencies: + fast-deep-equal: "npm:^3.1.3" + fast-uri: "npm:^3.0.1" + json-schema-traverse: "npm:^1.0.0" + require-from-string: "npm:^2.0.2" + checksum: 10c0/ec3ba10a573c6b60f94639ffc53526275917a2df6810e4ab5a6b959d87459f9ef3f00d5e7865b82677cb7d21590355b34da14d1d0b9c32d75f95a187e76fff35 + languageName: node + linkType: hard + +"ansi-escapes@npm:^4.2.1": + version: 4.3.2 + resolution: "ansi-escapes@npm:4.3.2" + dependencies: + type-fest: "npm:^0.21.3" + checksum: 10c0/da917be01871525a3dfcf925ae2977bc59e8c513d4423368645634bf5d4ceba5401574eb705c1e92b79f7292af5a656f78c5725a4b0e1cec97c4b413705c1d50 + languageName: node + linkType: hard + "ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" @@ -1623,7 +1824,7 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^4.0.0": +"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": version: 4.3.0 resolution: "ansi-styles@npm:4.3.0" dependencies: @@ -1672,6 +1873,13 @@ __metadata: languageName: node linkType: hard +"argparse@npm:^2.0.1": + version: 2.0.1 + resolution: "argparse@npm:2.0.1" + checksum: 10c0/c5640c2d89045371c7cedd6a70212a04e360fd34d6edeae32f6952c63949e3525ea77dbec0289d8213a99bbaeab5abfa860b5c12cf88a2e6cf8106e90dd27a7e + languageName: node + linkType: hard + "array-find-index@npm:^1.0.1": version: 1.0.2 resolution: "array-find-index@npm:1.0.2" @@ -1693,6 +1901,13 @@ __metadata: languageName: node linkType: hard +"astral-regex@npm:^2.0.0": + version: 2.0.0 + resolution: "astral-regex@npm:2.0.0" + checksum: 10c0/f63d439cc383db1b9c5c6080d1e240bd14dae745f15d11ec5da863e182bbeca70df6c8191cffef5deba0b566ef98834610a68be79ac6379c95eeb26e1b310e25 + languageName: node + linkType: hard + "async-sema@npm:^3.1.1": version: 3.1.1 resolution: "async-sema@npm:3.1.1" @@ -1700,6 +1915,13 @@ __metadata: languageName: node linkType: hard +"async@npm:^3.1.0": + version: 3.2.6 + resolution: "async@npm:3.2.6" + checksum: 10c0/36484bb15ceddf07078688d95e27076379cc2f87b10c03b6dd8a83e89475a3c8df5848859dd06a4c95af1e4c16fc973de0171a77f18ea00be899aca2a4f85e70 + languageName: node + linkType: hard + "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -1762,7 +1984,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.6.0": +"axios@npm:^1.6.0, axios@npm:^1.6.7": version: 1.7.7 resolution: "axios@npm:1.7.7" dependencies: @@ -1814,7 +2036,14 @@ __metadata: languageName: node linkType: hard -"bl@npm:^4.0.3": +"bintrees@npm:1.0.2": + version: 1.0.2 + resolution: "bintrees@npm:1.0.2" + checksum: 10c0/132944b20c93c1a8f97bf8aa25980a76c6eb4291b7f2df2dbcd01cb5b417c287d3ee0847c7260c9f05f3d5a4233aaa03dec95114e97f308abe9cc3f72bed4a44 + languageName: node + linkType: hard + +"bl@npm:^4.0.3, bl@npm:^4.1.0": version: 4.1.0 resolution: "bl@npm:4.1.0" dependencies: @@ -1918,6 +2147,19 @@ __metadata: languageName: node linkType: hard +"call-bind@npm:^1.0.5": + version: 1.0.7 + resolution: "call-bind@npm:1.0.7" + dependencies: + es-define-property: "npm:^1.0.0" + es-errors: "npm:^1.3.0" + function-bind: "npm:^1.1.2" + get-intrinsic: "npm:^1.2.4" + set-function-length: "npm:^1.2.1" + checksum: 10c0/a3ded2e423b8e2a265983dba81c27e125b48eefb2655e7dfab6be597088da3d47c47976c24bc51b8fd9af1061f8f87b4ab78a314f3c77784b2ae2ba535ad8b8d + languageName: node + linkType: hard + "callsites@npm:^4.2.0": version: 4.2.0 resolution: "callsites@npm:4.2.0" @@ -1934,13 +2176,30 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^5.3.0": +"chalk@npm:^4.1.0, chalk@npm:^4.1.1": + version: 4.1.2 + resolution: "chalk@npm:4.1.2" + dependencies: + ansi-styles: "npm:^4.1.0" + supports-color: "npm:^7.1.0" + checksum: 10c0/4a3fef5cc34975c898ffe77141450f679721df9dde00f6c304353fa9c8b571929123b26a0e4617bde5018977eb655b31970c297b91b63ee83bb82aeb04666880 + languageName: node + linkType: hard + +"chalk@npm:^5.2.0, chalk@npm:^5.3.0": version: 5.3.0 resolution: "chalk@npm:5.3.0" checksum: 10c0/8297d436b2c0f95801103ff2ef67268d362021b8210daf8ddbe349695333eb3610a71122172ff3b0272f1ef2cf7cc2c41fdaa4715f52e49ffe04c56340feed09 languageName: node linkType: hard +"chardet@npm:^0.7.0": + version: 0.7.0 + resolution: "chardet@npm:0.7.0" + checksum: 10c0/96e4731b9ec8050cbb56ab684e8c48d6c33f7826b755802d14e3ebfdc51c57afeece3ea39bc6b09acc359e4363525388b915e16640c1378053820f5e70d0f27d + languageName: node + linkType: hard + "chownr@npm:^1.1.1": version: 1.1.4 resolution: "chownr@npm:1.1.4" @@ -1983,6 +2242,22 @@ __metadata: languageName: node linkType: hard +"cli-cursor@npm:^3.1.0": + version: 3.1.0 + resolution: "cli-cursor@npm:3.1.0" + dependencies: + restore-cursor: "npm:^3.1.0" + checksum: 10c0/92a2f98ff9037d09be3dfe1f0d749664797fb674bf388375a2207a1203b69d41847abf16434203e0089212479e47a358b13a0222ab9fccfe8e2644a7ccebd111 + languageName: node + linkType: hard + +"cli-spinners@npm:^2.5.0": + version: 2.9.2 + resolution: "cli-spinners@npm:2.9.2" + checksum: 10c0/907a1c227ddf0d7a101e7ab8b300affc742ead4b4ebe920a5bf1bc6d45dce2958fcd195eb28fa25275062fe6fa9b109b93b63bc8033396ed3bcb50297008b3a3 + languageName: node + linkType: hard + "cli-truncate@npm:^4.0.0": version: 4.0.0 resolution: "cli-truncate@npm:4.0.0" @@ -1993,6 +2268,13 @@ __metadata: languageName: node linkType: hard +"cli-width@npm:^3.0.0": + version: 3.0.0 + resolution: "cli-width@npm:3.0.0" + checksum: 10c0/125a62810e59a2564268c80fdff56c23159a7690c003e34aeb2e68497dccff26911998ff49c33916fcfdf71e824322cc3953e3f7b48b27267c7a062c81348a9a + languageName: node + linkType: hard + "cliui@npm:^8.0.1": version: 8.0.1 resolution: "cliui@npm:8.0.1" @@ -2004,6 +2286,13 @@ __metadata: languageName: node linkType: hard +"clone@npm:^1.0.2": + version: 1.0.4 + resolution: "clone@npm:1.0.4" + checksum: 10c0/2176952b3649293473999a95d7bebfc9dc96410f6cbd3d2595cf12fd401f63a4bf41a7adbfd3ab2ff09ed60cb9870c58c6acdd18b87767366fabfc163700f13b + languageName: node + linkType: hard + "code-excerpt@npm:^4.0.0": version: 4.0.0 resolution: "code-excerpt@npm:4.0.0" @@ -2013,6 +2302,15 @@ __metadata: languageName: node linkType: hard +"color-convert@npm:^1.9.3": + version: 1.9.3 + resolution: "color-convert@npm:1.9.3" + dependencies: + color-name: "npm:1.1.3" + checksum: 10c0/5ad3c534949a8c68fca8fbc6f09068f435f0ad290ab8b2f76841b9e6af7e0bb57b98cb05b0e19fe33f5d91e5a8611ad457e5f69e0a484caad1f7487fd0e8253c + languageName: node + linkType: hard + "color-convert@npm:^2.0.1": version: 2.0.1 resolution: "color-convert@npm:2.0.1" @@ -2022,13 +2320,30 @@ __metadata: languageName: node linkType: hard -"color-name@npm:~1.1.4": +"color-name@npm:1.1.3": + version: 1.1.3 + resolution: "color-name@npm:1.1.3" + checksum: 10c0/566a3d42cca25b9b3cd5528cd7754b8e89c0eb646b7f214e8e2eaddb69994ac5f0557d9c175eb5d8f0ad73531140d9c47525085ee752a91a2ab15ab459caf6d6 + languageName: node + linkType: hard + +"color-name@npm:^1.0.0, color-name@npm:~1.1.4": version: 1.1.4 resolution: "color-name@npm:1.1.4" checksum: 10c0/a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95 languageName: node linkType: hard +"color-string@npm:^1.6.0": + version: 1.9.1 + resolution: "color-string@npm:1.9.1" + dependencies: + color-name: "npm:^1.0.0" + simple-swizzle: "npm:^0.2.2" + checksum: 10c0/b0bfd74c03b1f837f543898b512f5ea353f71630ccdd0d66f83028d1f0924a7d4272deb278b9aef376cacf1289b522ac3fb175e99895283645a2dc3a33af2404 + languageName: node + linkType: hard + "color-support@npm:^1.1.2": version: 1.1.3 resolution: "color-support@npm:1.1.3" @@ -2038,6 +2353,26 @@ __metadata: languageName: node linkType: hard +"color@npm:^3.1.3": + version: 3.2.1 + resolution: "color@npm:3.2.1" + dependencies: + color-convert: "npm:^1.9.3" + color-string: "npm:^1.6.0" + checksum: 10c0/39345d55825884c32a88b95127d417a2c24681d8b57069413596d9fcbb721459ef9d9ec24ce3e65527b5373ce171b73e38dbcd9c830a52a6487e7f37bf00e83c + languageName: node + linkType: hard + +"colorspace@npm:1.1.x": + version: 1.1.4 + resolution: "colorspace@npm:1.1.4" + dependencies: + color: "npm:^3.1.3" + text-hex: "npm:1.0.x" + checksum: 10c0/af5f91ff7f8e146b96e439ac20ed79b197210193bde721b47380a75b21751d90fa56390c773bb67c0aedd34ff85091883a437ab56861c779bd507d639ba7e123 + languageName: node + linkType: hard + "combined-stream@npm:^1.0.8": version: 1.0.8 resolution: "combined-stream@npm:1.0.8" @@ -2047,6 +2382,20 @@ __metadata: languageName: node linkType: hard +"commander@npm:7.1.0": + version: 7.1.0 + resolution: "commander@npm:7.1.0" + checksum: 10c0/1c114cc2e0c7c980068d7f2472f3fc9129ea5d6f2f0a8699671afe5a44a51d5707a6c73daff1aaa919424284dea9fca4017307d30647935a1116518699d54c9d + languageName: node + linkType: hard + +"commander@npm:^12.1.0": + version: 12.1.0 + resolution: "commander@npm:12.1.0" + checksum: 10c0/6e1996680c083b3b897bfc1cfe1c58dfbcd9842fd43e1aaf8a795fbc237f65efcc860a3ef457b318e73f29a4f4a28f6403c3d653d021d960e4632dd45bde54a9 + languageName: node + linkType: hard + "common-path-prefix@npm:^3.0.0": version: 3.0.0 resolution: "common-path-prefix@npm:3.0.0" @@ -2169,7 +2518,16 @@ __metadata: languageName: node linkType: hard -"define-data-property@npm:^1.0.1": +"defaults@npm:^1.0.3": + version: 1.0.4 + resolution: "defaults@npm:1.0.4" + dependencies: + clone: "npm:^1.0.2" + checksum: 10c0/9cfbe498f5c8ed733775db62dfd585780387d93c17477949e1670bfcfb9346e0281ce8c4bf9f4ac1fc0f9b851113bd6dc9e41182ea1644ccd97de639fa13c35a + languageName: node + linkType: hard + +"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.4": version: 1.1.4 resolution: "define-data-property@npm:1.1.4" dependencies: @@ -2212,6 +2570,15 @@ __metadata: languageName: node linkType: hard +"deterministic-json@npm:^1.0.5": + version: 1.0.5 + resolution: "deterministic-json@npm:1.0.5" + dependencies: + json-stable-stringify: "npm:^1.0.1" + checksum: 10c0/e29679601cd3b05c73665529dcd0132b48797fd7dfbac6793238a479e82b5f3905114316fbb316332da58b4497e35df9aea77b41ff92fd74fe298a6f31b93d40 + languageName: node + linkType: hard + "eastasianwidth@npm:^0.2.0": version: 0.2.0 resolution: "eastasianwidth@npm:0.2.0" @@ -2262,6 +2629,13 @@ __metadata: languageName: node linkType: hard +"enabled@npm:2.0.x": + version: 2.0.0 + resolution: "enabled@npm:2.0.0" + checksum: 10c0/3b2c2af9bc7f8b9e291610f2dde4a75cf6ee52a68f4dd585482fbdf9a55d65388940e024e56d40bb03e05ef6671f5f53021fa8b72a20e954d7066ec28166713f + languageName: node + linkType: hard + "encoding@npm:^0.1.13": version: 0.1.13 resolution: "encoding@npm:0.1.13" @@ -2400,6 +2774,13 @@ __metadata: languageName: node linkType: hard +"escape-string-regexp@npm:^1.0.5": + version: 1.0.5 + resolution: "escape-string-regexp@npm:1.0.5" + checksum: 10c0/a968ad453dd0c2724e14a4f20e177aaf32bb384ab41b674a8454afe9a41c5e6fe8903323e0a1052f56289d04bd600f81278edf140b0fcc02f5cac98d0f5b5371 + languageName: node + linkType: hard + "escape-string-regexp@npm:^2.0.0": version: 2.0.0 resolution: "escape-string-regexp@npm:2.0.0" @@ -2414,6 +2795,13 @@ __metadata: languageName: node linkType: hard +"esm@agoric-labs/esm#Agoric-built": + version: 3.2.25 + resolution: "esm@https://github.com/agoric-labs/esm.git#commit=3603726ad4636b2f865f463188fcaade6375638e" + checksum: 10c0/fc1e112a3a681e7b4152d4f5c76dd5aa9e30496d2020490ffa0fb61aaf57d1e12dae0c1074fdd2e0f08949ab2df7e00e750262356781f072e4119955ee10b754 + languageName: node + linkType: hard + "esprima@npm:^4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" @@ -2479,6 +2867,17 @@ __metadata: languageName: node linkType: hard +"external-editor@npm:^3.0.3": + version: 3.1.0 + resolution: "external-editor@npm:3.1.0" + dependencies: + chardet: "npm:^0.7.0" + iconv-lite: "npm:^0.4.24" + tmp: "npm:^0.0.33" + checksum: 10c0/c98f1ba3efdfa3c561db4447ff366a6adb5c1e2581462522c56a18bf90dfe4da382f9cd1feee3e330108c3595a854b218272539f311ba1b3298f841eb0fbf339 + languageName: node + linkType: hard + "fast-check@npm:^3.0.0": version: 3.22.0 resolution: "fast-check@npm:3.22.0" @@ -2488,6 +2887,13 @@ __metadata: languageName: node linkType: hard +"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": + version: 3.1.3 + resolution: "fast-deep-equal@npm:3.1.3" + checksum: 10c0/40dedc862eb8992c54579c66d914635afbec43350afbbe991235fdcb4e3a8d5af1b23ae7e79bef7d4882d0ecee06c3197488026998fb19f72dc95acff1d1b1d0 + languageName: node + linkType: hard + "fast-diff@npm:^1.2.0": version: 1.3.0 resolution: "fast-diff@npm:1.3.0" @@ -2508,6 +2914,20 @@ __metadata: languageName: node linkType: hard +"fast-safe-stringify@npm:2.0.4": + version: 2.0.4 + resolution: "fast-safe-stringify@npm:2.0.4" + checksum: 10c0/5e4fbafe8b8c4a1681c2ab259ed8ce6672fc209683a141876f020c36a2cbec73bfe25c417c269f439797020996d04ed2d7c4c6b2c5cf393d6febbf7f4d8a5f53 + languageName: node + linkType: hard + +"fast-uri@npm:^3.0.1": + version: 3.0.3 + resolution: "fast-uri@npm:3.0.3" + checksum: 10c0/4b2c5ce681a062425eae4f15cdc8fc151fd310b2f69b1f96680677820a8b49c3cd6e80661a406e19d50f0c40a3f8bffdd458791baf66f4a879d80be28e10a320 + languageName: node + linkType: hard + "fastq@npm:^1.6.0": version: 1.17.1 resolution: "fastq@npm:1.17.1" @@ -2517,6 +2937,22 @@ __metadata: languageName: node linkType: hard +"fecha@npm:^4.2.0": + version: 4.2.3 + resolution: "fecha@npm:4.2.3" + checksum: 10c0/0e895965959cf6a22bb7b00f0bf546f2783836310f510ddf63f463e1518d4c96dec61ab33fdfd8e79a71b4856a7c865478ce2ee8498d560fe125947703c9b1cf + languageName: node + linkType: hard + +"figures@npm:^3.0.0": + version: 3.2.0 + resolution: "figures@npm:3.2.0" + dependencies: + escape-string-regexp: "npm:^1.0.5" + checksum: 10c0/9c421646ede432829a50bc4e55c7a4eb4bcb7cc07b5bab2f471ef1ab9a344595bbebb6c5c21470093fbb730cd81bbca119624c40473a125293f656f49cb47629 + languageName: node + linkType: hard + "figures@npm:^6.1.0": version: 6.1.0 resolution: "figures@npm:6.1.0" @@ -2549,6 +2985,13 @@ __metadata: languageName: node linkType: hard +"fn.name@npm:1.x.x": + version: 1.1.0 + resolution: "fn.name@npm:1.1.0" + checksum: 10c0/8ad62aa2d4f0b2a76d09dba36cfec61c540c13a0fd72e5d94164e430f987a7ce6a743112bbeb14877c810ef500d1f73d7f56e76d029d2e3413f20d79e3460a9a + languageName: node + linkType: hard + "follow-redirects@npm:^1.15.6": version: 1.15.9 resolution: "follow-redirects@npm:1.15.9" @@ -2787,14 +3230,21 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 languageName: node linkType: hard -"has-property-descriptors@npm:^1.0.0": +"has-flag@npm:^4.0.0": + version: 4.0.0 + resolution: "has-flag@npm:4.0.0" + checksum: 10c0/2e789c61b7888d66993e14e8331449e525ef42aac53c627cc53d1c3334e768bcb6abdc4f5f0de1478a25beec6f0bd62c7549058b7ac53e924040d4f301f02fd1 + languageName: node + linkType: hard + +"has-property-descriptors@npm:^1.0.0, has-property-descriptors@npm:^1.0.2": version: 1.0.2 resolution: "has-property-descriptors@npm:1.0.2" dependencies: @@ -2898,6 +3348,15 @@ __metadata: languageName: node linkType: hard +"iconv-lite@npm:^0.4.24": + version: 0.4.24 + resolution: "iconv-lite@npm:0.4.24" + dependencies: + safer-buffer: "npm:>= 2.1.2 < 3" + checksum: 10c0/c6886a24cc00f2a059767440ec1bc00d334a89f250db8e0f7feb4961c8727118457e27c495ba94d082e51d3baca378726cd110aaf7ded8b9bbfd6a44760cf1d4 + languageName: node + linkType: hard + "iconv-lite@npm:^0.6.2": version: 0.6.3 resolution: "iconv-lite@npm:0.6.3" @@ -2980,6 +3439,29 @@ __metadata: languageName: node linkType: hard +"inquirer@npm:^8.2.2": + version: 8.2.6 + resolution: "inquirer@npm:8.2.6" + dependencies: + ansi-escapes: "npm:^4.2.1" + chalk: "npm:^4.1.1" + cli-cursor: "npm:^3.1.0" + cli-width: "npm:^3.0.0" + external-editor: "npm:^3.0.3" + figures: "npm:^3.0.0" + lodash: "npm:^4.17.21" + mute-stream: "npm:0.0.8" + ora: "npm:^5.4.1" + run-async: "npm:^2.4.0" + rxjs: "npm:^7.5.5" + string-width: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + through: "npm:^2.3.6" + wrap-ansi: "npm:^6.0.1" + checksum: 10c0/eb5724de1778265323f3a68c80acfa899378cb43c24cdcb58661386500e5696b6b0b6c700e046b7aa767fe7b4823c6f04e6ddc268173e3f84116112529016296 + languageName: node + linkType: hard + "ip-address@npm:^9.0.5": version: 9.0.5 resolution: "ip-address@npm:9.0.5" @@ -2997,6 +3479,13 @@ __metadata: languageName: node linkType: hard +"is-arrayish@npm:^0.3.1": + version: 0.3.2 + resolution: "is-arrayish@npm:0.3.2" + checksum: 10c0/f59b43dc1d129edb6f0e282595e56477f98c40278a2acdc8b0a5c57097c9eff8fe55470493df5775478cf32a4dc8eaf6d3a749f07ceee5bc263a78b2434f6a54 + languageName: node + linkType: hard + "is-builtin-module@npm:^3.1.0": version: 3.2.1 resolution: "is-builtin-module@npm:3.2.1" @@ -3045,6 +3534,13 @@ __metadata: languageName: node linkType: hard +"is-interactive@npm:^1.0.0": + version: 1.0.0 + resolution: "is-interactive@npm:1.0.0" + checksum: 10c0/dd47904dbf286cd20aa58c5192161be1a67138485b9836d5a70433b21a45442e9611b8498b8ab1f839fc962c7620667a50535fdfb4a6bc7989b8858645c06b4d + languageName: node + linkType: hard + "is-lambda@npm:^1.0.1": version: 1.0.1 resolution: "is-lambda@npm:1.0.1" @@ -3096,6 +3592,13 @@ __metadata: languageName: node linkType: hard +"is-stream@npm:^2.0.0": + version: 2.0.1 + resolution: "is-stream@npm:2.0.1" + checksum: 10c0/7c284241313fc6efc329b8d7f08e16c0efeb6baab1b4cd0ba579eb78e5af1aa5da11e68559896a2067cd6c526bd29241dda4eb1225e627d5aa1a89a76d4635a5 + languageName: node + linkType: hard + "is-stream@npm:^4.0.1": version: 4.0.1 resolution: "is-stream@npm:4.0.1" @@ -3103,6 +3606,13 @@ __metadata: languageName: node linkType: hard +"is-unicode-supported@npm:^0.1.0": + version: 0.1.0 + resolution: "is-unicode-supported@npm:0.1.0" + checksum: 10c0/00cbe3455c3756be68d2542c416cab888aebd5012781d6819749fefb15162ff23e38501fe681b3d751c73e8ff561ac09a5293eba6f58fdf0178462ce6dcb3453 + languageName: node + linkType: hard + "is-unicode-supported@npm:^2.0.0": version: 2.1.0 resolution: "is-unicode-supported@npm:2.1.0" @@ -3110,6 +3620,13 @@ __metadata: languageName: node linkType: hard +"isarray@npm:^2.0.5": + version: 2.0.5 + resolution: "isarray@npm:2.0.5" + checksum: 10c0/4199f14a7a13da2177c66c31080008b7124331956f47bca57dd0b6ea9f11687aa25e565a2c7a2b519bc86988d10398e3049a1f5df13c9f6b7664154690ae79fd + languageName: node + linkType: hard + "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -3169,6 +3686,17 @@ __metadata: languageName: node linkType: hard +"js-yaml@npm:4.0.0": + version: 4.0.0 + resolution: "js-yaml@npm:4.0.0" + dependencies: + argparse: "npm:^2.0.1" + bin: + js-yaml: bin/js-yaml.js + checksum: 10c0/ef8489b87d9796b45df9f0bf3eefbb343b5063e39a9911d7b8ddbd4518cafaf73b49150d1f5865f54ee68719642ff0ab86110b9a332ff88bb05cd3bcf3039de1 + languageName: node + linkType: hard + "js-yaml@npm:^3.14.1": version: 3.14.1 resolution: "js-yaml@npm:3.14.1" @@ -3206,6 +3734,39 @@ __metadata: languageName: node linkType: hard +"json-schema-traverse@npm:^1.0.0": + version: 1.0.0 + resolution: "json-schema-traverse@npm:1.0.0" + checksum: 10c0/71e30015d7f3d6dc1c316d6298047c8ef98a06d31ad064919976583eb61e1018a60a0067338f0f79cabc00d84af3fcc489bd48ce8a46ea165d9541ba17fb30c6 + languageName: node + linkType: hard + +"json-stable-stringify@npm:^1.0.1": + version: 1.1.1 + resolution: "json-stable-stringify@npm:1.1.1" + dependencies: + call-bind: "npm:^1.0.5" + isarray: "npm:^2.0.5" + jsonify: "npm:^0.0.1" + object-keys: "npm:^1.1.1" + checksum: 10c0/3801e3eeccbd030afb970f54bea690a079cfea7d9ed206a1b17ca9367f4b7772c764bf77a48f03e56b50e5f7ee7d11c52339fe20d8d7ccead003e4ca69e4cfde + languageName: node + linkType: hard + +"jsonify@npm:^0.0.1": + version: 0.0.1 + resolution: "jsonify@npm:0.0.1" + checksum: 10c0/7f5499cdd59a0967ed35bda48b7cec43d850bbc8fb955cdd3a1717bb0efadbe300724d5646de765bb7a99fc1c3ab06eb80d93503c6faaf99b4ff50a3326692f6 + languageName: node + linkType: hard + +"kuler@npm:^2.0.0": + version: 2.0.0 + resolution: "kuler@npm:2.0.0" + checksum: 10c0/0a4e99d92ca373f8f74d1dc37931909c4d0d82aebc94cf2ba265771160fc12c8df34eaaac80805efbda367e2795cb1f1dd4c3d404b6b1cf38aec94035b503d2d + languageName: node + linkType: hard + "libsodium-sumo@npm:^0.7.15": version: 0.7.15 resolution: "libsodium-sumo@npm:0.7.15" @@ -3229,13 +3790,44 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.15": +"lodash.truncate@npm:^4.4.2": + version: 4.4.2 + resolution: "lodash.truncate@npm:4.4.2" + checksum: 10c0/4e870d54e8a6c86c8687e057cec4069d2e941446ccab7f40b4d9555fa5872d917d0b6aa73bece7765500a3123f1723bcdba9ae881b679ef120bba9e1a0b0ed70 + languageName: node + linkType: hard + +"lodash@npm:4.17.21, lodash@npm:^4.17.15, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: 10c0/d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c languageName: node linkType: hard +"log-symbols@npm:^4.1.0": + version: 4.1.0 + resolution: "log-symbols@npm:4.1.0" + dependencies: + chalk: "npm:^4.1.0" + is-unicode-supported: "npm:^0.1.0" + checksum: 10c0/67f445a9ffa76db1989d0fa98586e5bc2fd5247260dafb8ad93d9f0ccd5896d53fb830b0e54dade5ad838b9de2006c826831a3c528913093af20dff8bd24aca6 + languageName: node + linkType: hard + +"logform@npm:^2.2.0, logform@npm:^2.7.0": + version: 2.7.0 + resolution: "logform@npm:2.7.0" + dependencies: + "@colors/colors": "npm:1.6.0" + "@types/triple-beam": "npm:^1.3.2" + fecha: "npm:^4.2.0" + ms: "npm:^2.1.1" + safe-stable-stringify: "npm:^2.3.1" + triple-beam: "npm:^1.3.0" + checksum: 10c0/4789b4b37413c731d1835734cb799240d31b865afde6b7b3e06051d6a4127bfda9e88c99cfbf296d084a315ccbed2647796e6a56b66e725bcb268c586f57558f + languageName: node + linkType: hard + "long@npm:^4.0.0": version: 4.0.0 resolution: "long@npm:4.0.0" @@ -3359,6 +3951,13 @@ __metadata: languageName: node linkType: hard +"mimic-fn@npm:^2.1.0": + version: 2.1.0 + resolution: "mimic-fn@npm:2.1.0" + checksum: 10c0/b26f5479d7ec6cc2bce275a08f146cf78f5e7b661b18114e2506dd91ec7ec47e7a25bf4360e5438094db0560bcc868079fb3b1fb3892b833c1ecbf63f80c95a4 + languageName: node + linkType: hard + "mimic-function@npm:^5.0.0": version: 5.0.1 resolution: "mimic-function@npm:5.0.1" @@ -3512,13 +4111,27 @@ __metadata: languageName: node linkType: hard -"ms@npm:^2.1.3": +"ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 languageName: node linkType: hard +"mute-stream@npm:0.0.8": + version: 0.0.8 + resolution: "mute-stream@npm:0.0.8" + checksum: 10c0/18d06d92e5d6d45e2b63c0e1b8f25376af71748ac36f53c059baa8b76ffac31c5ab225480494e7d35d30215ecdb18fed26ec23cafcd2f7733f2f14406bcd19e2 + languageName: node + linkType: hard + +"n-readlines@npm:^1.0.0": + version: 1.0.3 + resolution: "n-readlines@npm:1.0.3" + checksum: 10c0/436c27ac071409314093da35dc3a4c5198c94fb10ad12b1c4d2b3e44bdb634da0a7a8ab0c107c1f4815788cbf5e0c7c180e3037ba3d974f34637cab363a95a74 + languageName: node + linkType: hard + "napi-build-utils@npm:^1.0.1": version: 1.0.2 resolution: "napi-build-utils@npm:1.0.2" @@ -3670,6 +4283,57 @@ __metadata: languageName: node linkType: hard +"one-time@npm:^1.0.0": + version: 1.0.0 + resolution: "one-time@npm:1.0.0" + dependencies: + fn.name: "npm:1.x.x" + checksum: 10c0/6e4887b331edbb954f4e915831cbec0a7b9956c36f4feb5f6de98c448ac02ff881fd8d9b55a6b1b55030af184c6b648f340a76eb211812f4ad8c9b4b8692fdaa + languageName: node + linkType: hard + +"onetime@npm:^5.1.0": + version: 5.1.2 + resolution: "onetime@npm:5.1.2" + dependencies: + mimic-fn: "npm:^2.1.0" + checksum: 10c0/ffcef6fbb2692c3c40749f31ea2e22677a876daea92959b8a80b521d95cca7a668c884d8b2045d1d8ee7d56796aa405c405462af112a1477594cc63531baeb8f + languageName: node + linkType: hard + +"opener@npm:^1.5.2": + version: 1.5.2 + resolution: "opener@npm:1.5.2" + bin: + opener: bin/opener-bin.js + checksum: 10c0/dd56256ab0cf796585617bc28e06e058adf09211781e70b264c76a1dbe16e90f868c974e5bf5309c93469157c7d14b89c35dc53fe7293b0e40b4d2f92073bc79 + languageName: node + linkType: hard + +"ora@npm:^5.4.1": + version: 5.4.1 + resolution: "ora@npm:5.4.1" + dependencies: + bl: "npm:^4.1.0" + chalk: "npm:^4.1.0" + cli-cursor: "npm:^3.1.0" + cli-spinners: "npm:^2.5.0" + is-interactive: "npm:^1.0.0" + is-unicode-supported: "npm:^0.1.0" + log-symbols: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + wcwidth: "npm:^1.0.1" + checksum: 10c0/10ff14aace236d0e2f044193362b22edce4784add08b779eccc8f8ef97195cae1248db8ec1ec5f5ff076f91acbe573f5f42a98c19b78dba8c54eefff983cae85 + languageName: node + linkType: hard + +"os-tmpdir@npm:~1.0.2": + version: 1.0.2 + resolution: "os-tmpdir@npm:1.0.2" + checksum: 10c0/f438450224f8e2687605a8dd318f0db694b6293c5d835ae509a69e97c8de38b6994645337e5577f5001115470414638978cc49da1cdcc25106dad8738dc69990 + languageName: node + linkType: hard + "p-map@npm:^4.0.0": version: 4.0.0 resolution: "p-map@npm:4.0.0" @@ -3703,6 +4367,13 @@ __metadata: languageName: node linkType: hard +"pako@npm:^2.0.2": + version: 2.1.0 + resolution: "pako@npm:2.1.0" + checksum: 10c0/8e8646581410654b50eb22a5dfd71159cae98145bd5086c9a7a816ec0370b5f72b4648d08674624b3870a521e6a3daffd6c2f7bc00fdefc7063c9d8232ff5116 + languageName: node + linkType: hard + "parse-ms@npm:^4.0.0": version: 4.0.0 resolution: "parse-ms@npm:4.0.0" @@ -3823,6 +4494,15 @@ __metadata: languageName: node linkType: hard +"prom-client@npm:13.1.0": + version: 13.1.0 + resolution: "prom-client@npm:13.1.0" + dependencies: + tdigest: "npm:^0.1.1" + checksum: 10c0/0f117e044bdbc7e8fb3a926e16e0e76ff3fb308dbc98fdb084dfa16ad52a0b68cf6a79a31e907b1c4ac9009b1d50848e3e72fb36ed43893291148e1505844fc2 + languageName: node + linkType: hard + "promise-retry@npm:^2.0.1": version: 2.0.1 resolution: "promise-retry@npm:2.0.1" @@ -3833,6 +4513,17 @@ __metadata: languageName: node linkType: hard +"proper-lockfile@npm:^4.1.2": + version: 4.1.2 + resolution: "proper-lockfile@npm:4.1.2" + dependencies: + graceful-fs: "npm:^4.2.4" + retry: "npm:^0.12.0" + signal-exit: "npm:^3.0.2" + checksum: 10c0/2f265dbad15897a43110a02dae55105c04d356ec4ed560723dcb9f0d34bc4fb2f13f79bb930e7561be10278e2314db5aca2527d5d3dcbbdee5e6b331d1571f6d + languageName: node + linkType: hard + "protobufjs@npm:^6.8.8": version: 6.11.4 resolution: "protobufjs@npm:6.11.4" @@ -3874,6 +4565,13 @@ __metadata: languageName: node linkType: hard +"punycode@npm:^2.1.0": + version: 2.3.1 + resolution: "punycode@npm:2.3.1" + checksum: 10c0/14f76a8206bc3464f794fb2e3d3cc665ae416c01893ad7a02b23766eb07159144ee612ad67af5e84fa4479ccfe67678c4feb126b0485651b302babf66f04f9e9 + languageName: node + linkType: hard + "pure-rand@npm:^6.1.0": version: 6.1.0 resolution: "pure-rand@npm:6.1.0" @@ -3902,7 +4600,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0": +"readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0, readable-stream@npm:^3.6.2": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" dependencies: @@ -3927,6 +4625,13 @@ __metadata: languageName: node linkType: hard +"require-from-string@npm:^2.0.2": + version: 2.0.2 + resolution: "require-from-string@npm:2.0.2" + checksum: 10c0/aaa267e0c5b022fc5fd4eef49d8285086b15f2a1c54b28240fdf03599cbd9c26049fee3eab894f2e1f6ca65e513b030a7c264201e3f005601e80c49fb2937ce2 + languageName: node + linkType: hard + "resolve-cwd@npm:^3.0.0": version: 3.0.0 resolution: "resolve-cwd@npm:3.0.0" @@ -3976,6 +4681,16 @@ __metadata: languageName: node linkType: hard +"restore-cursor@npm:^3.1.0": + version: 3.1.0 + resolution: "restore-cursor@npm:3.1.0" + dependencies: + onetime: "npm:^5.1.0" + signal-exit: "npm:^3.0.2" + checksum: 10c0/8051a371d6aa67ff21625fa94e2357bd81ffdc96267f3fb0fc4aaf4534028343836548ef34c240ffa8c25b280ca35eb36be00b3cb2133fa4f51896d7e73c6b4f + languageName: node + linkType: hard + "retry@npm:^0.12.0": version: 0.12.0 resolution: "retry@npm:0.12.0" @@ -4030,6 +4745,7 @@ __metadata: "@endo/far": "npm:^1.1.5" "@endo/init": "npm:^1.1.4" "@endo/marshal": "npm:^1.5.3" + agoric: "npm:dev" ava: "npm:^6.1.2" execa: "npm:^9.3.1" tsx: "npm:^4.17.0" @@ -4037,6 +4753,13 @@ __metadata: languageName: unknown linkType: soft +"run-async@npm:^2.4.0": + version: 2.4.1 + resolution: "run-async@npm:2.4.1" + checksum: 10c0/35a68c8f1d9664f6c7c2e153877ca1d6e4f886e5ca067c25cdd895a6891ff3a1466ee07c63d6a9be306e9619ff7d509494e6d9c129516a36b9fd82263d579ee1 + languageName: node + linkType: hard + "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -4046,6 +4769,15 @@ __metadata: languageName: node linkType: hard +"rxjs@npm:^7.5.5": + version: 7.8.1 + resolution: "rxjs@npm:7.8.1" + dependencies: + tslib: "npm:^2.1.0" + checksum: 10c0/3c49c1ecd66170b175c9cacf5cef67f8914dcbc7cd0162855538d365c83fea631167cacb644b3ce533b2ea0e9a4d0b12175186985f89d75abe73dbd8f7f06f68 + languageName: node + linkType: hard + "safe-buffer@npm:^5.0.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" @@ -4053,7 +4785,14 @@ __metadata: languageName: node linkType: hard -"safer-buffer@npm:>= 2.1.2 < 3.0.0": +"safe-stable-stringify@npm:^2.3.1": + version: 2.5.0 + resolution: "safe-stable-stringify@npm:2.5.0" + checksum: 10c0/baea14971858cadd65df23894a40588ed791769db21bafb7fd7608397dbdce9c5aac60748abae9995e0fc37e15f2061980501e012cd48859740796bea2987f49 + languageName: node + linkType: hard + +"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" checksum: 10c0/7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4 @@ -4103,6 +4842,20 @@ __metadata: languageName: node linkType: hard +"set-function-length@npm:^1.2.1": + version: 1.2.2 + resolution: "set-function-length@npm:1.2.2" + dependencies: + define-data-property: "npm:^1.1.4" + es-errors: "npm:^1.3.0" + function-bind: "npm:^1.1.2" + get-intrinsic: "npm:^1.2.4" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.2" + checksum: 10c0/82850e62f412a258b71e123d4ed3873fa9377c216809551192bb6769329340176f109c2eeae8c22a8d386c76739855f78e8716515c818bcaef384b51110f0f3c + languageName: node + linkType: hard + "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -4119,7 +4872,7 @@ __metadata: languageName: node linkType: hard -"signal-exit@npm:^3.0.0": +"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" checksum: 10c0/25d272fa73e146048565e08f3309d5b942c1979a6f4a58a8c59d5fa299728e9c2fcd1a759ec870863b1fd38653670240cd420dad2ad9330c71f36608a6a1c912 @@ -4151,6 +4904,15 @@ __metadata: languageName: node linkType: hard +"simple-swizzle@npm:^0.2.2": + version: 0.2.2 + resolution: "simple-swizzle@npm:0.2.2" + dependencies: + is-arrayish: "npm:^0.3.1" + checksum: 10c0/df5e4662a8c750bdba69af4e8263c5d96fe4cd0f9fe4bdfa3cbdeb45d2e869dff640beaaeb1ef0e99db4d8d2ec92f85508c269f50c972174851bc1ae5bd64308 + languageName: node + linkType: hard + "slash@npm:^5.1.0": version: 5.1.0 resolution: "slash@npm:5.1.0" @@ -4158,6 +4920,17 @@ __metadata: languageName: node linkType: hard +"slice-ansi@npm:^4.0.0": + version: 4.0.0 + resolution: "slice-ansi@npm:4.0.0" + dependencies: + ansi-styles: "npm:^4.0.0" + astral-regex: "npm:^2.0.0" + is-fullwidth-code-point: "npm:^3.0.0" + checksum: 10c0/6c25678db1270d4793e0327620f1e0f9f5bea4630123f51e9e399191bc52c87d6e6de53ed33538609e5eacbd1fab769fae00f3705d08d029f02102a540648918 + languageName: node + linkType: hard + "slice-ansi@npm:^5.0.0": version: 5.0.0 resolution: "slice-ansi@npm:5.0.0" @@ -4240,6 +5013,13 @@ __metadata: languageName: node linkType: hard +"stack-trace@npm:0.0.x": + version: 0.0.10 + resolution: "stack-trace@npm:0.0.10" + checksum: 10c0/9ff3dabfad4049b635a85456f927a075c9d0c210e3ea336412d18220b2a86cbb9b13ec46d6c37b70a302a4ea4d49e30e5d4944dd60ae784073f1cde778ac8f4b + languageName: node + linkType: hard + "stack-utils@npm:^2.0.6": version: 2.0.6 resolution: "stack-utils@npm:2.0.6" @@ -4335,6 +5115,15 @@ __metadata: languageName: node linkType: hard +"supports-color@npm:^7.1.0": + version: 7.2.0 + resolution: "supports-color@npm:7.2.0" + dependencies: + has-flag: "npm:^4.0.0" + checksum: 10c0/afb4c88521b8b136b5f5f95160c98dee7243dc79d5432db7efc27efb219385bbc7d9427398e43dd6cc730a0f87d5085ce1652af7efbe391327bc0a7d0f7fc124 + languageName: node + linkType: hard + "supports-preserve-symlinks-flag@npm:^1.0.0": version: 1.0.0 resolution: "supports-preserve-symlinks-flag@npm:1.0.0" @@ -4349,6 +5138,19 @@ __metadata: languageName: node linkType: hard +"table@npm:^6.7.1": + version: 6.8.2 + resolution: "table@npm:6.8.2" + dependencies: + ajv: "npm:^8.0.1" + lodash.truncate: "npm:^4.4.2" + slice-ansi: "npm:^4.0.0" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + checksum: 10c0/f8b348af38ee34e419d8ce7306ba00671ce6f20e861ccff22555f491ba264e8416086063ce278a8d81abfa8d23b736ec2cca7ac4029b5472f63daa4b4688b803 + languageName: node + linkType: hard + "tar-fs@npm:^2.0.0": version: 2.1.1 resolution: "tar-fs@npm:2.1.1" @@ -4388,6 +5190,15 @@ __metadata: languageName: node linkType: hard +"tdigest@npm:^0.1.1": + version: 0.1.2 + resolution: "tdigest@npm:0.1.2" + dependencies: + bintrees: "npm:1.0.2" + checksum: 10c0/10187b8144b112fcdfd3a5e4e9068efa42c990b1e30cd0d4f35ee8f58f16d1b41bc587e668fa7a6f6ca31308961cbd06cd5d4a4ae1dc388335902ae04f7d57df + languageName: node + linkType: hard + "temp-dir@npm:^3.0.0": version: 3.0.0 resolution: "temp-dir@npm:3.0.0" @@ -4395,6 +5206,20 @@ __metadata: languageName: node linkType: hard +"text-hex@npm:1.0.x": + version: 1.0.0 + resolution: "text-hex@npm:1.0.0" + checksum: 10c0/57d8d320d92c79d7c03ffb8339b825bb9637c2cbccf14304309f51d8950015c44464b6fd1b6820a3d4821241c68825634f09f5a2d9d501e84f7c6fd14376860d + languageName: node + linkType: hard + +"through@npm:^2.3.6": + version: 2.3.8 + resolution: "through@npm:2.3.8" + checksum: 10c0/4b09f3774099de0d4df26d95c5821a62faee32c7e96fb1f4ebd54a2d7c11c57fe88b0a0d49cf375de5fee5ae6bf4eb56dbbf29d07366864e2ee805349970d3cc + languageName: node + linkType: hard + "time-zone@npm:^1.0.0": version: 1.0.0 resolution: "time-zone@npm:1.0.0" @@ -4402,6 +5227,15 @@ __metadata: languageName: node linkType: hard +"tmp@npm:^0.0.33": + version: 0.0.33 + resolution: "tmp@npm:0.0.33" + dependencies: + os-tmpdir: "npm:~1.0.2" + checksum: 10c0/69863947b8c29cabad43fe0ce65cec5bb4b481d15d4b4b21e036b060b3edbf3bc7a5541de1bacb437bb3f7c4538f669752627fdf9b4aaf034cebd172ba373408 + languageName: node + linkType: hard + "tmp@npm:^0.2.1": version: 0.2.3 resolution: "tmp@npm:0.2.3" @@ -4425,6 +5259,27 @@ __metadata: languageName: node linkType: hard +"triple-beam@npm:1.3.0": + version: 1.3.0 + resolution: "triple-beam@npm:1.3.0" + checksum: 10c0/a6da96495f25b6c04b3629df5161c7eb84760927943f16665fd8dcd3a643daadf73d69eee78306b4b68d606937f22f8703afe763bc8d3723632ffb1f3a798493 + languageName: node + linkType: hard + +"triple-beam@npm:^1.3.0": + version: 1.4.1 + resolution: "triple-beam@npm:1.4.1" + checksum: 10c0/4bf1db71e14fe3ff1c3adbe3c302f1fdb553b74d7591a37323a7badb32dc8e9c290738996cbb64f8b10dc5a3833645b5d8c26221aaaaa12e50d1251c9aba2fea + languageName: node + linkType: hard + +"tslib@npm:^2.1.0": + version: 2.8.1 + resolution: "tslib@npm:2.8.1" + checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62 + languageName: node + linkType: hard + "tsx@npm:^4.17.0": version: 4.19.2 resolution: "tsx@npm:4.19.2" @@ -4457,6 +5312,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^0.21.3": + version: 0.21.3 + resolution: "type-fest@npm:0.21.3" + checksum: 10c0/902bd57bfa30d51d4779b641c2bc403cdf1371fb9c91d3c058b0133694fcfdb817aef07a47f40faf79039eecbaa39ee9d3c532deff244f3a19ce68cea71a61e8 + languageName: node + linkType: hard + "typescript@npm:^5.5.4": version: 5.6.3 resolution: "typescript@npm:5.6.3" @@ -4516,6 +5378,15 @@ __metadata: languageName: node linkType: hard +"uri-js@npm:^4.2.2": + version: 4.4.1 + resolution: "uri-js@npm:4.4.1" + dependencies: + punycode: "npm:^2.1.0" + checksum: 10c0/4ef57b45aa820d7ac6496e9208559986c665e49447cb072744c13b66925a362d96dd5a46c4530a6b8e203e5db5fe849369444440cb22ecfc26c679359e5dfa3c + languageName: node + linkType: hard + "util-deprecate@npm:^1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" @@ -4523,6 +5394,15 @@ __metadata: languageName: node linkType: hard +"wcwidth@npm:^1.0.1": + version: 1.0.1 + resolution: "wcwidth@npm:1.0.1" + dependencies: + defaults: "npm:^1.0.3" + checksum: 10c0/5b61ca583a95e2dd85d7078400190efd452e05751a64accb8c06ce4db65d7e0b0cde9917d705e826a2e05cc2548f61efde115ffa374c3e436d04be45c889e5b4 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" @@ -4578,6 +5458,34 @@ __metadata: languageName: node linkType: hard +"winston-transport@npm:^4.4.0": + version: 4.9.0 + resolution: "winston-transport@npm:4.9.0" + dependencies: + logform: "npm:^2.7.0" + readable-stream: "npm:^3.6.2" + triple-beam: "npm:^1.3.0" + checksum: 10c0/e2990a172e754dbf27e7823772214a22dc8312f7ec9cfba831e5ef30a5d5528792e5ea8f083c7387ccfc5b2af20e3691f64738546c8869086110a26f98671095 + languageName: node + linkType: hard + +"winston@npm:3.3.3": + version: 3.3.3 + resolution: "winston@npm:3.3.3" + dependencies: + "@dabh/diagnostics": "npm:^2.0.2" + async: "npm:^3.1.0" + is-stream: "npm:^2.0.0" + logform: "npm:^2.2.0" + one-time: "npm:^1.0.0" + readable-stream: "npm:^3.4.0" + stack-trace: "npm:0.0.x" + triple-beam: "npm:^1.3.0" + winston-transport: "npm:^4.4.0" + checksum: 10c0/18205fa1e3ebb88dc910fbe5337e3c9d2dbd94310978adca5ab77444b854d5679dec0a70fed425e77cf93e237390c7670bb937f14c492b8415e594ab21540d3d + languageName: node + linkType: hard + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -4589,6 +5497,17 @@ __metadata: languageName: node linkType: hard +"wrap-ansi@npm:^6.0.1": + version: 6.2.0 + resolution: "wrap-ansi@npm:6.2.0" + dependencies: + ansi-styles: "npm:^4.0.0" + string-width: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + checksum: 10c0/baad244e6e33335ea24e86e51868fe6823626e3a3c88d9a6674642afff1d34d9a154c917e74af8d845fd25d170c4ea9cf69a47133c3f3656e1252b3d462d9f6c + languageName: node + linkType: hard + "wrap-ansi@npm:^8.1.0": version: 8.1.0 resolution: "wrap-ansi@npm:8.1.0" @@ -4617,7 +5536,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7": +"ws@npm:^7, ws@npm:^7.2.0": version: 7.5.10 resolution: "ws@npm:7.5.10" peerDependencies: diff --git a/packages/agoric-cli/src/helpers.js b/packages/agoric-cli/src/helpers.js index 51c3443806e..845da5536ae 100644 --- a/packages/agoric-cli/src/helpers.js +++ b/packages/agoric-cli/src/helpers.js @@ -3,6 +3,8 @@ /** @import { ChildProcess } from 'child_process' */ +export { getNetworkConfig } from './lib/network-config.js'; + export const getSDKBinaries = ({ jsPfx = '../..', goPfx = `${jsPfx}/../golang`, From 21a03f816e392a25c197b692905b2d0388632ee9 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 11 Nov 2024 18:51:46 -0500 Subject: [PATCH 6/9] feat(agoric-cli): Add `agoric wallet send` gas limit options ...defaulting to `--gas=auto --gas-adjustment=1.2`. --- packages/agoric-cli/src/commands/wallet.js | 26 ++++++++++++++++++++-- packages/agoric-cli/src/lib/chain.js | 24 ++++++++++++++++++++ packages/agoric-cli/src/lib/format.js | 12 ++++++++++ packages/agoric-cli/test/inter-cli.test.js | 2 +- 4 files changed, 61 insertions(+), 3 deletions(-) diff --git a/packages/agoric-cli/src/commands/wallet.js b/packages/agoric-cli/src/commands/wallet.js index ef137119b15..440fe2452d5 100644 --- a/packages/agoric-cli/src/commands/wallet.js +++ b/packages/agoric-cli/src/commands/wallet.js @@ -21,7 +21,11 @@ import { } from '../lib/chain.js'; import { getNetworkConfig } from '../lib/network-config.js'; import { coalesceWalletState, getCurrent } from '../lib/wallet.js'; -import { summarize, fmtRecordOfLines } from '../lib/format.js'; +import { + summarize, + fmtRecordOfLines, + parseFiniteNumber, +} from '../lib/format.js'; const networkConfig = await getNetworkConfig({ env: process.env, fetch }); @@ -135,12 +139,28 @@ export const makeWalletCommand = async command => { ) .requiredOption('--offer [filename]', 'path to file with prepared offer') .option('--dry-run', 'spit out the command instead of running it') + .option('--gas', 'gas limit; "auto" [default] to calculate automatically') + .option( + '--gas-adjustment', + 'factor by which to multiply the --gas=auto calculation result [default 1.2]', + ) .option('--verbose', 'print command output') .action(function (opts) { - /** @typedef {{ from: string, offer: string, dryRun: boolean, verbose: boolean }} Opts */ + /** + * @typedef {{ + * from: string, + * offer: string, + * dryRun: boolean, + * gas: string, + * gasAdjustment: string, + * verbose: boolean, + * }} Opts + */ const { dryRun, from, + gas = 'auto', + gasAdjustment = '1.2', offer, home, verbose, @@ -154,6 +174,8 @@ export const makeWalletCommand = async command => { ...networkConfig, keyring: { home, backend }, from, + gas: + gas === 'auto' ? ['auto', parseFiniteNumber(gasAdjustment)] : gas, dryRun, verbose, }, diff --git a/packages/agoric-cli/src/lib/chain.js b/packages/agoric-cli/src/lib/chain.js index d8f76a142e1..d56eb403688 100644 --- a/packages/agoric-cli/src/lib/chain.js +++ b/packages/agoric-cli/src/lib/chain.js @@ -43,6 +43,7 @@ harden(normalizeAddressWithOptions); * @param {MinimalNetworkConfig & { * from: string, * fees?: string, + * gas?: number | 'auto' | ['auto', adjustment?: number | undefined], * dryRun?: boolean, * verbose?: boolean, * keyring?: {home?: string, backend: string} @@ -54,6 +55,7 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => { const { from, fees, + gas = ['auto', 1.2], dryRun = false, verbose = true, keyring = undefined, @@ -67,10 +69,32 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => { ? [`--keyring-backend=${keyring.backend}`] : []; const feeOpt = fees ? ['--fees', fees] : []; + /** @type {string[]} */ + const gasOpt = []; + if (Number.isFinite(gas) || gas === 'auto') { + gasOpt.push(`--gas=${gas}`); + } else if (Array.isArray(gas) && gas.length >= 1 && gas[0] === 'auto') { + gasOpt.push('--gas=auto'); + if (gas.length > 1) { + const [adjustment, ...rest] = gas.slice(1); + const adjustmentIsValid = + adjustment === undefined || + (Number.isFinite(adjustment) && Number(adjustment) > 0); + if (rest.length !== 0 || !adjustmentIsValid) { + throw Error('invalid gas input'); + } + if (adjustment !== undefined) { + gasOpt.push(`--gas-adjustment=${adjustment}`); + } + } + } else { + throw Error('invalid gas input'); + } const cmd = [`--node=${rpcAddrs[0]}`, `--chain-id=${chainName}`].concat( homeOpt, backendOpt, feeOpt, + gasOpt, [`--from=${from}`, 'tx', 'swingset'], swingsetArgs, ); diff --git a/packages/agoric-cli/src/lib/format.js b/packages/agoric-cli/src/lib/format.js index 16ebe45308b..e5e1a277d3c 100644 --- a/packages/agoric-cli/src/lib/format.js +++ b/packages/agoric-cli/src/lib/format.js @@ -6,6 +6,18 @@ import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js'; * @import {AgoricNamesRemotes, BoardRemote, VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; */ +// TODO Move to packages/internal. +/** + * Parses the input and returns either a finite number or NaN. + * + * @param {string} input + * @returns {number} + */ +export const parseFiniteNumber = input => { + const result = /[0-9]/.test(input || '') ? Number(input) : NaN; + return Number.isFinite(result) ? result : NaN; +}; + /** * JSON.stringify replacer to handle bigint * diff --git a/packages/agoric-cli/test/inter-cli.test.js b/packages/agoric-cli/test/inter-cli.test.js index 38e3b970feb..386f9b6e825 100644 --- a/packages/agoric-cli/test/inter-cli.test.js +++ b/packages/agoric-cli/test/inter-cli.test.js @@ -599,7 +599,7 @@ test('README ex1: inter bid place by-price: printed offer is correct', async t = const expected = [ 'Run this interactive command in shell:\n\n', 'agd ', - '--node=http://0.0.0.0:26657 --chain-id=agoriclocal --from=agoric18jr9nlvp300feu726y3v4n07ykfjwup3twnlyn tx swingset wallet-action --allow-spend {"body":"#{\\"method\\":\\"executeOffer\\",\\"offer\\":{\\"id\\":\\"bid-1680241587424\\",\\"invitationSpec\\":{\\"callPipe\\":[[\\"makeBidInvitation\\",[\\"$0.Alleged: BoardRemoteBrand\\"]]],\\"instancePath\\":[\\"auctioneer\\"],\\"source\\":\\"agoricContract\\"},\\"offerArgs\\":{\\"maxBuy\\":{\\"brand\\":\\"$0\\",\\"value\\":\\"+1000000000000\\"},\\"offerPrice\\":{\\"denominator\\":{\\"brand\\":\\"$0\\",\\"value\\":\\"+100\\"},\\"numerator\\":{\\"brand\\":\\"$1.Alleged: BoardRemoteBrand\\",\\"value\\":\\"+855\\"}}},\\"proposal\\":{\\"give\\":{\\"Bid\\":{\\"brand\\":\\"$1\\",\\"value\\":\\"+85000000\\"}}}}}","slots":["board03446","board0566"]} --output json', + '--node=http://0.0.0.0:26657 --chain-id=agoriclocal --gas=auto --gas-adjustment=1.2 --from=agoric18jr9nlvp300feu726y3v4n07ykfjwup3twnlyn tx swingset wallet-action --allow-spend {"body":"#{\\"method\\":\\"executeOffer\\",\\"offer\\":{\\"id\\":\\"bid-1680241587424\\",\\"invitationSpec\\":{\\"callPipe\\":[[\\"makeBidInvitation\\",[\\"$0.Alleged: BoardRemoteBrand\\"]]],\\"instancePath\\":[\\"auctioneer\\"],\\"source\\":\\"agoricContract\\"},\\"offerArgs\\":{\\"maxBuy\\":{\\"brand\\":\\"$0\\",\\"value\\":\\"+1000000000000\\"},\\"offerPrice\\":{\\"denominator\\":{\\"brand\\":\\"$0\\",\\"value\\":\\"+100\\"},\\"numerator\\":{\\"brand\\":\\"$1.Alleged: BoardRemoteBrand\\",\\"value\\":\\"+855\\"}}},\\"proposal\\":{\\"give\\":{\\"Bid\\":{\\"brand\\":\\"$1\\",\\"value\\":\\"+85000000\\"}}}}}","slots":["board03446","board0566"]} --output json', ].join(''); t.deepEqual(txt, expected); }); From 236a61fb8a78fd97d8b1e7ac1c69e531c02de098 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 12 Nov 2024 13:07:46 -0500 Subject: [PATCH 7/9] refactor(a3p-integration): Use execa rather than a custom `runCommand` --- .../z:acceptance/test-lib/psm-lib.js | 108 ++++++++---- packages/internal/src/index.js | 1 - packages/internal/src/node-utils.js | 154 ------------------ .../test/snapshots/exports.test.js.md | 2 - .../test/snapshots/exports.test.js.snap | Bin 678 -> 648 bytes 5 files changed, 72 insertions(+), 193 deletions(-) delete mode 100644 packages/internal/src/node-utils.js diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index fe7d9286f09..442f5232142 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -1,5 +1,6 @@ /* eslint-env node */ +import { execa } from 'execa'; import { getNetworkConfig } from 'agoric/src/helpers.js'; import { boardSlottingMarshaller, @@ -9,7 +10,6 @@ import { waitUntilOfferResult, } from '@agoric/client-utils'; import { AmountMath } from '@agoric/ertp'; -import { makeRunCommand, commandResultData } from '@agoric/internal'; import { addUser, agd, @@ -24,20 +24,30 @@ import { mkTemp, VALIDATORADDR, } from '@agoric/synthetic-chain'; -import { spawn } from 'node:child_process'; import fsp from 'node:fs/promises'; -import { Readable } from 'node:stream'; import { NonNullish } from './errors.js'; import { getBalances } from './utils.js'; -/** @import {CommandResult} from '@agoric/internal'; */ +/** @import {Result as ExecaResult, ExecaError} from 'execa'; */ +/** + * @typedef {ExecaResult & { all: string } & ( + * | { failed: false } + * | Pick< + * ExecaError & { failed: true }, + * 'failed', + * | 'shortMessage' + * | 'cause' + * | 'exitCode' + * | 'signal' + * | 'signalDescription' + * > + * )} SendOfferResult + */ // Export these from synthetic-chain? const USDC_DENOM = NonNullish(process.env.USDC_DENOM); const PSM_PAIR = NonNullish(process.env.PSM_PAIR).replace('.', '-'); -const runCommand = makeRunCommand({ Buffer, Readable, setImmediate, spawn }); - /** * @import {Coin} from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js'; */ @@ -372,23 +382,21 @@ export const initializeNewUser = async (name, fund, io) => { * * @param {string} address * @param {Promise} offerPromise - * @returns {Promise} + * @returns {Promise} */ export const sendOfferAgoric = async (address, offerPromise) => { const offerPath = await mkTemp('agops.XXX'); const offer = await offerPromise; await fsp.writeFile(offerPath, offer); - return runCommand('agoric', [ - 'wallet', - '--keyring-backend=test', - 'send', - '--offer', - offerPath, - '--from', - address, - '--verbose', + const [settlement] = await Promise.allSettled([ + execa({ + all: true, + })`agoric wallet --keyring-backend=test send --offer ${offerPath} --from ${address} --verbose`, ]); + return settlement.status === 'fulfilled' + ? settlement.value + : settlement.reason; }; /** @@ -397,7 +405,7 @@ export const sendOfferAgoric = async (address, offerPromise) => { * * @param {string} address * @param {Promise} offerPromise - * @returns {Promise} + * @returns {Promise} */ export const sendOfferAgd = async (address, offerPromise) => { const offer = await offerPromise; @@ -417,24 +425,33 @@ export const sendOfferAgd = async (address, offerPromise) => { '--yes', '-ojson', ]; - const result = await runCommand('agd', args); - // Mimic --verbose - // https://github.com/Agoric/agoric-sdk/blob/master/packages/agoric-cli/src/lib/wallet.js - if (result.status === 0 && !result.signal && !result.error) { - const out = result.stdout.toString(); + + const [settlement] = await Promise.allSettled([ + execa('agd', args, { all: true }), + ]); + + // Upon successful exit, verify that the *output* also indicates success. + // cf. https://github.com/Agoric/agoric-sdk/blob/master/packages/agoric-cli/src/lib/wallet.js + if (settlement.status === 'fulfilled') { + const result = settlement.value; try { - const tx = JSON.parse(out); + const tx = JSON.parse(result.stdout); if (tx.code !== 0) { - console.error('failed to send tx', tx); - return { ...result, error: Error(`code ${tx.code}`) }; + return { ...result, failed: true, shortMessage: `code ${tx.code}` }; } - console.log(tx); } catch (err) { - console.error('unexpected output', JSON.stringify(out)); - return { ...result, error: err }; + return { + ...result, + failed: true, + shortMessage: 'unexpected output', + cause: err, + }; } } - return result; + + return settlement.status === 'fulfilled' + ? settlement.value + : settlement.reason; }; /** @@ -442,7 +459,7 @@ export const sendOfferAgd = async (address, offerPromise) => { * @param {Array} params * @param {{ * follow: (...params: string[]) => Promise; - * sendOffer?: (address: string, offerPromise: Promise) => Promise; + * sendOffer?: (address: string, offerPromise: Promise) => Promise; * setTimeout: typeof global.setTimeout; * now: () => number * }} io @@ -453,15 +470,34 @@ export const psmSwap = async (address, params, io) => { const newParams = ['psm', ...params, '--offerId', offerId]; const offerPromise = executeCommand(agopsLocation, newParams); const sendResult = await sendOffer(address, offerPromise); - const { status, stdout, stderr, signal, error } = sendResult; - if (status !== 0 || signal || error) { - console.error('psmSwap tx send failed', commandResultData(sendResult)); + if (sendResult.failed) { + const { + command, + durationMs, + shortMessage, + cause, + exitCode, + signal, + signalDescription, + all: output, + } = sendResult; + const summary = { + command, + durationMs, + shortMessage, + cause, + exitCode, + signal, + signalDescription, + output, + }; + console.error('psmSwap tx send failed', summary); throw Error( - `agoric wallet send failed: ${JSON.stringify({ status, signal })}`, - { cause: error }, + `psmSwap tx send failed: ${JSON.stringify({ exitCode, signal, signalDescription })}`, + { cause }, ); } - console.log('psmSwap tx send results', stdout.toString(), stderr.toString()); + console.log('psmSwap tx send results', sendResult.all); await waitUntilOfferResult(address, offerId, true, waitIO, { errorMessage: `${offerId} not succeeded`, diff --git a/packages/internal/src/index.js b/packages/internal/src/index.js index c4f290845e4..457c35502e3 100644 --- a/packages/internal/src/index.js +++ b/packages/internal/src/index.js @@ -7,7 +7,6 @@ export * from './debug.js'; export * from './errors.js'; export * from './utils.js'; export * from './method-tools.js'; -export * from './node-utils.js'; export * from './typeCheck.js'; export * from './typeGuards.js'; diff --git a/packages/internal/src/node-utils.js b/packages/internal/src/node-utils.js deleted file mode 100644 index 87f32d750cc..00000000000 --- a/packages/internal/src/node-utils.js +++ /dev/null @@ -1,154 +0,0 @@ -/// -// @ts-check -// @jessie-check -/** - * @file Node.js utility functions that are compatible with but not dependent - * upon a hardened environment. - */ - -import { makePromiseKit } from '@endo/promise-kit'; - -/** @import {PromiseKit} from '@endo/promise-kit'; */ - -const { stringify } = JSON; - -/** - * @typedef {object} CommandResult - * @property {number | null} status - * @property {Buffer | null} stdout - * @property {Buffer | null} stderr - * @property {string | null} signal - * @property {Error | null} error - */ - -/** - * @param {{ - * Buffer: typeof Buffer; - * Readable: typeof import('node:stream').Readable; - * setImmediate: typeof setImmediate; - * spawn: import('node:child_process').spawn; - * }} powers - */ -export const makeRunCommand = ({ Buffer, Readable, setImmediate, spawn }) => { - /** - * Launch a child process with optional standard input and wait for its - * termination. - * - * @param {string} cmd - * @param {string[]} args - * @param {{ - * input?: Parameters[0]; - * } & Parameters[2]} [options] - * @returns {Promise< - * CommandResult & - * ({ error: Error } | { status: number } | { signal: string }) - * >} - */ - const runCommand = async (cmd, args, { input, ...options } = {}) => { - const child = spawn(cmd, args, options); - /** @type {{ stdout: Buffer[]; stderr: Buffer[] }} */ - const outChunks = { stdout: [], stderr: [] }; - const exitKit = makePromiseKit(); - const inKit = child.stdin && makePromiseKit(); - const outKit = child.stdout && makePromiseKit(); - const errKit = child.stderr && makePromiseKit(); - // cf. https://nodejs.org/docs/latest/api/child_process.html#child_processspawnsynccommand-args-options - /** @type {CommandResult} */ - const result = { - status: null, - stdout: null, - stderr: null, - signal: null, - error: null, - }; - child.on('error', err => { - result.error = err; - // An exit event *might* be coming, so wait a tick. - setImmediate(() => exitKit.resolve('done')); - }); - child.on('exit', (exitCode, signal) => { - if (!Object.isFrozen(result)) { - result.status = exitCode; - result.signal = signal; - } - exitKit.resolve('done'); - }); - /** - * @type {( - * emitter: - * | import('node:stream').Readable - * | import('node:stream').Writable, - * kit: PromiseKit, - * msg: string, - * ) => void} - */ - const rejectOnError = (emitter, kit, msg) => { - emitter.on('error', err => kit.reject(Error(msg, { cause: err }))); - }; - /** - * @typedef {[ - * string, - * import('node:stream').Readable | null, - * Buffer[], - * PromiseKit, - * ]} ReadableKit - */ - for (const [label, stream, chunks, kit] of /** @type {ReadableKit[]} */ ([ - ['stdout', child.stdout, outChunks.stdout, outKit], - ['stderr', child.stderr, outChunks.stderr, errKit], - ])) { - if (!stream) { - continue; - } - rejectOnError( - stream, - kit, - `failed reading from ${stringify(cmd)} ${label}`, - ); - stream.on('data', chunk => chunks.push(chunk)); - stream.on('end', () => kit.resolve('done')); - } - if (child.stdin) { - const actualInKit = /** @type {PromiseKit} */ (inKit); - rejectOnError( - child.stdin, - actualInKit, - `failed writing to ${stringify(cmd)} stdin`, - ); - Readable.from(input || []).pipe(child.stdin); - child.stdin.on('finish', () => actualInKit.resolve('done')); - } else if (input) { - throw Error(`missing ${stringify(cmd)} stdin`); - } - await Promise.all( - [exitKit, inKit, outKit, errKit].map(kit => kit?.promise), - ); - if (outKit) { - result.stdout = Buffer.concat(outChunks.stdout); - } - if (errKit) { - result.stderr = Buffer.concat(outChunks.stderr); - } - Object.freeze(result); - // @ts-expect-error result really is a CommandResult - return result; - }; - return runCommand; -}; - -/** - * Decode stdout and/or stderr buffers. - * - * @param {CommandResult} commandResult - * @returns {Pick & { - * stdout: string | null; - * stderr: string | null; - * }} - */ -export const commandResultData = commandResult => ({ - status: commandResult.status, - stdout: commandResult.stdout?.toString() ?? null, - stderr: commandResult.stderr?.toString() ?? null, - signal: commandResult.signal, - error: commandResult.error, -}); diff --git a/packages/internal/test/snapshots/exports.test.js.md b/packages/internal/test/snapshots/exports.test.js.md index eec22407552..683deeab0dc 100644 --- a/packages/internal/test/snapshots/exports.test.js.md +++ b/packages/internal/test/snapshots/exports.test.js.md @@ -23,7 +23,6 @@ Generated by [AVA](https://avajs.dev). 'assertAllDefined', 'bindAllMethods', 'cast', - 'commandResultData', 'deepMapObject', 'deeplyFulfilledObject', 'forever', @@ -31,7 +30,6 @@ Generated by [AVA](https://avajs.dev). 'getMethodNames', 'getStringMethodNames', 'makeMeasureSeconds', - 'makeRunCommand', 'makeTracer', 'mustMatch', 'objectMap', diff --git a/packages/internal/test/snapshots/exports.test.js.snap b/packages/internal/test/snapshots/exports.test.js.snap index 035108d95ef0e50cdc93a69208056542fbe0de59..1f14b724a857fabc90605666adcd68c41d01ce38 100644 GIT binary patch literal 648 zcmV;30(bpERzVu1633Qx-Sm~#Y_V-_BW_C{cJ#Etie|!o- z1r4B#gcr&iG4#0&{`f>n5yYeN{SupHyVL4)lQYRV*~*4fGJ}>RGeu^7)B1t+Eu+E% z7JQU*-EVNq0kyaM-1ZGbL3V;mO02ofUX-gmBHkQ zLh}@w!>9W~7Z9tz5Ni|OgA3T;J?JX~aXt%_SnAIRTt&Aruk}s#i$C{Vu>7oP} zw#9I#_Y~5otEAV)T92BA?kns~{vE4PY_@M5JO@XjPNLq&53^^~vjVnEaB9-oa;!Up z@TcbS;G$n4zluJ=S55Yx)N0&-fjEFR2wylzAhl*PfwlO3#+j}Y>7>w$arA@2hqef5 zT(0$~?C+*=NTe>s>76ME;+(!ry6Q(J&7C#s2xJ%HR$Pfk;~FX5bwyNHqdLr$hV$xL i+@(Vma$Ey&4&98T)9+RC4tq$?rTz_ zV}dR-kspf)00000000ARlFM#WF%X9BCcTn2O)r#tVZj0xJOk-XL?}tsq(z7Ya*rn` zratz;_MxOJx?&IF0m=fg0-l4*W0XB_z=U?(f{64f(fR)P%#7!#x2tWk=MUdQP(cGI zBjKg;M&!P4gFifyQUvk1{I0~t+3>?B_^prl{R#Po93wNFvAakM$&ok67vwwg3#p7S zb`NPG5_ye$Kz<-Uk;xKccaS#Xk+;Za1GDom0s<*@+dWWC{&QW`xYrs`Z)m4Wq(C z7RPwmx^vcf%8XKGwiB!qDYUGFPG96eiLsd2 zHfbT81o;4T4z59o@z~_fiZFZiB(a4FWG7;UkA&6`S|W>QPm-G#Y3d*q0lIFmp$sMm z6q=&YBtG2{x`0^yg;<;L9$df%*Py2i#Q9VxF|&)Cg}w=)Z)H4TntVACKGr-#Piu+I zGGXKv_(F#@+(e30DKaeq@}|h!yU!qrC(M#w9BMt-D0EL@`||Htjbh_H>)-`A5_7SF z9^T!yQO^rlH^Hg1=I3K;DTI@@hO>=+f&2pc4*u1o|4A*zCCS7dG(q^nK?f3R&W3a` zzG;}*D$MH1RLC#ID<1l;6UkX4m*VYZg%3>;lDMCjqq2X7fI zFiGE8qYglJAuiUncr&6zS3}B-H7YBuR Date: Tue, 12 Nov 2024 13:44:43 -0500 Subject: [PATCH 8/9] style(a3p-integration): Use `concat` to group `agd` CLI arguments --- .../proposals/z:acceptance/test-lib/psm-lib.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index 442f5232142..f97a89c7dd2 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -411,20 +411,14 @@ export const sendOfferAgd = async (address, offerPromise) => { const offer = await offerPromise; const networkConfig = await getNetworkConfig({ env: process.env, fetch }); const { chainName, rpcAddrs } = networkConfig; - const args = [ - `--node=${rpcAddrs[0]}`, - `--chain-id=${chainName}`, - `--keyring-backend=test`, - `--from=${address}`, - 'tx', - 'swingset', - 'wallet-action', - '--allow-spend', - offer, - '-bblock', + const args = [].concat( + [`--node=${rpcAddrs[0]}`, `--chain-id=${chainName}`], + [`--keyring-backend=test`, `--from=${address}`], + ['tx', 'swingset', 'wallet-action', '--allow-spend', offer], '--yes', + '-bblock', '-ojson', - ]; + ); const [settlement] = await Promise.allSettled([ execa('agd', args, { all: true }), From 4016066d3ee03dab107099af51ac6f4266e0facc Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 12 Nov 2024 14:08:32 -0500 Subject: [PATCH 9/9] style(agoric-cli): Introduce `gas` option helper --- packages/agoric-cli/src/lib/chain.js | 55 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/packages/agoric-cli/src/lib/chain.js b/packages/agoric-cli/src/lib/chain.js index d56eb403688..3a47c5a7f49 100644 --- a/packages/agoric-cli/src/lib/chain.js +++ b/packages/agoric-cli/src/lib/chain.js @@ -38,12 +38,42 @@ export const normalizeAddressWithOptions = ( }; harden(normalizeAddressWithOptions); +/** @typedef {number | 'auto' | ['auto', adjustment?: number | undefined]} GasLimit */ + +/** + * @param {GasLimit} limit + * @returns {string[]} + */ +const makeGasOpts = limit => { + if (Number.isFinite(limit) || limit === 'auto') { + return [`--gas=${limit}`]; + } + if (Array.isArray(limit) && limit.length >= 1 && limit[0] === 'auto') { + const gasOpts = ['--gas=auto']; + if (limit.length > 1) { + const [adjustment, ...rest] = limit.slice(1); + const adjustmentIsValid = + adjustment === undefined || + (Number.isFinite(adjustment) && Number(adjustment) > 0); + if (rest.length !== 0 || !adjustmentIsValid) { + throw Error('invalid gas input'); + } + if (adjustment !== undefined) { + gasOpts.push(`--gas-adjustment=${adjustment}`); + } + } + return gasOpts; + } + + throw Error('invalid gas input'); +}; + /** * @param {ReadonlyArray} swingsetArgs * @param {MinimalNetworkConfig & { * from: string, * fees?: string, - * gas?: number | 'auto' | ['auto', adjustment?: number | undefined], + * gas?: GasLimit, * dryRun?: boolean, * verbose?: boolean, * keyring?: {home?: string, backend: string} @@ -69,32 +99,11 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => { ? [`--keyring-backend=${keyring.backend}`] : []; const feeOpt = fees ? ['--fees', fees] : []; - /** @type {string[]} */ - const gasOpt = []; - if (Number.isFinite(gas) || gas === 'auto') { - gasOpt.push(`--gas=${gas}`); - } else if (Array.isArray(gas) && gas.length >= 1 && gas[0] === 'auto') { - gasOpt.push('--gas=auto'); - if (gas.length > 1) { - const [adjustment, ...rest] = gas.slice(1); - const adjustmentIsValid = - adjustment === undefined || - (Number.isFinite(adjustment) && Number(adjustment) > 0); - if (rest.length !== 0 || !adjustmentIsValid) { - throw Error('invalid gas input'); - } - if (adjustment !== undefined) { - gasOpt.push(`--gas-adjustment=${adjustment}`); - } - } - } else { - throw Error('invalid gas input'); - } const cmd = [`--node=${rpcAddrs[0]}`, `--chain-id=${chainName}`].concat( homeOpt, backendOpt, feeOpt, - gasOpt, + makeGasOpts(gas), [`--from=${from}`, 'tx', 'swingset'], swingsetArgs, );