agoric 0.21.2-dev-3b478fb.0 → 0.21.2-dev-8f9f075.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 +20 -20
- package/src/commands/auction.js +7 -2
- package/src/commands/gov.js +23 -13
- package/src/commands/oracle.js +6 -4
- package/src/commands/psm.js +9 -8
- package/src/commands/reserve.js +9 -3
- package/src/commands/vaults.js +11 -4
- package/src/commands/wallet.js +10 -8
- package/src/lib/wallet.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agoric",
|
|
3
|
-
"version": "0.21.2-dev-
|
|
3
|
+
"version": "0.21.2-dev-8f9f075.0+8f9f075",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -30,29 +30,29 @@
|
|
|
30
30
|
"lint:eslint": "eslint ."
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@agoric/cosmic-swingset": "0.41.4-dev-
|
|
34
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
33
|
+
"@agoric/cosmic-swingset": "0.41.4-dev-8f9f075.0+8f9f075",
|
|
34
|
+
"@agoric/deploy-script-support": "0.10.4-dev-8f9f075.0+8f9f075",
|
|
35
35
|
"ava": "^5.3.0",
|
|
36
36
|
"c8": "^10.1.2",
|
|
37
37
|
"dd-trace": "^4.11.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@agoric/access-token": "0.4.22-dev-
|
|
41
|
-
"@agoric/cache": "0.3.3-dev-
|
|
42
|
-
"@agoric/casting": "0.4.3-dev-
|
|
43
|
-
"@agoric/client-utils": "0.1.1-dev-
|
|
44
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
45
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
46
|
-
"@agoric/governance": "0.10.4-dev-
|
|
47
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
48
|
-
"@agoric/internal": "0.3.3-dev-
|
|
49
|
-
"@agoric/network": "0.1.1-dev-
|
|
50
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
51
|
-
"@agoric/store": "0.9.3-dev-
|
|
52
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
53
|
-
"@agoric/vats": "0.15.2-dev-
|
|
54
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
55
|
-
"@agoric/zone": "0.2.3-dev-
|
|
40
|
+
"@agoric/access-token": "0.4.22-dev-8f9f075.0+8f9f075",
|
|
41
|
+
"@agoric/cache": "0.3.3-dev-8f9f075.0+8f9f075",
|
|
42
|
+
"@agoric/casting": "0.4.3-dev-8f9f075.0+8f9f075",
|
|
43
|
+
"@agoric/client-utils": "0.1.1-dev-8f9f075.0+8f9f075",
|
|
44
|
+
"@agoric/cosmic-proto": "0.4.1-dev-8f9f075.0+8f9f075",
|
|
45
|
+
"@agoric/ertp": "0.16.3-dev-8f9f075.0+8f9f075",
|
|
46
|
+
"@agoric/governance": "0.10.4-dev-8f9f075.0+8f9f075",
|
|
47
|
+
"@agoric/inter-protocol": "0.16.2-dev-8f9f075.0+8f9f075",
|
|
48
|
+
"@agoric/internal": "0.3.3-dev-8f9f075.0+8f9f075",
|
|
49
|
+
"@agoric/network": "0.1.1-dev-8f9f075.0+8f9f075",
|
|
50
|
+
"@agoric/smart-wallet": "0.5.4-dev-8f9f075.0+8f9f075",
|
|
51
|
+
"@agoric/store": "0.9.3-dev-8f9f075.0+8f9f075",
|
|
52
|
+
"@agoric/swingset-vat": "0.32.3-dev-8f9f075.0+8f9f075",
|
|
53
|
+
"@agoric/vats": "0.15.2-dev-8f9f075.0+8f9f075",
|
|
54
|
+
"@agoric/zoe": "0.26.3-dev-8f9f075.0+8f9f075",
|
|
55
|
+
"@agoric/zone": "0.2.3-dev-8f9f075.0+8f9f075",
|
|
56
56
|
"@confio/relayer": "^0.11.3",
|
|
57
57
|
"@cosmjs/crypto": "^0.32.3",
|
|
58
58
|
"@cosmjs/encoding": "^0.32.3",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"typeCoverage": {
|
|
104
104
|
"atLeast": 78.19
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "8f9f07501c1e5f25103d0a015f2f2817275391f2"
|
|
107
107
|
}
|
package/src/commands/auction.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-env node */
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
fetchEnvNetworkConfig,
|
|
5
|
+
makeAgoricNames,
|
|
6
|
+
makeVstorageKit,
|
|
7
|
+
} from '@agoric/client-utils';
|
|
4
8
|
import { Fail } from '@endo/errors';
|
|
5
9
|
import { InvalidArgumentError } from 'commander';
|
|
6
10
|
import { outputActionAndHint } from '../lib/wallet.js';
|
|
@@ -88,10 +92,11 @@ export const makeAuctionCommand = (
|
|
|
88
92
|
* }} opts
|
|
89
93
|
*/
|
|
90
94
|
async opts => {
|
|
91
|
-
const {
|
|
95
|
+
const { readPublished, ...vsk } = makeVstorageKit(
|
|
92
96
|
{ fetch },
|
|
93
97
|
networkConfig,
|
|
94
98
|
);
|
|
99
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
95
100
|
|
|
96
101
|
const { current } = await readPublished(`auction.governance`);
|
|
97
102
|
|
package/src/commands/gov.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-disable func-names */
|
|
3
3
|
/* eslint-env node */
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fetchEnvNetworkConfig,
|
|
6
|
+
makeAgoricNames,
|
|
7
|
+
makeVstorageKit,
|
|
8
|
+
} from '@agoric/client-utils';
|
|
5
9
|
import { execFileSync as execFileSyncAmbient } from 'child_process';
|
|
6
10
|
import { Command, CommanderError } from 'commander';
|
|
7
11
|
import { normalizeAddressWithOptions, pollBlocks } from '../lib/chain.js';
|
|
@@ -14,8 +18,10 @@ import {
|
|
|
14
18
|
} from '../lib/wallet.js';
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
|
-
* @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js'
|
|
18
|
-
* @import {
|
|
21
|
+
* @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js';
|
|
22
|
+
* @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js';
|
|
23
|
+
* @import {CurrentWalletRecord} from '@agoric/smart-wallet/src/smartWallet.js';
|
|
24
|
+
* @import {VstorageKit} from '@agoric/client-utils';
|
|
19
25
|
*/
|
|
20
26
|
|
|
21
27
|
const collectValues = (val, memo) => {
|
|
@@ -85,19 +91,21 @@ export const makeGovCommand = (_logger, io = {}) => {
|
|
|
85
91
|
* given a sendFrom address; else print it.
|
|
86
92
|
*
|
|
87
93
|
* @param {{
|
|
88
|
-
* toOffer: (agoricNames:
|
|
94
|
+
* toOffer: (agoricNames: AgoricNamesRemotes, current: CurrentWalletRecord | undefined) => OfferSpec,
|
|
89
95
|
* sendFrom?: string | undefined,
|
|
90
96
|
* keyringBackend: string,
|
|
91
97
|
* instanceName?: string,
|
|
92
98
|
* }} detail
|
|
93
|
-
* @param {
|
|
99
|
+
* @param {VstorageKit} [vsk]
|
|
94
100
|
*/
|
|
95
101
|
const processOffer = async function (
|
|
96
102
|
{ toOffer, sendFrom, keyringBackend },
|
|
97
|
-
|
|
103
|
+
vsk,
|
|
98
104
|
) {
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
await null;
|
|
106
|
+
vsk ||= makeVstorageKit({ fetch }, networkConfig);
|
|
107
|
+
const { readPublished } = vsk;
|
|
108
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
101
109
|
|
|
102
110
|
assert(keyringBackend, 'missing keyring-backend option');
|
|
103
111
|
|
|
@@ -264,10 +272,11 @@ export const makeGovCommand = (_logger, io = {}) => {
|
|
|
264
272
|
)
|
|
265
273
|
.requiredOption('--for <string>', 'description of the invitation')
|
|
266
274
|
.action(async opts => {
|
|
267
|
-
const {
|
|
275
|
+
const { readPublished, ...vsk } = makeVstorageKit(
|
|
268
276
|
{ fetch },
|
|
269
277
|
networkConfig,
|
|
270
278
|
);
|
|
279
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
271
280
|
const current = await getCurrent(opts.from, { readPublished });
|
|
272
281
|
|
|
273
282
|
const known = findContinuingIds(current, agoricNames);
|
|
@@ -293,10 +302,11 @@ export const makeGovCommand = (_logger, io = {}) => {
|
|
|
293
302
|
normalizeAddress,
|
|
294
303
|
)
|
|
295
304
|
.action(async opts => {
|
|
296
|
-
const {
|
|
305
|
+
const { readPublished, ...vsk } = makeVstorageKit(
|
|
297
306
|
{ fetch },
|
|
298
307
|
networkConfig,
|
|
299
308
|
);
|
|
309
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
300
310
|
const current = await getCurrent(opts.from, { readPublished });
|
|
301
311
|
|
|
302
312
|
const found = findContinuingIds(current, agoricNames);
|
|
@@ -332,8 +342,8 @@ export const makeGovCommand = (_logger, io = {}) => {
|
|
|
332
342
|
normalizeAddress,
|
|
333
343
|
)
|
|
334
344
|
.action(async function (opts, options) {
|
|
335
|
-
const
|
|
336
|
-
const { readPublished } =
|
|
345
|
+
const vsk = makeVstorageKit({ fetch }, networkConfig);
|
|
346
|
+
const { readPublished } = vsk;
|
|
337
347
|
|
|
338
348
|
const questionDesc = await readPublished(
|
|
339
349
|
`committees.${opts.pathname}.latestQuestion`,
|
|
@@ -383,7 +393,7 @@ export const makeGovCommand = (_logger, io = {}) => {
|
|
|
383
393
|
sendFrom: opts.sendFrom,
|
|
384
394
|
keyringBackend: options.optsWithGlobals().keyringBackend,
|
|
385
395
|
},
|
|
386
|
-
|
|
396
|
+
vsk,
|
|
387
397
|
);
|
|
388
398
|
});
|
|
389
399
|
|
package/src/commands/oracle.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/* eslint-env node */
|
|
4
4
|
import {
|
|
5
5
|
fetchEnvNetworkConfig,
|
|
6
|
+
makeAgoricNames,
|
|
6
7
|
makeVstorageKit,
|
|
7
8
|
makeWalletUtils,
|
|
8
9
|
storageHelper,
|
|
@@ -90,19 +91,20 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
90
91
|
env: process.env,
|
|
91
92
|
fetch,
|
|
92
93
|
});
|
|
93
|
-
const
|
|
94
|
+
const vsk = makeVstorageKit({ fetch }, networkConfig);
|
|
95
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
94
96
|
|
|
95
97
|
const lookupPriceAggregatorInstance = ([brandIn, brandOut]) => {
|
|
96
98
|
const name = oracleBrandFeedName(brandIn, brandOut);
|
|
97
|
-
const instance =
|
|
99
|
+
const instance = agoricNames.instance[name];
|
|
98
100
|
if (!instance) {
|
|
99
|
-
logger.debug('known instances:',
|
|
101
|
+
logger.debug('known instances:', agoricNames.instance);
|
|
100
102
|
throw Error(`Unknown instance ${name}`);
|
|
101
103
|
}
|
|
102
104
|
return instance;
|
|
103
105
|
};
|
|
104
106
|
|
|
105
|
-
return { ...
|
|
107
|
+
return { ...vsk, networkConfig, lookupPriceAggregatorInstance };
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
oracle
|
package/src/commands/psm.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/* eslint-env node */
|
|
4
4
|
import {
|
|
5
5
|
fetchEnvNetworkConfig,
|
|
6
|
+
makeAgoricNames,
|
|
6
7
|
makeVstorageKit,
|
|
7
8
|
storageHelper,
|
|
8
9
|
} from '@agoric/client-utils';
|
|
@@ -66,13 +67,14 @@ export const makePsmCommand = logger => {
|
|
|
66
67
|
);
|
|
67
68
|
|
|
68
69
|
const rpcTools = async () => {
|
|
69
|
-
const
|
|
70
|
+
const vsk = await makeVstorageKit({ fetch }, networkConfig);
|
|
71
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
70
72
|
|
|
71
73
|
const lookupPsmInstance = ([minted, anchor]) => {
|
|
72
74
|
const name = `psm-${minted}-${anchor}`;
|
|
73
|
-
const instance =
|
|
75
|
+
const instance = agoricNames.instance[name];
|
|
74
76
|
if (!instance) {
|
|
75
|
-
logger.debug('known instances:',
|
|
77
|
+
logger.debug('known instances:', agoricNames.instance);
|
|
76
78
|
throw Error(`Unknown instance ${name}`);
|
|
77
79
|
}
|
|
78
80
|
return instance;
|
|
@@ -83,20 +85,19 @@ export const makePsmCommand = logger => {
|
|
|
83
85
|
* @param {[Minted: string, Anchor: string]} pair
|
|
84
86
|
*/
|
|
85
87
|
const getGovernanceState = async ([Minted, Anchor]) => {
|
|
86
|
-
const govContent = await
|
|
88
|
+
const govContent = await vsk.vstorage.readLatest(
|
|
87
89
|
`published.psm.${Minted}.${Anchor}.governance`,
|
|
88
90
|
);
|
|
89
91
|
assert(govContent, 'no gov content');
|
|
90
92
|
const { current: governance } = last(
|
|
91
|
-
storageHelper.unserializeTxt(govContent,
|
|
93
|
+
storageHelper.unserializeTxt(govContent, vsk.fromBoard),
|
|
92
94
|
);
|
|
93
|
-
const { [`psm.${Minted}.${Anchor}`]: instance } =
|
|
94
|
-
utils.agoricNames.instance;
|
|
95
|
+
const { [`psm.${Minted}.${Anchor}`]: instance } = agoricNames.instance;
|
|
95
96
|
|
|
96
97
|
return { instance, governance };
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
return { ...
|
|
100
|
+
return { ...vsk, agoricNames, lookupPsmInstance, getGovernanceState };
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
psm
|
package/src/commands/reserve.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-disable func-names */
|
|
3
3
|
/* eslint-env node */
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fetchEnvNetworkConfig,
|
|
6
|
+
makeAgoricNames,
|
|
7
|
+
makeVstorageKit,
|
|
8
|
+
} from '@agoric/client-utils';
|
|
5
9
|
import { Offers } from '@agoric/inter-protocol/src/clientSupport.js';
|
|
6
10
|
import { Command } from 'commander';
|
|
7
11
|
import { outputActionAndHint } from '../lib/wallet.js';
|
|
@@ -31,7 +35,8 @@ export const makeReserveCommand = (_logger, io = {}) => {
|
|
|
31
35
|
* }} opts
|
|
32
36
|
*/
|
|
33
37
|
async ({ collateralBrand, ...opts }) => {
|
|
34
|
-
const
|
|
38
|
+
const vsk = makeVstorageKit({ fetch }, networkConfig);
|
|
39
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
35
40
|
|
|
36
41
|
const offer = Offers.reserve.AddCollateral(agoricNames, {
|
|
37
42
|
collateralBrandKey: collateralBrand,
|
|
@@ -65,7 +70,8 @@ export const makeReserveCommand = (_logger, io = {}) => {
|
|
|
65
70
|
1,
|
|
66
71
|
)
|
|
67
72
|
.action(async function (opts) {
|
|
68
|
-
const
|
|
73
|
+
const vsk = makeVstorageKit({ fetch }, networkConfig);
|
|
74
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
69
75
|
|
|
70
76
|
const reserveInstance = agoricNames.instance.reserve;
|
|
71
77
|
assert(reserveInstance, 'missing reserve in names');
|
package/src/commands/vaults.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-disable func-names */
|
|
3
3
|
/* eslint-env node */
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fetchEnvNetworkConfig,
|
|
6
|
+
makeAgoricNames,
|
|
7
|
+
makeVstorageKit,
|
|
8
|
+
} from '@agoric/client-utils';
|
|
5
9
|
import {
|
|
6
10
|
lookupOfferIdForVault,
|
|
7
11
|
Offers,
|
|
@@ -63,7 +67,8 @@ export const makeVaultsCommand = logger => {
|
|
|
63
67
|
.option('--collateralBrand <string>', 'Collateral brand key', 'ATOM')
|
|
64
68
|
.action(async function (opts) {
|
|
65
69
|
logger.warn('running with options', opts);
|
|
66
|
-
const
|
|
70
|
+
const vsk = makeVstorageKit({ fetch }, networkConfig);
|
|
71
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
67
72
|
|
|
68
73
|
const offer = Offers.vaults.OpenVault(agoricNames, {
|
|
69
74
|
giveCollateral: opts.giveCollateral,
|
|
@@ -98,10 +103,11 @@ export const makeVaultsCommand = logger => {
|
|
|
98
103
|
.requiredOption('--vaultId <string>', 'Key of vault (e.g. vault1)')
|
|
99
104
|
.action(async function (opts) {
|
|
100
105
|
logger.warn('running with options', opts);
|
|
101
|
-
const {
|
|
106
|
+
const { readPublished, ...vsk } = makeVstorageKit(
|
|
102
107
|
{ fetch },
|
|
103
108
|
networkConfig,
|
|
104
109
|
);
|
|
110
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
105
111
|
|
|
106
112
|
const previousOfferId = await lookupOfferIdForVault(
|
|
107
113
|
opts.vaultId,
|
|
@@ -142,10 +148,11 @@ export const makeVaultsCommand = logger => {
|
|
|
142
148
|
)
|
|
143
149
|
.action(async function (opts) {
|
|
144
150
|
logger.warn('running with options', opts);
|
|
145
|
-
const {
|
|
151
|
+
const { readPublished, ...vsk } = makeVstorageKit(
|
|
146
152
|
{ fetch },
|
|
147
153
|
networkConfig,
|
|
148
154
|
);
|
|
155
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
149
156
|
|
|
150
157
|
const previousOfferId = await lookupOfferIdForVault(
|
|
151
158
|
opts.vaultId,
|
package/src/commands/wallet.js
CHANGED
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
makeLeader,
|
|
9
9
|
makeLeaderFromRpcAddresses,
|
|
10
10
|
} from '@agoric/casting';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
makeVstorageKit,
|
|
13
|
+
fetchEnvNetworkConfig,
|
|
14
|
+
makeAgoricNames,
|
|
15
|
+
} from '@agoric/client-utils';
|
|
12
16
|
import { execFileSync } from 'child_process';
|
|
13
17
|
import fs from 'fs';
|
|
14
18
|
import util from 'util';
|
|
@@ -214,13 +218,11 @@ export const makeWalletCommand = async command => {
|
|
|
214
218
|
normalizeAddress,
|
|
215
219
|
)
|
|
216
220
|
.action(async function (opts) {
|
|
217
|
-
const {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
networkConfig,
|
|
223
|
-
);
|
|
221
|
+
const { readPublished, unserializer, ...vsk } = makeVstorageKit(
|
|
222
|
+
{ fetch },
|
|
223
|
+
networkConfig,
|
|
224
|
+
);
|
|
225
|
+
const agoricNames = await makeAgoricNames(vsk.fromBoard, vsk.vstorage);
|
|
224
226
|
|
|
225
227
|
const leader = makeLeader(networkConfig.rpcAddrs[0]);
|
|
226
228
|
const follower = await makeFollower(
|
package/src/lib/wallet.js
CHANGED
|
@@ -149,7 +149,7 @@ export const coalesceWalletState = async (follower, invitationBrand) => {
|
|
|
149
149
|
* fees?: string,
|
|
150
150
|
* verbose?: boolean,
|
|
151
151
|
* keyring?: {home?: string, backend: string},
|
|
152
|
-
* stdout
|
|
152
|
+
* stdout?: Pick<import('stream').Writable, 'write'>,
|
|
153
153
|
* execFileSync: typeof import('child_process').execFileSync,
|
|
154
154
|
* delay: (ms: number) => Promise<void>,
|
|
155
155
|
* dryRun?: boolean,
|