agoric 0.21.2-dev-76118c5.0 → 0.21.2-dev-312271b.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.
Files changed (2) hide show
  1. package/package.json +20 -20
  2. package/src/commands/oracle.js +27 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agoric",
3
- "version": "0.21.2-dev-76118c5.0+76118c5",
3
+ "version": "0.21.2-dev-312271b.0+312271b",
4
4
  "description": "Manage the Agoric Javascript smart contract platform",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
@@ -28,29 +28,29 @@
28
28
  "lint:eslint": "eslint ."
29
29
  },
30
30
  "devDependencies": {
31
- "@agoric/cosmic-swingset": "0.41.4-dev-76118c5.0+76118c5",
32
- "@agoric/deploy-script-support": "0.10.4-dev-76118c5.0+76118c5",
31
+ "@agoric/cosmic-swingset": "0.41.4-dev-312271b.0+312271b",
32
+ "@agoric/deploy-script-support": "0.10.4-dev-312271b.0+312271b",
33
33
  "ava": "^5.3.0",
34
34
  "c8": "^7.13.0",
35
35
  "dd-trace": "^4.11.1"
36
36
  },
37
37
  "dependencies": {
38
- "@agoric/access-token": "0.4.22-dev-76118c5.0+76118c5",
39
- "@agoric/assert": "0.6.1-dev-76118c5.0+76118c5",
40
- "@agoric/cache": "0.3.3-dev-76118c5.0+76118c5",
41
- "@agoric/casting": "0.4.3-dev-76118c5.0+76118c5",
42
- "@agoric/cosmic-proto": "0.3.1-dev-76118c5.0+76118c5",
43
- "@agoric/ertp": "0.16.3-dev-76118c5.0+76118c5",
44
- "@agoric/governance": "0.10.4-dev-76118c5.0+76118c5",
45
- "@agoric/inter-protocol": "0.16.2-dev-76118c5.0+76118c5",
46
- "@agoric/internal": "0.3.3-dev-76118c5.0+76118c5",
47
- "@agoric/network": "0.1.1-dev-76118c5.0+76118c5",
48
- "@agoric/smart-wallet": "0.5.4-dev-76118c5.0+76118c5",
49
- "@agoric/store": "0.9.3-dev-76118c5.0+76118c5",
50
- "@agoric/swingset-vat": "0.32.3-dev-76118c5.0+76118c5",
51
- "@agoric/vats": "0.15.2-dev-76118c5.0+76118c5",
52
- "@agoric/zoe": "0.26.3-dev-76118c5.0+76118c5",
53
- "@agoric/zone": "0.2.3-dev-76118c5.0+76118c5",
38
+ "@agoric/access-token": "0.4.22-dev-312271b.0+312271b",
39
+ "@agoric/assert": "0.6.1-dev-312271b.0+312271b",
40
+ "@agoric/cache": "0.3.3-dev-312271b.0+312271b",
41
+ "@agoric/casting": "0.4.3-dev-312271b.0+312271b",
42
+ "@agoric/cosmic-proto": "0.3.1-dev-312271b.0+312271b",
43
+ "@agoric/ertp": "0.16.3-dev-312271b.0+312271b",
44
+ "@agoric/governance": "0.10.4-dev-312271b.0+312271b",
45
+ "@agoric/inter-protocol": "0.16.2-dev-312271b.0+312271b",
46
+ "@agoric/internal": "0.3.3-dev-312271b.0+312271b",
47
+ "@agoric/network": "0.1.1-dev-312271b.0+312271b",
48
+ "@agoric/smart-wallet": "0.5.4-dev-312271b.0+312271b",
49
+ "@agoric/store": "0.9.3-dev-312271b.0+312271b",
50
+ "@agoric/swingset-vat": "0.32.3-dev-312271b.0+312271b",
51
+ "@agoric/vats": "0.15.2-dev-312271b.0+312271b",
52
+ "@agoric/zoe": "0.26.3-dev-312271b.0+312271b",
53
+ "@agoric/zone": "0.2.3-dev-312271b.0+312271b",
54
54
  "@confio/relayer": "^0.9.0",
55
55
  "@cosmjs/crypto": "^0.30.1",
56
56
  "@cosmjs/encoding": "^0.30.1",
@@ -98,5 +98,5 @@
98
98
  "typeCoverage": {
99
99
  "atLeast": 77.53
100
100
  },
101
- "gitHead": "76118c5ceb3aeed6bbb54f8d24c3b9e4ade43be2"
101
+ "gitHead": "312271b6db71af347640a4d3a789dd37e42e5c12"
102
102
  }
@@ -70,6 +70,11 @@ export const makeOracleCommand = (logger, io = {}) => {
70
70
  env.AGORIC_KEYRING_BACKEND,
71
71
  );
72
72
 
73
+ const normalizeAddress = literalOrName =>
74
+ normalizeAddressWithOptions(literalOrName, oracle.opts(), {
75
+ execFileSync,
76
+ });
77
+
73
78
  const rpcTools = async () => {
74
79
  // XXX pass fetch to getNetworkConfig() explicitly
75
80
  const networkConfig = await getNetworkConfig(env);
@@ -161,7 +166,7 @@ export const makeOracleCommand = (logger, io = {}) => {
161
166
  console.warn('Now execute the prepared offer');
162
167
  });
163
168
 
164
- const findOracleCap = async (from, readLatestHead) => {
169
+ const findOracleCap = async (instance, from, readLatestHead) => {
165
170
  const current = await getCurrent(from, { readLatestHead });
166
171
 
167
172
  const { offerToUsedInvitation: entries } = /** @type {any} */ (current);
@@ -169,8 +174,8 @@ export const makeOracleCommand = (logger, io = {}) => {
169
174
 
170
175
  for (const [offerId, { value }] of entries) {
171
176
  /** @type {{ description: string, instance: unknown }[]} */
172
- const [{ description }] = value;
173
- if (description === 'oracle invitation') {
177
+ const [{ description, instance: candidate }] = value;
178
+ if (description === 'oracle invitation' && candidate === instance) {
174
179
  return offerId;
175
180
  }
176
181
  }
@@ -179,11 +184,22 @@ export const makeOracleCommand = (logger, io = {}) => {
179
184
  oracle
180
185
  .command('find-continuing-id')
181
186
  .description('print id of specified oracle continuing invitation')
182
- .requiredOption('--from <address>', 'from address', String)
187
+ .requiredOption(
188
+ '--from <address>',
189
+ 'wallet address literal or name',
190
+ normalizeAddress,
191
+ )
192
+ .requiredOption(
193
+ '--pair [brandIn.brandOut]',
194
+ 'token pair (brandIn.brandOut)',
195
+ s => s.split('.'),
196
+ )
183
197
  .action(async opts => {
184
- const { readLatestHead } = await makeRpcUtils({ fetch });
198
+ const { readLatestHead, lookupPriceAggregatorInstance } =
199
+ await rpcTools();
200
+ const instance = lookupPriceAggregatorInstance(opts.pair);
185
201
 
186
- const offerId = await findOracleCap(opts.from, readLatestHead);
202
+ const offerId = await findOracleCap(instance, opts.from, readLatestHead);
187
203
  if (!offerId) {
188
204
  console.error('No continuing ids found');
189
205
  }
@@ -211,11 +227,6 @@ export const makeOracleCommand = (logger, io = {}) => {
211
227
  console.log(inspect(capDatas[0], { depth: 10, colors: true }));
212
228
  });
213
229
 
214
- /** @param {string} literalOrName */
215
- const normalizeAddress = literalOrName =>
216
- normalizeAddressWithOptions(literalOrName, oracle.opts(), {
217
- execFileSync,
218
- });
219
230
  const show = (info, indent = false) =>
220
231
  stdout.write(
221
232
  `${JSON.stringify(info, bigintReplacer, indent ? 2 : undefined)}\n`,
@@ -249,7 +260,8 @@ export const makeOracleCommand = (logger, io = {}) => {
249
260
  * }}
250
261
  */ { pair, keys, price },
251
262
  ) => {
252
- const { readLatestHead, networkConfig } = await rpcTools();
263
+ const { readLatestHead, networkConfig, lookupPriceAggregatorInstance } =
264
+ await rpcTools();
253
265
  const wutil = await makeWalletUtils(
254
266
  { fetch, execFileSync, delay },
255
267
  networkConfig,
@@ -307,9 +319,12 @@ export const makeOracleCommand = (logger, io = {}) => {
307
319
  console.warn(err);
308
320
  });
309
321
 
322
+ const instance = lookupPriceAggregatorInstance(pair);
323
+
310
324
  console.error('pushPrice from each:', keyOrder);
311
325
  for await (const from of keyOrder) {
312
326
  const oracleAdminAcceptOfferId = await findOracleCap(
327
+ instance,
313
328
  from,
314
329
  readLatestHead,
315
330
  );