@agoric/wallet-backend 0.14.4-dev-b2b928a.0 → 0.14.4-dev-a07bcaa.0.a07bcaa

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/wallet-backend",
3
- "version": "0.14.4-dev-b2b928a.0+b2b928a",
3
+ "version": "0.14.4-dev-a07bcaa.0.a07bcaa",
4
4
  "description": "Wallet backend",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -14,23 +14,23 @@
14
14
  "lint:eslint": "yarn run -T eslint ."
15
15
  },
16
16
  "devDependencies": {
17
- "@agoric/vats": "0.15.2-dev-b2b928a.0+b2b928a",
17
+ "@agoric/vats": "0.15.2-dev-a07bcaa.0.a07bcaa",
18
18
  "@endo/bundle-source": "^4.1.2",
19
19
  "@endo/far": "^1.1.14",
20
20
  "@endo/init": "^1.1.12",
21
21
  "ava": "^5.3.0"
22
22
  },
23
23
  "dependencies": {
24
- "@agoric/cache": "0.3.3-dev-b2b928a.0+b2b928a",
25
- "@agoric/ertp": "0.16.3-dev-b2b928a.0+b2b928a",
26
- "@agoric/internal": "0.3.3-dev-b2b928a.0+b2b928a",
27
- "@agoric/notifier": "0.6.3-dev-b2b928a.0+b2b928a",
28
- "@agoric/smart-wallet": "0.5.4-dev-b2b928a.0+b2b928a",
29
- "@agoric/store": "0.9.3-dev-b2b928a.0+b2b928a",
30
- "@agoric/time": "0.3.3-dev-b2b928a.0+b2b928a",
31
- "@agoric/vat-data": "0.5.3-dev-b2b928a.0+b2b928a",
32
- "@agoric/zoe": "0.26.3-dev-b2b928a.0+b2b928a",
33
- "@agoric/zone": "0.2.3-dev-b2b928a.0+b2b928a",
24
+ "@agoric/cache": "0.3.3-dev-a07bcaa.0.a07bcaa",
25
+ "@agoric/ertp": "0.16.3-dev-a07bcaa.0.a07bcaa",
26
+ "@agoric/internal": "0.3.3-dev-a07bcaa.0.a07bcaa",
27
+ "@agoric/notifier": "0.6.3-dev-a07bcaa.0.a07bcaa",
28
+ "@agoric/smart-wallet": "0.5.4-dev-a07bcaa.0.a07bcaa",
29
+ "@agoric/store": "0.9.3-dev-a07bcaa.0.a07bcaa",
30
+ "@agoric/time": "0.3.3-dev-a07bcaa.0.a07bcaa",
31
+ "@agoric/vat-data": "0.5.3-dev-a07bcaa.0.a07bcaa",
32
+ "@agoric/zoe": "0.26.3-dev-a07bcaa.0.a07bcaa",
33
+ "@agoric/zone": "0.2.3-dev-a07bcaa.0.a07bcaa",
34
34
  "@endo/errors": "^1.2.13",
35
35
  "@endo/eventual-send": "^1.3.4",
36
36
  "@endo/marshal": "^1.8.0",
@@ -65,5 +65,8 @@
65
65
  "typeCoverage": {
66
66
  "atLeast": 0
67
67
  },
68
- "gitHead": "b2b928a9d8f18400bb67d23787b169bb184217cd"
68
+ "engines": {
69
+ "node": "^20.9 || ^22.11"
70
+ },
71
+ "gitHead": "a07bcaafea902c18b6d1c5233636240237bc8a6e"
69
72
  }
@@ -3,6 +3,10 @@ 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
+ */
9
+
6
10
  export const makeId = (dappOrigin, rawId) => `${dappOrigin}#${rawId}`;
7
11
 
8
12
  const assertFirstCapASCII = str => {
@@ -19,7 +23,7 @@ const assertFirstCapASCII = str => {
19
23
  /**
20
24
  * @param {Amount<'set'>} invitationPurseBalance
21
25
  * @param {object} query
22
- * @param {import('@agoric/vats').Board} query.board
26
+ * @param {Board} query.board
23
27
  * @param {string} query.boardId
24
28
  * @returns {Promise<Array>}
25
29
  * @deprecated
@@ -91,7 +95,7 @@ const makeContinuingInvitation = async (
91
95
  /**
92
96
  * @param {InvitationMaker} invitationMaker
93
97
  * @param {string} instanceHandleBoardId
94
- * @param {import('@agoric/vats').Board} board
98
+ * @param {Board} board
95
99
  * @param {ZoeService} zoe
96
100
  * @returns {Promise<Invitation>}
97
101
  */
@@ -1,5 +1,7 @@
1
1
  // @ts-check
2
2
 
3
+ /** @import {PursesJSONState, RecordMetadata} from './types-ambient.js'; */
4
+
3
5
  /**
4
6
  * @typedef {object} PursesAddedState
5
7
  * @property {Purse} purse
@@ -8,8 +10,12 @@
8
10
  */
9
11
 
10
12
  /**
11
- * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
12
13
  * @import {Key} from '@endo/patterns';
14
+ * @import {Coordinator} from '@agoric/cache';
15
+ * @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js';
16
+ * @import {AmountValue} from '@agoric/ertp/src/types.js';
17
+ * @import {ZoeIssuerRecord} from '@agoric/zoe';
18
+ * @import {WalletRoot} from './lib-wallet.js';
13
19
  */
14
20
 
15
21
  /**
@@ -18,7 +24,7 @@
18
24
 
19
25
  /**
20
26
  * @typedef {object} PurseActions
21
- * @property {(receiverP: ERef<{ receive: (payment: Payment) => void }>, valueToSend: import('@agoric/ertp/src/types.js').AmountValue) => Promise<void>} send
27
+ * @property {(receiverP: ERef<{ receive: (payment: Payment) => void }>, valueToSend: AmountValue) => Promise<void>} send
22
28
  * @property {(payment: Payment) => Promise<Amount>} receive
23
29
  * @property {(payment: Payment, amount?: Amount) => Promise<Amount>} deposit
24
30
  */
@@ -42,7 +48,7 @@
42
48
  * @property {Petname} petname
43
49
  * @property {boolean} enable
44
50
  * @property {string} origin
45
- * @property {ERef<import('@agoric/cache').Coordinator>} cacheCoordinator
51
+ * @property {ERef<Coordinator>} cacheCoordinator
46
52
  * @property {DappActions} actions
47
53
  */
48
54
 
@@ -85,7 +91,7 @@
85
91
  * @property {string} [issuerBoardId]
86
92
  *
87
93
  * @typedef {object} PaymentActions
88
- * @property {(purseOrPetname?: (Purse | Petname)) => Promise<import('@agoric/ertp/src/types.js').AmountValue>} deposit
94
+ * @property {(purseOrPetname?: (Purse | Petname)) => Promise<AmountValue>} deposit
89
95
  * @property {() => Promise<boolean>} refresh
90
96
  * @property {() => Promise<boolean>} getAmountOf
91
97
  */
@@ -96,6 +102,6 @@
96
102
  * would make them part of the WalletUser available as `home.wallet` in the
97
103
  * REPL. Then, the Wallet UI could use that instead.
98
104
  *
99
- * @typedef {import('./lib-wallet.js').WalletRoot['admin']}
105
+ * @typedef {WalletRoot['admin']}
100
106
  * WalletAdminFacet
101
107
  */
@@ -5,7 +5,10 @@ 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-ambient.js';
11
+ */
9
12
 
10
13
  /**
11
14
  * IssuerTable
@@ -4,6 +4,11 @@ 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
+ */
11
+
7
12
  /**
8
13
  * @typedef {string[]} Path
9
14
  * @typedef {{} & 'Strongname'} Strongname
package/src/lib-wallet.js CHANGED
@@ -42,7 +42,12 @@ 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 {UserSeat} from '@agoric/zoe';
48
+ * @import {BrandRecord, Contact, DappRecord, Mapping, PaymentRecord, PursesFullState} from './internal-types.js';
49
+ * @import {InstallationManager, InstanceManager, IssuerManager, OfferState, PursesJSONState, RecordMetadata} from './types-ambient.js';
50
+ */
46
51
 
47
52
  // does nothing
48
53
  const noActionStateChangeHandler = _newState => {};
@@ -57,13 +62,19 @@ const cmp = (a, b) => {
57
62
  return -1;
58
63
  };
59
64
 
65
+ /**
66
+ * @import {Board} from '@agoric/vats';
67
+ * @import {MyAddressNameAdmin} from '@agoric/vats';
68
+ * @import {makeMarshal} from '@endo/marshal';
69
+ */
70
+
60
71
  /**
61
72
  * @param {{
62
73
  * agoricNames?: ERef<NameHub>
63
- * board: ERef<import('@agoric/vats').Board>
74
+ * board: ERef<Board>
64
75
  * dateNow?: () => number,
65
76
  * inboxStateChangeHandler?: (state: any) => void,
66
- * myAddressNameAdmin: ERef<import('@agoric/vats').MyAddressNameAdmin>
77
+ * myAddressNameAdmin: ERef<MyAddressNameAdmin>
67
78
  * namesByAddress?: ERef<NameHub>
68
79
  * pursesStateChangeHandler?: (state: any) => void,
69
80
  * zoe: ERef<ZoeService>,
@@ -1264,11 +1275,10 @@ export function makeWalletRoot({
1264
1275
  const { updater: paymentsUpdater, notifier: paymentsNotifier } =
1265
1276
  /** @type {NotifierRecord<PaymentRecord[]>} */ (makeNotifierKit([]));
1266
1277
  /**
1267
- * @param {PaymentRecord} param0
1278
+ * @param {PaymentRecord & {displayPayment?: ReturnType<typeof fillInSlots>}} param0
1268
1279
  */
1269
1280
  const updatePaymentRecord = ({ actions, ...preDisplay }) => {
1270
1281
  // in case we have been here before...
1271
- // @ts-expect-error
1272
1282
  delete preDisplay.displayPayment;
1273
1283
  const displayPayment = fillInSlots(dehydrate(harden(preDisplay)));
1274
1284
  const paymentRecord = addMeta({
@@ -1690,7 +1700,7 @@ export function makeWalletRoot({
1690
1700
 
1691
1701
  const firstPathToLookup = createRootLookups();
1692
1702
 
1693
- /** @type {ReturnType<typeof import('@endo/marshal').makeMarshal>} */
1703
+ /** @type {ReturnType<typeof makeMarshal>} */
1694
1704
  const marshaller = harden({
1695
1705
  fromCapData: context.fromCapData,
1696
1706
  toCapData: context.toCapData,
@@ -1,5 +1,13 @@
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} from '@agoric/zoe';
8
+ * @import {BrandRecord, WalletAdminFacet} from './internal-types.js';
9
+ */
10
+
3
11
  /**
4
12
  * This is the complete wallet, including the means to get the WalletAdminFacet
5
13
  * (necessary for the operation of the Wallet UI, and useful for the REPL).
@@ -57,7 +65,7 @@
57
65
  * wallet.
58
66
  *
59
67
  * @property {(offer: OfferState) => Promise<string>} addOffer
60
- * @property {() => Promise<import('@agoric/cache').Coordinator>} getCacheCoordinator
68
+ * @property {() => Promise<Coordinator>} getCacheCoordinator
61
69
  * @property {(brandBoardId: string) => Promise<string>} getDepositFacetId
62
70
  * Return the board ID to use to receive payments of the specified brand.
63
71
  * @property {() => Promise<Notifier<Array<PursesJSONState>>>} getPursesNotifier
@@ -85,7 +93,7 @@
85
93
  * is safe to pass to the dapp UI.
86
94
  * @property {() => Promise<ZoeService>} getZoe
87
95
  * Get the Zoe Service
88
- * @property {() => Promise<import('@agoric/vats').Board>} getBoard
96
+ * @property {() => Promise<Board>} getBoard
89
97
  * Get the Board
90
98
  * @property {(...path: Array<unknown>) => Promise<unknown>} getAgoricNames
91
99
  * Get the curated Agoric public naming hub
package/src/wallet.js CHANGED
@@ -18,16 +18,27 @@ 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-ambient.js';
25
+ */
26
+
27
+ /**
28
+ * @import {Board} from '@agoric/vats';
29
+ * @import {TimerService} from '@agoric/time';
30
+ * @import {MyAddressNameAdmin} from '@agoric/vats';
31
+ * @import {WalletRoot} from './lib-wallet.js';
32
+ */
22
33
 
23
34
  /**
24
35
  * @typedef {{
25
36
  * agoricNames: ERef<NameHub>,
26
- * board: ERef<import('@agoric/vats').Board>,
37
+ * board: ERef<Board>,
27
38
  * cacheStorageNode: ERef<StorageNode>,
28
39
  * localTimerPollInterval?: bigint,
29
- * localTimerService?: import('@agoric/time').TimerService,
30
- * myAddressNameAdmin: ERef<import('@agoric/vats').MyAddressNameAdmin>,
40
+ * localTimerService?: TimerService,
41
+ * myAddressNameAdmin: ERef<MyAddressNameAdmin>,
31
42
  * namesByAddress: ERef<NameHub>,
32
43
  * timerDevice?: unknown,
33
44
  * timerDeviceScale?: number,
@@ -41,7 +52,7 @@ export function buildRootObject(vatPowers) {
41
52
  // See if we have the device vat power.
42
53
  const { D } = vatPowers || {};
43
54
 
44
- /** @type {import('./lib-wallet.js').WalletRoot} */
55
+ /** @type {WalletRoot} */
45
56
  let walletRoot;
46
57
  /** @type {WalletAdminFacet} */
47
58
  let walletAdmin;
@@ -19,6 +19,11 @@ import { resolve as importMetaResolve } from 'import-meta-resolve';
19
19
  import { makeHeapZone } from '@agoric/zone';
20
20
  import { makeWalletRoot } from '../src/lib-wallet.js';
21
21
 
22
+ /**
23
+ * @import {TestFn} from 'ava';
24
+ * @import {ExecutionContext} from 'ava';
25
+ */
26
+
22
27
  const ZOE_INVITE_PURSE_PETNAME = 'Default Zoe invite purse';
23
28
 
24
29
  const mixinMyAddress = prepareMixinMyAddress(makeHeapZone());
@@ -28,7 +33,7 @@ function makeFakeMyAddressNameAdmin() {
28
33
  return mixinMyAddress(nameAdmin, 'agoric1test1');
29
34
  }
30
35
 
31
- /** @type {import('ava').TestFn<Awaited<LibWalletTestContext>>} */
36
+ /** @type {TestFn<Awaited<LibWalletTestContext>>} */
32
37
  const test = anyTest;
33
38
 
34
39
  /**
@@ -40,7 +45,7 @@ const test = anyTest;
40
45
  */
41
46
 
42
47
  async function setupTest(
43
- /** @type {import('ava').ExecutionContext<LibWalletTestContext>} */ t,
48
+ /** @type {ExecutionContext<LibWalletTestContext>} */ t,
44
49
  { autoswap = false, automaticRefund = false } = {},
45
50
  ) {
46
51
  const pursesStateChangeLog = [];