agoric 0.21.2-u11wf.0 → 0.21.2-upgrade-16-dev-8879538.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +50 -37
- package/src/anylogger-agoric.js +28 -14
- package/src/bin-agops.js +8 -8
- package/src/chain-config.js +11 -11
- package/src/commands/auction.js +6 -5
- package/src/commands/{ec.js → gov.js} +181 -39
- package/src/commands/inter.js +20 -37
- package/src/commands/oracle.js +34 -17
- package/src/commands/perf.js +0 -2
- package/src/commands/psm.js +11 -15
- package/src/commands/reserve.js +1 -2
- package/src/commands/test-upgrade.js +7 -2
- package/src/commands/vaults.js +6 -8
- package/src/commands/wallet.js +6 -3
- package/src/cosmos.js +2 -2
- package/src/follow.js +6 -3
- package/src/helpers.js +2 -1
- package/src/init.js +3 -8
- package/src/install.js +9 -11
- package/src/lib/chain.js +24 -10
- package/src/lib/format.js +14 -18
- package/src/lib/rpc.js +18 -5
- package/src/lib/wallet.js +29 -58
- package/src/main-publish.js +1 -2
- package/src/main.js +43 -45
- package/src/open.js +6 -6
- package/src/publish.js +3 -6
- package/src/sdk-package-names.js +11 -6
- package/src/set-defaults.js +1 -0
- package/src/start.js +52 -60
- package/tools/getting-started.js +170 -0
- package/tools/resm-plugin/deploy.js +18 -0
- package/tools/resm-plugin/package.json +12 -0
- package/tools/resm-plugin/src/output.js +1 -0
- package/tools/resm-plugin/src/plugin.js +17 -0
- package/CHANGELOG.md +0 -1078
package/src/lib/wallet.js
CHANGED
|
@@ -6,10 +6,9 @@ import { makeWalletStateCoalescer } from '@agoric/smart-wallet/src/utils.js';
|
|
|
6
6
|
import { execSwingsetTransaction, pollBlocks, pollTx } from './chain.js';
|
|
7
7
|
import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js';
|
|
8
8
|
|
|
9
|
-
/** @
|
|
10
|
-
/** @
|
|
9
|
+
/** @import {CurrentWalletRecord} from '@agoric/smart-wallet/src/smartWallet.js' */
|
|
10
|
+
/** @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js' */
|
|
11
11
|
|
|
12
|
-
const { values } = Object;
|
|
13
12
|
const { Fail } = assert;
|
|
14
13
|
const marshaller = boardSlottingMarshaller();
|
|
15
14
|
|
|
@@ -24,13 +23,13 @@ const emptyCurrentRecord = {
|
|
|
24
23
|
/**
|
|
25
24
|
* @param {string} addr
|
|
26
25
|
* @param {Pick<import('./rpc.js').RpcUtils, 'readLatestHead'>} io
|
|
27
|
-
* @returns {Promise<import('@agoric/smart-wallet/src/smartWallet').CurrentWalletRecord>}
|
|
26
|
+
* @returns {Promise<import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord>}
|
|
28
27
|
*/
|
|
29
28
|
export const getCurrent = async (addr, { readLatestHead }) => {
|
|
30
29
|
// Partial because older writes may not have had all properties
|
|
31
30
|
// NB: assumes changes are only additions
|
|
32
31
|
let current =
|
|
33
|
-
/** @type {Partial<import('@agoric/smart-wallet/src/smartWallet').CurrentWalletRecord> | undefined} */ (
|
|
32
|
+
/** @type {Partial<import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord> | undefined} */ (
|
|
34
33
|
await readLatestHead(`published.wallet.${addr}.current`)
|
|
35
34
|
);
|
|
36
35
|
if (current === undefined) {
|
|
@@ -59,7 +58,7 @@ export const getCurrent = async (addr, { readLatestHead }) => {
|
|
|
59
58
|
/**
|
|
60
59
|
* @param {string} addr
|
|
61
60
|
* @param {Pick<import('./rpc.js').RpcUtils, 'readLatestHead'>} io
|
|
62
|
-
* @returns {Promise<import('@agoric/smart-wallet/src/smartWallet').UpdateRecord>}
|
|
61
|
+
* @returns {Promise<import('@agoric/smart-wallet/src/smartWallet.js').UpdateRecord>}
|
|
63
62
|
*/
|
|
64
63
|
export const getLastUpdate = (addr, { readLatestHead }) => {
|
|
65
64
|
// @ts-expect-error cast
|
|
@@ -67,7 +66,7 @@ export const getLastUpdate = (addr, { readLatestHead }) => {
|
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
|
-
* @param {import('@agoric/smart-wallet/src/smartWallet').BridgeAction} bridgeAction
|
|
69
|
+
* @param {import('@agoric/smart-wallet/src/smartWallet.js').BridgeAction} bridgeAction
|
|
71
70
|
* @param {Pick<import('stream').Writable,'write'>} [stdout]
|
|
72
71
|
*/
|
|
73
72
|
export const outputAction = (bridgeAction, stdout = process.stdout) => {
|
|
@@ -76,11 +75,11 @@ export const outputAction = (bridgeAction, stdout = process.stdout) => {
|
|
|
76
75
|
stdout.write('\n');
|
|
77
76
|
};
|
|
78
77
|
|
|
79
|
-
const sendHint =
|
|
78
|
+
export const sendHint =
|
|
80
79
|
'Now use `agoric wallet send ...` to sign and broadcast the offer.\n';
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
|
-
* @param {import('@agoric/smart-wallet/src/smartWallet').BridgeAction} bridgeAction
|
|
82
|
+
* @param {import('@agoric/smart-wallet/src/smartWallet.js').BridgeAction} bridgeAction
|
|
84
83
|
* @param {{
|
|
85
84
|
* stdout: Pick<import('stream').Writable,'write'>,
|
|
86
85
|
* stderr: Pick<import('stream').Writable,'write'>,
|
|
@@ -94,25 +93,38 @@ export const outputActionAndHint = (bridgeAction, { stdout, stderr }) => {
|
|
|
94
93
|
/**
|
|
95
94
|
* @param {import('@agoric/smart-wallet/src/offers.js').OfferSpec} offer
|
|
96
95
|
* @param {Pick<import('stream').Writable,'write'>} [stdout]
|
|
96
|
+
* @param {Pick<import('stream').Writable,'write'>} [stderr]
|
|
97
97
|
*/
|
|
98
|
-
export const outputExecuteOfferAction = (
|
|
99
|
-
|
|
98
|
+
export const outputExecuteOfferAction = (
|
|
99
|
+
offer,
|
|
100
|
+
stdout = process.stdout,
|
|
101
|
+
stderr = process.stderr,
|
|
102
|
+
) => {
|
|
103
|
+
/** @type {import('@agoric/smart-wallet/src/smartWallet.js').BridgeAction} */
|
|
100
104
|
const spendAction = {
|
|
101
105
|
method: 'executeOffer',
|
|
102
106
|
offer,
|
|
103
107
|
};
|
|
104
108
|
outputAction(spendAction, stdout);
|
|
109
|
+
stderr.write(sendHint);
|
|
105
110
|
};
|
|
106
111
|
|
|
107
112
|
/**
|
|
108
113
|
* @deprecated use `.current` node for current state
|
|
109
|
-
* @param {import('@agoric/casting').Follower<import('@agoric/casting').ValueFollowerElement<import('@agoric/smart-wallet/src/smartWallet').UpdateRecord>>} follower
|
|
114
|
+
* @param {import('@agoric/casting').Follower<import('@agoric/casting').ValueFollowerElement<import('@agoric/smart-wallet/src/smartWallet.js').UpdateRecord>>} follower
|
|
110
115
|
* @param {Brand<'set'>} [invitationBrand]
|
|
111
116
|
*/
|
|
112
117
|
export const coalesceWalletState = async (follower, invitationBrand) => {
|
|
113
118
|
// values with oldest last
|
|
114
119
|
const history = [];
|
|
115
120
|
for await (const followerElement of iterateReverse(follower)) {
|
|
121
|
+
if ('error' in followerElement) {
|
|
122
|
+
console.error(
|
|
123
|
+
'Skipping wallet update due to error:',
|
|
124
|
+
followerElement.error,
|
|
125
|
+
);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
116
128
|
history.push(followerElement.value);
|
|
117
129
|
}
|
|
118
130
|
|
|
@@ -129,9 +141,10 @@ export const coalesceWalletState = async (follower, invitationBrand) => {
|
|
|
129
141
|
* Sign and broadcast a wallet-action.
|
|
130
142
|
*
|
|
131
143
|
* @throws { Error & { code: number } } if transaction fails
|
|
132
|
-
* @param {import('@agoric/smart-wallet/src/smartWallet').BridgeAction} bridgeAction
|
|
133
|
-
* @param {import('./rpc').MinimalNetworkConfig & {
|
|
144
|
+
* @param {import('@agoric/smart-wallet/src/smartWallet.js').BridgeAction} bridgeAction
|
|
145
|
+
* @param {import('./rpc.js').MinimalNetworkConfig & {
|
|
134
146
|
* from: string,
|
|
147
|
+
* fees?: string,
|
|
135
148
|
* verbose?: boolean,
|
|
136
149
|
* keyring?: {home?: string, backend: string},
|
|
137
150
|
* stdout: Pick<import('stream').Writable, 'write'>,
|
|
@@ -159,7 +172,7 @@ export const sendAction = async (bridgeAction, opts) => {
|
|
|
159
172
|
assert(out); // not dry run
|
|
160
173
|
const tx = JSON.parse(out);
|
|
161
174
|
if (tx.code !== 0) {
|
|
162
|
-
const err = Error(`failed to send
|
|
175
|
+
const err = Error(`failed to send tx: ${tx.raw_log} code: ${tx.code}`);
|
|
163
176
|
// @ts-expect-error XXX how to add properties to an error?
|
|
164
177
|
err.code = tx.code;
|
|
165
178
|
throw err;
|
|
@@ -174,7 +187,7 @@ export const sendAction = async (bridgeAction, opts) => {
|
|
|
174
187
|
*/
|
|
175
188
|
export const findContinuingIds = (current, agoricNames) => {
|
|
176
189
|
// XXX should runtime type-check
|
|
177
|
-
/** @type {{ offerToUsedInvitation: [string,
|
|
190
|
+
/** @type {{ offerToUsedInvitation: [string, InvitationAmount][]}} */
|
|
178
191
|
const { offerToUsedInvitation: entries } = /** @type {any} */ (current);
|
|
179
192
|
|
|
180
193
|
Array.isArray(entries) || Fail`entries must be an array: ${entries}`;
|
|
@@ -247,7 +260,6 @@ export const makeWalletUtils = async (
|
|
|
247
260
|
untilNumWantsSatisfied = false,
|
|
248
261
|
) => {
|
|
249
262
|
const lookup = async () => {
|
|
250
|
-
// eslint-disable-next-line @jessie.js/no-nested-await, no-await-in-loop
|
|
251
263
|
const { offerStatuses } = await storedWalletState(from, minHeight);
|
|
252
264
|
const offerStatus = [...offerStatuses.values()].find(s => s.id === id);
|
|
253
265
|
if (!offerStatus) throw Error('retry');
|
|
@@ -272,44 +284,3 @@ export const makeWalletUtils = async (
|
|
|
272
284
|
pollOffer,
|
|
273
285
|
};
|
|
274
286
|
};
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* @param {{
|
|
278
|
-
* brand: Record<string, Brand>,
|
|
279
|
-
* vbankAsset: Record<string, { brand: Brand, displayInfo: DisplayInfo }>,
|
|
280
|
-
* }} agoricNames
|
|
281
|
-
* @param {(msg: string) => Error} makeError error constructor
|
|
282
|
-
* @returns {(a: string) => Amount<'nat'>}
|
|
283
|
-
*/
|
|
284
|
-
export const makeParseAmount =
|
|
285
|
-
(agoricNames, makeError = msg => RangeError(msg)) =>
|
|
286
|
-
opt => {
|
|
287
|
-
assert.typeof(opt, 'string', 'parseAmount expected string');
|
|
288
|
-
const m = opt.match(/^(?<value>[\d_]+(\.[\d_]+)?)(?<brand>[A-Z]\w*?)$/);
|
|
289
|
-
if (!m || !m.groups) {
|
|
290
|
-
throw makeError(`invalid amount: ${opt}`);
|
|
291
|
-
}
|
|
292
|
-
const anyBrand = agoricNames.brand[m.groups.brand];
|
|
293
|
-
if (!anyBrand) {
|
|
294
|
-
throw makeError(`unknown brand: ${m.groups.brand}`);
|
|
295
|
-
}
|
|
296
|
-
const assetDesc = values(agoricNames.vbankAsset).find(
|
|
297
|
-
d => d.brand === anyBrand,
|
|
298
|
-
);
|
|
299
|
-
if (!assetDesc) {
|
|
300
|
-
throw makeError(`unknown brand: ${m.groups.brand}`);
|
|
301
|
-
}
|
|
302
|
-
const { displayInfo } = assetDesc;
|
|
303
|
-
if (!displayInfo.decimalPlaces || displayInfo.assetKind !== 'nat') {
|
|
304
|
-
throw makeError(`bad brand: ${displayInfo}`);
|
|
305
|
-
}
|
|
306
|
-
const value = BigInt(
|
|
307
|
-
Number(m.groups.value.replace(/_/g, '')) *
|
|
308
|
-
10 ** displayInfo.decimalPlaces,
|
|
309
|
-
);
|
|
310
|
-
/** @type {Brand<'nat'>} */
|
|
311
|
-
// @ts-expect-error dynamic cast
|
|
312
|
-
const natBrand = anyBrand;
|
|
313
|
-
const amt = { value, brand: natBrand };
|
|
314
|
-
return amt;
|
|
315
|
-
};
|
package/src/main-publish.js
CHANGED
|
@@ -31,9 +31,9 @@ const publishMain = async (progname, rawArgs, powers, opts) => {
|
|
|
31
31
|
chainID,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
await null;
|
|
34
35
|
for (const bundlePath of rawArgs.slice(1)) {
|
|
35
36
|
// AWAIT
|
|
36
|
-
// eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
|
|
37
37
|
const bundleText = await fs.readFile(bundlePath, 'utf-8');
|
|
38
38
|
const bundle = parseLocatedJson(bundleText, bundlePath);
|
|
39
39
|
|
|
@@ -53,7 +53,6 @@ const publishMain = async (progname, rawArgs, powers, opts) => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
// AWAIT
|
|
56
|
-
// eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
|
|
57
56
|
const hashedBundle = await publishBundle(bundle, connectionSpec);
|
|
58
57
|
process.stdout.write(`${JSON.stringify(hashedBundle)}\n`);
|
|
59
58
|
}
|
package/src/main.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @jessie.js/no-nested-await */
|
|
2
1
|
/* global process */
|
|
3
2
|
import { Command } from 'commander';
|
|
4
3
|
import path from 'path';
|
|
@@ -20,7 +19,7 @@ import followMain from './follow.js';
|
|
|
20
19
|
import walletMain from './open.js';
|
|
21
20
|
import { makeWalletCommand } from './commands/wallet.js';
|
|
22
21
|
|
|
23
|
-
const DEFAULT_DAPP_TEMPLATE = 'dapp-
|
|
22
|
+
const DEFAULT_DAPP_TEMPLATE = 'dapp-offer-up';
|
|
24
23
|
const DEFAULT_DAPP_URL_BASE = 'https://github.com/Agoric/';
|
|
25
24
|
const DEFAULT_DAPP_BRANCH = undefined;
|
|
26
25
|
|
|
@@ -36,6 +35,7 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
36
35
|
const program = new Command();
|
|
37
36
|
|
|
38
37
|
async function isNotBasedir() {
|
|
38
|
+
await null;
|
|
39
39
|
try {
|
|
40
40
|
await fs.stat(STAMP);
|
|
41
41
|
return false;
|
|
@@ -57,23 +57,29 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
57
57
|
const pkg = JSON.parse(pj);
|
|
58
58
|
program.name(pkg.name).version(pkg.version);
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.option(
|
|
63
|
-
.option('--docker-tag <tag>', 'image tag to use for Docker containers')
|
|
64
|
-
.option(
|
|
60
|
+
const cmdOpts = { verbose: 0 };
|
|
61
|
+
const addCmdOpts = baseCmd =>
|
|
62
|
+
baseCmd.option(
|
|
65
63
|
'-v, --verbose',
|
|
66
64
|
'verbosity that can be increased',
|
|
67
|
-
(_value,
|
|
68
|
-
0,
|
|
65
|
+
(_value, _previous) => (cmdOpts.verbose += 1),
|
|
69
66
|
);
|
|
67
|
+
const baseCmd = (...args) => addCmdOpts(program.command(...args));
|
|
68
|
+
|
|
69
|
+
addCmdOpts(
|
|
70
|
+
program
|
|
71
|
+
.enablePositionalOptions()
|
|
72
|
+
.option('--sdk', 'use the Agoric SDK containing this program')
|
|
73
|
+
.option('--no-sdk', 'do not use the Agoric SDK containing this program'),
|
|
74
|
+
);
|
|
70
75
|
|
|
71
76
|
// Add each of the commands.
|
|
72
|
-
|
|
73
|
-
.
|
|
77
|
+
baseCmd('cosmos <command...>')
|
|
78
|
+
.passThroughOptions(true)
|
|
79
|
+
.option('--docker-tag <tag>', 'image tag to use for Docker containers')
|
|
74
80
|
.description('client for an Agoric Cosmos chain')
|
|
75
81
|
.action(async (command, _options, cmd) => {
|
|
76
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
82
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
77
83
|
return subMain(cosmosMain, ['cosmos', ...command], opts);
|
|
78
84
|
});
|
|
79
85
|
|
|
@@ -90,13 +96,12 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
90
96
|
{ executableFile: ibcSetup },
|
|
91
97
|
);
|
|
92
98
|
|
|
93
|
-
|
|
94
|
-
.command('open')
|
|
99
|
+
baseCmd('open')
|
|
95
100
|
.description('launch the Agoric UI')
|
|
96
101
|
.option(
|
|
97
102
|
'--hostport <host:port>',
|
|
98
103
|
'host and port to connect to VM',
|
|
99
|
-
'
|
|
104
|
+
'localhost:8000',
|
|
100
105
|
)
|
|
101
106
|
.option('--no-browser', `just display the URL, don't open a browser`)
|
|
102
107
|
.option(
|
|
@@ -112,12 +117,11 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
112
117
|
},
|
|
113
118
|
)
|
|
114
119
|
.action(async (_options, cmd) => {
|
|
115
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
120
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
116
121
|
return subMain(walletMain, ['wallet'], opts);
|
|
117
122
|
});
|
|
118
123
|
|
|
119
|
-
|
|
120
|
-
.command('init <project>')
|
|
124
|
+
baseCmd('init <project>')
|
|
121
125
|
.description('create a new Dapp directory named <project>')
|
|
122
126
|
.option(
|
|
123
127
|
'--dapp-template <name>',
|
|
@@ -134,13 +138,17 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
134
138
|
'use this branch instead of the repository HEAD',
|
|
135
139
|
DEFAULT_DAPP_BRANCH,
|
|
136
140
|
)
|
|
141
|
+
// Tolerate @agoric/create-dapp's `agoric init --version` invocation.
|
|
142
|
+
.option('-V, --version', 'output the version number', () => {
|
|
143
|
+
console.log(pkg.version);
|
|
144
|
+
process.exit(0);
|
|
145
|
+
})
|
|
137
146
|
.action(async (project, _options, cmd) => {
|
|
138
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
147
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
139
148
|
return subMain(initMain, ['init', project], opts);
|
|
140
149
|
});
|
|
141
150
|
|
|
142
|
-
program
|
|
143
|
-
.command('set-defaults <program> <config-dir>')
|
|
151
|
+
baseCmd('set-defaults <program> <config-dir>')
|
|
144
152
|
.description('update the configuration files for <program> in <config-dir>')
|
|
145
153
|
.option(
|
|
146
154
|
'--enable-cors',
|
|
@@ -168,7 +176,7 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
168
176
|
'',
|
|
169
177
|
)
|
|
170
178
|
.action(async (prog, configDir, _options, cmd) => {
|
|
171
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
179
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
172
180
|
return subMain(setDefaultsMain, ['set-defaults', prog, configDir], opts);
|
|
173
181
|
});
|
|
174
182
|
|
|
@@ -187,17 +195,15 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
187
195
|
},
|
|
188
196
|
);
|
|
189
197
|
|
|
190
|
-
|
|
191
|
-
.command('install [force-sdk-version]')
|
|
198
|
+
baseCmd('install [force-sdk-version]')
|
|
192
199
|
.description('install Dapp dependencies')
|
|
193
200
|
.action(async (forceSdkVersion, _options, cmd) => {
|
|
194
201
|
await isNotBasedir();
|
|
195
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
202
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
196
203
|
return subMain(installMain, ['install', forceSdkVersion], opts);
|
|
197
204
|
});
|
|
198
205
|
|
|
199
|
-
|
|
200
|
-
.command('follow <path-spec...>')
|
|
206
|
+
baseCmd('follow <path-spec...>')
|
|
201
207
|
.description('follow an Agoric Casting leader')
|
|
202
208
|
.option(
|
|
203
209
|
'--proof <strict | optimistic | none>',
|
|
@@ -270,7 +276,7 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
270
276
|
)
|
|
271
277
|
.option('-B, --bootstrap <config>', 'network bootstrap configuration')
|
|
272
278
|
.action(async (pathSpecs, _options, cmd) => {
|
|
273
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
279
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
274
280
|
return subMain(followMain, ['follow', ...pathSpecs], opts);
|
|
275
281
|
});
|
|
276
282
|
|
|
@@ -297,19 +303,18 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
297
303
|
'',
|
|
298
304
|
);
|
|
299
305
|
|
|
300
|
-
|
|
301
|
-
.command('run <script> [script-args...]')
|
|
306
|
+
baseCmd('run <script> [script-args...]')
|
|
302
307
|
.description(
|
|
303
308
|
'run a script with all your user privileges and some Agoric endowments',
|
|
304
309
|
)
|
|
310
|
+
.passThroughOptions(true)
|
|
305
311
|
.action(async (script, scriptArgs, _options, cmd) => {
|
|
306
|
-
const opts = { ...program.opts(), ...cmd.opts(), scriptArgs };
|
|
312
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts, scriptArgs };
|
|
307
313
|
return subMain(runMain, ['run', script], opts);
|
|
308
314
|
});
|
|
309
315
|
|
|
310
316
|
addRunOptions(
|
|
311
|
-
|
|
312
|
-
.command('deploy [script...]')
|
|
317
|
+
baseCmd('deploy [script...]')
|
|
313
318
|
.option(
|
|
314
319
|
'--target <target>',
|
|
315
320
|
'One of agoric, local, cosmos, or sim',
|
|
@@ -323,8 +328,7 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
323
328
|
return subMain(deployMain, ['deploy', ...scripts], opts);
|
|
324
329
|
});
|
|
325
330
|
|
|
326
|
-
|
|
327
|
-
.command('publish [bundle...]')
|
|
331
|
+
baseCmd('publish [bundle...]')
|
|
328
332
|
.option(
|
|
329
333
|
'-c, --chain-id <chainID>',
|
|
330
334
|
'The ID of the destination chain',
|
|
@@ -345,10 +349,9 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
345
349
|
return subMain(publishMain, ['publish', ...bundles], opts);
|
|
346
350
|
});
|
|
347
351
|
|
|
348
|
-
|
|
352
|
+
await makeWalletCommand(baseCmd);
|
|
349
353
|
|
|
350
|
-
|
|
351
|
-
.command('start [profile] [args...]')
|
|
354
|
+
baseCmd('start [profile] [args...]')
|
|
352
355
|
.description(
|
|
353
356
|
`\
|
|
354
357
|
start an Agoric VM
|
|
@@ -360,6 +363,7 @@ agoric start local-solo [portNum] [provisionPowers] - local solo VM
|
|
|
360
363
|
`,
|
|
361
364
|
)
|
|
362
365
|
.option('-d, --debug', 'run in JS debugger mode')
|
|
366
|
+
.option('--docker-tag <tag>', 'image tag to use for Docker containers')
|
|
363
367
|
.option('--reset', 'clear all VM state before starting')
|
|
364
368
|
.option('--no-restart', 'do not actually start the VM')
|
|
365
369
|
.option('--pull', 'for Docker-based VM, pull the image before running')
|
|
@@ -383,19 +387,13 @@ agoric start local-solo [portNum] [provisionPowers] - local solo VM
|
|
|
383
387
|
)
|
|
384
388
|
.action(async (profile, args, _options, cmd) => {
|
|
385
389
|
await isNotBasedir();
|
|
386
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
390
|
+
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts };
|
|
387
391
|
return subMain(startMain, ['start', profile, ...args], opts);
|
|
388
392
|
});
|
|
389
393
|
|
|
390
394
|
// Throw an error instead of exiting directly.
|
|
391
395
|
program.exitOverride();
|
|
392
396
|
|
|
393
|
-
// Hack: cosmos arguments are always unparsed.
|
|
394
|
-
const cosmosIndex = rawArgs.indexOf('cosmos');
|
|
395
|
-
if (cosmosIndex >= 0) {
|
|
396
|
-
rawArgs.splice(cosmosIndex + 1, 0, '--');
|
|
397
|
-
}
|
|
398
|
-
|
|
399
397
|
try {
|
|
400
398
|
await program.parseAsync(rawArgs, { from: 'user' });
|
|
401
399
|
} catch (e) {
|
package/src/open.js
CHANGED
|
@@ -5,8 +5,8 @@ import { getAccessToken } from '@agoric/access-token';
|
|
|
5
5
|
|
|
6
6
|
import { assert, details as X } from '@agoric/assert';
|
|
7
7
|
|
|
8
|
-
export default async function walletMain(
|
|
9
|
-
const { anylogger
|
|
8
|
+
export default async function walletMain(_progname, _rawArgs, powers, opts) {
|
|
9
|
+
const { anylogger } = powers;
|
|
10
10
|
const console = anylogger('agoric:wallet');
|
|
11
11
|
|
|
12
12
|
let suffix;
|
|
@@ -39,10 +39,10 @@ export default async function walletMain(progname, rawArgs, powers, opts) {
|
|
|
39
39
|
1000,
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const walletAccessToken = await getAccessToken(opts.hostport
|
|
43
|
-
console
|
|
44
|
-
|
|
45
|
-
})
|
|
42
|
+
const walletAccessToken = await getAccessToken(opts.hostport).catch(e => {
|
|
43
|
+
console.error(`Trying to fetch access token:`, e);
|
|
44
|
+
throw e;
|
|
45
|
+
});
|
|
46
46
|
|
|
47
47
|
clearInterval(progressTimer);
|
|
48
48
|
process.stderr.write('\n');
|
package/src/publish.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
/// <reference types="ses"/>
|
|
2
|
+
/// <reference types="ses" />
|
|
3
3
|
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
5
|
|
|
@@ -38,6 +38,7 @@ const Agoric = {
|
|
|
38
38
|
const hdPath = (coinType = 118, account = 0) =>
|
|
39
39
|
stringToPath(`m/44'/${coinType}'/${account}'/0/0`);
|
|
40
40
|
|
|
41
|
+
// @ts-expect-error difference in private property _push
|
|
41
42
|
const registry = new Registry([
|
|
42
43
|
...defaultRegistryTypes,
|
|
43
44
|
[Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle],
|
|
@@ -96,7 +97,6 @@ const choose = (array, randomNumber) => {
|
|
|
96
97
|
return array[index];
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
// eslint-disable-next-line jsdoc/require-returns-check
|
|
100
100
|
/**
|
|
101
101
|
* @param {unknown} connectionSpec
|
|
102
102
|
* @returns {asserts connectionSpec is HttpConnectionSpec}
|
|
@@ -124,7 +124,6 @@ const assertHttpConnectionSpec = connectionSpec => {
|
|
|
124
124
|
Fail`Expected integer "port" on "http" type connectionSpec, ${connectionSpec}`;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// eslint-disable-next-line jsdoc/require-returns-check
|
|
128
127
|
/**
|
|
129
128
|
* @param {unknown} connectionSpec
|
|
130
129
|
* @returns {asserts connectionSpec is CosmosConnectionSpec}
|
|
@@ -289,14 +288,12 @@ export const makeCosmosBundlePublisher = ({
|
|
|
289
288
|
const endpoint = urlForRpcAddress(rpcAddress);
|
|
290
289
|
|
|
291
290
|
// AWAIT
|
|
292
|
-
// eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
|
|
293
291
|
const stargateClient = await connectWithSigner(endpoint, wallet, {
|
|
294
292
|
gasPrice: Agoric.gasPrice,
|
|
295
293
|
registry,
|
|
296
294
|
});
|
|
297
295
|
|
|
298
296
|
// AWAIT
|
|
299
|
-
// eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
|
|
300
297
|
const result = await stargateClient
|
|
301
298
|
.signAndBroadcast(from.address, encodeObjects, Agoric.fee)
|
|
302
299
|
.catch(error => {
|
|
@@ -312,7 +309,6 @@ export const makeCosmosBundlePublisher = ({
|
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
// AWAIT
|
|
315
|
-
// eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
|
|
316
312
|
await E(leader).jitter('agoric CLI deploy');
|
|
317
313
|
}
|
|
318
314
|
|
|
@@ -426,6 +422,7 @@ const publishBundle = async (
|
|
|
426
422
|
)}, publishBundle supports only "endoZipBase64" with "endoZipBase64Sha512"`;
|
|
427
423
|
}
|
|
428
424
|
|
|
425
|
+
await null;
|
|
429
426
|
if (connectionSpec === undefined && getDefaultConnection !== undefined) {
|
|
430
427
|
connectionSpec = await getDefaultConnection();
|
|
431
428
|
}
|
package/src/sdk-package-names.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
// DO NOT EDIT - automatically generated by get-sdk-package-names.js
|
|
2
|
-
/* eslint-disable comma-dangle,quotes */
|
|
3
2
|
// prettier-ignore
|
|
4
3
|
export default [
|
|
5
4
|
"@agoric/access-token",
|
|
6
5
|
"@agoric/assert",
|
|
6
|
+
"@agoric/async-flow",
|
|
7
|
+
"@agoric/base-zone",
|
|
8
|
+
"@agoric/benchmark",
|
|
9
|
+
"@agoric/boot",
|
|
10
|
+
"@agoric/builders",
|
|
7
11
|
"@agoric/cache",
|
|
8
12
|
"@agoric/casting",
|
|
9
13
|
"@agoric/cosmic-proto",
|
|
10
14
|
"@agoric/cosmic-swingset",
|
|
11
15
|
"@agoric/cosmos",
|
|
16
|
+
"@agoric/create-dapp",
|
|
12
17
|
"@agoric/deploy-script-support",
|
|
13
18
|
"@agoric/deployment",
|
|
14
19
|
"@agoric/ertp",
|
|
@@ -17,10 +22,11 @@ export default [
|
|
|
17
22
|
"@agoric/import-manager",
|
|
18
23
|
"@agoric/inter-protocol",
|
|
19
24
|
"@agoric/internal",
|
|
25
|
+
"@agoric/kmarshal",
|
|
26
|
+
"@agoric/network",
|
|
20
27
|
"@agoric/notifier",
|
|
28
|
+
"@agoric/orchestration",
|
|
21
29
|
"@agoric/pegasus",
|
|
22
|
-
"@agoric/same-structure",
|
|
23
|
-
"@agoric/sharing-service",
|
|
24
30
|
"@agoric/smart-wallet",
|
|
25
31
|
"@agoric/solo",
|
|
26
32
|
"@agoric/sparse-ints",
|
|
@@ -34,13 +40,12 @@ export default [
|
|
|
34
40
|
"@agoric/swingset-xsnap-supervisor",
|
|
35
41
|
"@agoric/telemetry",
|
|
36
42
|
"@agoric/time",
|
|
37
|
-
"@agoric/ui-components",
|
|
38
43
|
"@agoric/vat-data",
|
|
39
44
|
"@agoric/vats",
|
|
45
|
+
"@agoric/vm-config",
|
|
46
|
+
"@agoric/vow",
|
|
40
47
|
"@agoric/wallet",
|
|
41
48
|
"@agoric/wallet-backend",
|
|
42
|
-
"@agoric/wallet-connection",
|
|
43
|
-
"@agoric/web-components",
|
|
44
49
|
"@agoric/xsnap",
|
|
45
50
|
"@agoric/xsnap-lockdown",
|
|
46
51
|
"@agoric/zoe",
|
package/src/set-defaults.js
CHANGED