@agoric/smart-wallet 0.5.4-upgrade-14-dev-c8f9e7b.0 → 0.5.4-upgrade-16-dev-8879538.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,46 +1,45 @@
1
1
  {
2
2
  "name": "@agoric/smart-wallet",
3
- "version": "0.5.4-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
3
+ "version": "0.5.4-upgrade-16-dev-8879538.0+8879538",
4
4
  "description": "Wallet contract",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "yarn build:bundles",
8
8
  "build:bundles": "node ./scripts/build-bundles.js",
9
- "prepack": "tsc --build jsconfig.build.json",
9
+ "prepack": "tsc --build tsconfig.build.json",
10
10
  "postpack": "git clean -f '*.d.ts*'",
11
11
  "test": "ava",
12
12
  "test:xs": "exit 0",
13
13
  "lint": "run-s --continue-on-error lint:*",
14
14
  "lint-fix": "yarn lint:eslint --fix",
15
- "lint:types": "tsc -p jsconfig.json",
15
+ "lint:types": "tsc",
16
16
  "lint:eslint": "eslint ."
17
17
  },
18
18
  "devDependencies": {
19
- "@agoric/cosmic-proto": "0.3.1-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
20
- "@agoric/vats": "^0.15.2-u13.0",
21
- "@endo/bundle-source": "2.5.2-upstream-rollup",
22
- "@endo/captp": "3.1.1",
23
- "@endo/init": "0.5.56",
24
- "ava": "^5.2.0",
19
+ "@agoric/cosmic-proto": "0.4.1-upgrade-16-dev-8879538.0+8879538",
20
+ "@agoric/swingset-vat": "0.32.3-upgrade-16-dev-8879538.0+8879538",
21
+ "@agoric/zone": "0.2.3-upgrade-16-dev-8879538.0+8879538",
22
+ "@endo/bundle-source": "^3.2.3",
23
+ "@endo/captp": "^4.2.0",
24
+ "@endo/init": "^1.1.2",
25
+ "ava": "^5.3.0",
25
26
  "import-meta-resolve": "^2.2.1"
26
27
  },
27
28
  "dependencies": {
28
- "@agoric/assert": "0.6.1-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
29
- "@agoric/casting": "0.4.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
30
- "@agoric/deploy-script-support": "0.10.4-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
31
- "@agoric/ertp": "0.16.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
32
- "@agoric/internal": "0.4.0-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
33
- "@agoric/notifier": "0.6.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
34
- "@agoric/store": "0.9.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
35
- "@agoric/swingset-vat": "0.32.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
36
- "@agoric/vat-data": "0.5.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
37
- "@agoric/vats": "0.15.2-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
38
- "@agoric/zoe": "0.26.3-upgrade-14-dev-c8f9e7b.0+c8f9e7b",
39
- "@endo/eventual-send": "0.17.2",
40
- "@endo/far": "0.2.18",
41
- "@endo/marshal": "0.8.5",
42
- "@endo/nat": "4.1.27",
43
- "@endo/promise-kit": "0.2.56"
29
+ "@agoric/assert": "0.6.1-upgrade-16-dev-8879538.0+8879538",
30
+ "@agoric/casting": "0.4.3-upgrade-16-dev-8879538.0+8879538",
31
+ "@agoric/ertp": "0.16.3-upgrade-16-dev-8879538.0+8879538",
32
+ "@agoric/internal": "0.3.3-upgrade-16-dev-8879538.0+8879538",
33
+ "@agoric/notifier": "0.6.3-upgrade-16-dev-8879538.0+8879538",
34
+ "@agoric/store": "0.9.3-upgrade-16-dev-8879538.0+8879538",
35
+ "@agoric/vat-data": "0.5.3-upgrade-16-dev-8879538.0+8879538",
36
+ "@agoric/vats": "0.15.2-upgrade-16-dev-8879538.0+8879538",
37
+ "@agoric/zoe": "0.26.3-upgrade-16-dev-8879538.0+8879538",
38
+ "@endo/eventual-send": "^1.2.2",
39
+ "@endo/far": "^1.1.2",
40
+ "@endo/marshal": "^1.5.0",
41
+ "@endo/nat": "^5.0.7",
42
+ "@endo/promise-kit": "^1.1.2"
44
43
  },
45
44
  "files": [
46
45
  "src/"
@@ -58,12 +57,18 @@
58
57
  "homepage": "https://github.com/Agoric/agoric#readme",
59
58
  "ava": {
60
59
  "files": [
61
- "test/**/test-*.js"
60
+ "test/**/*.test.*"
61
+ ],
62
+ "require": [
63
+ "@endo/init/debug.js"
62
64
  ],
63
65
  "timeout": "2m"
64
66
  },
65
67
  "publishConfig": {
66
68
  "access": "public"
67
69
  },
68
- "gitHead": "c8f9e7be1645e0be23f47de197409a7d4874add5"
70
+ "typeCoverage": {
71
+ "atLeast": 94.35
72
+ },
73
+ "gitHead": "8879538cd1d125a08346f02dd5701d0d70c90bb8"
69
74
  }
@@ -1,4 +1,4 @@
1
- export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<NameHub>, invitationBrand: Brand<'set'>, invitationsPurse: Purse<'set'>, getInvitationContinuation: (fromOfferId: string) => import('./types').RemoteInvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
1
+ export function makeInvitationsHelper(zoe: ERef<ZoeService>, agoricNames: ERef<import("@agoric/vats").NameHub>, invitationBrand: Brand<"set">, invitationsPurse: Purse<"set", InvitationDetails>, getInvitationContinuation: (fromOfferId: string) => import("./types.js").InvitationMakers): (spec: InvitationSpec) => ERef<Invitation>;
2
2
  /**
3
3
  * Specify how to produce an invitation. See each type in the union for details.
4
4
  */
@@ -10,7 +10,7 @@ export type InvitationSpec = AgoricContractInvitationSpec | ContractInvitationSp
10
10
  * - the end of the pipe is expected to return an Invitation
11
11
  */
12
12
  export type AgoricContractInvitationSpec = {
13
- source: 'agoricContract';
13
+ source: "agoricContract";
14
14
  instancePath: string[];
15
15
  callPipe: Array<[methodName: string, methodArgs?: any[]]>;
16
16
  };
@@ -18,7 +18,7 @@ export type AgoricContractInvitationSpec = {
18
18
  * source is a contract (in which case this takes an Instance to look up in zoe)
19
19
  */
20
20
  export type ContractInvitationSpec = {
21
- source: 'contract';
21
+ source: "contract";
22
22
  instance: Instance;
23
23
  publicInvitationMaker: string;
24
24
  invitationArgs?: any[];
@@ -28,7 +28,7 @@ export type ContractInvitationSpec = {
28
28
  * - use the find/query invitation by kvs thing
29
29
  */
30
30
  export type PurseInvitationSpec = {
31
- source: 'purse';
31
+ source: "purse";
32
32
  instance: Instance;
33
33
  description: string;
34
34
  };
@@ -36,10 +36,10 @@ export type PurseInvitationSpec = {
36
36
  * continuing invitation in which the offer result from a previous invitation had an `invitationMakers` property
37
37
  */
38
38
  export type ContinuingInvitationSpec = {
39
- source: 'continuing';
40
- previousOffer: import('./offers.js').OfferId;
39
+ source: "continuing";
40
+ previousOffer: import("./offers.js").OfferId;
41
41
  invitationMakerName: string;
42
42
  invitationArgs?: any[];
43
43
  };
44
- export type InvitationsPurseQuery = Pick<InvitationDetails, 'description' | 'instance'>;
44
+ export type InvitationsPurseQuery = Pick<InvitationDetails, "description" | "instance">;
45
45
  //# sourceMappingURL=invitations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["invitations.js"],"names":[],"mappings":"AAkEO,2CANI,KAAK,UAAU,CAAC,eAChB,KAAK,OAAO,CAAC,mBACb,MAAM,KAAK,CAAC,oBACZ,MAAM,KAAK,CAAC,2CACE,MAAM,KAAK,OAAO,SAAS,EAAE,sBAAsB,UAsFxD,cAAc,KAAK,KAAK,UAAU,CAAC,CAgBtD;;;;6BAvJY,4BAA4B,GAAG,sBAAsB,GAAG,mBAAmB,GAAG,wBAAwB;;;;;;;2CAKtG;IACZ,MAAQ,EAAE,gBAAgB,CAAC;IAC3B,YAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAU,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CACzD;;;;qCAMS;IACZ,M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C;CACtB;;;;;kCAGS;IACZ,MAAQ,EAAE,OAAO,CAAC;IAClB,QAAU,EAAE,QAAQ,CAAC;IACrB,WAAa,EAAE,MAAM,CAAC;CACnB;;;;uCAIS;IACZ,MAAQ,EAAE,YAAY,CAAC;IACvB,aAAe,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC;IAC/C,mBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;CACtB;oCAKS,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC"}
@@ -4,9 +4,6 @@ import { InvitationHandleShape } from '@agoric/zoe/src/typeGuards.js';
4
4
  import { E } from '@endo/far';
5
5
  import { shape } from './typeGuards.js';
6
6
 
7
- // Ambient types. Needed only for dev but this does a runtime import.
8
- import '@agoric/zoe/exported.js';
9
-
10
7
  const { Fail } = assert;
11
8
 
12
9
  // A safety limit
@@ -59,10 +56,10 @@ const MAX_PIPE_LENGTH = 2;
59
56
 
60
57
  /**
61
58
  * @param {ERef<ZoeService>} zoe
62
- * @param {ERef<NameHub>} agoricNames
59
+ * @param {ERef<import('@agoric/vats').NameHub>} agoricNames
63
60
  * @param {Brand<'set'>} invitationBrand
64
- * @param {Purse<'set'>} invitationsPurse
65
- * @param {(fromOfferId: string) => import('./types').RemoteInvitationMakers} getInvitationContinuation
61
+ * @param {Purse<'set', InvitationDetails>} invitationsPurse
62
+ * @param {(fromOfferId: string) => import('./types.js').InvitationMakers} getInvitationContinuation
66
63
  */
67
64
  export const makeInvitationsHelper = (
68
65
  zoe,
@@ -103,9 +100,7 @@ export const makeInvitationsHelper = (
103
100
  mustMatch(spec, shape.PurseInvitationSpec);
104
101
 
105
102
  const { instance, description } = spec;
106
- // @ts-expect-error TS thinks it's always true. I'm doubtful.
107
103
  (instance && description) || Fail`missing instance or description`;
108
- /** @type {Amount<'set'>} */
109
104
  const purseAmount = await E(invitationsPurse).getCurrentAmount();
110
105
  const invitations = AmountMath.getValue(invitationBrand, purseAmount);
111
106
 
@@ -1,65 +1,65 @@
1
1
  export function makeExportContext(): {
2
- toCapData: import("@endo/marshal/src/marshal").ToCapData<string>;
3
- fromCapData: import("@endo/marshal/src/marshal").FromCapData<string>;
4
- serialize: import("@endo/marshal/src/marshal").ToCapData<string>;
5
- unserialize: import("@endo/marshal/src/marshal").FromCapData<string>;
6
- savePurseActions: (val: Purse<AssetKind>) => void;
7
- savePaymentActions: (val: Payment<AssetKind>) => void;
2
+ toCapData: import("@endo/marshal").ToCapData<string>;
3
+ fromCapData: import("@endo/marshal").FromCapData<string>;
4
+ serialize: import("@endo/marshal").ToCapData<string>;
5
+ unserialize: import("@endo/marshal").FromCapData<string>;
6
+ savePurseActions: (val: globalThis.Purse) => void;
7
+ savePaymentActions: (val: globalThis.Payment) => void;
8
8
  /**
9
9
  * @param {number} id
10
10
  * @param {Purse} purse
11
11
  */
12
12
  initPurseId: (id: number, purse: Purse) => void;
13
- purseEntries: (keyPatt?: any, valuePatt?: any) => Iterable<[number, Purse<AssetKind>]>;
13
+ purseEntries: (keyPatt?: globalThis.Pattern, valuePatt?: globalThis.Pattern) => Iterable<[number, globalThis.Purse]>;
14
14
  /**
15
15
  * @param {BoardId} id
16
- * @param {unknown} val
16
+ * @param {RemotableObject} val
17
17
  */
18
- initBoardId: (id: BoardId, val: unknown) => void;
18
+ initBoardId: (id: string, val: RemotableObject) => void;
19
19
  /**
20
20
  * @param {BoardId} id
21
- * @param {unknown} val
21
+ * @param {RemotableObject} val
22
22
  */
23
- ensureBoardId: (id: BoardId, val: unknown) => void;
23
+ ensureBoardId: (id: string, val: RemotableObject) => void;
24
24
  };
25
- export function makeImportContext(makePresence?: ((iface: string) => unknown) | undefined): {
25
+ export function makeImportContext(makePresence?: ((iface: string) => PassableCap) | undefined): {
26
26
  /**
27
27
  * @param {BoardId} id
28
- * @param {unknown} val
28
+ * @param {PassableCap} val
29
29
  */
30
- initBoardId: (id: BoardId, val: unknown) => void;
30
+ initBoardId: (id: string, val: PassableCap) => void;
31
31
  /**
32
32
  * @param {BoardId} id
33
- * @param {unknown} val
33
+ * @param {PassableCap} val
34
34
  */
35
- ensureBoardId: (id: BoardId, val: unknown) => void;
35
+ ensureBoardId: (id: string, val: PassableCap) => void;
36
36
  fromMyWallet: {
37
- toCapData: import("@endo/marshal/src/marshal").ToCapData<string>;
38
- fromCapData: import("@endo/marshal/src/marshal").FromCapData<string>;
39
- serialize: import("@endo/marshal/src/marshal").ToCapData<string>;
40
- unserialize: import("@endo/marshal/src/marshal").FromCapData<string>;
41
- } & import("@endo/eventual-send").RemotableBrand<{}, {
42
- toCapData: import("@endo/marshal/src/marshal").ToCapData<string>;
43
- fromCapData: import("@endo/marshal/src/marshal").FromCapData<string>;
44
- serialize: import("@endo/marshal/src/marshal").ToCapData<string>;
45
- unserialize: import("@endo/marshal/src/marshal").FromCapData<string>;
37
+ toCapData: import("@endo/marshal").ToCapData<string>;
38
+ fromCapData: import("@endo/marshal").FromCapData<string>;
39
+ serialize: import("@endo/marshal").ToCapData<string>;
40
+ unserialize: import("@endo/marshal").FromCapData<string>;
41
+ } & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
42
+ toCapData: import("@endo/marshal").ToCapData<string>;
43
+ fromCapData: import("@endo/marshal").FromCapData<string>;
44
+ serialize: import("@endo/marshal").ToCapData<string>;
45
+ unserialize: import("@endo/marshal").FromCapData<string>;
46
46
  }>;
47
47
  fromBoard: {
48
- toCapData: import("@endo/marshal/src/marshal").ToCapData<string>;
49
- fromCapData: import("@endo/marshal/src/marshal").FromCapData<string>;
50
- serialize: import("@endo/marshal/src/marshal").ToCapData<string>;
51
- unserialize: import("@endo/marshal/src/marshal").FromCapData<string>;
52
- } & import("@endo/eventual-send").RemotableBrand<{}, {
53
- toCapData: import("@endo/marshal/src/marshal").ToCapData<string>;
54
- fromCapData: import("@endo/marshal/src/marshal").FromCapData<string>;
55
- serialize: import("@endo/marshal/src/marshal").ToCapData<string>;
56
- unserialize: import("@endo/marshal/src/marshal").FromCapData<string>;
48
+ toCapData: import("@endo/marshal").ToCapData<string>;
49
+ fromCapData: import("@endo/marshal").FromCapData<string>;
50
+ serialize: import("@endo/marshal").ToCapData<string>;
51
+ unserialize: import("@endo/marshal").FromCapData<string>;
52
+ } & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
53
+ toCapData: import("@endo/marshal").ToCapData<string>;
54
+ fromCapData: import("@endo/marshal").FromCapData<string>;
55
+ serialize: import("@endo/marshal").ToCapData<string>;
56
+ unserialize: import("@endo/marshal").FromCapData<string>;
57
57
  }>;
58
58
  };
59
59
  export function makeLoggingPresence(iface: string, log: (parts: unknown[]) => void): any;
60
- export type BoardId = import('@agoric/vats/src/lib-board.js').BoardId;
61
60
  /**
62
- * <T>
61
+ * When marshaling a purse, payment, etc. we partition the slots
62
+ * using prefixes.
63
63
  */
64
64
  export type WalletSlot<T extends Record<string, IdTable<any, any>>> = `${string & keyof T}:${Digits}`;
65
65
  /**
@@ -67,9 +67,10 @@ export type WalletSlot<T extends Record<string, IdTable<any, any>>> = `${string
67
67
  */
68
68
  export type KindSlot<K extends string> = `${K}:${Digits}`;
69
69
  /**
70
- * <T>
70
+ * Since KindSlots always include a colon and BoardIds never do,
71
+ * we an mix them without confusion.
71
72
  */
72
- export type MixedSlot<T extends Record<string, IdTable<any, any>>> = WalletSlot<T> | BoardId;
73
+ export type MixedSlot<T extends Record<string, IdTable<any, any>>> = string;
73
74
  /**
74
75
  * - 1 or more digits.
75
76
  * NOTE: the typescript definition here is more restrictive than
@@ -79,10 +80,13 @@ export type Digits = `1` | `12` | `123`;
79
80
  /**
80
81
  * <Value>
81
82
  */
82
- export type IdTable<Slot, Val> = {
83
+ export type IdTable<Slot extends Key, Val extends PassableCap> = {
83
84
  bySlot: MapStore<Slot, Val>;
84
85
  byVal: MapStore<Val, Slot>;
85
86
  };
86
87
  export type ExportContext = ReturnType<typeof makeExportContext>;
87
88
  export type ImportContext = ReturnType<typeof makeImportContext>;
89
+ import type { RemotableObject } from '@endo/marshal';
90
+ import type { PassableCap } from '@endo/marshal';
91
+ import type { Key } from '@endo/patterns';
88
92
  //# sourceMappingURL=marshal-contexts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"AAmHO;;;;;;;IAqFH;;;OAGG;sBAFQ,MAAM,SACN,KAAK;;IAMhB;;;OAGG;sBAFQ,OAAO,OACP,OAAO;IAKlB;;;OAGG;wBAFQ,OAAO,OACP,OAAO;EAWrB;AAcM,0DAFY,MAAM,KAAK,OAAO;IA8FjC;;;OAGG;sBAFQ,OAAO,OACP,OAAO;IAKlB;;;OAGG;wBAFQ,OAAO,OACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAYrB;AAwBM,2CAHI,MAAM,eACE,OAAO,EAAE,KAAK,IAAI,OAapC;sBA9Xa,OAAO,+BAA+B,EAAE,OAAO;;;;sEAiBhD,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE;;;;yCAI/B,GAAG,CAAC,IAAI,MAAM,EAAE;;;;qEA2ChB,WAAW,CAAC,CAAC,GAAG,OAAO;;;;;;qBAGvB,GAAG,GAAG,IAAI,GAAG,KAAK;;;;iCASlB;IACZ,MAAU,EAAE,SAAS,IAAI,EAAE,GAAG,CAAC,CAAC;IAChC,KAAS,EAAE,SAAS,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5B;4BA8IU,WAAW,wBAAwB,CAAC;4BA+HpC,WAAW,wBAAwB,CAAC"}
1
+ {"version":3,"file":"marshal-contexts.d.ts","sourceRoot":"","sources":["marshal-contexts.js"],"names":[],"mappings":"AAuHO;;;;;;;IAqFH;;;OAGG;sBAFQ,MAAM,SACN,KAAK;;IAMhB;;;OAGG;;IAIH;;;OAGG;;EAUN;AAcM,0DAFY,MAAM;IA8FrB;;;OAGG;;IAIH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;EAWN;AAwBM,2CAHI,MAAM,OACN,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,OAapC;;;;;uBA7W8B,CAAC,8CAAnB,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE;;;;qBAI5B,CAAC,mBAAJ,GAAG,CAAC,IAAI,MAAM,EAAE;;;;;sBA2CL,CAAC;;;;;;qBAGZ,GAAG,GAAG,IAAI,GAAG,KAAK;;;;oBAWL,IAAI,cAAT,GAAG,wBAFX;IACZ,MAAU,EAAE,QAAQ,CACK,IAAI,AADJ,EACL,GAAG,AADO,CAAC,CAAC;IAChC,KAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5B;4BA8IU,UAAU,CAAC,OAAO,iBAAiB,CAAC;4BA+HpC,UAAU,CAAC,OAAO,iBAAiB,CAAC;qCA/VH,eAAe;iCAAf,eAAe;yBACxC,gBAAgB"}
@@ -6,7 +6,11 @@ import { DEFAULT_PREFIX } from '@agoric/vats/src/lib-board.js';
6
6
 
7
7
  const { Fail, quote: q } = assert;
8
8
 
9
- /** @typedef {import('@agoric/vats/src/lib-board.js').BoardId} BoardId */
9
+ /**
10
+ * @import {PassableCap, RemotableObject} from '@endo/marshal';
11
+ * @import {Key} from '@endo/patterns';
12
+ * @import {BoardId} from '@agoric/vats/src/lib-board.js';
13
+ */
10
14
 
11
15
  /**
12
16
  * ID from a board made with { prefix: DEFAULT_PREFIX }
@@ -23,7 +27,7 @@ const isDefaultBoardId = specimen => {
23
27
  * using prefixes.
24
28
  *
25
29
  * @template {Record<string, IdTable<*,*>>} T
26
- * @typedef {`${string & keyof T}:${Digits}`} WalletSlot<T>
30
+ * @typedef {`${string & keyof T}:${Digits}`} WalletSlot
27
31
  */
28
32
  /**
29
33
  * @template {string} K
@@ -70,7 +74,7 @@ const parseWalletSlot = (tables, slot) => {
70
74
  * we an mix them without confusion.
71
75
  *
72
76
  * @template {Record<string, IdTable<*,*>>} T
73
- * @typedef {WalletSlot<T> | BoardId} MixedSlot<T>
77
+ * @typedef {WalletSlot<T> | BoardId} MixedSlot
74
78
  */
75
79
  /**
76
80
  * @typedef {`1` | `12` | `123`} Digits - 1 or more digits.
@@ -79,8 +83,8 @@ const parseWalletSlot = (tables, slot) => {
79
83
  */
80
84
 
81
85
  /**
82
- * @template Slot
83
- * @template Val
86
+ * @template {Key} Slot
87
+ * @template {PassableCap} Val
84
88
  *
85
89
  * @typedef {{
86
90
  * bySlot: MapStore<Slot, Val>,
@@ -89,9 +93,9 @@ const parseWalletSlot = (tables, slot) => {
89
93
  */
90
94
 
91
95
  /**
92
- * @template Slot
93
- * @template Val
94
- * @param {IdTable<Slot, Val>} table
96
+ * @template {Key} Slot
97
+ * @template {PassableCap} Val
98
+ * @param {IdTable<Slot, PassableCap>} table
95
99
  * @param {Slot} slot
96
100
  * @param {Val} val
97
101
  */
@@ -126,13 +130,13 @@ export const makeExportContext = () => {
126
130
  byVal: makeScalarMapStore(),
127
131
  },
128
132
  // TODO: offer, contact, dapp
129
- /** @type {IdTable<number, unknown>} */
133
+ /** @type {IdTable<number, PassableCap>} */
130
134
  unknown: {
131
135
  bySlot: makeScalarMapStore(),
132
136
  byVal: makeScalarMapStore(),
133
137
  },
134
138
  };
135
- /** @type {IdTable<BoardId, unknown>} */
139
+ /** @type {IdTable<BoardId, PassableCap>} */
136
140
  const boardObjects = {
137
141
  bySlot: makeScalarMapStore(),
138
142
  byVal: makeScalarMapStore(),
@@ -161,7 +165,7 @@ export const makeExportContext = () => {
161
165
  let unknownNonce = 0;
162
166
 
163
167
  /**
164
- * @param {unknown} val
168
+ * @param {PassableCap} val
165
169
  * @returns {MixedSlot<typeof walletObjects>}
166
170
  */
167
171
  const valToSlot = val => {
@@ -181,7 +185,7 @@ export const makeExportContext = () => {
181
185
  };
182
186
 
183
187
  /**
184
- * @template V
188
+ * @template {PassableCap} V
185
189
  * @param {string & keyof typeof walletObjects} kind
186
190
  * @param {IdTable<number, V>} table
187
191
  */
@@ -208,14 +212,14 @@ export const makeExportContext = () => {
208
212
  purseEntries: walletObjects.purse.bySlot.entries,
209
213
  /**
210
214
  * @param {BoardId} id
211
- * @param {unknown} val
215
+ * @param {RemotableObject} val
212
216
  */
213
217
  initBoardId: (id, val) => {
214
218
  initSlotVal(boardObjects, id, val);
215
219
  },
216
220
  /**
217
221
  * @param {BoardId} id
218
- * @param {unknown} val
222
+ * @param {RemotableObject} val
219
223
  */
220
224
  ensureBoardId: (id, val) => {
221
225
  if (boardObjects.byVal.has(val)) {
@@ -238,35 +242,35 @@ const defaultMakePresence = iface => {
238
242
  * Make context for marshalling wallet or board data.
239
243
  * To be imported into the client, which never exports objects.
240
244
  *
241
- * @param {(iface: string) => unknown} [makePresence]
245
+ * @param {(iface: string) => PassableCap} [makePresence]
242
246
  */
243
247
  export const makeImportContext = (makePresence = defaultMakePresence) => {
244
248
  const walletObjects = {
245
- /** @type {IdTable<number, unknown>} */
249
+ /** @type {IdTable<number, PassableCap>} */
246
250
  purse: {
247
251
  bySlot: makeScalarMapStore(),
248
252
  byVal: makeScalarMapStore(),
249
253
  },
250
- /** @type {IdTable<number, unknown>} */
254
+ /** @type {IdTable<number, PassableCap>} */
251
255
  payment: {
252
256
  bySlot: makeScalarMapStore(),
253
257
  byVal: makeScalarMapStore(),
254
258
  },
255
- /** @type {IdTable<number, unknown>} */
259
+ /** @type {IdTable<number, PassableCap>} */
256
260
  unknown: {
257
261
  bySlot: makeScalarMapStore(),
258
262
  byVal: makeScalarMapStore(),
259
263
  },
260
264
  };
261
- /** @type {IdTable<BoardId, unknown>} */
265
+ /** @type {IdTable<BoardId, PassableCap>} */
262
266
  const boardObjects = {
263
267
  bySlot: makeScalarMapStore(),
264
268
  byVal: makeScalarMapStore(),
265
269
  };
266
270
 
267
271
  /**
268
- * @template Slot
269
- * @template Val
272
+ * @template {Key} Slot
273
+ * @template {PassableCap} Val
270
274
  * @param {IdTable<Slot, Val>} table
271
275
  * @param {Slot} slot
272
276
  * @param {string} iface
@@ -308,7 +312,7 @@ export const makeImportContext = (makePresence = defaultMakePresence) => {
308
312
 
309
313
  const valToSlot = {
310
314
  fromBoard: val => boardObjects.byVal.get(val),
311
- /** @param {unknown} val */
315
+ /** @param {PassableCap} val */
312
316
  fromMyWallet: val => {
313
317
  const kind = findKey(walletObjects, k => walletObjects[k].byVal.has(val));
314
318
  if (kind === undefined) {
@@ -334,14 +338,14 @@ export const makeImportContext = (makePresence = defaultMakePresence) => {
334
338
  return harden({
335
339
  /**
336
340
  * @param {BoardId} id
337
- * @param {unknown} val
341
+ * @param {PassableCap} val
338
342
  */
339
343
  initBoardId: (id, val) => {
340
344
  initSlotVal(boardObjects, id, val);
341
345
  },
342
346
  /**
343
347
  * @param {BoardId} id
344
- * @param {unknown} val
348
+ * @param {PassableCap} val
345
349
  */
346
350
  ensureBoardId: (id, val) => {
347
351
  if (boardObjects.byVal.has(val)) {
@@ -365,7 +369,7 @@ export const makeImportContext = (makePresence = defaultMakePresence) => {
365
369
  */
366
370
  const makePresence = (iface, handler) => {
367
371
  let obj;
368
- // eslint-disable-next-line no-new
372
+
369
373
  void new HandledPromise((resolve, reject, resolveWithPresence) => {
370
374
  obj = resolveWithPresence(handler);
371
375
  });
@@ -1,41 +1,40 @@
1
1
  export function watchOfferOutcomes(watchers: OutcomeWatchers, seat: UserSeat): Promise<[unknown, 0 | 1, PaymentPKeywordRecord]>;
2
- export function prepareOfferWatcher(baggage: any): (walletHelper?: any, deposit?: any, offerSpec?: any, address?: any, iAmount?: any, seatRef?: any) => {
2
+ export function prepareOfferWatcher(baggage: import("@agoric/vat-data").Baggage): (walletHelper: any, deposit: any, offerSpec: OfferSpec, address: string, invitationAmount: import("@agoric/ertp/src/types.js").SetAmount<import("@endo/patterns").Key>, seatRef: UserSeat<unknown>) => import("@endo/exo").GuardedKit<{
3
3
  helper: {
4
- updateStatus(offerStatusUpdates: any): void;
5
- onNewContinuingOffer(offerId: any, invitationAmount: any, invitationMakers: any, publicSubscribers: any): void;
6
- publishResult(result: any): void;
4
+ /**
5
+ * @param {Record<string, unknown>} offerStatusUpdates
6
+ */
7
+ updateStatus(offerStatusUpdates: Record<string, unknown>): void;
8
+ /**
9
+ * @param {string} offerId
10
+ * @param {Amount<"set">} invitationAmount
11
+ * @param {import('./types.js').InvitationMakers} invitationMakers
12
+ * @param {import("./types.js").PublicSubscribers} publicSubscribers
13
+ */
14
+ onNewContinuingOffer(offerId: string, invitationAmount: Amount<"set">, invitationMakers: import("./types.js").InvitationMakers, publicSubscribers: import("./types.js").PublicSubscribers): void;
15
+ /** @param {unknown} result */
16
+ publishResult(result: unknown): void;
17
+ /**
18
+ * Called when the offer result promise rejects. The other two watchers
19
+ * are waiting for particular values out of Zoe but they settle at the same time
20
+ * and don't need their own error handling.
21
+ * @param {Error} err
22
+ */
23
+ handleError(err: Error): void;
7
24
  };
8
25
  /** @type {OutcomeWatchers['paymentWatcher']} */
9
- paymentWatcher: OutcomeWatchers['paymentWatcher'];
26
+ paymentWatcher: OutcomeWatchers["paymentWatcher"];
10
27
  /** @type {OutcomeWatchers['resultWatcher']} */
11
- resultWatcher: OutcomeWatchers['resultWatcher'];
28
+ resultWatcher: OutcomeWatchers["resultWatcher"];
12
29
  /** @type {OutcomeWatchers['numWantsWatcher']} */
13
- numWantsWatcher: OutcomeWatchers['numWantsWatcher'];
14
- } & import("@endo/eventual-send").RemotableBrand<{}, {
15
- helper: {
16
- updateStatus(offerStatusUpdates: any): void;
17
- onNewContinuingOffer(offerId: any, invitationAmount: any, invitationMakers: any, publicSubscribers: any): void;
18
- publishResult(result: any): void;
19
- };
20
- /** @type {OutcomeWatchers['paymentWatcher']} */
21
- paymentWatcher: OutcomeWatchers['paymentWatcher'];
22
- /** @type {OutcomeWatchers['resultWatcher']} */
23
- resultWatcher: OutcomeWatchers['resultWatcher'];
24
- /** @type {OutcomeWatchers['numWantsWatcher']} */
25
- numWantsWatcher: OutcomeWatchers['numWantsWatcher'];
30
+ numWantsWatcher: OutcomeWatchers["numWantsWatcher"];
26
31
  }>;
27
- export type OfferStatus = import('./offers.js').OfferSpec & {
28
- error?: string;
29
- numWantsSatisfied?: number;
30
- result?: unknown | typeof import('./offers.js').UNPUBLISHED_RESULT;
31
- payouts?: AmountKeywordRecord;
32
- };
33
32
  /**
34
33
  * <T, [UserSeat]
35
34
  */
36
35
  export type OfferPromiseWatcher<T extends unknown> = {
37
- onFulfilled: (any: any) => any;
38
- onRejected: (err: Error, seat: any) => void;
36
+ onFulfilled?: ((value: T, args_0: UserSeat<unknown>) => void) | undefined;
37
+ onRejected?: ((reason: unknown, args_0: UserSeat<unknown>) => void) | undefined;
39
38
  };
40
39
  export type OutcomeWatchers = {
41
40
  resultWatcher: OfferPromiseWatcher<unknown>;
@@ -43,4 +42,6 @@ export type OutcomeWatchers = {
43
42
  paymentWatcher: OfferPromiseWatcher<PaymentPKeywordRecord>;
44
43
  };
45
44
  export type MakeOfferWatcher = ReturnType<typeof prepareOfferWatcher>;
45
+ export type OfferWatcher = ReturnType<MakeOfferWatcher>;
46
+ import type { OfferSpec } from "./offers.js";
46
47
  //# sourceMappingURL=offerWatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offerWatcher.d.ts","sourceRoot":"","sources":["offerWatcher.js"],"names":[],"mappings":"AAyEO,6CAHI,eAAe,QACf,QAAQ,oDAQlB;AA8BM;;;;;;IAwED,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IAyB5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IAkB3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;;;;;;;IA3C7C,gDAAgD;oBAArC,eAAe,CAAC,gBAAgB,CAAC;IAyB5C,+CAA+C;mBAApC,eAAe,CAAC,eAAe,CAAC;IAkB3C,iDAAiD;qBAAtC,eAAe,CAAC,iBAAiB,CAAC;GAoBlD;0BArOY,OAAO,aAAa,EAAE,SAAS,GAAG;IAC9C,KAAS,CAAC,EAA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