@agoric/ertp 0.16.3-other-dev-3eb1a1d.0 → 0.16.3-other-dev-fbe72e7.0.fbe72e7

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,25 +1,25 @@
1
1
  {
2
2
  "name": "@agoric/ertp",
3
- "version": "0.16.3-other-dev-3eb1a1d.0+3eb1a1d",
3
+ "version": "0.16.3-other-dev-fbe72e7.0.fbe72e7",
4
4
  "description": "Electronic Rights Transfer Protocol (ERTP). A smart contract framework for exchanging electronic rights",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "engines": {
8
- "node": "^18.12 || ^20.9"
8
+ "node": "^20.9 || ^22.11"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
- "prepack": "tsc --build tsconfig.build.json",
13
- "postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
12
+ "prepack": "yarn run -T tsc --build tsconfig.build.json",
13
+ "postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
14
14
  "test": "ava",
15
- "test:c8": "c8 --all $C8_OPTIONS ava",
15
+ "test:c8": "c8 --all ${C8_OPTIONS:-} ava",
16
16
  "test:xs": "yarn test:xs-worker",
17
17
  "test:xs-unit": "exit 0",
18
18
  "test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 test/swingsetTests",
19
19
  "lint-fix": "yarn lint:eslint --fix",
20
- "lint": "run-s --continue-on-error lint:*",
21
- "lint:eslint": "eslint .",
22
- "lint:types": "tsc"
20
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
21
+ "lint:eslint": "yarn run -T eslint .",
22
+ "lint:types": "yarn run -T tsc"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -39,24 +39,24 @@
39
39
  },
40
40
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
41
41
  "dependencies": {
42
- "@agoric/notifier": "0.6.3-other-dev-3eb1a1d.0+3eb1a1d",
43
- "@agoric/store": "0.9.3-other-dev-3eb1a1d.0+3eb1a1d",
44
- "@agoric/vat-data": "0.5.3-other-dev-3eb1a1d.0+3eb1a1d",
45
- "@agoric/zone": "0.2.3-other-dev-3eb1a1d.0+3eb1a1d",
46
- "@endo/errors": "^1.2.8",
47
- "@endo/eventual-send": "^1.2.8",
48
- "@endo/far": "^1.1.9",
49
- "@endo/marshal": "^1.6.2",
50
- "@endo/nat": "^5.0.13",
51
- "@endo/patterns": "^1.4.7",
52
- "@endo/promise-kit": "^1.1.8"
42
+ "@agoric/notifier": "0.6.3-other-dev-fbe72e7.0.fbe72e7",
43
+ "@agoric/store": "0.9.3-other-dev-fbe72e7.0.fbe72e7",
44
+ "@agoric/vat-data": "0.5.3-other-dev-fbe72e7.0.fbe72e7",
45
+ "@agoric/zone": "0.2.3-other-dev-fbe72e7.0.fbe72e7",
46
+ "@endo/errors": "^1.2.13",
47
+ "@endo/eventual-send": "^1.3.4",
48
+ "@endo/far": "^1.1.14",
49
+ "@endo/marshal": "^1.8.0",
50
+ "@endo/nat": "^5.1.3",
51
+ "@endo/patterns": "^1.7.0",
52
+ "@endo/promise-kit": "^1.1.13"
53
53
  },
54
54
  "devDependencies": {
55
- "@agoric/swingset-vat": "0.32.3-other-dev-3eb1a1d.0+3eb1a1d",
56
- "@endo/bundle-source": "^3.5.0",
55
+ "@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
56
+ "@endo/bundle-source": "^4.1.2",
57
57
  "@fast-check/ava": "^1.1.5",
58
58
  "ava": "^5.3.0",
59
- "tsd": "^0.31.1"
59
+ "tsd": "^0.33.0"
60
60
  },
61
61
  "files": [
62
62
  "src",
@@ -77,7 +77,7 @@
77
77
  "access": "public"
78
78
  },
79
79
  "typeCoverage": {
80
- "atLeast": 91.76
80
+ "atLeast": 92.99
81
81
  },
82
- "gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
82
+ "gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
83
83
  }
@@ -9,9 +9,9 @@ export namespace AssetKind {
9
9
  let COPY_BAG: "copyBag";
10
10
  }
11
11
  export function assertAssetKind(allegedAK: AssetKind): void;
12
- export function assertValueGetHelpers<V>(value: V): MathHelpers<V>;
12
+ export function assertValueGetHelpers<V extends AmountValue>(value: V): MathHelpers<V>;
13
13
  export namespace AmountMath {
14
- export function make<B extends Brand, V extends NatValue | CopySet | CopyBag | SetValue>(brand: B, allegedValue: V): B extends Brand<"nat"> ? NatAmount : V extends NatValue ? NatAmount : V extends CopySet ? CopySetAmount<V["payload"][0]> : V extends CopyBag ? CopyBagAmount<V["payload"][0][0]> : V extends SetValue ? SetAmount<V[0]> : never;
14
+ export function make<B extends Brand<any>, V extends NatValue | CopySet | CopyBag | SetValue>(brand: B, allegedValue: V): B extends Brand<"nat"> ? NatAmount : V extends NatValue ? NatAmount : V extends CopySet ? CopySetAmount<V["payload"][0]> : V extends CopyBag ? CopyBagAmount<V["payload"][0][0]> : V extends SetValue ? SetAmount<V[0]> : never;
15
15
  export function coerce<A extends Amount>(brand: Brand, allegedAmount: A): A;
16
16
  export function getValue<A extends Amount>(brand: Brand, amount: A): A["value"];
17
17
  export let makeEmpty: {
@@ -19,15 +19,19 @@ export namespace AmountMath {
19
19
  <K extends AssetKind>(brand: Brand<K>, assetKind: K): Amount<K>;
20
20
  };
21
21
  export function makeEmptyFromAmount<A extends Amount>(amount: A): A;
22
- export function isEmpty(amount: Amount, brand?: Brand | undefined): boolean;
22
+ export function isEmpty(amount: Amount, brand?: Brand): boolean;
23
23
  export { isGTE };
24
- export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): boolean;
25
- export function add<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): A;
26
- export function subtract<L extends Amount, R extends Amount>(leftAmount: L, rightAmount: R, brand?: Brand | undefined): L extends R ? L : never;
27
- export function min<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
28
- export function max<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
24
+ export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): boolean;
25
+ export let add: {
26
+ <A extends CopyBag, B extends CopyBag>(leftAmount: CopyBagAmount<A>, rightAmount: CopyBagAmount<B>, brand?: Brand): CopyBagAmount<A | B>;
27
+ <A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): A;
28
+ };
29
+ export function subtract<L extends Amount, R extends Amount>(leftAmount: L, rightAmount: R, brand?: Brand): L extends R ? L : never;
30
+ export function min<A extends Amount>(x: A, y: A, brand?: Brand): A;
31
+ export function max<A extends Amount>(x: A, y: A, brand?: Brand): A;
29
32
  }
30
- export function getAssetKind(amount: Amount): "copySet" | "set" | "nat" | "copyBag";
33
+ export function getAssetKind(amount: Amount): "copySet" | "copyBag" | "set" | "nat";
34
+ import type { AmountValue } from './types.js';
31
35
  import type { MathHelpers } from './types.js';
32
36
  import type { Brand } from './types.js';
33
37
  import type { NatValue } from './types.js';
@@ -52,6 +56,6 @@ import type { Amount } from './types.js';
52
56
  * @param {Brand<K>} [brand]
53
57
  * @returns {boolean}
54
58
  */
55
- declare function isGTE<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): boolean;
59
+ declare function isGTE<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K>): boolean;
56
60
  export {};
57
61
  //# sourceMappingURL=amountMath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":";;;wBAkBU,CAAC,OAAO,SAAS,EAAE,MAAM,OAAO,SAAS,CAAC;;;;;;;AAY7C,2CADK,SAAS,QAIpB;AA8EM,sCAJM,CAAC,SACH,CAAC,GACC,YAAY,CAAC,CAAC,CAIc;;IAsGjC,qBAhBe,CAAC,SAAT,KAAO,EACmC,CAAC,SAA1C,QAAQ,GAAG,OAAO,GAAG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,YAAY;mCAAZ,YAAY;+BAAZ,YAAY;4BAAZ,YAAY;AA4JjK;;;;;;;;;;;;GAYG;AACH,uBANyB,CAAC,SAAZ,SAAU,cACb,OAAO,CAAC,CAAC,eACT,OAAO,CAAC,CAAC,UACT,MAAM,CAAC,CAAC,GACN,OAAO,CAKnB"}
package/src/amountMath.js CHANGED
@@ -9,7 +9,7 @@ import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
9
9
 
10
10
  /**
11
11
  * @import {CopyBag, CopySet} from '@endo/patterns';
12
- * @import {Amount, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
12
+ * @import {Amount, AmountValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
13
13
  */
14
14
 
15
15
  // NB: AssetKind is both a constant for enumerated values and a type for those values.
@@ -105,7 +105,7 @@ const assertValueGetAssetKind = value => {
105
105
  *
106
106
  * Made available only for testing, but it is harmless for other uses.
107
107
  *
108
- * @template V
108
+ * @template {AmountValue} V
109
109
  * @param {V} value
110
110
  * @returns {MathHelpers<V>}
111
111
  */
@@ -113,7 +113,9 @@ export const assertValueGetHelpers = value =>
113
113
  // @ts-expect-error cast
114
114
  helpers[assertValueGetAssetKind(value)];
115
115
 
116
- /** @type {(allegedBrand: Brand, brand?: Brand) => void} */
116
+ /**
117
+ * @type {(allegedBrand: Brand<any>, brand?: Brand<any>) => void}
118
+ */
117
119
  const optionalBrandCheck = (allegedBrand, brand) => {
118
120
  if (brand !== undefined) {
119
121
  assertRemotable(brand, 'brand');
@@ -156,7 +158,7 @@ const checkLRAndGetHelpers = (leftAmount, rightAmount, brand = undefined) => {
156
158
  * @param {MathHelpers<AssetValueForKind<K>>} h
157
159
  * @param {Amount<K>} leftAmount
158
160
  * @param {Amount<K>} rightAmount
159
- * @returns {[K, K]}
161
+ * @returns {[AssetValueForKind<K>, AssetValueForKind<K>]}
160
162
  */
161
163
  const coerceLR = (h, leftAmount, rightAmount) => {
162
164
  // @ts-expect-error could be arbitrary subtype
@@ -197,7 +199,7 @@ export const AmountMath = {
197
199
  *
198
200
  * Does not verify that the Brand's AssetKind matches the value's.
199
201
  *
200
- * @template {Brand} B
202
+ * @template {Brand<any>} B
201
203
  * @template {NatValue | CopySet | CopyBag | SetValue} V
202
204
  * @param {B} brand
203
205
  * @param {V} allegedValue
@@ -316,16 +318,18 @@ export const AmountMath = {
316
318
  * amount, it usually means including all of the elements from both left and
317
319
  * right.
318
320
  *
319
- * @template {Amount} A
320
- * @param {A} leftAmount
321
- * @param {A} rightAmount
322
- * @param {Brand} [brand]
323
- * @returns {A}
321
+ * @type {{
322
+ * <A extends CopyBag, B extends CopyBag>(
323
+ * leftAmount: CopyBagAmount<A>,
324
+ * rightAmount: CopyBagAmount<B>,
325
+ * brand?: Brand,
326
+ * ): CopyBagAmount<A | B>;
327
+ * <A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): A;
328
+ * }}
324
329
  */
325
330
  add: (leftAmount, rightAmount, brand = undefined) => {
326
331
  const h = checkLRAndGetHelpers(leftAmount, rightAmount, brand);
327
332
  const value = h.doAdd(...coerceLR(h, leftAmount, rightAmount));
328
- // @ts-expect-error different subtype
329
333
  return harden({ brand: leftAmount.brand, value });
330
334
  },
331
335
  /**
@@ -1,17 +1,8 @@
1
- export function upgradeIssuerKit<K extends AssetKind>(issuerBaggage: import("@agoric/vat-data").Baggage, optShutdownWithFailure?: ShutdownWithFailure | undefined, recoverySetsOption?: RecoverySetsOption | undefined): IssuerKit<K>;
2
- export function hasIssuer(baggage: import("@agoric/vat-data").Baggage): boolean;
3
- export function makeDurableIssuerKit<K extends AssetKind>(issuerBaggage: import("@agoric/vat-data").Baggage, name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, { elementShape, recoverySetsOption }?: Partial<{
4
- elementShape: Pattern;
5
- recoverySetsOption: RecoverySetsOption;
6
- }> | undefined): IssuerKit<K>;
7
- export function prepareIssuerKit<K extends AssetKind>(issuerBaggage: import("@agoric/vat-data").Baggage, name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, options?: Partial<{
8
- elementShape: Pattern;
9
- recoverySetsOption: RecoverySetsOption;
10
- }> | undefined): IssuerKit<K>;
11
- export function makeIssuerKit<K extends AssetKind = "nat">(name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, { elementShape, recoverySetsOption }?: Partial<{
12
- elementShape: Pattern;
13
- recoverySetsOption: RecoverySetsOption;
14
- }> | undefined): IssuerKit<K, any>;
1
+ export function upgradeIssuerKit<K extends AssetKind>(issuerBaggage: Baggage, optShutdownWithFailure?: ShutdownWithFailure, recoverySetsOption?: RecoverySetsOption): IssuerKit<K>;
2
+ export function hasIssuer(baggage: Baggage): boolean;
3
+ export function makeDurableIssuerKit<K extends AssetKind>(issuerBaggage: Baggage, name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, { elementShape, recoverySetsOption }?: IssuerOptionsRecord): IssuerKit<K>;
4
+ export function prepareIssuerKit<O extends IssuerOptionsRecord, K extends AssetKind>(issuerBaggage: Baggage, name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, options?: O): O["elementShape"] extends TypedPattern<infer T extends Key> ? IssuerKit<K, T> : IssuerKit<K>;
5
+ export function makeIssuerKit<K extends AssetKind = "nat", O extends IssuerOptionsRecord = {}>(name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, { elementShape, recoverySetsOption }?: O): O["elementShape"] extends TypedPattern<infer T extends Key> ? IssuerKit<K, T> : IssuerKit<K>;
15
6
  export type IssuerRecord<K extends AssetKind> = {
16
7
  name: string;
17
8
  assetKind: K;
@@ -37,8 +28,12 @@ export type IssuerOptionsRecord = Partial<{
37
28
  recoverySetsOption: RecoverySetsOption;
38
29
  }>;
39
30
  import { AssetKind } from './amountMath.js';
31
+ import type { Baggage } from '@agoric/vat-data';
40
32
  import type { ShutdownWithFailure } from '@agoric/swingset-vat';
41
33
  import type { RecoverySetsOption } from './types.js';
42
34
  import type { IssuerKit } from './types.js';
43
35
  import type { AdditionalDisplayInfo } from './types.js';
36
+ import type { Key } from '@endo/patterns';
37
+ import type { TypedPattern } from '@agoric/internal';
38
+ import type { Pattern } from '@endo/patterns';
44
39
  //# sourceMappingURL=issuerKit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"issuerKit.d.ts","sourceRoot":"","sources":["issuerKit.js"],"names":[],"mappings":"AA4GO,iCAbkB,CAAC,SAAZ,SAAU,iBACb,OAAO,kBAAkB,EAAE,OAAO,kHAUhC,UAAU,CAAC,CAAC,CA4BxB;AAQM,mCAFI,OAAO,kBAAkB,EAAE,OAAO,WAEgB;AAoDtD,qCA1BkB,CAAC,SAAZ,SAAU,iBAYb,OAAO,kBAAkB,EAAE,OAAO,QAClC,MAAM;kBAtBE,OAAO;wBACD,kBAAkB;iBAgC9B,UAAU,CAAC,CAAC,CA2BxB;AAiCM,iCA1BkB,CAAC,SAAZ,SAAU,iBAYb,OAAO,kBAAkB,EAAE,OAAO,QAClC,MAAM;kBAhFE,OAAO;wBACD,kBAAkB;iBA0F9B,UAAU,CAAC,CAAC,CAuCxB;AAqCM,8BAzBmB,CAAC,SAAb,SAAU,gBAYb,MAAM;kBA1JE,OAAO;wBACD,kBAAkB;iBAoK9B,UAAU,CAAC,EAAE,GAAG,CAAC,CAiB3B;yBAtUsB,CAAC,SAAZ,SAAU;UAEV,MAAM;eACN,CAAC;iBACD,qBAAqB;kBACrB,OAAO;;;;;;;;;;;;;;;;kCA0IR,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IAC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BAhKsC,iBAAiB;6BASlC,kBAAkB;yCAFN,sBAAsB;wCAG0B,YAAY;+BAAZ,YAAY;2CAAZ,YAAY;yBALnE,gBAAgB;kCAGhB,kBAAkB;6BAHlB,gBAAgB"}
package/src/issuerKit.js CHANGED
@@ -9,8 +9,14 @@ import { AssetKind, assertAssetKind } from './amountMath.js';
9
9
  import { coerceDisplayInfo } from './displayInfo.js';
10
10
  import { preparePaymentLedger } from './paymentLedger.js';
11
11
 
12
- /** @import {AdditionalDisplayInfo, RecoverySetsOption, IssuerKit, PaymentLedger} from './types.js' */
13
- /** @import {ShutdownWithFailure} from '@agoric/swingset-vat' */
12
+ /**
13
+ * @import {Key, Pattern} from '@endo/patterns';
14
+ * @import {Zone} from '@agoric/base-zone';
15
+ * @import {ShutdownWithFailure} from '@agoric/swingset-vat';
16
+ * @import {TypedPattern} from '@agoric/internal';
17
+ * @import {Baggage} from '@agoric/vat-data';
18
+ * @import {AdditionalDisplayInfo, RecoverySetsOption, IssuerKit, PaymentLedger} from './types.js';
19
+ */
14
20
 
15
21
  /**
16
22
  * @template {AssetKind} K
@@ -26,7 +32,7 @@ import { preparePaymentLedger } from './paymentLedger.js';
26
32
  *
27
33
  * @template {AssetKind} K
28
34
  * @param {IssuerRecord<K>} issuerRecord
29
- * @param {import('@agoric/zone').Zone} issuerZone
35
+ * @param {Zone} issuerZone
30
36
  * @param {RecoverySetsOption} recoverySetsState Omitted from issuerRecord
31
37
  * because it was added in an upgrade.
32
38
  * @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
@@ -94,7 +100,7 @@ const RECOVERY_SETS_STATE = 'recoverySetsState';
94
100
  * make a new one.
95
101
  *
96
102
  * @template {AssetKind} K
97
- * @param {import('@agoric/vat-data').Baggage} issuerBaggage
103
+ * @param {Baggage} issuerBaggage
98
104
  * @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
99
105
  * the middle of an atomic action (which btw should never happen), it
100
106
  * potentially leaves its ledger in a corrupted state. If this function was
@@ -138,7 +144,7 @@ harden(upgradeIssuerKit);
138
144
  /**
139
145
  * Does baggage already have an issuerKit?
140
146
  *
141
- * @param {import('@agoric/vat-data').Baggage} baggage
147
+ * @param {Baggage} baggage
142
148
  */
143
149
  export const hasIssuer = baggage => baggage.has(INSTANCE_KEY);
144
150
 
@@ -178,7 +184,7 @@ export const hasIssuer = baggage => baggage.has(INSTANCE_KEY);
178
184
  * basic fungible tokens.
179
185
  *
180
186
  * `displayInfo` gives information to the UI on how to display the amount.
181
- * @param {import('@agoric/vat-data').Baggage} issuerBaggage
187
+ * @param {Baggage} issuerBaggage
182
188
  * @param {string} name
183
189
  * @param {K} [assetKind]
184
190
  * @param {AdditionalDisplayInfo} [displayInfo]
@@ -224,6 +230,7 @@ harden(makeDurableIssuerKit);
224
230
  * Used to either revive a predecessor issuerKit, or to make a new durable one
225
231
  * if it is absent, and to place it in baggage for the next successor.
226
232
  *
233
+ * @template {IssuerOptionsRecord} O
227
234
  * @template {AssetKind} K The name becomes part of the brand in asset
228
235
  * descriptions. The name is useful for debugging and double-checking
229
236
  * assumptions, but should not be trusted wrt any external namespace. For
@@ -236,7 +243,7 @@ harden(makeDurableIssuerKit);
236
243
  * basic fungible tokens.
237
244
  *
238
245
  * `displayInfo` gives information to the UI on how to display the amount.
239
- * @param {import('@agoric/vat-data').Baggage} issuerBaggage
246
+ * @param {Baggage} issuerBaggage
240
247
  * @param {string} name
241
248
  * @param {K} [assetKind]
242
249
  * @param {AdditionalDisplayInfo} [displayInfo]
@@ -247,8 +254,10 @@ harden(makeDurableIssuerKit);
247
254
  * unit of computation, like the enclosing vat, can be shutdown before
248
255
  * anything else is corrupted by that corrupted state. See
249
256
  * https://github.com/Agoric/agoric-sdk/issues/3434
250
- * @param {IssuerOptionsRecord} [options]
251
- * @returns {IssuerKit<K>}
257
+ * @param {O} [options]
258
+ * @returns {O['elementShape'] extends TypedPattern<infer T extends Key>
259
+ * ? IssuerKit<K, T>
260
+ * : IssuerKit<K>}
252
261
  */
253
262
  export const prepareIssuerKit = (
254
263
  issuerBaggage,
@@ -257,6 +266,7 @@ export const prepareIssuerKit = (
257
266
  assetKind = AssetKind.NAT,
258
267
  displayInfo = harden({}),
259
268
  optShutdownWithFailure = undefined,
269
+ // @ts-expect-error could have a different subtype of IssuerOptionsRecord
260
270
  options = {},
261
271
  ) => {
262
272
  if (hasIssuer(issuerBaggage)) {
@@ -285,6 +295,7 @@ export const prepareIssuerKit = (
285
295
  optShutdownWithFailure,
286
296
  options,
287
297
  );
298
+ // @ts-expect-error cast to the type parameter
288
299
  return issuerKit;
289
300
  }
290
301
  };
@@ -299,21 +310,19 @@ harden(prepareIssuerKit);
299
310
  * Currently used for testing only. Should probably continue to be used for
300
311
  * testing only.
301
312
  *
302
- * @template {AssetKind} [K='nat'] The name becomes part of the brand in asset
313
+ * @template {AssetKind} [K='nat']
314
+ * @template {IssuerOptionsRecord} [O={}]
315
+ * @param {string} name The name becomes part of the brand in asset
303
316
  * descriptions. The name is useful for debugging and double-checking
304
317
  * assumptions, but should not be trusted wrt any external namespace. For
305
318
  * example, anyone could create a new issuer kit with name 'BTC', but it is
306
319
  * not bitcoin or even related. It is only the name according to that issuer
307
320
  * and brand.
308
- *
309
- * The assetKind will be used to import a specific mathHelpers from the
310
- * mathHelpers library. For example, natMathHelpers, the default, is used for
311
- * basic fungible tokens.
312
- *
313
- * `displayInfo` gives information to the UI on how to display the amount.
314
- * @param {string} name
315
- * @param {K} [assetKind]
316
- * @param {AdditionalDisplayInfo} [displayInfo]
321
+ * @param {K} [assetKind] The assetKind will be used to import a specific
322
+ * mathHelpers from the mathHelpers library. For example, natMathHelpers, the
323
+ * default, is used for basic fungible tokens.
324
+ * @param {AdditionalDisplayInfo} [displayInfo] `displayInfo` gives information
325
+ * to the UI on how to display the amount.
317
326
  * @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
318
327
  * the middle of an atomic action (which btw should never happen), it
319
328
  * potentially leaves its ledger in a corrupted state. If this function was
@@ -321,8 +330,10 @@ harden(prepareIssuerKit);
321
330
  * unit of computation, like the enclosing vat, can be shutdown before
322
331
  * anything else is corrupted by that corrupted state. See
323
332
  * https://github.com/Agoric/agoric-sdk/issues/3434
324
- * @param {IssuerOptionsRecord} [options]
325
- * @returns {IssuerKit<K, any>}
333
+ * @param {O} [options]
334
+ * @returns {O['elementShape'] extends TypedPattern<infer T extends Key>
335
+ * ? IssuerKit<K, T>
336
+ * : IssuerKit<K>}
326
337
  */
327
338
  export const makeIssuerKit = (
328
339
  name,
@@ -330,8 +341,10 @@ export const makeIssuerKit = (
330
341
  assetKind = AssetKind.NAT,
331
342
  displayInfo = harden({}),
332
343
  optShutdownWithFailure = undefined,
344
+ // @ts-expect-error O could be instantiated with a different subtype
333
345
  { elementShape = undefined, recoverySetsOption = undefined } = {},
334
346
  ) =>
347
+ // @ts-expect-error cast
335
348
  makeDurableIssuerKit(
336
349
  makeScalarBigMapStore('dropped issuer kit', { durable: true }),
337
350
  name,
@@ -1,10 +1,12 @@
1
- export function claim<P extends Payment>(recoveryPurse: ERef<Purse>, srcPaymentP: ERef<P>, optAmountShape?: Pattern): Promise<P>;
2
- export function combine<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentsPs: ERef<Payment<K>>[], optTotalAmount?: Pattern): Promise<Payment<K>>;
1
+ export function claim<K extends AssetKind, T extends Key>(recoveryPurse: ERef<Purse<K, T>>, srcPaymentP: ERef<Payment<K, T>>, optAmountShape?: Pattern): Promise<Payment<K, T>>;
2
+ export function combine<K extends AssetKind, T extends Key>(recoveryPurse: ERef<Purse<K, T>>, srcPaymentsPs: ERef<Payment<K, T>>[], optTotalAmount?: Pattern): Promise<Payment<K, T>>;
3
3
  export function split<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, paymentAmountA: Amount<K>): Promise<Payment<K>[]>;
4
4
  export function splitMany<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, amounts: Amount<K>[]): Promise<Payment[]>;
5
- import type { Payment } from './types.js';
5
+ import type { AssetKind } from './types.js';
6
+ import type { Key } from '@endo/patterns';
6
7
  import type { Purse } from './types.js';
7
8
  import type { ERef } from '@endo/far';
8
- import type { AssetKind } from './types.js';
9
+ import type { Payment } from './types.js';
10
+ import type { Pattern } from '@endo/patterns';
9
11
  import type { Amount } from './types.js';
10
12
  //# sourceMappingURL=legacy-payment-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-payment-helpers.d.ts","sourceRoot":"","sources":["legacy-payment-helpers.js"],"names":[],"mappings":"AAiCO,sBANgB,CAAC,SAAX,OAAS,iBACX,KAAK,KAAK,CAAC,eACX,KAAK,CAAC,CAAC,mBACP,OAAO,GACL,OAAO,CAAC,CAAC,CAAC,CAYtB;AAiBM,wBANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,iBACd,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,mBAClB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CA0B/B;AAgBM,sBANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAChB,OAAO,CAAC,CAAC,GACP,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAYjC;AAgBM,0BANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,WAChB,OAAO,CAAC,CAAC,EAAE,GACT,OAAO,CAAC,OAAO,EAAE,CAAC,CAoB9B;6BAvImD,YAAY;2BAAZ,YAAY;0BADzC,WAAW;+BACkB,YAAY;4BAAZ,YAAY"}
1
+ {"version":3,"file":"legacy-payment-helpers.d.ts","sourceRoot":"","sources":["legacy-payment-helpers.js"],"names":[],"mappings":"AAmCO,sBAPkB,CAAC,SAAb,SAAW,EACL,CAAC,SAAP,GAAK,iBACP,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,eACjB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,mBACnB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAWlC;AAkBM,wBAPkB,CAAC,SAAb,SAAW,EACL,CAAC,SAAP,GAAK,iBACP,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,iBACjB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,mBACrB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CA8BlC;AAgBM,sBANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAChB,OAAO,CAAC,CAAC,GACP,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAYjC;AAgBM,0BANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,WAChB,OAAO,CAAC,CAAC,EAAE,GACT,OAAO,CAAC,OAAO,EAAE,CAAC,CAoB9B;+BA5ImD,YAAY;yBADjC,gBAAgB;2BACK,YAAY;0BAFzC,WAAW;6BAEkB,YAAY;6BADjC,gBAAgB;4BACK,YAAY"}
@@ -7,6 +7,7 @@ import { AmountMath } from './amountMath.js';
7
7
 
8
8
  /**
9
9
  * @import {ERef} from '@endo/far';
10
+ * @import {Key, Pattern} from '@endo/patterns';
10
11
  * @import {Amount, AssetKind, Payment, Purse} from './types.js';
11
12
  */
12
13
 
@@ -25,11 +26,12 @@ import { AmountMath } from './amountMath.js';
25
26
  */
26
27
 
27
28
  /**
28
- * @template {Payment} P
29
- * @param {ERef<Purse>} recoveryPurse
30
- * @param {ERef<P>} srcPaymentP
29
+ * @template {AssetKind} K
30
+ * @template {Key} T type of values in set-like kind
31
+ * @param {ERef<Purse<K, T>>} recoveryPurse
32
+ * @param {ERef<Payment<K, T>>} srcPaymentP
31
33
  * @param {Pattern} [optAmountShape]
32
- * @returns {Promise<P>}
34
+ * @returns {Promise<Payment<K, T>>}
33
35
  */
34
36
  export const claim = async (
35
37
  recoveryPurse,
@@ -37,7 +39,6 @@ export const claim = async (
37
39
  optAmountShape = undefined,
38
40
  ) => {
39
41
  const srcPayment = await srcPaymentP;
40
- // @ts-expect-error XXX could be instantiated with a different subtype
41
42
  return E.when(E(recoveryPurse).deposit(srcPayment, optAmountShape), amount =>
42
43
  E(recoveryPurse).withdraw(amount),
43
44
  );
@@ -53,10 +54,11 @@ harden(claim);
53
54
  * origin.
54
55
  *
55
56
  * @template {AssetKind} K
56
- * @param {ERef<Purse<K>>} recoveryPurse
57
- * @param {ERef<Payment<K>>[]} srcPaymentsPs
57
+ * @template {Key} T type of values in set-like kind
58
+ * @param {ERef<Purse<K, T>>} recoveryPurse
59
+ * @param {ERef<Payment<K, T>>[]} srcPaymentsPs
58
60
  * @param {Pattern} [optTotalAmount]
59
- * @returns {Promise<Payment<K>>}
61
+ * @returns {Promise<Payment<K, T>>}
60
62
  */
61
63
  export const combine = async (
62
64
  recoveryPurse,
@@ -69,7 +71,11 @@ export const combine = async (
69
71
  E(brandP).getDisplayInfo(),
70
72
  ...srcPaymentsPs,
71
73
  ]);
72
- const emptyAmount = AmountMath.makeEmpty(brand, displayInfo.assetKind);
74
+
75
+ // XXX Brand lacks M
76
+ const emptyAmount = /** @type {Amount<K, T>} */ (
77
+ AmountMath.makeEmpty(brand, displayInfo.assetKind)
78
+ );
73
79
  const amountPs = srcPayments.map(srcPayment =>
74
80
  E(recoveryPurse).deposit(srcPayment),
75
81
  );
package/src/payment.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export function preparePaymentKind<K extends AssetKind>(issuerZone: import("@agoric/zone").Zone, name: string, brand: Brand<K>, PaymentI: import("@endo/patterns").InterfaceGuard<any>): () => Payment<K>;
1
+ export function preparePaymentKind<K extends AssetKind>(issuerZone: import("@agoric/zone").Zone, name: string, brand: Brand<K>, PaymentI: import("@endo/patterns").InterfaceGuard<any>): () => Payment<K, any>;
2
2
  import type { AssetKind } from './types.js';
3
3
  import type { Brand } from './types.js';
4
4
  import type { Payment } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,mCAPkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,SACN,MAAM,CAAC,CAAC,YACR,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,GAC1C,MAAM,QAAQ,CAAC,CAAC,CAc5B;+BAvB4C,YAAY;2BAAZ,YAAY;6BAAZ,YAAY"}
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,mCAPkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,SACN,MAAM,CAAC,CAAC,YACR,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,GAC1C,MAAM,QAAQ,CAAC,EAAE,GAAG,CAAC,CAejC;+BAxB4C,YAAY;2BAAZ,YAAY;6BAAZ,YAAY"}
package/src/payment.js CHANGED
@@ -11,7 +11,7 @@ import { initEmpty } from '@agoric/store';
11
11
  * @param {string} name
12
12
  * @param {Brand<K>} brand
13
13
  * @param {import('@endo/patterns').InterfaceGuard<any>} PaymentI
14
- * @returns {() => Payment<K>}
14
+ * @returns {() => Payment<K, any>}
15
15
  */
16
16
  export const preparePaymentKind = (issuerZone, name, brand, PaymentI) => {
17
17
  const makePayment = issuerZone.exoClass(
@@ -24,6 +24,7 @@ export const preparePaymentKind = (issuerZone, name, brand, PaymentI) => {
24
24
  },
25
25
  },
26
26
  );
27
+ // @ts-expect-error [tag] for tagged type not defined in runtime
27
28
  return makePayment;
28
29
  };
29
30
  harden(preparePaymentKind);
@@ -1,6 +1,8 @@
1
- export function preparePaymentLedger<K extends AssetKind>(issuerZone: import("@agoric/zone").Zone, name: string, assetKind: K, displayInfo: DisplayInfo<K>, elementShape: Pattern, recoverySetsState: RecoverySetsOption, optShutdownWithFailure?: ShutdownWithFailure | undefined): PaymentLedger<K>;
1
+ export function preparePaymentLedger<K extends AssetKind>(issuerZone: Zone, name: string, assetKind: K, displayInfo: DisplayInfo<K>, elementShape: Pattern, recoverySetsState: RecoverySetsOption, optShutdownWithFailure?: ShutdownWithFailure): PaymentLedger<K>;
2
2
  import type { AssetKind } from './types.js';
3
+ import type { Zone } from '@agoric/base-zone';
3
4
  import type { DisplayInfo } from './types.js';
5
+ import type { Pattern } from '@endo/patterns';
4
6
  import type { RecoverySetsOption } from './types.js';
5
7
  import type { ShutdownWithFailure } from '@agoric/swingset-vat';
6
8
  import type { PaymentLedger } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAqFO,qCAVkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,aACN,CAAC,eACD,YAAY,CAAC,CAAC,gBACd,OAAO,qBACP,kBAAkB,6DAEhB,cAAc,CAAC,CAAC,CAyT5B;+BA9XwH,YAAY;iCAAZ,YAAY;wCAAZ,YAAY;yCAC/F,sBAAsB;mCAD6D,YAAY"}
1
+ {"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAuFO,qCAVkB,CAAC,SAAb,SAAW,cACb,IAAI,QACJ,MAAM,aACN,CAAC,eACD,YAAY,CAAC,CAAC,gBACd,OAAO,qBACP,kBAAkB,2BAClB,mBAAmB,GACjB,cAAc,CAAC,CAAC,CAyT5B;+BA5XwH,YAAY;0BAJ9G,mBAAmB;iCAI+E,YAAY;6BALtG,gBAAgB;wCAK0E,YAAY;yCAF/F,sBAAsB;mCAE6D,YAAY"}
@@ -2,19 +2,21 @@
2
2
 
3
3
  /// <reference types="@agoric/store/exported.js" />
4
4
 
5
- import { X, q, Fail, annotateError } from '@endo/errors';
5
+ import { q, Fail, annotateError, X } from '@endo/errors';
6
6
  import { isPromise } from '@endo/promise-kit';
7
- import { mustMatch, M, keyEQ } from '@agoric/store';
7
+ import { mustMatch, M, keyEQ } from '@endo/patterns';
8
8
  import { AmountMath } from './amountMath.js';
9
9
  import { preparePaymentKind } from './payment.js';
10
10
  import { preparePurseKind } from './purse.js';
11
-
12
11
  import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
13
12
 
14
13
  /**
15
- * @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js'
16
- * @import {ShutdownWithFailure} from '@agoric/swingset-vat'
14
+ * @import {Key, Pattern} from '@endo/patterns';
15
+ * @import {Zone} from '@agoric/base-zone';
17
16
  * @import {TypedPattern} from '@agoric/internal';
17
+ * @import {ShutdownWithFailure} from '@agoric/swingset-vat';
18
+ * @import {AmountStore} from './amountStore.js';
19
+ * @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js';
18
20
  */
19
21
 
20
22
  /**
@@ -74,7 +76,7 @@ const amountShapeFromElementShape = (brand, assetKind, elementShape) => {
74
76
  * minting and transfer authority originates here.
75
77
  *
76
78
  * @template {AssetKind} K
77
- * @param {import('@agoric/zone').Zone} issuerZone
79
+ * @param {Zone} issuerZone
78
80
  * @param {string} name
79
81
  * @param {K} assetKind
80
82
  * @param {DisplayInfo<K>} displayInfo
@@ -239,7 +241,7 @@ export const preparePaymentLedger = (
239
241
  /**
240
242
  * Used by the purse code to implement purse.deposit
241
243
  *
242
- * @param {import('./amountStore.js').AmountStore} balanceStore
244
+ * @param {AmountStore} balanceStore
243
245
  * @param {Payment} srcPayment
244
246
  * @param {Pattern} [optAmountShape]
245
247
  * @returns {Amount}
@@ -273,7 +275,7 @@ export const preparePaymentLedger = (
273
275
  /**
274
276
  * Used by the purse code to implement purse.withdraw
275
277
  *
276
- * @param {import('./amountStore.js').AmountStore} balanceStore
278
+ * @param {AmountStore} balanceStore
277
279
  * @param {Amount} amount - the amount to be withdrawn
278
280
  * @param {SetStore<Payment>} [recoverySet]
279
281
  * @returns {Payment}
package/src/purse.d.ts CHANGED
@@ -7,14 +7,14 @@ export function preparePurseKind(issuerZone: import("@agoric/zone").Zone, name:
7
7
  }, recoverySetsState: RecoverySetsOption, paymentRecoverySets: WeakMapStore<Payment, SetStore<Payment>>): () => import("@endo/exo").Guarded<{
8
8
  deposit(srcPayment: any, optAmountShape?: undefined): any;
9
9
  withdraw(amount: any): any;
10
- getCurrentAmount(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key>;
10
+ getCurrentAmount(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key>;
11
11
  getCurrentAmountNotifier(): import("@agoric/notifier").Notifier<any>;
12
12
  getAllegedBrand(): Brand;
13
13
  getDepositFacet(): import("@endo/exo").Guarded<{
14
14
  receive(...args: any[]): any;
15
15
  }>;
16
16
  getRecoverySet(): import("@endo/patterns").CopySet<any>;
17
- recoverAll(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key>;
17
+ recoverAll(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key>;
18
18
  }>;
19
19
  import type { AssetKind } from './types.js';
20
20
  import type { Brand } from './types.js';