agoric 0.21.2-dev-b05c226.0 → 0.21.2-dev-6bce049.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",
3
- "version": "0.21.2-dev-b05c226.0+b05c226",
3
+ "version": "0.21.2-dev-6bce049.0+6bce049",
4
4
  "description": "Manage the Agoric Javascript smart contract platform",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
@@ -8,6 +8,10 @@
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
+ },
11
15
  "files": [
12
16
  "src",
13
17
  "exported.js"
@@ -24,25 +28,25 @@
24
28
  "lint:eslint": "eslint ."
25
29
  },
26
30
  "devDependencies": {
27
- "@agoric/deploy-script-support": "0.10.4-dev-b05c226.0+b05c226",
31
+ "@agoric/deploy-script-support": "0.10.4-dev-6bce049.0+6bce049",
28
32
  "ava": "^5.3.0",
29
33
  "c8": "^7.13.0"
30
34
  },
31
35
  "dependencies": {
32
- "@agoric/access-token": "0.4.22-dev-b05c226.0+b05c226",
33
- "@agoric/assert": "0.6.1-dev-b05c226.0+b05c226",
34
- "@agoric/cache": "0.3.3-dev-b05c226.0+b05c226",
35
- "@agoric/casting": "0.4.3-dev-b05c226.0+b05c226",
36
- "@agoric/cosmic-proto": "0.3.1-dev-b05c226.0+b05c226",
37
- "@agoric/ertp": "0.16.3-dev-b05c226.0+b05c226",
38
- "@agoric/inter-protocol": "0.16.2-dev-b05c226.0+b05c226",
39
- "@agoric/internal": "0.3.3-dev-b05c226.0+b05c226",
40
- "@agoric/smart-wallet": "0.5.4-dev-b05c226.0+b05c226",
41
- "@agoric/store": "0.9.3-dev-b05c226.0+b05c226",
42
- "@agoric/swingset-vat": "0.32.3-dev-b05c226.0+b05c226",
43
- "@agoric/vats": "0.15.2-dev-b05c226.0+b05c226",
44
- "@agoric/zoe": "0.26.3-dev-b05c226.0+b05c226",
45
- "@agoric/zone": "0.2.3-dev-b05c226.0+b05c226",
36
+ "@agoric/access-token": "0.4.22-dev-6bce049.0+6bce049",
37
+ "@agoric/assert": "0.6.1-dev-6bce049.0+6bce049",
38
+ "@agoric/cache": "0.3.3-dev-6bce049.0+6bce049",
39
+ "@agoric/casting": "0.4.3-dev-6bce049.0+6bce049",
40
+ "@agoric/cosmic-proto": "0.3.1-dev-6bce049.0+6bce049",
41
+ "@agoric/ertp": "0.16.3-dev-6bce049.0+6bce049",
42
+ "@agoric/inter-protocol": "0.16.2-dev-6bce049.0+6bce049",
43
+ "@agoric/internal": "0.3.3-dev-6bce049.0+6bce049",
44
+ "@agoric/smart-wallet": "0.5.4-dev-6bce049.0+6bce049",
45
+ "@agoric/store": "0.9.3-dev-6bce049.0+6bce049",
46
+ "@agoric/swingset-vat": "0.32.3-dev-6bce049.0+6bce049",
47
+ "@agoric/vats": "0.15.2-dev-6bce049.0+6bce049",
48
+ "@agoric/zoe": "0.26.3-dev-6bce049.0+6bce049",
49
+ "@agoric/zone": "0.2.3-dev-6bce049.0+6bce049",
46
50
  "@confio/relayer": "^0.9.0",
47
51
  "@cosmjs/crypto": "^0.30.1",
48
52
  "@cosmjs/encoding": "^0.30.1",
@@ -88,5 +92,5 @@
88
92
  "timeout": "2m",
89
93
  "workerThreads": false
90
94
  },
91
- "gitHead": "b05c226c053703540fb51df1e274ac6cf5e00b50"
95
+ "gitHead": "6bce049552bcc46666a9f2eb4afac8a017b5f3d4"
92
96
  }
@@ -25,7 +25,6 @@ import {
25
25
  import { getNetworkConfig } from '../lib/rpc.js';
26
26
  import {
27
27
  getCurrent,
28
- makeParseAmount,
29
28
  makeWalletUtils,
30
29
  outputActionAndHint,
31
30
  sendAction,
@@ -415,14 +414,7 @@ inter auction status
415
414
  async ({ generateOnly, dryRun, ...opts }) => {
416
415
  const tools = await tryMakeUtils();
417
416
 
418
- const parseAmount = makeParseAmount(
419
- tools.agoricNames,
420
- msg => new InvalidArgumentError(msg),
421
- );
422
- const offer = Offers.auction.Bid(tools.agoricNames.brand, {
423
- ...opts,
424
- parseAmount,
425
- });
417
+ const offer = Offers.auction.Bid(tools.agoricNames, opts);
426
418
 
427
419
  if (generateOnly) {
428
420
  outputActionAndHint(
@@ -463,14 +455,7 @@ inter auction status
463
455
  async ({ generateOnly, ...opts }) => {
464
456
  const tools = await tryMakeUtils();
465
457
 
466
- const parseAmount = makeParseAmount(
467
- tools.agoricNames,
468
- msg => new InvalidArgumentError(msg),
469
- );
470
- const offer = Offers.auction.Bid(tools.agoricNames.brand, {
471
- ...opts,
472
- parseAmount,
473
- });
458
+ const offer = Offers.auction.Bid(tools.agoricNames, opts);
474
459
  if (generateOnly) {
475
460
  outputActionAndHint(
476
461
  { method: 'executeOffer', offer },
@@ -157,7 +157,7 @@ export const makePsmCommand = logger => {
157
157
  console.warn('running with options', opts);
158
158
  const { agoricNames, lookupPsmInstance } = await rpcTools();
159
159
  const instance = await lookupPsmInstance(opts.pair);
160
- const offer = Offers.psm.swap(instance, agoricNames.brand, opts);
160
+ const offer = Offers.psm.swap(agoricNames, instance, opts);
161
161
  outputExecuteOfferAction(offer);
162
162
  });
163
163
 
@@ -31,7 +31,7 @@ export const makeReserveCommand = (_logger, io = {}) => {
31
31
  async ({ collateralBrand, ...opts }) => {
32
32
  const { agoricNames } = await makeRpcUtils({ fetch });
33
33
 
34
- const offer = Offers.reserve.AddCollateral(agoricNames.brand, {
34
+ const offer = Offers.reserve.AddCollateral(agoricNames, {
35
35
  collateralBrandKey: collateralBrand,
36
36
  ...opts,
37
37
  });
@@ -63,7 +63,7 @@ export const makeVaultsCommand = logger => {
63
63
  logger.warn('running with options', opts);
64
64
  const { agoricNames } = await makeRpcUtils({ fetch });
65
65
 
66
- const offer = Offers.vaults.OpenVault(agoricNames.brand, {
66
+ const offer = Offers.vaults.OpenVault(agoricNames, {
67
67
  giveCollateral: opts.giveCollateral,
68
68
  wantMinted: opts.wantMinted,
69
69
  offerId: opts.offerId,
@@ -104,7 +104,7 @@ export const makeVaultsCommand = logger => {
104
104
  );
105
105
 
106
106
  const offer = Offers.vaults.AdjustBalances(
107
- agoricNames.brand,
107
+ agoricNames,
108
108
  {
109
109
  giveCollateral: opts.giveCollateral,
110
110
  wantCollateral: opts.wantCollateral,
@@ -145,7 +145,7 @@ export const makeVaultsCommand = logger => {
145
145
  );
146
146
 
147
147
  const offer = Offers.vaults.CloseVault(
148
- agoricNames.brand,
148
+ agoricNames,
149
149
  {
150
150
  giveMinted: opts.giveMinted,
151
151
  offerId: opts.offerId,
package/src/lib/wallet.js CHANGED
@@ -9,7 +9,6 @@ import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js';
9
9
  /** @typedef {import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord} CurrentWalletRecord */
10
10
  /** @typedef {import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes} AgoricNamesRemotes */
11
11
 
12
- const { values } = Object;
13
12
  const { Fail } = assert;
14
13
  const marshaller = boardSlottingMarshaller();
15
14
 
@@ -271,44 +270,3 @@ export const makeWalletUtils = async (
271
270
  pollOffer,
272
271
  };
273
272
  };
274
-
275
- /**
276
- * @param {{
277
- * brand: Record<string, Brand>,
278
- * vbankAsset: Record<string, { brand: Brand, displayInfo: DisplayInfo }>,
279
- * }} agoricNames
280
- * @param {(msg: string) => Error} makeError error constructor
281
- * @returns {(a: string) => Amount<'nat'>}
282
- */
283
- export const makeParseAmount =
284
- (agoricNames, makeError = msg => RangeError(msg)) =>
285
- opt => {
286
- assert.typeof(opt, 'string', 'parseAmount expected string');
287
- const m = opt.match(/^(?<value>[\d_]+(\.[\d_]+)?)(?<brand>[A-Z]\w*?)$/);
288
- if (!m || !m.groups) {
289
- throw makeError(`invalid amount: ${opt}`);
290
- }
291
- const anyBrand = agoricNames.brand[m.groups.brand];
292
- if (!anyBrand) {
293
- throw makeError(`unknown brand: ${m.groups.brand}`);
294
- }
295
- const assetDesc = values(agoricNames.vbankAsset).find(
296
- d => d.brand === anyBrand,
297
- );
298
- if (!assetDesc) {
299
- throw makeError(`unknown brand: ${m.groups.brand}`);
300
- }
301
- const { displayInfo } = assetDesc;
302
- if (!displayInfo.decimalPlaces || displayInfo.assetKind !== 'nat') {
303
- throw makeError(`bad brand: ${displayInfo}`);
304
- }
305
- const value = BigInt(
306
- Number(m.groups.value.replace(/_/g, '')) *
307
- 10 ** displayInfo.decimalPlaces,
308
- );
309
- /** @type {Brand<'nat'>} */
310
- // @ts-expect-error dynamic cast
311
- const natBrand = anyBrand;
312
- const amt = { value, brand: natBrand };
313
- return amt;
314
- };