@agoric/wallet-backend 0.15.0 → 0.15.1-upgrade-23-dev-bd79330.0.bd79330

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,36 +1,34 @@
1
1
  {
2
2
  "name": "@agoric/wallet-backend",
3
- "version": "0.15.0",
3
+ "version": "0.15.1-upgrade-23-dev-bd79330.0.bd79330",
4
4
  "description": "Wallet backend",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "build": "yarn build:bundles",
8
- "build:bundles": "node scripts/build-bundles.js",
9
7
  "test": "ava",
10
8
  "test:xs": "exit 0",
11
9
  "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
12
10
  "lint-fix": "yarn lint:eslint --fix",
13
11
  "lint:types": "yarn run -T tsc",
14
- "lint:eslint": "yarn run -T eslint ."
12
+ "lint:eslint": "node ../../../scripts/eslint-repo.mjs ."
15
13
  },
16
14
  "devDependencies": {
17
- "@agoric/vats": "0.16.0",
15
+ "@agoric/vats": "0.16.1-upgrade-23-dev-bd79330.0.bd79330",
18
16
  "@endo/bundle-source": "^4.1.2",
19
17
  "@endo/far": "^1.1.14",
20
18
  "@endo/init": "^1.1.12",
21
- "ava": "^5.3.0"
19
+ "ava": "^6.4.1"
22
20
  },
23
21
  "dependencies": {
24
- "@agoric/cache": "0.4.0",
25
- "@agoric/ertp": "0.17.0",
26
- "@agoric/internal": "0.4.0",
27
- "@agoric/notifier": "0.7.0",
28
- "@agoric/smart-wallet": "0.6.0",
29
- "@agoric/store": "0.10.0",
30
- "@agoric/time": "0.4.0",
31
- "@agoric/vat-data": "0.6.0",
32
- "@agoric/zoe": "0.27.0",
33
- "@agoric/zone": "0.3.0",
22
+ "@agoric/cache": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
23
+ "@agoric/ertp": "0.17.1-upgrade-23-dev-bd79330.0.bd79330",
24
+ "@agoric/internal": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
25
+ "@agoric/notifier": "0.7.1-upgrade-23-dev-bd79330.0.bd79330",
26
+ "@agoric/smart-wallet": "0.6.1-upgrade-23-dev-bd79330.0.bd79330",
27
+ "@agoric/store": "0.10.1-upgrade-23-dev-bd79330.0.bd79330",
28
+ "@agoric/time": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
29
+ "@agoric/vat-data": "0.6.1-upgrade-23-dev-bd79330.0.bd79330",
30
+ "@agoric/zoe": "0.27.1-upgrade-23-dev-bd79330.0.bd79330",
31
+ "@agoric/zone": "0.3.1-upgrade-23-dev-bd79330.0.bd79330",
34
32
  "@endo/errors": "^1.2.13",
35
33
  "@endo/eventual-send": "^1.3.4",
36
34
  "@endo/marshal": "^1.8.0",
@@ -38,6 +36,9 @@
38
36
  "@endo/promise-kit": "^1.1.13",
39
37
  "import-meta-resolve": "^4.1.0"
40
38
  },
39
+ "files": [
40
+ "src"
41
+ ],
41
42
  "keywords": [],
42
43
  "repository": {
43
44
  "type": "git",
@@ -56,8 +57,7 @@
56
57
  "require": [
57
58
  "@endo/init/debug.js"
58
59
  ],
59
- "timeout": "2m",
60
- "workerThreads": false
60
+ "timeout": "2m"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": "^20.9 || ^22.11"
70
70
  },
71
- "gitHead": "0922d0447ab8fae9d2d87415964403330b5ca313"
71
+ "gitHead": "bd79330f78dae2faf9cc3d8b10063567700da07b"
72
72
  }
package/src/actions.js CHANGED
@@ -4,6 +4,10 @@ import { makePromiseKit } from '@endo/promise-kit';
4
4
  import { Far } from '@endo/marshal';
5
5
  import { E } from '@endo/eventual-send';
6
6
 
7
+ /**
8
+ * @import {Purse} from '@agoric/ertp';
9
+ */
10
+
7
11
  export const makePaymentActions = ({
8
12
  getBrandRecord,
9
13
  getPurseByPetname,
package/src/date-now.js CHANGED
@@ -2,6 +2,10 @@ import { E } from '@endo/eventual-send';
2
2
  import { observeNotifier } from '@agoric/notifier';
3
3
  import { makePromiseKit } from '@endo/promise-kit';
4
4
 
5
+ /**
6
+ * @import {PromiseRecord} from '@endo/promise-kit';
7
+ */
8
+
5
9
  export const DEFAULT_TIMER_SERVICE_POLL_INTERVAL = 60_000n;
6
10
  export const DEFAULT_TIMER_DEVICE_SCALE = 1;
7
11
 
@@ -3,6 +3,14 @@ import { E } from '@endo/eventual-send';
3
3
  import { passStyleOf } from '@endo/marshal';
4
4
  import { AmountMath } from '@agoric/ertp';
5
5
 
6
+ /**
7
+ * @import {Board} from '@agoric/vats';
8
+ * @import {Amount} from '@agoric/ertp';
9
+ * @import {ZoeService} from '@agoric/zoe';
10
+ * @import {Invitation} from '@agoric/zoe';
11
+ * @import {Instance} from '@agoric/zoe';
12
+ */
13
+
6
14
  export const makeId = (dappOrigin, rawId) => `${dappOrigin}#${rawId}`;
7
15
 
8
16
  const assertFirstCapASCII = str => {
@@ -19,7 +27,7 @@ const assertFirstCapASCII = str => {
19
27
  /**
20
28
  * @param {Amount<'set'>} invitationPurseBalance
21
29
  * @param {object} query
22
- * @param {import('@agoric/vats').Board} query.board
30
+ * @param {Board} query.board
23
31
  * @param {string} query.boardId
24
32
  * @returns {Promise<Array>}
25
33
  * @deprecated
@@ -91,7 +99,7 @@ const makeContinuingInvitation = async (
91
99
  /**
92
100
  * @param {InvitationMaker} invitationMaker
93
101
  * @param {string} instanceHandleBoardId
94
- * @param {import('@agoric/vats').Board} board
102
+ * @param {Board} board
95
103
  * @param {ZoeService} zoe
96
104
  * @returns {Promise<Invitation>}
97
105
  */
@@ -1,5 +1,14 @@
1
1
  // @ts-check
2
2
 
3
+ /**
4
+ * @import {PursesJSONState, RecordMetadata} from './types.js';
5
+ * @import {ERef} from '@agoric/vow';
6
+ * @import {LegacyWeakMap} from '@agoric/store';
7
+ * @import {WeakMapStore} from '@agoric/store';
8
+ * @import {MapStore} from '@agoric/store';
9
+ */
10
+ /** @import {Purse} from '@agoric/ertp'; */
11
+
3
12
  /**
4
13
  * @typedef {object} PursesAddedState
5
14
  * @property {Purse} purse
@@ -8,8 +17,12 @@
8
17
  */
9
18
 
10
19
  /**
11
- * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
12
20
  * @import {Key} from '@endo/patterns';
21
+ * @import {Coordinator} from '@agoric/cache';
22
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
23
+ * @import {Amount, AmountValue, Brand, Issuer, Payment} from '@agoric/ertp/src/types.js';
24
+ * @import {ZoeIssuerRecord} from '@agoric/zoe';
25
+ * @import {WalletRoot} from './lib-wallet.js';
13
26
  */
14
27
 
15
28
  /**
@@ -18,7 +31,7 @@
18
31
 
19
32
  /**
20
33
  * @typedef {object} PurseActions
21
- * @property {(receiverP: ERef<{ receive: (payment: Payment) => void }>, valueToSend: import('@agoric/ertp/src/types.js').AmountValue) => Promise<void>} send
34
+ * @property {(receiverP: ERef<{ receive: (payment: Payment) => void }>, valueToSend: AmountValue) => Promise<void>} send
22
35
  * @property {(payment: Payment) => Promise<Amount>} receive
23
36
  * @property {(payment: Payment, amount?: Amount) => Promise<Amount>} deposit
24
37
  */
@@ -42,7 +55,7 @@
42
55
  * @property {Petname} petname
43
56
  * @property {boolean} enable
44
57
  * @property {string} origin
45
- * @property {ERef<import('@agoric/cache').Coordinator>} cacheCoordinator
58
+ * @property {ERef<Coordinator>} cacheCoordinator
46
59
  * @property {DappActions} actions
47
60
  */
48
61
 
@@ -85,7 +98,7 @@
85
98
  * @property {string} [issuerBoardId]
86
99
  *
87
100
  * @typedef {object} PaymentActions
88
- * @property {(purseOrPetname?: (Purse | Petname)) => Promise<import('@agoric/ertp/src/types.js').AmountValue>} deposit
101
+ * @property {(purseOrPetname?: (Purse | Petname)) => Promise<AmountValue>} deposit
89
102
  * @property {() => Promise<boolean>} refresh
90
103
  * @property {() => Promise<boolean>} getAmountOf
91
104
  */
@@ -96,6 +109,6 @@
96
109
  * would make them part of the WalletUser available as `home.wallet` in the
97
110
  * REPL. Then, the Wallet UI could use that instead.
98
111
  *
99
- * @typedef {import('./lib-wallet.js').WalletRoot['admin']}
112
+ * @typedef {WalletRoot['admin']}
100
113
  * WalletAdminFacet
101
114
  */
@@ -5,7 +5,14 @@ import { E } from '@endo/eventual-send';
5
5
 
6
6
  import { makeScalarWeakMapStore } from '@agoric/store';
7
7
 
8
- import './internal-types.js';
8
+ /**
9
+ * @import {ZoeIssuerRecord} from '@agoric/zoe';
10
+ * @import {IssuerTable} from './types.js';
11
+ * @import {WeakMapStore} from '@agoric/store';
12
+ * @import {Brand} from '@agoric/ertp';
13
+ * @import {Issuer} from '@agoric/ertp';
14
+ * @import {DisplayInfo} from '@agoric/ertp';
15
+ */
9
16
 
10
17
  /**
11
18
  * IssuerTable
@@ -4,6 +4,13 @@ import { assert, Fail, q } from '@endo/errors';
4
4
  import { makeMarshal, mapIterable } from '@endo/marshal';
5
5
  import { makeLegacyMap, makeScalarMapStore } from '@agoric/store';
6
6
 
7
+ /**
8
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
9
+ * @import {Mapping} from './internal-types.js';
10
+ * @import {MapStore} from '@agoric/store';
11
+ * @import {LegacyMap} from '@agoric/store';
12
+ */
13
+
7
14
  /**
8
15
  * @typedef {string[]} Path
9
16
  * @typedef {{} & 'Strongname'} Strongname
package/src/lib-wallet.js CHANGED
@@ -42,7 +42,26 @@ import { makeId, findOrMakeInvitation } from './findOrMakeInvitation.js';
42
42
  import { bigintStringify } from './bigintStringify.js';
43
43
  import { makePaymentActions } from './actions.js';
44
44
 
45
- import './internal-types.js';
45
+ /**
46
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
47
+ * @import {Handle, UserSeat, ZoeService} from '@agoric/zoe';
48
+ * @import {Purse} from '@agoric/ertp';
49
+ * @import {BrandRecord, Contact, DappRecord, Mapping, PaymentRecord, PursesFullState} from './internal-types.js';
50
+ * @import {InstallationManager, InstanceManager, IssuerManager, OfferState, PursesJSONState, RecordMetadata} from './types.js';
51
+ * @import {ERef} from '@agoric/vow';
52
+ * @import {Brand} from '@agoric/ertp';
53
+ * @import {Instance} from '@agoric/zoe/src/zoeService/utils.js';
54
+ * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
55
+ * @import {WeakMapStore} from '@agoric/store';
56
+ * @import {Issuer} from '@agoric/ertp';
57
+ * @import {MapStore} from '@agoric/store';
58
+ * @import {LegacyMap} from '@agoric/store';
59
+ * @import {NotifierRecord} from '@agoric/notifier';
60
+ * @import {Payment} from '@agoric/ertp';
61
+ * @import {Subscriber} from '@agoric/notifier';
62
+ * @import {Notifier} from '@agoric/notifier';
63
+ * @import {PromiseRecord} from '@endo/promise-kit';
64
+ */
46
65
 
47
66
  // does nothing
48
67
  const noActionStateChangeHandler = _newState => {};
@@ -57,13 +76,19 @@ const cmp = (a, b) => {
57
76
  return -1;
58
77
  };
59
78
 
79
+ /**
80
+ * @import {Board} from '@agoric/vats';
81
+ * @import {MyAddressNameAdmin} from '@agoric/vats';
82
+ * @import {makeMarshal} from '@endo/marshal';
83
+ */
84
+
60
85
  /**
61
86
  * @param {{
62
87
  * agoricNames?: ERef<NameHub>
63
- * board: ERef<import('@agoric/vats').Board>
88
+ * board: ERef<Board>
64
89
  * dateNow?: () => number,
65
90
  * inboxStateChangeHandler?: (state: any) => void,
66
- * myAddressNameAdmin: ERef<import('@agoric/vats').MyAddressNameAdmin>
91
+ * myAddressNameAdmin: ERef<MyAddressNameAdmin>
67
92
  * namesByAddress?: ERef<NameHub>
68
93
  * pursesStateChangeHandler?: (state: any) => void,
69
94
  * zoe: ERef<ZoeService>,
@@ -131,9 +156,9 @@ export function makeWalletRoot({
131
156
  'contact',
132
157
  { useLegacyMap: true }, // because contacts have identity!
133
158
  );
134
- /** @type {Mapping<Instance>} */
159
+ /** @type {Mapping<Instance<any>>} */
135
160
  const instanceMapping = makeMapping('instance');
136
- /** @type {Mapping<Installation>} */
161
+ /** @type {Mapping<Installation<any>>} */
137
162
  const installationMapping = makeMapping('installation');
138
163
 
139
164
  const brandTable = makeIssuerTable();
@@ -566,7 +591,7 @@ export function makeWalletRoot({
566
591
 
567
592
  // handle the update, which has already resolved to a record. The update means
568
593
  // the offer is 'done'.
569
- function updateOrResubscribe(id, seat, update) {
594
+ function updateOrResubscribe(id, _seat, update) {
570
595
  const { updateCount } = update;
571
596
  assert(updateCount === undefined);
572
597
  idToSeat.delete(id);
@@ -1224,6 +1249,7 @@ export function makeWalletRoot({
1224
1249
  if (!exited) {
1225
1250
  return subscribeToUpdates(id, seat);
1226
1251
  }
1252
+ return undefined;
1227
1253
  });
1228
1254
 
1229
1255
  const offerResultP = E(seat).getOfferResult();
@@ -1264,11 +1290,10 @@ export function makeWalletRoot({
1264
1290
  const { updater: paymentsUpdater, notifier: paymentsNotifier } =
1265
1291
  /** @type {NotifierRecord<PaymentRecord[]>} */ (makeNotifierKit([]));
1266
1292
  /**
1267
- * @param {PaymentRecord} param0
1293
+ * @param {PaymentRecord & {displayPayment?: ReturnType<typeof fillInSlots>}} param0
1268
1294
  */
1269
1295
  const updatePaymentRecord = ({ actions, ...preDisplay }) => {
1270
1296
  // in case we have been here before...
1271
- // @ts-expect-error
1272
1297
  delete preDisplay.displayPayment;
1273
1298
  const displayPayment = fillInSlots(dehydrate(harden(preDisplay)));
1274
1299
  const paymentRecord = addMeta({
@@ -1690,7 +1715,7 @@ export function makeWalletRoot({
1690
1715
 
1691
1716
  const firstPathToLookup = createRootLookups();
1692
1717
 
1693
- /** @type {ReturnType<typeof import('@endo/marshal').makeMarshal>} */
1718
+ /** @type {ReturnType<typeof makeMarshal>} */
1694
1719
  const marshaller = harden({
1695
1720
  fromCapData: context.fromCapData,
1696
1721
  toCapData: context.toCapData,
@@ -1,5 +1,19 @@
1
1
  // @ts-check
2
2
 
3
+ /**
4
+ * @import {Coordinator} from '@agoric/cache';
5
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
6
+ * @import {Board} from '@agoric/vats';
7
+ * @import {ZoeIssuerRecord, ZoeService} from '@agoric/zoe';
8
+ * @import {Brand, Issuer, Payment, Purse} from '@agoric/ertp';
9
+ * @import {BrandRecord, WalletAdminFacet} from './internal-types.js';
10
+ * @import {Marshaller} from '@agoric/internal/src/lib-chainStorage.js';
11
+ * @import {ERef} from '@agoric/vow';
12
+ * @import {Notifier} from '@agoric/notifier';
13
+ * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
14
+ * @import {Instance} from '@agoric/zoe/src/zoeService/utils.js';
15
+ */
16
+
3
17
  /**
4
18
  * This is the complete wallet, including the means to get the WalletAdminFacet
5
19
  * (necessary for the operation of the Wallet UI, and useful for the REPL).
@@ -57,7 +71,7 @@
57
71
  * wallet.
58
72
  *
59
73
  * @property {(offer: OfferState) => Promise<string>} addOffer
60
- * @property {() => Promise<import('@agoric/cache').Coordinator>} getCacheCoordinator
74
+ * @property {() => Promise<Coordinator>} getCacheCoordinator
61
75
  * @property {(brandBoardId: string) => Promise<string>} getDepositFacetId
62
76
  * Return the board ID to use to receive payments of the specified brand.
63
77
  * @property {() => Promise<Notifier<Array<PursesJSONState>>>} getPursesNotifier
@@ -85,7 +99,7 @@
85
99
  * is safe to pass to the dapp UI.
86
100
  * @property {() => Promise<ZoeService>} getZoe
87
101
  * Get the Zoe Service
88
- * @property {() => Promise<import('@agoric/vats').Board>} getBoard
102
+ * @property {() => Promise<Board>} getBoard
89
103
  * Get the Board
90
104
  * @property {(...path: Array<unknown>) => Promise<unknown>} getAgoricNames
91
105
  * Get the curated Agoric public naming hub
@@ -147,11 +161,11 @@
147
161
  */
148
162
 
149
163
  /**
150
- * @typedef {PetnameManager<Installation>} InstallationManager
164
+ * @typedef {PetnameManager<Installation<any>>} InstallationManager
151
165
  */
152
166
 
153
167
  /**
154
- * @typedef {PetnameManager<Instance>} InstanceManager
168
+ * @typedef {PetnameManager<Instance<any>>} InstanceManager
155
169
  */
156
170
 
157
171
  /**
package/src/wallet.js CHANGED
@@ -18,16 +18,30 @@ import pubsub from './pubsub.js';
18
18
  import { bigintStringify } from './bigintStringify.js';
19
19
  import { makeTimerDeviceDateNow, makeTimerServiceDateNow } from './date-now.js';
20
20
 
21
- import './internal-types.js';
21
+ /**
22
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
23
+ * @import {WalletAdminFacet} from './internal-types.js';
24
+ * @import {OfferState, PursesJSONState, WalletAdmin, WalletBridge} from './types.js';
25
+ * @import {ERef} from '@agoric/vow';
26
+ * @import {StorageNode} from '@agoric/internal/src/lib-chainStorage.js';
27
+ * @import {ZoeService} from '@agoric/zoe';
28
+ */
29
+
30
+ /**
31
+ * @import {Board} from '@agoric/vats';
32
+ * @import {TimerService} from '@agoric/time';
33
+ * @import {MyAddressNameAdmin} from '@agoric/vats';
34
+ * @import {WalletRoot} from './lib-wallet.js';
35
+ */
22
36
 
23
37
  /**
24
38
  * @typedef {{
25
39
  * agoricNames: ERef<NameHub>,
26
- * board: ERef<import('@agoric/vats').Board>,
40
+ * board: ERef<Board>,
27
41
  * cacheStorageNode: ERef<StorageNode>,
28
42
  * localTimerPollInterval?: bigint,
29
- * localTimerService?: import('@agoric/time').TimerService,
30
- * myAddressNameAdmin: ERef<import('@agoric/vats').MyAddressNameAdmin>,
43
+ * localTimerService?: TimerService,
44
+ * myAddressNameAdmin: ERef<MyAddressNameAdmin>,
31
45
  * namesByAddress: ERef<NameHub>,
32
46
  * timerDevice?: unknown,
33
47
  * timerDeviceScale?: number,
@@ -41,7 +55,7 @@ export function buildRootObject(vatPowers) {
41
55
  // See if we have the device vat power.
42
56
  const { D } = vatPowers || {};
43
57
 
44
- /** @type {import('./lib-wallet.js').WalletRoot} */
58
+ /** @type {WalletRoot} */
45
59
  let walletRoot;
46
60
  /** @type {WalletAdminFacet} */
47
61
  let walletAdmin;