@agoric/wallet-backend 0.14.4-dev-5dc325b.0 → 0.14.4-getting-started-dev-26244e8.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.
@@ -1,10 +1,6 @@
1
1
  // This file can contain .js-specific Typescript compiler config.
2
2
  {
3
3
  "extends": "../../../tsconfig.json",
4
- "compilerOptions": {
5
- "allowSyntheticDefaultImports": true,
6
- "maxNodeModuleJsDepth": 2,
7
- },
8
4
  "include": [
9
5
  "*.js",
10
6
  "scripts/**/*.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/wallet-backend",
3
- "version": "0.14.4-dev-5dc325b.0+5dc325b",
3
+ "version": "0.14.4-getting-started-dev-26244e8.0+26244e8",
4
4
  "description": "Wallet backend",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,32 +10,30 @@
10
10
  "test:xs": "exit 0",
11
11
  "lint": "run-s --continue-on-error lint:*",
12
12
  "lint-fix": "yarn lint:eslint --fix",
13
- "lint:types": "tsc",
13
+ "lint:types": "tsc -p jsconfig.json",
14
14
  "lint:eslint": "eslint ."
15
15
  },
16
16
  "devDependencies": {
17
- "@agoric/vats": "0.15.2-dev-5dc325b.0+5dc325b",
18
- "@endo/bundle-source": "^2.7.0",
19
- "@endo/far": "^0.2.21",
20
- "@endo/init": "^0.5.59",
21
- "ava": "^5.3.0"
17
+ "@agoric/vats": "0.15.2-getting-started-dev-26244e8.0+26244e8",
18
+ "@endo/bundle-source": "2.5.2-upstream-rollup",
19
+ "@endo/init": "0.5.56",
20
+ "ava": "^5.2.0"
22
21
  },
23
22
  "dependencies": {
24
- "@agoric/assert": "0.6.1-dev-5dc325b.0+5dc325b",
25
- "@agoric/cache": "0.3.3-dev-5dc325b.0+5dc325b",
26
- "@agoric/ertp": "0.16.3-dev-5dc325b.0+5dc325b",
27
- "@agoric/internal": "0.3.3-dev-5dc325b.0+5dc325b",
28
- "@agoric/notifier": "0.6.3-dev-5dc325b.0+5dc325b",
29
- "@agoric/smart-wallet": "0.5.4-dev-5dc325b.0+5dc325b",
30
- "@agoric/store": "0.9.3-dev-5dc325b.0+5dc325b",
31
- "@agoric/time": "0.3.3-dev-5dc325b.0+5dc325b",
32
- "@agoric/vat-data": "0.5.3-dev-5dc325b.0+5dc325b",
33
- "@agoric/zoe": "0.26.3-dev-5dc325b.0+5dc325b",
34
- "@agoric/zone": "0.2.3-dev-5dc325b.0+5dc325b",
35
- "@endo/eventual-send": "^0.17.5",
36
- "@endo/marshal": "^0.8.8",
37
- "@endo/nat": "^4.1.30",
38
- "@endo/promise-kit": "^0.2.59",
23
+ "@agoric/assert": "0.6.1-getting-started-dev-26244e8.0+26244e8",
24
+ "@agoric/cache": "0.3.3-getting-started-dev-26244e8.0+26244e8",
25
+ "@agoric/ertp": "0.16.3-getting-started-dev-26244e8.0+26244e8",
26
+ "@agoric/internal": "0.4.0-getting-started-dev-26244e8.0+26244e8",
27
+ "@agoric/notifier": "0.6.3-getting-started-dev-26244e8.0+26244e8",
28
+ "@agoric/smart-wallet": "0.5.4-getting-started-dev-26244e8.0+26244e8",
29
+ "@agoric/store": "0.9.3-getting-started-dev-26244e8.0+26244e8",
30
+ "@agoric/time": "0.3.3-getting-started-dev-26244e8.0+26244e8",
31
+ "@agoric/vat-data": "0.5.3-getting-started-dev-26244e8.0+26244e8",
32
+ "@agoric/zoe": "0.26.3-getting-started-dev-26244e8.0+26244e8",
33
+ "@endo/eventual-send": "0.17.2",
34
+ "@endo/marshal": "0.8.5",
35
+ "@endo/nat": "4.1.27",
36
+ "@endo/promise-kit": "0.2.56",
39
37
  "import-meta-resolve": "^2.2.1"
40
38
  },
41
39
  "keywords": [],
@@ -53,17 +51,11 @@
53
51
  "files": [
54
52
  "test/**/test-*.js"
55
53
  ],
56
- "require": [
57
- "@endo/init/debug.js"
58
- ],
59
54
  "timeout": "2m",
60
55
  "workerThreads": false
61
56
  },
62
57
  "publishConfig": {
63
58
  "access": "public"
64
59
  },
65
- "typeCoverage": {
66
- "atLeast": 0
67
- },
68
- "gitHead": "5dc325b8cc1d94f46ecc18a7c67a14989feade11"
60
+ "gitHead": "26244e821f1a83cd5868f0c7d54aa480c8c17e5e"
69
61
  }
package/src/lib-wallet.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // @ts-check
2
- /* eslint @typescript-eslint/no-floating-promises: "warn" */
3
2
 
4
3
  /**
5
4
  * This file defines the wallet internals without dependency on the ag-solo on
@@ -47,7 +46,7 @@ import '@agoric/store/exported.js';
47
46
  import '@agoric/zoe/exported.js';
48
47
 
49
48
  import './internal-types.js';
50
- /// <reference path="./types.js" />
49
+ import './types.js';
51
50
 
52
51
  // does nothing
53
52
  const noActionStateChangeHandler = _newState => {};
@@ -503,8 +502,9 @@ export function makeWalletRoot({
503
502
  const alreadyDisplayed =
504
503
  inboxState.has(id) && inboxState.get(id).proposalForDisplay;
505
504
 
506
- const augmentedInvitationDetails =
507
- await expandInvitationBrands(invitationDetails);
505
+ const augmentedInvitationDetails = await expandInvitationBrands(
506
+ invitationDetails,
507
+ );
508
508
 
509
509
  const offerForDisplay = {
510
510
  ...offer,
@@ -726,7 +726,7 @@ export function makeWalletRoot({
726
726
  // eslint-disable-next-line no-use-before-define
727
727
  p = makeEmptyPurse(petnameForBrand, petnameForBrand, true);
728
728
  } else {
729
- p = Promise.resolve(undefined);
729
+ p = Promise.resolve();
730
730
  }
731
731
  return E.when(p, _ => petnameForBrand);
732
732
  };
@@ -1209,7 +1209,6 @@ export function makeWalletRoot({
1209
1209
  updateInboxState(id, rejectOffer);
1210
1210
  };
1211
1211
 
1212
- await null;
1213
1212
  try {
1214
1213
  const pendingOffer = addMeta({
1215
1214
  ...offer,
@@ -1373,7 +1372,6 @@ export function makeWalletRoot({
1373
1372
  brandToAutoDepositPurse.init(brand, purse);
1374
1373
  }
1375
1374
 
1376
- await null;
1377
1375
  if (updateState) {
1378
1376
  await updateAllPurseState();
1379
1377
  }
@@ -1895,32 +1893,28 @@ export function makeWalletRoot({
1895
1893
  // don't really trust.
1896
1894
  // The param is{import('@agoric/vats/src/vat-bank.js').Bank} but that here triggers https://github.com/Agoric/agoric-sdk/issues/4620
1897
1895
  const importBankAssets = async bank => {
1898
- observeIteration(
1899
- subscribeEach(E(bank).getAssetSubscription()),
1900
- harden({
1901
- async updateState({ proposedName, issuerName, issuer, brand }) {
1902
- await null;
1903
- try {
1904
- issuerName = await addIssuer(issuerName, issuer);
1905
- const purse = await E(bank).getPurse(brand);
1906
- // We can import this purse, because we trust the bank.
1907
- await internalUnsafeImportPurse(
1908
- issuerName,
1909
- proposedName,
1910
- true,
1911
- purse,
1912
- );
1913
- } catch (e) {
1914
- console.error('/// could not add bank asset purse', e, {
1915
- issuerName,
1916
- proposedName,
1917
- issuer,
1918
- brand,
1919
- });
1920
- }
1921
- },
1922
- }),
1923
- ).finally(() => console.error('/// This is the end of the bank assets'));
1896
+ observeIteration(subscribeEach(E(bank).getAssetSubscription()), {
1897
+ async updateState({ proposedName, issuerName, issuer, brand }) {
1898
+ try {
1899
+ issuerName = await addIssuer(issuerName, issuer);
1900
+ const purse = await E(bank).getPurse(brand);
1901
+ // We can import this purse, because we trust the bank.
1902
+ await internalUnsafeImportPurse(
1903
+ issuerName,
1904
+ proposedName,
1905
+ true,
1906
+ purse,
1907
+ );
1908
+ } catch (e) {
1909
+ console.error('/// could not add bank asset purse', e, {
1910
+ issuerName,
1911
+ proposedName,
1912
+ issuer,
1913
+ brand,
1914
+ });
1915
+ }
1916
+ },
1917
+ }).finally(() => console.error('/// This is the end of the bank assets'));
1924
1918
  };
1925
1919
  return {
1926
1920
  admin: wallet,
package/src/wallet.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // @ts-check
2
- /* eslint @typescript-eslint/no-floating-promises: "warn" */
3
2
 
4
3
  /**
5
4
  * This file defines the vat launched by the spawner in the ../deploy.js script.
@@ -588,8 +587,9 @@ export function buildRootObject(vatPowers) {
588
587
 
589
588
  case 'walletGetDepositFacetId': {
590
589
  const { brandBoardId } = obj;
591
- const result =
592
- await walletAdmin.getDepositFacetId(brandBoardId);
590
+ const result = await walletAdmin.getDepositFacetId(
591
+ brandBoardId,
592
+ );
593
593
  return {
594
594
  type: 'walletDepositFacetIdResponse',
595
595
  data: result,
@@ -3,8 +3,10 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
3
3
 
4
4
  import { makeIssuerKit } from '@agoric/ertp';
5
5
  import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
6
+ // eslint-disable-next-line import/no-extraneous-dependencies
6
7
  import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
7
- import { makeHeapZone } from '@agoric/zone';
8
+ // eslint-disable-next-line import/no-extraneous-dependencies
9
+ import { heapZone } from '@agoric/zone';
8
10
  import {
9
11
  makeNameHubKit,
10
12
  prepareMixinMyAddress,
@@ -13,7 +15,7 @@ import { makeWalletRoot } from '../src/lib-wallet.js';
13
15
 
14
16
  import '../src/types.js';
15
17
 
16
- const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
18
+ const mixinMyAddress = prepareMixinMyAddress(heapZone);
17
19
 
18
20
  function makeFakeMyAddressNameAdmin() {
19
21
  const { nameAdmin } = makeNameHubKit();
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
- /* eslint @typescript-eslint/no-floating-promises: "warn" */
3
2
  import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';
4
3
 
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
5
5
  import bundleSource from '@endo/bundle-source';
6
6
  import { makeCache } from '@agoric/cache';
7
7
  import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp';
@@ -12,20 +12,23 @@ import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
12
12
  import { E } from '@endo/eventual-send';
13
13
 
14
14
  import { assert } from '@agoric/assert';
15
+ // eslint-disable-next-line import/no-extraneous-dependencies
15
16
  import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
17
+ // eslint-disable-next-line import/no-extraneous-dependencies
16
18
  import {
17
19
  makeNameHubKit,
18
20
  prepareMixinMyAddress,
19
21
  } from '@agoric/vats/src/nameHub.js';
20
22
  import { resolve as importMetaResolve } from 'import-meta-resolve';
21
- import { makeHeapZone } from '@agoric/zone';
23
+ // eslint-disable-next-line import/no-extraneous-dependencies
24
+ import { heapZone } from '@agoric/zone';
22
25
  import { makeWalletRoot } from '../src/lib-wallet.js';
23
26
 
24
27
  import '../src/types.js';
25
28
 
26
29
  const ZOE_INVITE_PURSE_PETNAME = 'Default Zoe invite purse';
27
30
 
28
- const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
31
+ const mixinMyAddress = prepareMixinMyAddress(heapZone);
29
32
 
30
33
  function makeFakeMyAddressNameAdmin() {
31
34
  const { nameAdmin } = makeNameHubKit();
@@ -1636,14 +1639,17 @@ test('stamps from dateNow', async t => {
1636
1639
  const paymentNotifier = E(wallet).getPaymentsNotifier();
1637
1640
 
1638
1641
  const date0 = currentDateMS;
1639
- const { value: val0, updateCount: count0 } =
1640
- await E(paymentNotifier).getUpdateSince();
1642
+ const { value: val0, updateCount: count0 } = await E(
1643
+ paymentNotifier,
1644
+ ).getUpdateSince();
1641
1645
  await E(wallet).addPayment(pmt1);
1642
- const { value: val1a, updateCount: count1a } =
1643
- await E(paymentNotifier).getUpdateSince(count0);
1646
+ const { value: val1a, updateCount: count1a } = await E(
1647
+ paymentNotifier,
1648
+ ).getUpdateSince(count0);
1644
1649
  E(wallet).addPayment(pmt4);
1645
- const { value: val1, updateCount: count1 } =
1646
- await E(paymentNotifier).getUpdateSince(count1a);
1650
+ const { value: val1, updateCount: count1 } = await E(
1651
+ paymentNotifier,
1652
+ ).getUpdateSince(count1a);
1647
1653
 
1648
1654
  // Wait for tick to take effect.
1649
1655
  currentDateMS += 1234;
@@ -1651,8 +1657,9 @@ test('stamps from dateNow', async t => {
1651
1657
  t.is(dateNow(), startDateMS + 1234);
1652
1658
 
1653
1659
  await E(wallet).addPayment(pmt2);
1654
- const { value: val2, updateCount: count2 } =
1655
- await E(paymentNotifier).getUpdateSince(count1);
1660
+ const { value: val2, updateCount: count2 } = await E(
1661
+ paymentNotifier,
1662
+ ).getUpdateSince(count1);
1656
1663
  await E(wallet).addPayment(pmt3);
1657
1664
  const { value: payments } = await E(paymentNotifier).getUpdateSince(count2);
1658
1665
 
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
4
  import { E, Far } from '@endo/far';
4
5
  import {
5
6
  makeExportContext,