agoric 0.21.2-dev-57802f9.0 → 0.21.2-mainnet1B-dev-c0e1089.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/CHANGELOG.md +1069 -0
- package/package.json +29 -36
- package/src/bin-agops.js +6 -7
- package/src/chain-config.js +10 -11
- package/src/commands/auction.js +2 -5
- package/src/commands/ec.js +1 -0
- package/src/commands/inter.js +22 -10
- package/src/commands/oracle.js +3 -2
- package/src/commands/perf.js +2 -0
- package/src/commands/psm.js +11 -11
- package/src/commands/reserve.js +2 -1
- package/src/commands/test-upgrade.js +2 -7
- package/src/commands/vaults.js +5 -3
- package/src/init.js +4 -3
- package/src/install.js +1 -1
- package/src/lib/chain.js +3 -13
- package/src/lib/format.js +9 -6
- package/src/lib/rpc.js +3 -4
- package/src/lib/wallet.js +44 -2
- package/src/main-publish.js +2 -1
- package/src/main.js +1 -1
- package/src/publish.js +3 -1
- package/src/sdk-package-names.js +4 -5
- package/src/set-defaults.js +0 -1
- package/src/start.js +57 -51
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-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
"agoric": "src/entrypoint.js",
|
|
9
9
|
"agops": "src/bin-agops.js"
|
|
10
10
|
},
|
|
11
|
-
"exports": {
|
|
12
|
-
"./src/entrypoint.js": "./src/entrypoint.js",
|
|
13
|
-
"./src/helpers.js": "./src/helpers.js"
|
|
14
|
-
},
|
|
15
11
|
"files": [
|
|
16
12
|
"src",
|
|
17
13
|
"exported.js"
|
|
@@ -24,51 +20,48 @@
|
|
|
24
20
|
"integration-test": "ava --config .ava-integration-test.config.js",
|
|
25
21
|
"lint-fix": "yarn lint:eslint --fix",
|
|
26
22
|
"lint": "run-s --continue-on-error lint:*",
|
|
27
|
-
"lint:types": "tsc",
|
|
23
|
+
"lint:types": "tsc -p jsconfig.json",
|
|
28
24
|
"lint:eslint": "eslint ."
|
|
29
25
|
},
|
|
30
26
|
"devDependencies": {
|
|
31
|
-
"@agoric/
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
28
|
+
"ava": "^5.2.0",
|
|
29
|
+
"c8": "^7.13.0",
|
|
30
|
+
"dd-trace": "^3.3.0"
|
|
35
31
|
},
|
|
36
32
|
"dependencies": {
|
|
37
|
-
"@agoric/access-token": "0.4.22-dev-
|
|
38
|
-
"@agoric/assert": "0.6.1-dev-
|
|
39
|
-
"@agoric/cache": "0.3.3-dev-
|
|
40
|
-
"@agoric/casting": "0.4.3-dev-
|
|
41
|
-
"@agoric/cosmic-proto": "0.3.1-dev-
|
|
42
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
43
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
44
|
-
"@agoric/internal": "0.3.3-dev-
|
|
45
|
-
"@agoric/
|
|
46
|
-
"@agoric/
|
|
47
|
-
"@agoric/
|
|
48
|
-
"@agoric/
|
|
49
|
-
"@agoric/
|
|
50
|
-
"@agoric/
|
|
51
|
-
"@agoric/zone": "0.2.3-dev-57802f9.0+57802f9",
|
|
33
|
+
"@agoric/access-token": "0.4.22-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
34
|
+
"@agoric/assert": "0.6.1-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
35
|
+
"@agoric/cache": "0.3.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
36
|
+
"@agoric/casting": "0.4.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
37
|
+
"@agoric/cosmic-proto": "0.3.1-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
38
|
+
"@agoric/ertp": "0.16.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
39
|
+
"@agoric/inter-protocol": "0.16.2-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
40
|
+
"@agoric/internal": "0.3.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
41
|
+
"@agoric/smart-wallet": "0.5.4-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
42
|
+
"@agoric/store": "0.9.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
43
|
+
"@agoric/swingset-vat": "0.32.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
44
|
+
"@agoric/vats": "0.15.2-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
45
|
+
"@agoric/zoe": "0.26.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
46
|
+
"@agoric/zone": "0.2.3-mainnet1B-dev-c0e1089.0+c0e1089",
|
|
52
47
|
"@confio/relayer": "^0.9.0",
|
|
53
48
|
"@cosmjs/crypto": "^0.30.1",
|
|
54
49
|
"@cosmjs/encoding": "^0.30.1",
|
|
55
50
|
"@cosmjs/math": "^0.30.1",
|
|
56
51
|
"@cosmjs/proto-signing": "^0.30.1",
|
|
57
52
|
"@cosmjs/stargate": "^0.30.1",
|
|
58
|
-
"@
|
|
59
|
-
"@endo/
|
|
60
|
-
"@endo/
|
|
61
|
-
"@endo/
|
|
62
|
-
"@endo/
|
|
63
|
-
"@endo/
|
|
64
|
-
"@endo/
|
|
65
|
-
"@endo/
|
|
66
|
-
"@endo/promise-kit": "^0.2.59",
|
|
53
|
+
"@endo/bundle-source": "2.5.2-upstream-rollup",
|
|
54
|
+
"@endo/captp": "3.1.1",
|
|
55
|
+
"@endo/compartment-mapper": "0.8.4",
|
|
56
|
+
"@endo/far": "0.2.18",
|
|
57
|
+
"@endo/init": "0.5.56",
|
|
58
|
+
"@endo/marshal": "0.8.5",
|
|
59
|
+
"@endo/nat": "4.1.27",
|
|
60
|
+
"@endo/promise-kit": "0.2.56",
|
|
67
61
|
"@iarna/toml": "^2.2.3",
|
|
68
62
|
"anylogger": "^0.21.0",
|
|
69
63
|
"chalk": "^5.2.0",
|
|
70
64
|
"commander": "^10.0.0",
|
|
71
|
-
"dd-trace": "^4.11.1",
|
|
72
65
|
"deterministic-json": "^1.0.5",
|
|
73
66
|
"esm": "agoric-labs/esm#Agoric-built",
|
|
74
67
|
"inquirer": "^8.2.2",
|
|
@@ -94,5 +87,5 @@
|
|
|
94
87
|
"timeout": "2m",
|
|
95
88
|
"workerThreads": false
|
|
96
89
|
},
|
|
97
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "c0e10895096f10703536fec603ebf1e2c2f948bc"
|
|
98
91
|
}
|
package/src/bin-agops.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ts-check
|
|
3
3
|
// @jessie-check
|
|
4
|
-
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
5
4
|
|
|
5
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
6
6
|
/* global fetch, setTimeout */
|
|
7
7
|
|
|
8
|
-
import '@endo/init/pre.js';
|
|
9
|
-
|
|
10
8
|
import '@agoric/casting/node-fetch-shim.js';
|
|
11
9
|
import '@endo/init';
|
|
12
|
-
|
|
13
|
-
import { E } from '@endo/far';
|
|
10
|
+
import '@endo/init/pre.js';
|
|
14
11
|
|
|
15
12
|
import { execFileSync } from 'child_process';
|
|
16
13
|
import path from 'path';
|
|
@@ -77,11 +74,13 @@ program.addCommand(makeAuctionCommand(logger, { ...procIO, fetch }));
|
|
|
77
74
|
program.addCommand(makeInterCommand(procIO, { fetch }));
|
|
78
75
|
program.addCommand(makeTestCommand(procIO, { fetch }));
|
|
79
76
|
|
|
80
|
-
|
|
77
|
+
try {
|
|
78
|
+
await program.parseAsync(process.argv);
|
|
79
|
+
} catch (err) {
|
|
81
80
|
if (err instanceof CommanderError) {
|
|
82
81
|
console.error(err.message);
|
|
83
82
|
} else {
|
|
84
83
|
console.error(err); // CRASH! show stack trace
|
|
85
84
|
}
|
|
86
85
|
process.exit(1);
|
|
87
|
-
}
|
|
86
|
+
}
|
package/src/chain-config.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import djson from 'deterministic-json';
|
|
2
2
|
import TOML from '@iarna/toml';
|
|
3
|
-
import * as Tokens from '@agoric/internal/src/tokens.js';
|
|
4
3
|
|
|
5
4
|
export const STAKING_MAX_VALIDATORS = 150;
|
|
6
5
|
// Required for IBC connections not to time out.
|
|
@@ -14,38 +13,38 @@ export const ICA_HOST_ALLOW_MESSAGES = [
|
|
|
14
13
|
];
|
|
15
14
|
|
|
16
15
|
const Stake = /** @type {const} */ ({
|
|
17
|
-
name:
|
|
16
|
+
name: 'Agoric Staking Token',
|
|
18
17
|
description: 'The token used by delegates to stake on the Agoric chain',
|
|
19
18
|
denom_units: [
|
|
20
19
|
{
|
|
21
|
-
denom:
|
|
20
|
+
denom: 'ubld',
|
|
22
21
|
exponent: 0,
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
denom: 'bld',
|
|
26
|
-
exponent:
|
|
25
|
+
exponent: 6,
|
|
27
26
|
},
|
|
28
27
|
],
|
|
29
|
-
base:
|
|
28
|
+
base: 'ubld',
|
|
30
29
|
display: 'bld',
|
|
31
|
-
symbol:
|
|
30
|
+
symbol: 'BLD',
|
|
32
31
|
});
|
|
33
32
|
const Stable = /** @type {const} */ ({
|
|
34
|
-
name:
|
|
33
|
+
name: 'Agoric stable token',
|
|
35
34
|
description: 'The stable token used by the Agoric chain',
|
|
36
35
|
denom_units: [
|
|
37
36
|
{
|
|
38
|
-
denom:
|
|
37
|
+
denom: 'uist',
|
|
39
38
|
exponent: 0,
|
|
40
39
|
},
|
|
41
40
|
{
|
|
42
41
|
denom: 'ist',
|
|
43
|
-
exponent:
|
|
42
|
+
exponent: 6,
|
|
44
43
|
},
|
|
45
44
|
],
|
|
46
|
-
base:
|
|
45
|
+
base: 'uist',
|
|
47
46
|
display: 'ist',
|
|
48
|
-
symbol:
|
|
47
|
+
symbol: 'IST',
|
|
49
48
|
});
|
|
50
49
|
export const DENOM_METADATA = /** @type {const} */ ([Stake, Stable]);
|
|
51
50
|
|
package/src/commands/auction.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
1
2
|
// @ts-check
|
|
2
3
|
/* eslint-disable func-names */
|
|
3
4
|
import { InvalidArgumentError } from 'commander';
|
|
@@ -7,11 +8,7 @@ import { outputActionAndHint } from '../lib/wallet.js';
|
|
|
7
8
|
const { Fail } = assert;
|
|
8
9
|
|
|
9
10
|
/** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMap} ParamTypesMap */
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @template {ParamStateRecord} M
|
|
13
|
-
* @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<M>} ParamTypesMapFromRecord
|
|
14
|
-
*/
|
|
11
|
+
/** @template M @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<M>} ParamTypesMapFromRecord */
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* @template {ParamTypesMap} M
|
package/src/commands/ec.js
CHANGED
package/src/commands/inter.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import { getNetworkConfig } from '../lib/rpc.js';
|
|
26
26
|
import {
|
|
27
27
|
getCurrent,
|
|
28
|
+
makeParseAmount,
|
|
28
29
|
makeWalletUtils,
|
|
29
30
|
outputActionAndHint,
|
|
30
31
|
sendAction,
|
|
@@ -87,7 +88,7 @@ const makeFormatters = assets => {
|
|
|
87
88
|
* @param {(_: T) => string} f
|
|
88
89
|
* @returns { (x: T | null | undefined ) => string | undefined }
|
|
89
90
|
*/
|
|
90
|
-
const maybe = f => x =>
|
|
91
|
+
const maybe = f => x => x ? f(x) : undefined;
|
|
91
92
|
|
|
92
93
|
return {
|
|
93
94
|
amount,
|
|
@@ -107,7 +108,7 @@ const makeFormatters = assets => {
|
|
|
107
108
|
* Dynamic check that an OfferStatus is also a BidSpec.
|
|
108
109
|
*
|
|
109
110
|
* @param {import('@agoric/smart-wallet/src/offers.js').OfferStatus} offerStatus
|
|
110
|
-
* @param {import('../lib/
|
|
111
|
+
* @param {Awaited<ReturnType<import('../lib/rpc').makeAgoricNames>>} agoricNames
|
|
111
112
|
* @param {typeof console.warn} warn
|
|
112
113
|
* returns null if offerStatus is not a BidSpec
|
|
113
114
|
*/
|
|
@@ -205,10 +206,6 @@ export const makeInterCommand = (
|
|
|
205
206
|
const interCmd = createCommand('inter')
|
|
206
207
|
.description('Inter Protocol commands for liquidation bidding etc.')
|
|
207
208
|
.option('--home <dir>', 'agd CosmosSDK application home directory')
|
|
208
|
-
.option(
|
|
209
|
-
'--fees <amount>',
|
|
210
|
-
'set fees for transaction broadcast (e.g. 5000ubld)',
|
|
211
|
-
)
|
|
212
209
|
.option(
|
|
213
210
|
'--keyring-backend <os|file|test>',
|
|
214
211
|
`keyring's backend (os|file|test) (default "${
|
|
@@ -241,6 +238,7 @@ export const makeInterCommand = (
|
|
|
241
238
|
try {
|
|
242
239
|
// XXX pass fetch to getNetworkConfig() explicitly
|
|
243
240
|
// await null above makes this await safe
|
|
241
|
+
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
244
242
|
const networkConfig = await getNetworkConfig(env);
|
|
245
243
|
return makeWalletUtils({ fetch, execFileSync, delay }, networkConfig);
|
|
246
244
|
} catch (err) {
|
|
@@ -341,10 +339,10 @@ inter auction status
|
|
|
341
339
|
const { networkConfig, agoricNames, pollOffer } = tools;
|
|
342
340
|
const io = { ...networkConfig, execFileSync, delay, stdout };
|
|
343
341
|
|
|
344
|
-
const { home, keyringBackend: backend
|
|
342
|
+
const { home, keyringBackend: backend } = interCmd.opts();
|
|
345
343
|
const result = await sendAction(
|
|
346
344
|
{ method: 'executeOffer', offer },
|
|
347
|
-
{ keyring: { home, backend }, from,
|
|
345
|
+
{ keyring: { home, backend }, from, verbose: false, dryRun, ...io },
|
|
348
346
|
);
|
|
349
347
|
if (dryRun) {
|
|
350
348
|
return;
|
|
@@ -418,7 +416,14 @@ inter auction status
|
|
|
418
416
|
async ({ generateOnly, dryRun, ...opts }) => {
|
|
419
417
|
const tools = await tryMakeUtils();
|
|
420
418
|
|
|
421
|
-
const
|
|
419
|
+
const parseAmount = makeParseAmount(
|
|
420
|
+
tools.agoricNames,
|
|
421
|
+
msg => new InvalidArgumentError(msg),
|
|
422
|
+
);
|
|
423
|
+
const offer = Offers.auction.Bid(tools.agoricNames.brand, {
|
|
424
|
+
...opts,
|
|
425
|
+
parseAmount,
|
|
426
|
+
});
|
|
422
427
|
|
|
423
428
|
if (generateOnly) {
|
|
424
429
|
outputActionAndHint(
|
|
@@ -459,7 +464,14 @@ inter auction status
|
|
|
459
464
|
async ({ generateOnly, ...opts }) => {
|
|
460
465
|
const tools = await tryMakeUtils();
|
|
461
466
|
|
|
462
|
-
const
|
|
467
|
+
const parseAmount = makeParseAmount(
|
|
468
|
+
tools.agoricNames,
|
|
469
|
+
msg => new InvalidArgumentError(msg),
|
|
470
|
+
);
|
|
471
|
+
const offer = Offers.auction.Bid(tools.agoricNames.brand, {
|
|
472
|
+
...opts,
|
|
473
|
+
parseAmount,
|
|
474
|
+
});
|
|
463
475
|
if (generateOnly) {
|
|
464
476
|
outputActionAndHint(
|
|
465
477
|
{ method: 'executeOffer', offer },
|
package/src/commands/oracle.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
1
3
|
// @ts-check
|
|
2
4
|
/* eslint-disable func-names */
|
|
3
5
|
/* global fetch, setTimeout, process */
|
|
@@ -7,7 +9,6 @@ import { Nat } from '@endo/nat';
|
|
|
7
9
|
import { Command } from 'commander';
|
|
8
10
|
import * as cp from 'child_process';
|
|
9
11
|
import { inspect } from 'util';
|
|
10
|
-
import { instanceNameFor } from '@agoric/inter-protocol/src/proposals/price-feed-proposal.js';
|
|
11
12
|
import { normalizeAddressWithOptions } from '../lib/chain.js';
|
|
12
13
|
import { getNetworkConfig, makeRpcUtils, storageHelper } from '../lib/rpc.js';
|
|
13
14
|
import {
|
|
@@ -76,7 +77,7 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
76
77
|
const utils = await makeRpcUtils({ fetch });
|
|
77
78
|
|
|
78
79
|
const lookupPriceAggregatorInstance = ([brandIn, brandOut]) => {
|
|
79
|
-
const name =
|
|
80
|
+
const name = `${brandIn}-${brandOut} price feed`;
|
|
80
81
|
const instance = utils.agoricNames.instance[name];
|
|
81
82
|
if (!instance) {
|
|
82
83
|
logger.debug('known instances:', utils.agoricNames.instance);
|
package/src/commands/perf.js
CHANGED
package/src/commands/psm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
1
3
|
// @ts-check
|
|
2
4
|
/* eslint-disable func-names */
|
|
3
5
|
/* global fetch, process */
|
|
@@ -151,17 +153,15 @@ export const makePsmCommand = logger => {
|
|
|
151
153
|
.option('--giveMinted <DOLLARS>', 'amount of minted tokens to give', Number)
|
|
152
154
|
.option('--feePct [%]', 'Gas fee percentage', Number)
|
|
153
155
|
.option('--offerId <string>', 'Offer id', String, `swap-${Date.now()}`)
|
|
154
|
-
.action(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
);
|
|
156
|
+
.action(async function (
|
|
157
|
+
/** @type {Parameters<typeof Offers.psm.swap>[2]} */ opts,
|
|
158
|
+
) {
|
|
159
|
+
console.warn('running with options', opts);
|
|
160
|
+
const { agoricNames, lookupPsmInstance } = await rpcTools();
|
|
161
|
+
const instance = await lookupPsmInstance(opts.pair);
|
|
162
|
+
const offer = Offers.psm.swap(instance, agoricNames.brand, opts);
|
|
163
|
+
outputExecuteOfferAction(offer);
|
|
164
|
+
});
|
|
165
165
|
|
|
166
166
|
psm
|
|
167
167
|
.command('proposePauseOffers')
|
package/src/commands/reserve.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
1
2
|
// @ts-check
|
|
2
3
|
/* eslint-disable func-names */
|
|
3
4
|
/* global fetch, process */
|
|
@@ -31,7 +32,7 @@ export const makeReserveCommand = (_logger, io = {}) => {
|
|
|
31
32
|
async ({ collateralBrand, ...opts }) => {
|
|
32
33
|
const { agoricNames } = await makeRpcUtils({ fetch });
|
|
33
34
|
|
|
34
|
-
const offer = Offers.reserve.AddCollateral(agoricNames, {
|
|
35
|
+
const offer = Offers.reserve.AddCollateral(agoricNames.brand, {
|
|
35
36
|
collateralBrandKey: collateralBrand,
|
|
36
37
|
...opts,
|
|
37
38
|
});
|
|
@@ -38,6 +38,7 @@ export const makeTestCommand = (
|
|
|
38
38
|
try {
|
|
39
39
|
// XXX pass fetch to getNetworkConfig() explicitly
|
|
40
40
|
// await null above makes this await safe
|
|
41
|
+
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
41
42
|
const networkConfig = await getNetworkConfig(env);
|
|
42
43
|
return makeWalletUtils({ fetch, execFileSync, delay }, networkConfig);
|
|
43
44
|
} catch (err) {
|
|
@@ -82,13 +83,7 @@ export const makeTestCommand = (
|
|
|
82
83
|
publicInvitationMaker: 'makeInvitation',
|
|
83
84
|
},
|
|
84
85
|
proposal: {
|
|
85
|
-
want: {
|
|
86
|
-
Tokens: {
|
|
87
|
-
// @ts-expect-error BoardRemote not a Brand object
|
|
88
|
-
brand: agoricNames.brand.GoodStuff,
|
|
89
|
-
value: 32n,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
86
|
+
want: { Tokens: { brand: agoricNames.brand.GoodStuff, value: 32n } },
|
|
92
87
|
},
|
|
93
88
|
};
|
|
94
89
|
const result = await sendAction(
|
package/src/commands/vaults.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
1
3
|
// @ts-check
|
|
2
4
|
/* eslint-disable func-names */
|
|
3
5
|
/* global fetch, process */
|
|
@@ -63,7 +65,7 @@ export const makeVaultsCommand = logger => {
|
|
|
63
65
|
logger.warn('running with options', opts);
|
|
64
66
|
const { agoricNames } = await makeRpcUtils({ fetch });
|
|
65
67
|
|
|
66
|
-
const offer = Offers.vaults.OpenVault(agoricNames, {
|
|
68
|
+
const offer = Offers.vaults.OpenVault(agoricNames.brand, {
|
|
67
69
|
giveCollateral: opts.giveCollateral,
|
|
68
70
|
wantMinted: opts.wantMinted,
|
|
69
71
|
offerId: opts.offerId,
|
|
@@ -104,7 +106,7 @@ export const makeVaultsCommand = logger => {
|
|
|
104
106
|
);
|
|
105
107
|
|
|
106
108
|
const offer = Offers.vaults.AdjustBalances(
|
|
107
|
-
agoricNames,
|
|
109
|
+
agoricNames.brand,
|
|
108
110
|
{
|
|
109
111
|
giveCollateral: opts.giveCollateral,
|
|
110
112
|
wantCollateral: opts.wantCollateral,
|
|
@@ -145,7 +147,7 @@ export const makeVaultsCommand = logger => {
|
|
|
145
147
|
);
|
|
146
148
|
|
|
147
149
|
const offer = Offers.vaults.CloseVault(
|
|
148
|
-
agoricNames,
|
|
150
|
+
agoricNames.brand,
|
|
149
151
|
{
|
|
150
152
|
giveMinted: opts.giveMinted,
|
|
151
153
|
offerId: opts.offerId,
|
package/src/init.js
CHANGED
|
@@ -5,7 +5,7 @@ import { makePspawn } from './helpers.js';
|
|
|
5
5
|
// https://github.com/Agoric/agoric-sdk/issues/6512
|
|
6
6
|
import '@endo/captp/src/types.js';
|
|
7
7
|
import '@agoric/swingset-vat/exported.js';
|
|
8
|
-
import '@agoric/network/
|
|
8
|
+
import '@agoric/swingset-vat/src/vats/network/types.js';
|
|
9
9
|
|
|
10
10
|
// Use either an absolute template URL, or find it relative to DAPP_URL_BASE.
|
|
11
11
|
const gitURL = (relativeOrAbsoluteURL, base) => {
|
|
@@ -40,10 +40,9 @@ export default async function initMain(_progname, rawArgs, priv, opts) {
|
|
|
40
40
|
dappBranch = ['-b', opts.dappBranch];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const shallow = ['--depth', '1', '--shallow-submodules'];
|
|
44
43
|
const exitStatus = await pspawn(
|
|
45
44
|
'git',
|
|
46
|
-
['clone', '--origin=upstream',
|
|
45
|
+
['clone', '--origin=upstream', dappURL, DIR, ...dappBranch],
|
|
47
46
|
{
|
|
48
47
|
stdio: 'inherit',
|
|
49
48
|
},
|
|
@@ -61,6 +60,7 @@ export default async function initMain(_progname, rawArgs, priv, opts) {
|
|
|
61
60
|
const path = `${DIR}/${dir}package.json`;
|
|
62
61
|
log('rewriting ', path);
|
|
63
62
|
|
|
63
|
+
// eslint-disable-next-line no-await-in-loop
|
|
64
64
|
const contents = await fs.readFile(path, 'utf-8');
|
|
65
65
|
const pkg = JSON.parse(contents.replace(/@DIR@/g, DIR));
|
|
66
66
|
if (dir === '') {
|
|
@@ -74,6 +74,7 @@ export default async function initMain(_progname, rawArgs, priv, opts) {
|
|
|
74
74
|
pkg.name = `${DIR}${pkg.name.substr(topLevelName.length)}`;
|
|
75
75
|
const json = JSON.stringify(pkg, undefined, 2);
|
|
76
76
|
|
|
77
|
+
// eslint-disable-next-line no-await-in-loop
|
|
77
78
|
await fs.writeFile(path, json);
|
|
78
79
|
}
|
|
79
80
|
|
package/src/install.js
CHANGED
|
@@ -61,6 +61,7 @@ export default async function installMain(progname, rawArgs, powers, opts) {
|
|
|
61
61
|
const yarnInstallEachWorktree = async (phase, ...flags) => {
|
|
62
62
|
for await (const workTree of workTrees) {
|
|
63
63
|
log.info(`yarn install ${phase} in ${workTree}`);
|
|
64
|
+
// eslint-disable-next-line no-await-in-loop
|
|
64
65
|
const yarnInstall = await pspawn(
|
|
65
66
|
'yarn',
|
|
66
67
|
[...linkFlags, 'install', ...flags],
|
|
@@ -287,7 +288,6 @@ export default async function installMain(progname, rawArgs, powers, opts) {
|
|
|
287
288
|
await Promise.all(
|
|
288
289
|
[...sdkPackageToPath.entries()].map(async ([pjName, dir]) => {
|
|
289
290
|
const SUBOPTIMAL = false;
|
|
290
|
-
await null;
|
|
291
291
|
if (SUBOPTIMAL) {
|
|
292
292
|
// This use of yarn is noisy and slow.
|
|
293
293
|
await pspawn('yarn', [...linkFlags, 'unlink', pjName]);
|
package/src/lib/chain.js
CHANGED
|
@@ -38,7 +38,6 @@ harden(normalizeAddressWithOptions);
|
|
|
38
38
|
* @param {ReadonlyArray<string>} swingsetArgs
|
|
39
39
|
* @param {import('./rpc').MinimalNetworkConfig & {
|
|
40
40
|
* from: string,
|
|
41
|
-
* fees?: string,
|
|
42
41
|
* dryRun?: boolean,
|
|
43
42
|
* verbose?: boolean,
|
|
44
43
|
* keyring?: {home?: string, backend: string}
|
|
@@ -49,7 +48,6 @@ harden(normalizeAddressWithOptions);
|
|
|
49
48
|
export const execSwingsetTransaction = (swingsetArgs, opts) => {
|
|
50
49
|
const {
|
|
51
50
|
from,
|
|
52
|
-
fees,
|
|
53
51
|
dryRun = false,
|
|
54
52
|
verbose = true,
|
|
55
53
|
keyring = undefined,
|
|
@@ -62,11 +60,9 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => {
|
|
|
62
60
|
const backendOpt = keyring?.backend
|
|
63
61
|
? [`--keyring-backend=${keyring.backend}`]
|
|
64
62
|
: [];
|
|
65
|
-
const feeOpt = fees ? ['--fees', fees] : [];
|
|
66
63
|
const cmd = [`--node=${rpcAddrs[0]}`, `--chain-id=${chainName}`].concat(
|
|
67
64
|
homeOpt,
|
|
68
65
|
backendOpt,
|
|
69
|
-
feeOpt,
|
|
70
66
|
[`--from=${from}`, 'tx', 'swingset'],
|
|
71
67
|
swingsetArgs,
|
|
72
68
|
);
|
|
@@ -79,15 +75,7 @@ export const execSwingsetTransaction = (swingsetArgs, opts) => {
|
|
|
79
75
|
} else {
|
|
80
76
|
const yesCmd = cmd.concat(['--yes']);
|
|
81
77
|
if (verbose) console.log('Executing ', yesCmd);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// agd puts this diagnostic on stdout rather than stderr :-/
|
|
85
|
-
// "Default sign-mode 'direct' not supported by Ledger, using sign-mode 'amino-json'.
|
|
86
|
-
if (out.startsWith('Default sign-mode')) {
|
|
87
|
-
const stripDiagnostic = out.replace(/^Default[^\n]+\n/, '');
|
|
88
|
-
return stripDiagnostic;
|
|
89
|
-
}
|
|
90
|
-
return out;
|
|
78
|
+
return execFileSync(agdBinary, yesCmd, { encoding: 'utf-8' });
|
|
91
79
|
}
|
|
92
80
|
};
|
|
93
81
|
harden(execSwingsetTransaction);
|
|
@@ -134,6 +122,7 @@ export const pollBlocks = opts => async lookup => {
|
|
|
134
122
|
} = status;
|
|
135
123
|
try {
|
|
136
124
|
// see await null above
|
|
125
|
+
// eslint-disable-next-line @jessie.js/no-nested-await, no-await-in-loop
|
|
137
126
|
const result = await lookup({ time, height });
|
|
138
127
|
return result;
|
|
139
128
|
} catch (_err) {
|
|
@@ -143,6 +132,7 @@ export const pollBlocks = opts => async lookup => {
|
|
|
143
132
|
height,
|
|
144
133
|
'retrying...',
|
|
145
134
|
);
|
|
135
|
+
// eslint-disable-next-line @jessie.js/no-nested-await, no-await-in-loop
|
|
146
136
|
await delay(period);
|
|
147
137
|
}
|
|
148
138
|
}
|
package/src/lib/format.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js';
|
|
3
|
+
// eslint-disable-next-line no-unused-vars -- typeof below
|
|
4
|
+
import { makeAgoricNames } from './rpc.js';
|
|
2
5
|
|
|
3
6
|
// ambient types
|
|
4
7
|
import '@agoric/ertp/src/types-ambient.js';
|
|
5
|
-
import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js';
|
|
6
8
|
|
|
7
9
|
/** @typedef {import('@agoric/vats/tools/board-utils.js').BoardRemote} BoardRemote */
|
|
8
10
|
|
|
@@ -28,15 +30,16 @@ export const Natural = str => {
|
|
|
28
30
|
*/
|
|
29
31
|
export const bigintReplacer = (k, v) => (typeof v === 'bigint' ? `${v}` : v);
|
|
30
32
|
|
|
31
|
-
/** @type {
|
|
33
|
+
/** @type {import('@agoric/vats/tools/board-utils.js').VBankAssetDetail} */
|
|
32
34
|
// eslint-disable-next-line no-unused-vars
|
|
33
35
|
const exampleAsset = {
|
|
36
|
+
// @ts-expect-error cast
|
|
34
37
|
brand: makeBoardRemote({ boardId: 'board0425', iface: 'Alleged: BLD brand' }),
|
|
35
38
|
displayInfo: { assetKind: 'nat', decimalPlaces: 6 },
|
|
39
|
+
// @ts-expect-error cast
|
|
36
40
|
issuer: makeBoardRemote({ boardId: null, iface: undefined }),
|
|
37
|
-
|
|
41
|
+
petname: 'Agoric staking token',
|
|
38
42
|
};
|
|
39
|
-
|
|
40
43
|
/** @typedef {import('@agoric/vats/tools/board-utils.js').VBankAssetDetail } AssetDescriptor */
|
|
41
44
|
|
|
42
45
|
/**
|
|
@@ -119,7 +122,7 @@ export const fmtRecordOfLines = record => {
|
|
|
119
122
|
* Summarize the offerStatuses of the state as user-facing informative tuples
|
|
120
123
|
*
|
|
121
124
|
* @param {import('@agoric/smart-wallet/src/utils.js').CoalescedWalletState} state
|
|
122
|
-
* @param {
|
|
125
|
+
* @param {Awaited<ReturnType<typeof makeAgoricNames>>} agoricNames
|
|
123
126
|
*/
|
|
124
127
|
export const offerStatusTuples = (state, agoricNames) => {
|
|
125
128
|
const { offerStatuses } = state;
|
|
@@ -176,7 +179,7 @@ export const offerStatusTuples = (state, agoricNames) => {
|
|
|
176
179
|
/**
|
|
177
180
|
* @param {import('@agoric/smart-wallet/src/smartWallet').CurrentWalletRecord} current
|
|
178
181
|
* @param {ReturnType<import('@agoric/smart-wallet/src/utils.js').makeWalletStateCoalescer>['state']} coalesced
|
|
179
|
-
* @param {
|
|
182
|
+
* @param {Awaited<ReturnType<typeof makeAgoricNames>>} agoricNames
|
|
180
183
|
*/
|
|
181
184
|
export const summarize = (current, coalesced, agoricNames) => {
|
|
182
185
|
return {
|
package/src/lib/rpc.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
/* eslint-disable @jessie.js/no-nested-await */
|
|
2
3
|
/* global Buffer, fetch, process */
|
|
3
4
|
|
|
4
5
|
import { NonNullish } from '@agoric/assert';
|
|
@@ -49,8 +50,7 @@ export const getNetworkConfig = async env => {
|
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
/** @type {MinimalNetworkConfig} */
|
|
52
|
-
const networkConfig = await getNetworkConfig(process.env);
|
|
53
|
-
export { networkConfig };
|
|
53
|
+
export const networkConfig = await getNetworkConfig(process.env);
|
|
54
54
|
// console.warn('networkConfig', networkConfig);
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -132,11 +132,11 @@ export const makeVStorage = (powers, config = networkConfig) => {
|
|
|
132
132
|
const parts = [];
|
|
133
133
|
// undefined the first iteration, to query at the highest
|
|
134
134
|
let blockHeight;
|
|
135
|
-
await null;
|
|
136
135
|
do {
|
|
137
136
|
// console.debug('READING', { blockHeight });
|
|
138
137
|
let values;
|
|
139
138
|
try {
|
|
139
|
+
// eslint-disable-next-line no-await-in-loop
|
|
140
140
|
({ blockHeight, values } = await this.readAt(
|
|
141
141
|
path,
|
|
142
142
|
blockHeight && Number(blockHeight) - 1,
|
|
@@ -242,7 +242,6 @@ export const makeAgoricNames = async (ctx, vstorage) => {
|
|
|
242
242
|
* @param {MinimalNetworkConfig} config
|
|
243
243
|
*/
|
|
244
244
|
export const makeRpcUtils = async ({ fetch }, config = networkConfig) => {
|
|
245
|
-
await null;
|
|
246
245
|
try {
|
|
247
246
|
const vstorage = makeVStorage({ fetch }, config);
|
|
248
247
|
const fromBoard = makeFromBoard();
|