agoric 0.22.0-upgrade-18a-dev-61134db.0 → 0.22.0-upgrade-19-dev-0754752.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 +32 -33
- package/src/bin-agops.js +1 -1
- package/src/commands/oracle.js +40 -28
- package/src/commands/wallet.js +12 -9
- package/src/install.js +3 -11
- package/src/lib/chain.js +2 -0
- package/src/lib/packageManager.js +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agoric",
|
|
3
|
-
"version": "0.22.0-upgrade-
|
|
3
|
+
"version": "0.22.0-upgrade-19-dev-0754752.0+0754752",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -30,46 +30,45 @@
|
|
|
30
30
|
"lint:eslint": "eslint ."
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@agoric/cosmic-swingset": "0.42.0-upgrade-
|
|
34
|
-
"@agoric/deploy-script-support": "0.10.4-upgrade-
|
|
33
|
+
"@agoric/cosmic-swingset": "0.42.0-upgrade-19-dev-0754752.0+0754752",
|
|
34
|
+
"@agoric/deploy-script-support": "0.10.4-upgrade-19-dev-0754752.0+0754752",
|
|
35
35
|
"ava": "^5.3.0",
|
|
36
|
-
"c8": "^10.1.2"
|
|
37
|
-
"dd-trace": "^4.11.1"
|
|
36
|
+
"c8": "^10.1.2"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@agoric/access-token": "0.4.22-upgrade-
|
|
41
|
-
"@agoric/cache": "0.3.3-upgrade-
|
|
42
|
-
"@agoric/casting": "0.4.3-upgrade-
|
|
43
|
-
"@agoric/client-utils": "0.2.0-upgrade-
|
|
44
|
-
"@agoric/cosmic-proto": "0.5.0-upgrade-
|
|
45
|
-
"@agoric/ertp": "0.16.3-upgrade-
|
|
46
|
-
"@agoric/governance": "0.10.4-upgrade-
|
|
47
|
-
"@agoric/inter-protocol": "0.17.0-upgrade-
|
|
48
|
-
"@agoric/internal": "0.4.0-upgrade-
|
|
49
|
-
"@agoric/network": "0.2.0-upgrade-
|
|
50
|
-
"@agoric/smart-wallet": "0.5.4-upgrade-
|
|
51
|
-
"@agoric/store": "0.9.3-upgrade-
|
|
52
|
-
"@agoric/swingset-vat": "0.33.0-upgrade-
|
|
53
|
-
"@agoric/vats": "0.16.0-upgrade-
|
|
54
|
-
"@agoric/zoe": "0.
|
|
55
|
-
"@agoric/zone": "0.3.0-upgrade-
|
|
39
|
+
"@agoric/access-token": "0.4.22-upgrade-19-dev-0754752.0+0754752",
|
|
40
|
+
"@agoric/cache": "0.3.3-upgrade-19-dev-0754752.0+0754752",
|
|
41
|
+
"@agoric/casting": "0.4.3-upgrade-19-dev-0754752.0+0754752",
|
|
42
|
+
"@agoric/client-utils": "0.2.0-upgrade-19-dev-0754752.0+0754752",
|
|
43
|
+
"@agoric/cosmic-proto": "0.5.0-upgrade-19-dev-0754752.0+0754752",
|
|
44
|
+
"@agoric/ertp": "0.16.3-upgrade-19-dev-0754752.0+0754752",
|
|
45
|
+
"@agoric/governance": "0.10.4-upgrade-19-dev-0754752.0+0754752",
|
|
46
|
+
"@agoric/inter-protocol": "0.17.0-upgrade-19-dev-0754752.0+0754752",
|
|
47
|
+
"@agoric/internal": "0.4.0-upgrade-19-dev-0754752.0+0754752",
|
|
48
|
+
"@agoric/network": "0.2.0-upgrade-19-dev-0754752.0+0754752",
|
|
49
|
+
"@agoric/smart-wallet": "0.5.4-upgrade-19-dev-0754752.0+0754752",
|
|
50
|
+
"@agoric/store": "0.9.3-upgrade-19-dev-0754752.0+0754752",
|
|
51
|
+
"@agoric/swingset-vat": "0.33.0-upgrade-19-dev-0754752.0+0754752",
|
|
52
|
+
"@agoric/vats": "0.16.0-upgrade-19-dev-0754752.0+0754752",
|
|
53
|
+
"@agoric/zoe": "0.27.0-upgrade-19-dev-0754752.0+0754752",
|
|
54
|
+
"@agoric/zone": "0.3.0-upgrade-19-dev-0754752.0+0754752",
|
|
56
55
|
"@confio/relayer": "^0.11.3",
|
|
57
56
|
"@cosmjs/crypto": "^0.32.3",
|
|
58
57
|
"@cosmjs/encoding": "^0.32.3",
|
|
59
58
|
"@cosmjs/math": "^0.32.3",
|
|
60
59
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
61
60
|
"@cosmjs/stargate": "^0.32.3",
|
|
62
|
-
"@endo/bundle-source": "^3.5.
|
|
63
|
-
"@endo/captp": "^4.4.
|
|
64
|
-
"@endo/compartment-mapper": "^1.
|
|
61
|
+
"@endo/bundle-source": "^3.5.1",
|
|
62
|
+
"@endo/captp": "^4.4.4",
|
|
63
|
+
"@endo/compartment-mapper": "^1.5.0",
|
|
65
64
|
"@endo/env-options": "^1.1.8",
|
|
66
|
-
"@endo/errors": "^1.2.
|
|
67
|
-
"@endo/far": "^1.1.
|
|
68
|
-
"@endo/init": "^1.1.
|
|
69
|
-
"@endo/marshal": "^1.6.
|
|
70
|
-
"@endo/nat": "^5.0.
|
|
71
|
-
"@endo/patterns": "^1.4.
|
|
72
|
-
"@endo/promise-kit": "^1.1.
|
|
65
|
+
"@endo/errors": "^1.2.9",
|
|
66
|
+
"@endo/far": "^1.1.10",
|
|
67
|
+
"@endo/init": "^1.1.8",
|
|
68
|
+
"@endo/marshal": "^1.6.3",
|
|
69
|
+
"@endo/nat": "^5.0.14",
|
|
70
|
+
"@endo/patterns": "^1.4.8",
|
|
71
|
+
"@endo/promise-kit": "^1.1.9",
|
|
73
72
|
"@endo/zip": "^1.0.9",
|
|
74
73
|
"@iarna/toml": "^2.2.3",
|
|
75
74
|
"anylogger": "^0.21.0",
|
|
@@ -101,7 +100,7 @@
|
|
|
101
100
|
"workerThreads": false
|
|
102
101
|
},
|
|
103
102
|
"typeCoverage": {
|
|
104
|
-
"atLeast": 78.
|
|
103
|
+
"atLeast": 78.73
|
|
105
104
|
},
|
|
106
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "07547522e9d8a06692fa5ff12c35230ddb4b252b"
|
|
107
106
|
}
|
package/src/bin-agops.js
CHANGED
|
@@ -30,7 +30,6 @@ const progname = path.basename(process.argv[1]);
|
|
|
30
30
|
const program = new Command();
|
|
31
31
|
program.name(progname).version('unversioned');
|
|
32
32
|
|
|
33
|
-
program.addCommand(makeOracleCommand(logger));
|
|
34
33
|
program.addCommand(makeGovCommand(logger));
|
|
35
34
|
program.addCommand(makePerfCommand(logger));
|
|
36
35
|
program.addCommand(makePsmCommand(logger));
|
|
@@ -69,6 +68,7 @@ const procIO = {
|
|
|
69
68
|
setTimeout,
|
|
70
69
|
};
|
|
71
70
|
|
|
71
|
+
program.addCommand(makeOracleCommand(procIO, logger));
|
|
72
72
|
program.addCommand(makeReserveCommand(logger, procIO));
|
|
73
73
|
program.addCommand(makeAuctionCommand(logger, { ...procIO, fetch }));
|
|
74
74
|
program.addCommand(makeInterCommand(procIO, { fetch }));
|
package/src/commands/oracle.js
CHANGED
|
@@ -12,7 +12,6 @@ import { Offers } from '@agoric/inter-protocol/src/clientSupport.js';
|
|
|
12
12
|
import { oracleBrandFeedName } from '@agoric/inter-protocol/src/proposals/utils.js';
|
|
13
13
|
import { Fail } from '@endo/errors';
|
|
14
14
|
import { Nat } from '@endo/nat';
|
|
15
|
-
import * as cp from 'child_process';
|
|
16
15
|
import { Command } from 'commander';
|
|
17
16
|
import { inspect } from 'util';
|
|
18
17
|
import { normalizeAddressWithOptions } from '../lib/chain.js';
|
|
@@ -28,26 +27,33 @@ import {
|
|
|
28
27
|
|
|
29
28
|
// XXX support other decimal places
|
|
30
29
|
const COSMOS_UNIT = 1_000_000n;
|
|
31
|
-
|
|
30
|
+
/** @param {number} num */
|
|
31
|
+
const scaleDecimals = num => BigInt(Math.round(num * Number(COSMOS_UNIT)));
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Prints JSON output to stdout and diagnostic info (like logs) to stderr
|
|
35
35
|
*
|
|
36
|
-
* @param {import('anylogger').Logger} logger
|
|
37
36
|
* @param {{
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* createCommand: typeof import('commander').createCommand,
|
|
38
|
+
* env: Partial<Record<string, string>>,
|
|
39
|
+
* execFileSync: typeof import('child_process').execFileSync,
|
|
40
|
+
* now: () => number,
|
|
41
|
+
* setTimeout: typeof setTimeout,
|
|
42
|
+
* stderr: Pick<import('stream').Writable,'write'>,
|
|
43
|
+
* stdout: Pick<import('stream').Writable,'write'>,
|
|
44
|
+
* }} process
|
|
45
|
+
* @param {import('anylogger').Logger} [logger]
|
|
43
46
|
*/
|
|
44
|
-
export const makeOracleCommand = (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
export const makeOracleCommand = (
|
|
48
|
+
{ env, execFileSync, setTimeout, stderr, stdout },
|
|
49
|
+
logger,
|
|
50
|
+
) => {
|
|
51
|
+
/**
|
|
52
|
+
* @param {number} ms
|
|
53
|
+
* @returns {Promise<void>}
|
|
54
|
+
*/
|
|
55
|
+
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
56
|
+
|
|
51
57
|
const oracle = new Command('oracle')
|
|
52
58
|
.description('Oracle commands')
|
|
53
59
|
.usage(
|
|
@@ -98,7 +104,7 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
98
104
|
const name = oracleBrandFeedName(brandIn, brandOut);
|
|
99
105
|
const instance = agoricNames.instance[name];
|
|
100
106
|
if (!instance) {
|
|
101
|
-
logger.debug('known instances:', agoricNames.instance);
|
|
107
|
+
logger && logger.debug('known instances:', agoricNames.instance);
|
|
102
108
|
throw Error(`Unknown instance ${name}`);
|
|
103
109
|
}
|
|
104
110
|
return instance;
|
|
@@ -137,12 +143,15 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
137
143
|
proposal: {},
|
|
138
144
|
};
|
|
139
145
|
|
|
140
|
-
outputAction(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
outputAction(
|
|
147
|
+
{
|
|
148
|
+
method: 'executeOffer',
|
|
149
|
+
offer,
|
|
150
|
+
},
|
|
151
|
+
stdout,
|
|
152
|
+
);
|
|
144
153
|
|
|
145
|
-
|
|
154
|
+
stderr.write(sendHint);
|
|
146
155
|
});
|
|
147
156
|
|
|
148
157
|
oracle
|
|
@@ -172,12 +181,15 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
172
181
|
opts.oracleAdminAcceptOfferId,
|
|
173
182
|
);
|
|
174
183
|
|
|
175
|
-
outputAction(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
outputAction(
|
|
185
|
+
{
|
|
186
|
+
method: 'executeOffer',
|
|
187
|
+
offer,
|
|
188
|
+
},
|
|
189
|
+
stdout,
|
|
190
|
+
);
|
|
179
191
|
|
|
180
|
-
|
|
192
|
+
stderr.write(sendHint);
|
|
181
193
|
});
|
|
182
194
|
|
|
183
195
|
const findOracleCap = async (instance, from, readPublished) => {
|
|
@@ -288,7 +300,7 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
288
300
|
/** @type {Promise<PriceDescription>} */ (
|
|
289
301
|
readLatestHead(feedPath).catch(() => {
|
|
290
302
|
const viewer = `https://vstorage.agoric.net/#${networkConfig.rpcAddrs[0]}|published,published.priceFeed|${feedPath}`;
|
|
291
|
-
|
|
303
|
+
stderr.write(`no existing price data; see ${viewer}`);
|
|
292
304
|
return undefined;
|
|
293
305
|
})
|
|
294
306
|
);
|
|
@@ -333,7 +345,7 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
333
345
|
}
|
|
334
346
|
}),
|
|
335
347
|
]).catch(err => {
|
|
336
|
-
|
|
348
|
+
stderr.write(err);
|
|
337
349
|
});
|
|
338
350
|
}
|
|
339
351
|
|
package/src/commands/wallet.js
CHANGED
|
@@ -55,6 +55,7 @@ export const makeWalletCommand = async command => {
|
|
|
55
55
|
'wallet commands',
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
+
/** @param {string} literalOrName */
|
|
58
59
|
const normalizeAddress = literalOrName =>
|
|
59
60
|
normalizeAddressWithOptions(literalOrName, wallet.opts());
|
|
60
61
|
|
|
@@ -112,9 +113,9 @@ export const makeWalletCommand = async command => {
|
|
|
112
113
|
.action(async function (opts) {
|
|
113
114
|
const offerStr = fs.readFileSync(opts.file).toString();
|
|
114
115
|
|
|
115
|
-
const {
|
|
116
|
+
const { marshaller } = makeVstorageKit({ fetch }, networkConfig);
|
|
116
117
|
|
|
117
|
-
const offerObj =
|
|
118
|
+
const offerObj = marshaller.fromCapData(JSON.parse(offerStr));
|
|
118
119
|
console.log(offerObj);
|
|
119
120
|
});
|
|
120
121
|
|
|
@@ -127,9 +128,9 @@ export const makeWalletCommand = async command => {
|
|
|
127
128
|
.action(async function (opts) {
|
|
128
129
|
const offerStr = fs.readFileSync(opts.offer).toString();
|
|
129
130
|
|
|
130
|
-
const {
|
|
131
|
+
const { marshaller } = makeVstorageKit({ fetch }, networkConfig);
|
|
131
132
|
|
|
132
|
-
const offerObj =
|
|
133
|
+
const offerObj = marshaller.fromCapData(JSON.parse(offerStr));
|
|
133
134
|
console.log(offerObj.offer.id);
|
|
134
135
|
});
|
|
135
136
|
|
|
@@ -204,7 +205,7 @@ export const makeWalletCommand = async command => {
|
|
|
204
205
|
.command('list')
|
|
205
206
|
.description('list all wallets in vstorage')
|
|
206
207
|
.action(async function () {
|
|
207
|
-
const { vstorage } =
|
|
208
|
+
const { vstorage } = makeVstorageKit({ fetch }, networkConfig);
|
|
208
209
|
const wallets = await vstorage.keys('published.wallet');
|
|
209
210
|
process.stdout.write(wallets.join('\n'));
|
|
210
211
|
});
|
|
@@ -218,10 +219,11 @@ export const makeWalletCommand = async command => {
|
|
|
218
219
|
normalizeAddress,
|
|
219
220
|
)
|
|
220
221
|
.action(async function (opts) {
|
|
221
|
-
const {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
const {
|
|
223
|
+
readPublished,
|
|
224
|
+
marshaller: unserializer,
|
|
225
|
+
...vsk
|
|
226
|
+
} = makeVstorageKit({ fetch }, networkConfig);
|
|
225
227
|
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
226
228
|
|
|
227
229
|
const leader = makeLeader(networkConfig.rpcAddrs[0]);
|
|
@@ -229,6 +231,7 @@ export const makeWalletCommand = async command => {
|
|
|
229
231
|
`:published.wallet.${opts.from}`,
|
|
230
232
|
leader,
|
|
231
233
|
{
|
|
234
|
+
// @ts-expect-error xxx follower/marshaller types
|
|
232
235
|
unserializer,
|
|
233
236
|
},
|
|
234
237
|
);
|
package/src/install.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* eslint-env node */
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
4
5
|
import { makePspawn } from './helpers.js';
|
|
5
6
|
import DEFAULT_SDK_PACKAGE_NAMES from './sdk-package-names.js';
|
|
7
|
+
import { listWorkspaces } from './lib/packageManager.js';
|
|
6
8
|
|
|
7
9
|
const REQUIRED_AGORIC_START_PACKAGES = [
|
|
8
10
|
'@agoric/solo',
|
|
@@ -30,17 +32,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
|
|
|
30
32
|
const rimraf = file => pspawn('rm', ['-rf', file]);
|
|
31
33
|
|
|
32
34
|
async function getWorktreePackagePaths(cwd = '.', map = new Map()) {
|
|
33
|
-
|
|
34
|
-
// use, instead of a hard-coded list
|
|
35
|
-
const p = pspawn('yarn', ['workspaces', '--silent', 'info'], {
|
|
36
|
-
cwd,
|
|
37
|
-
stdio: ['inherit', 'pipe', 'inherit'],
|
|
38
|
-
});
|
|
39
|
-
const stdout = [];
|
|
40
|
-
p.childProcess.stdout?.on('data', out => stdout.push(out));
|
|
41
|
-
await p;
|
|
42
|
-
const d = JSON.parse(Buffer.concat(stdout).toString('utf-8'));
|
|
43
|
-
for (const [name, { location }] of Object.entries(d)) {
|
|
35
|
+
for (const { name, location } of listWorkspaces({ execFileSync })) {
|
|
44
36
|
map.set(name, path.resolve(cwd, location));
|
|
45
37
|
}
|
|
46
38
|
return map;
|
package/src/lib/chain.js
CHANGED
|
@@ -5,6 +5,7 @@ import { execFileSync as execFileSyncAmbient } from 'child_process';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @import {MinimalNetworkConfig} from '@agoric/client-utils';
|
|
8
|
+
* @import {ParamsSDKType} from '@agoric/cosmic-proto/agoric/swingset/swingset.js';
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
const agdBinary = 'agd';
|
|
@@ -132,6 +133,7 @@ harden(execSwingsetTransaction);
|
|
|
132
133
|
/**
|
|
133
134
|
*
|
|
134
135
|
* @param {MinimalNetworkConfig} net
|
|
136
|
+
* @returns {ParamsSDKType}
|
|
135
137
|
*/
|
|
136
138
|
// TODO fetch by HTTP instead of shelling out https://github.com/Agoric/agoric-sdk/issues/9200
|
|
137
139
|
export const fetchSwingsetParams = net => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import { execFileSync } from 'child_process';
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Omits the root
|
|
9
|
+
*
|
|
10
|
+
* @param {{ execFileSync: execFileSync }} io
|
|
11
|
+
* @returns {Array<{ location: string, name: string }>}
|
|
12
|
+
*/
|
|
13
|
+
export const listWorkspaces = ({ execFileSync }) => {
|
|
14
|
+
const out = execFileSync('npm', ['query', '.workspace'], {
|
|
15
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
16
|
+
shell: true,
|
|
17
|
+
encoding: 'utf-8',
|
|
18
|
+
});
|
|
19
|
+
/** @type {Array<{ location: string, name: string, description: string }>} */
|
|
20
|
+
const result = JSON.parse(out);
|
|
21
|
+
return result.filter(({ location }) => location !== '.');
|
|
22
|
+
};
|