@agoric/builders 0.1.1-dev-1dd4589.0 → 0.1.1-dev-23120a9.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/builders",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-23120a9.0+23120a9",
|
|
4
4
|
"description": "Build scripts for proposals to an Agoric chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"author": "Agoric",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
27
|
-
"@agoric/fast-usdc": "0.1.1-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
30
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
31
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
32
|
-
"@agoric/vats": "0.15.2-dev-
|
|
33
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
26
|
+
"@agoric/ertp": "0.16.3-dev-23120a9.0+23120a9",
|
|
27
|
+
"@agoric/fast-usdc": "0.1.1-dev-23120a9.0+23120a9",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-23120a9.0+23120a9",
|
|
29
|
+
"@agoric/notifier": "0.6.3-dev-23120a9.0+23120a9",
|
|
30
|
+
"@agoric/smart-wallet": "0.5.4-dev-23120a9.0+23120a9",
|
|
31
|
+
"@agoric/vat-data": "0.5.3-dev-23120a9.0+23120a9",
|
|
32
|
+
"@agoric/vats": "0.15.2-dev-23120a9.0+23120a9",
|
|
33
|
+
"@agoric/zoe": "0.26.3-dev-23120a9.0+23120a9",
|
|
34
34
|
"@endo/bundle-source": "^3.5.0",
|
|
35
35
|
"@endo/captp": "^4.4.3",
|
|
36
36
|
"@endo/eventual-send": "^1.2.8",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"import-meta-resolve": "^2.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
47
|
-
"@agoric/governance": "0.10.4-dev-
|
|
48
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
49
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
52
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
+
"@agoric/deploy-script-support": "0.10.4-dev-23120a9.0+23120a9",
|
|
47
|
+
"@agoric/governance": "0.10.4-dev-23120a9.0+23120a9",
|
|
48
|
+
"@agoric/inter-protocol": "0.16.2-dev-23120a9.0+23120a9",
|
|
49
|
+
"@agoric/orchestration": "0.1.1-dev-23120a9.0+23120a9",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-23120a9.0+23120a9",
|
|
51
|
+
"@agoric/swing-store": "0.9.2-dev-23120a9.0+23120a9",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-23120a9.0+23120a9",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-23120a9.0+23120a9",
|
|
54
54
|
"@endo/errors": "^1.2.8",
|
|
55
55
|
"ava": "^5.3.0",
|
|
56
56
|
"c8": "^10.1.2"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"typeCoverage": {
|
|
84
84
|
"atLeast": 89.69
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "23120a923c2bd3ca182291df2080214fbd5f20ca"
|
|
87
87
|
}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
getManifestForFastUSDC,
|
|
7
7
|
} from '@agoric/fast-usdc/src/fast-usdc.start.js';
|
|
8
8
|
import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
|
|
9
|
+
import { denomHash, withChainCapabilities } from '@agoric/orchestration';
|
|
10
|
+
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
|
|
9
11
|
import {
|
|
10
12
|
multiplyBy,
|
|
11
13
|
parseRatio,
|
|
@@ -17,12 +19,35 @@ import { parseArgs } from 'node:util';
|
|
|
17
19
|
* @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
|
|
18
20
|
* @import {ParseArgsConfig} from 'node:util'
|
|
19
21
|
* @import {FastUSDCConfig} from '@agoric/fast-usdc/src/fast-usdc.start.js'
|
|
22
|
+
* @import {Passable} from '@endo/marshal';
|
|
23
|
+
* @import {CosmosChainInfo} from '@agoric/orchestration';
|
|
20
24
|
*/
|
|
21
25
|
|
|
22
26
|
const { keys } = Object;
|
|
23
27
|
|
|
28
|
+
const defaultAssetInfo = {
|
|
29
|
+
uusdc: {
|
|
30
|
+
baseName: 'noble',
|
|
31
|
+
chainName: 'noble',
|
|
32
|
+
baseDenom: 'uusdc',
|
|
33
|
+
},
|
|
34
|
+
[`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.agoric.connections['noble-1'].transferChannel.channelId })}`]:
|
|
35
|
+
{
|
|
36
|
+
baseName: 'noble',
|
|
37
|
+
chainName: 'agoric',
|
|
38
|
+
baseDenom: 'uusdc',
|
|
39
|
+
brandKey: 'USDC',
|
|
40
|
+
},
|
|
41
|
+
[`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.osmosis.connections['noble-1'].transferChannel.channelId })}`]:
|
|
42
|
+
{
|
|
43
|
+
baseName: 'noble',
|
|
44
|
+
chainName: 'osmosis',
|
|
45
|
+
baseDenom: 'uusdc',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
24
49
|
/**
|
|
25
|
-
* @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy'>>}
|
|
50
|
+
* @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
|
|
26
51
|
*
|
|
27
52
|
* TODO: determine OCW operator addresses
|
|
28
53
|
* meanwhile, use price oracle addresses (from updatePriceFeeds.js).
|
|
@@ -47,6 +72,10 @@ const configurations = {
|
|
|
47
72
|
},
|
|
48
73
|
},
|
|
49
74
|
},
|
|
75
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
76
|
+
withChainCapabilities(fetchedChainInfo)
|
|
77
|
+
),
|
|
78
|
+
assetInfo: defaultAssetInfo,
|
|
50
79
|
},
|
|
51
80
|
MAINNET: {
|
|
52
81
|
oracles: {
|
|
@@ -69,6 +98,10 @@ const configurations = {
|
|
|
69
98
|
},
|
|
70
99
|
},
|
|
71
100
|
},
|
|
101
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
102
|
+
withChainCapabilities(fetchedChainInfo)
|
|
103
|
+
),
|
|
104
|
+
assetInfo: defaultAssetInfo,
|
|
72
105
|
},
|
|
73
106
|
DEVNET: {
|
|
74
107
|
oracles: {
|
|
@@ -90,6 +123,10 @@ const configurations = {
|
|
|
90
123
|
},
|
|
91
124
|
},
|
|
92
125
|
},
|
|
126
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
127
|
+
withChainCapabilities(fetchedChainInfo) // TODO: use devnet values
|
|
128
|
+
),
|
|
129
|
+
assetInfo: defaultAssetInfo, // TODO: use emerynet values
|
|
93
130
|
},
|
|
94
131
|
EMERYNET: {
|
|
95
132
|
oracles: {
|
|
@@ -108,6 +145,10 @@ const configurations = {
|
|
|
108
145
|
},
|
|
109
146
|
},
|
|
110
147
|
},
|
|
148
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
149
|
+
withChainCapabilities(fetchedChainInfo) // TODO: use emerynet values
|
|
150
|
+
),
|
|
151
|
+
assetInfo: defaultAssetInfo, // TODO: use emerynet values
|
|
111
152
|
},
|
|
112
153
|
};
|
|
113
154
|
|
|
@@ -124,11 +165,17 @@ const options = {
|
|
|
124
165
|
default:
|
|
125
166
|
'ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9',
|
|
126
167
|
},
|
|
168
|
+
chainInfo: { type: 'string' },
|
|
169
|
+
assetInfo: { type: 'string' },
|
|
127
170
|
};
|
|
128
171
|
const oraclesUsage = 'use --oracle name:address ...';
|
|
129
172
|
|
|
130
173
|
const feedPolicyUsage = 'use --feedPolicy <policy> ...';
|
|
131
174
|
|
|
175
|
+
const chainInfoUsage = 'use --chainInfo chainName:CosmosChainInfo ...';
|
|
176
|
+
const assetInfoUsage =
|
|
177
|
+
'use --assetInfo denom:DenomInfo & {brandKey?: string} ...';
|
|
178
|
+
|
|
132
179
|
/**
|
|
133
180
|
* @typedef {{
|
|
134
181
|
* flatFee: string;
|
|
@@ -139,6 +186,8 @@ const feedPolicyUsage = 'use --feedPolicy <policy> ...';
|
|
|
139
186
|
* oracle?: string[];
|
|
140
187
|
* usdcDenom: string;
|
|
141
188
|
* feedPolicy?: string;
|
|
189
|
+
* chainInfo: string;
|
|
190
|
+
* assetInfo: string;
|
|
142
191
|
* }} FastUSDCOpts
|
|
143
192
|
*/
|
|
144
193
|
|
|
@@ -180,7 +229,15 @@ export default async (homeP, endowments) => {
|
|
|
180
229
|
/** @type {{ values: FastUSDCOpts }} */
|
|
181
230
|
// @ts-expect-error ensured by options
|
|
182
231
|
const {
|
|
183
|
-
values: {
|
|
232
|
+
values: {
|
|
233
|
+
oracle: oracleArgs,
|
|
234
|
+
net,
|
|
235
|
+
usdcDenom,
|
|
236
|
+
feedPolicy,
|
|
237
|
+
chainInfo,
|
|
238
|
+
assetInfo,
|
|
239
|
+
...fees
|
|
240
|
+
},
|
|
184
241
|
} = parseArgs({ args: scriptArgs, options });
|
|
185
242
|
|
|
186
243
|
const parseFeedPolicy = () => {
|
|
@@ -226,6 +283,27 @@ export default async (homeP, endowments) => {
|
|
|
226
283
|
};
|
|
227
284
|
};
|
|
228
285
|
|
|
286
|
+
const parseChainInfo = () => {
|
|
287
|
+
if (net) {
|
|
288
|
+
if (!(net in configurations)) {
|
|
289
|
+
throw Error(`${net} not in ${keys(configurations)}`);
|
|
290
|
+
}
|
|
291
|
+
return configurations[net].chainInfo;
|
|
292
|
+
}
|
|
293
|
+
if (!chainInfo) throw Error(chainInfoUsage);
|
|
294
|
+
return JSON.parse(chainInfo);
|
|
295
|
+
};
|
|
296
|
+
const parseAssetInfo = () => {
|
|
297
|
+
if (net) {
|
|
298
|
+
if (!(net in configurations)) {
|
|
299
|
+
throw Error(`${net} not in ${keys(configurations)}`);
|
|
300
|
+
}
|
|
301
|
+
return configurations[net].assetInfo;
|
|
302
|
+
}
|
|
303
|
+
if (!assetInfo) throw Error(assetInfoUsage);
|
|
304
|
+
return JSON.parse(assetInfo);
|
|
305
|
+
};
|
|
306
|
+
|
|
229
307
|
/** @type {FastUSDCConfig} */
|
|
230
308
|
const config = harden({
|
|
231
309
|
oracles: parseOracleArgs(),
|
|
@@ -234,6 +312,8 @@ export default async (homeP, endowments) => {
|
|
|
234
312
|
},
|
|
235
313
|
feeConfig: parseFeeConfigArgs(),
|
|
236
314
|
feedPolicy: parseFeedPolicy(),
|
|
315
|
+
chainInfo: parseChainInfo(),
|
|
316
|
+
assetInfo: parseAssetInfo(),
|
|
237
317
|
});
|
|
238
318
|
|
|
239
319
|
await writeCoreEval('start-fast-usdc', utils =>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import {
|
|
3
|
+
getManifest,
|
|
4
|
+
startSendAnywhere,
|
|
5
|
+
} from '@agoric/orchestration/src/proposals/start-send-anywhere.js';
|
|
6
|
+
import { parseArgs } from 'node:util';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @import {ParseArgsConfig} from 'node:util'
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @type {ParseArgsConfig['options']} */
|
|
13
|
+
const parserOpts = {
|
|
14
|
+
chainInfo: { type: 'string' },
|
|
15
|
+
assetInfo: { type: 'string' },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
19
|
+
export const defaultProposalBuilder = async (
|
|
20
|
+
{ publishRef, install },
|
|
21
|
+
options,
|
|
22
|
+
) =>
|
|
23
|
+
harden({
|
|
24
|
+
sourceSpec: '@agoric/orchestration/src/proposals/start-send-anywhere.js',
|
|
25
|
+
getManifestCall: [
|
|
26
|
+
getManifest.name,
|
|
27
|
+
{
|
|
28
|
+
installationRef: publishRef(
|
|
29
|
+
install(
|
|
30
|
+
'@agoric/orchestration/src/examples/send-anywhere.contract.js',
|
|
31
|
+
),
|
|
32
|
+
),
|
|
33
|
+
options,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
39
|
+
export default async (homeP, endowments) => {
|
|
40
|
+
const { scriptArgs } = endowments;
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
values: { chainInfo, assetInfo },
|
|
44
|
+
} = parseArgs({
|
|
45
|
+
args: scriptArgs,
|
|
46
|
+
options: parserOpts,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const parseChainInfo = () => {
|
|
50
|
+
if (typeof chainInfo !== 'string') return undefined;
|
|
51
|
+
return JSON.parse(chainInfo);
|
|
52
|
+
};
|
|
53
|
+
const parseAssetInfo = () => {
|
|
54
|
+
if (typeof assetInfo !== 'string') return undefined;
|
|
55
|
+
return JSON.parse(assetInfo);
|
|
56
|
+
};
|
|
57
|
+
const opts = harden({
|
|
58
|
+
chainInfo: parseChainInfo(),
|
|
59
|
+
assetInfo: parseAssetInfo(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
63
|
+
|
|
64
|
+
await writeCoreEval(startSendAnywhere.name, utils =>
|
|
65
|
+
defaultProposalBuilder(utils, opts),
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file This is for use in tests in a3p-integration
|
|
3
|
-
* Unlike most builder scripts, this one includes the proposal exports as well.
|
|
4
|
-
*/
|
|
5
|
-
import {
|
|
6
|
-
deeplyFulfilledObject,
|
|
7
|
-
makeTracer,
|
|
8
|
-
NonNullish,
|
|
9
|
-
} from '@agoric/internal';
|
|
10
|
-
import { E } from '@endo/far';
|
|
11
|
-
|
|
12
|
-
/// <reference types="@agoric/vats/src/core/types-ambient"/>
|
|
13
|
-
/**
|
|
14
|
-
* @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const trace = makeTracer('StartSA', true);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {BootstrapPowers & {
|
|
25
|
-
* installation: {
|
|
26
|
-
* consume: {
|
|
27
|
-
* sendAnywhere: Installation<StartFn>;
|
|
28
|
-
* };
|
|
29
|
-
* };
|
|
30
|
-
* }} powers
|
|
31
|
-
*/
|
|
32
|
-
export const startSendAnywhere = async ({
|
|
33
|
-
consume: {
|
|
34
|
-
agoricNames,
|
|
35
|
-
board,
|
|
36
|
-
chainStorage,
|
|
37
|
-
chainTimerService,
|
|
38
|
-
cosmosInterchainService,
|
|
39
|
-
localchain,
|
|
40
|
-
startUpgradable,
|
|
41
|
-
},
|
|
42
|
-
installation: {
|
|
43
|
-
consume: { sendAnywhere },
|
|
44
|
-
},
|
|
45
|
-
instance: {
|
|
46
|
-
// @ts-expect-error unknown instance
|
|
47
|
-
produce: { sendAnywhere: produceInstance },
|
|
48
|
-
},
|
|
49
|
-
issuer: {
|
|
50
|
-
consume: { IST },
|
|
51
|
-
},
|
|
52
|
-
}) => {
|
|
53
|
-
trace(startSendAnywhere.name);
|
|
54
|
-
|
|
55
|
-
const marshaller = await E(board).getReadonlyMarshaller();
|
|
56
|
-
|
|
57
|
-
const privateArgs = await deeplyFulfilledObject(
|
|
58
|
-
harden({
|
|
59
|
-
agoricNames,
|
|
60
|
-
localchain,
|
|
61
|
-
marshaller,
|
|
62
|
-
orchestrationService: cosmosInterchainService,
|
|
63
|
-
storageNode: E(NonNullish(await chainStorage)).makeChildNode(
|
|
64
|
-
'send-anywhere',
|
|
65
|
-
),
|
|
66
|
-
timerService: chainTimerService,
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const { instance } = await E(startUpgradable)({
|
|
71
|
-
label: 'send-anywhere',
|
|
72
|
-
installation: sendAnywhere,
|
|
73
|
-
issuerKeywordRecord: { Stable: await IST },
|
|
74
|
-
privateArgs,
|
|
75
|
-
});
|
|
76
|
-
produceInstance.resolve(instance);
|
|
77
|
-
trace('done');
|
|
78
|
-
};
|
|
79
|
-
harden(startSendAnywhere);
|
|
80
|
-
|
|
81
|
-
export const getManifest = ({ restoreRef }, { installationRef }) => {
|
|
82
|
-
return {
|
|
83
|
-
manifest: {
|
|
84
|
-
[startSendAnywhere.name]: {
|
|
85
|
-
consume: {
|
|
86
|
-
agoricNames: true,
|
|
87
|
-
board: true,
|
|
88
|
-
chainStorage: true,
|
|
89
|
-
chainTimerService: true,
|
|
90
|
-
cosmosInterchainService: true,
|
|
91
|
-
localchain: true,
|
|
92
|
-
|
|
93
|
-
startUpgradable: true,
|
|
94
|
-
},
|
|
95
|
-
installation: {
|
|
96
|
-
consume: { sendAnywhere: true },
|
|
97
|
-
},
|
|
98
|
-
instance: {
|
|
99
|
-
produce: { sendAnywhere: true },
|
|
100
|
-
},
|
|
101
|
-
issuer: {
|
|
102
|
-
consume: { IST: true },
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
installations: {
|
|
107
|
-
sendAnywhere: restoreRef(installationRef),
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
113
|
-
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
114
|
-
harden({
|
|
115
|
-
// Somewhat unorthodox, source the exports from this builder module
|
|
116
|
-
sourceSpec: '@agoric/builders/scripts/testing/start-send-anywhere.js',
|
|
117
|
-
getManifestCall: [
|
|
118
|
-
getManifest.name,
|
|
119
|
-
{
|
|
120
|
-
installationRef: publishRef(
|
|
121
|
-
install(
|
|
122
|
-
'@agoric/orchestration/src/examples/send-anywhere.contract.js',
|
|
123
|
-
),
|
|
124
|
-
),
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
130
|
-
export default async (homeP, endowments) => {
|
|
131
|
-
// import dynamically so the module can work in CoreEval environment
|
|
132
|
-
const dspModule = await import('@agoric/deploy-script-support');
|
|
133
|
-
const { makeHelpers } = dspModule;
|
|
134
|
-
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
135
|
-
await writeCoreEval(startSendAnywhere.name, defaultProposalBuilder);
|
|
136
|
-
};
|