@agoric/ertp 0.16.3-u14.0 → 0.16.3-u16.1

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.
Files changed (53) hide show
  1. package/exported.d.ts +37 -0
  2. package/exported.js +2 -1
  3. package/package.json +35 -26
  4. package/src/amountMath.d.ts +44 -31
  5. package/src/amountMath.d.ts.map +1 -1
  6. package/src/amountMath.js +130 -120
  7. package/src/amountStore.d.ts +9 -0
  8. package/src/amountStore.d.ts.map +1 -0
  9. package/src/amountStore.js +34 -0
  10. package/src/displayInfo.d.ts +3 -0
  11. package/src/displayInfo.d.ts.map +1 -1
  12. package/src/displayInfo.js +2 -0
  13. package/src/index.js +8 -0
  14. package/src/issuerKit.d.ts +30 -6
  15. package/src/issuerKit.d.ts.map +1 -1
  16. package/src/issuerKit.js +218 -76
  17. package/src/legacy-payment-helpers.d.ts +6 -1
  18. package/src/legacy-payment-helpers.d.ts.map +1 -1
  19. package/src/legacy-payment-helpers.js +33 -32
  20. package/src/mathHelpers/copyBagMathHelpers.d.ts +3 -4
  21. package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -1
  22. package/src/mathHelpers/copyBagMathHelpers.js +4 -5
  23. package/src/mathHelpers/copySetMathHelpers.d.ts +3 -3
  24. package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -1
  25. package/src/mathHelpers/copySetMathHelpers.js +6 -4
  26. package/src/mathHelpers/natMathHelpers.d.ts +8 -7
  27. package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
  28. package/src/mathHelpers/natMathHelpers.js +7 -8
  29. package/src/mathHelpers/setMathHelpers.d.ts +2 -0
  30. package/src/mathHelpers/setMathHelpers.d.ts.map +1 -1
  31. package/src/mathHelpers/setMathHelpers.js +2 -1
  32. package/src/payment.d.ts +4 -2
  33. package/src/payment.d.ts.map +1 -1
  34. package/src/payment.js +6 -7
  35. package/src/paymentLedger.d.ts +6 -2
  36. package/src/paymentLedger.d.ts.map +1 -1
  37. package/src/paymentLedger.js +71 -90
  38. package/src/purse.d.ts +19 -9
  39. package/src/purse.d.ts.map +1 -1
  40. package/src/purse.js +86 -25
  41. package/src/transientNotifier.d.ts +1 -1
  42. package/src/transientNotifier.d.ts.map +1 -1
  43. package/src/transientNotifier.js +5 -0
  44. package/src/typeGuards.d.ts +41 -9
  45. package/src/typeGuards.d.ts.map +1 -1
  46. package/src/typeGuards.js +38 -43
  47. package/src/types.d.ts +250 -215
  48. package/src/types.d.ts.map +1 -1
  49. package/src/types.js +305 -326
  50. package/CHANGELOG.md +0 -775
  51. package/src/types-ambient.d.ts +0 -376
  52. package/src/types-ambient.d.ts.map +0 -1
  53. package/src/types-ambient.js +0 -440
@@ -1 +1 @@
1
- {"version":3,"file":"transientNotifier.d.ts","sourceRoot":"","sources":["transientNotifier.js"],"names":[],"mappings":"AAQO;;;EAoBN"}
1
+ {"version":3,"file":"transientNotifier.d.ts","sourceRoot":"","sources":["transientNotifier.js"],"names":[],"mappings":"AAaO;;;EAoBN"}
@@ -4,6 +4,11 @@ import { makeScalarBigWeakMapStore } from '@agoric/vat-data';
4
4
  import { provideLazy } from '@agoric/store';
5
5
  import { makeNotifierKit } from '@agoric/notifier';
6
6
 
7
+ /**
8
+ * @import {Purse} from './types.js';
9
+ * @import {LatestTopic, NotifierRecord} from '@agoric/notifier');
10
+ */
11
+
7
12
  // Note: Virtual for high cardinality, but *not* durable, and so
8
13
  // broken across an upgrade.
9
14
  export const makeTransientNotifierKit = () => {
@@ -1,3 +1,4 @@
1
+ /** @import {AmountValue, AssetKindForValue, AssetValueForKind, Brand, MathHelpers} from './types.js' */
1
2
  export const BrandShape: import("@endo/patterns").Matcher;
2
3
  export const IssuerShape: import("@endo/patterns").Matcher;
3
4
  export const PaymentShape: import("@endo/patterns").Matcher;
@@ -13,10 +14,10 @@ export namespace RatioShape {
13
14
  export { AmountShape as numerator };
14
15
  export { AmountShape as denominator };
15
16
  }
16
- export function isNatValue(value: AmountValue): value is bigint;
17
- export function isCopySetValue(value: AmountValue): value is CopySet<any>;
17
+ export function isNatValue(value: AmountValue): value is import("./types.js").NatValue;
18
+ export function isCopySetValue(value: AmountValue): value is CopySet;
18
19
  export function isSetValue(value: AmountValue): value is SetValue;
19
- export function isCopyBagValue(value: AmountValue): value is CopyBag<any>;
20
+ export function isCopyBagValue(value: AmountValue): value is CopyBag;
20
21
  export const MAX_ABSOLUTE_DECIMAL_PLACES: 100;
21
22
  export const AssetKindShape: import("@endo/patterns").Matcher;
22
23
  export const DisplayInfoShape: import("@endo/patterns").Matcher;
@@ -27,16 +28,47 @@ export namespace IssuerKitShape {
27
28
  export { IssuerShape as issuer };
28
29
  export { DisplayInfoShape as displayInfo };
29
30
  }
30
- export const BrandI: import("@endo/patterns").InterfaceGuard;
31
+ export const BrandI: import("@endo/patterns").InterfaceGuard<{
32
+ isMyIssuer: import("@endo/patterns").MethodGuard;
33
+ getAllegedName: import("@endo/patterns").MethodGuard;
34
+ getDisplayInfo: import("@endo/patterns").MethodGuard;
35
+ getAmountShape: import("@endo/patterns").MethodGuard;
36
+ }>;
31
37
  export function makeIssuerInterfaces(brandShape?: Pattern, assetKindShape?: Pattern, amountShape?: Pattern): {
32
- IssuerI: import("@endo/patterns").InterfaceGuard;
33
- MintI: import("@endo/patterns").InterfaceGuard;
34
- PaymentI: import("@endo/patterns").InterfaceGuard;
38
+ IssuerI: import("@endo/patterns").InterfaceGuard<{
39
+ getBrand: import("@endo/patterns").MethodGuard;
40
+ getAllegedName: import("@endo/patterns").MethodGuard;
41
+ getAssetKind: import("@endo/patterns").MethodGuard;
42
+ getDisplayInfo: import("@endo/patterns").MethodGuard;
43
+ makeEmptyPurse: import("@endo/patterns").MethodGuard;
44
+ isLive: import("@endo/patterns").MethodGuard;
45
+ getAmountOf: import("@endo/patterns").MethodGuard;
46
+ burn: import("@endo/patterns").MethodGuard;
47
+ }>;
48
+ MintI: import("@endo/patterns").InterfaceGuard<{
49
+ getIssuer: import("@endo/patterns").MethodGuard;
50
+ mintPayment: import("@endo/patterns").MethodGuard;
51
+ }>;
52
+ PaymentI: import("@endo/patterns").InterfaceGuard<{
53
+ getAllegedBrand: import("@endo/patterns").MethodGuard;
54
+ }>;
35
55
  PurseIKit: {
36
- purse: import("@endo/patterns").InterfaceGuard;
37
- depositFacet: import("@endo/patterns").InterfaceGuard;
56
+ purse: import("@endo/patterns").InterfaceGuard<{
57
+ getAllegedBrand: import("@endo/patterns").MethodGuard;
58
+ getCurrentAmount: import("@endo/patterns").MethodGuard;
59
+ getCurrentAmountNotifier: import("@endo/patterns").MethodGuard;
60
+ deposit: import("@endo/patterns").MethodGuard;
61
+ getDepositFacet: import("@endo/patterns").MethodGuard;
62
+ withdraw: import("@endo/patterns").MethodGuard;
63
+ getRecoverySet: import("@endo/patterns").MethodGuard;
64
+ recoverAll: import("@endo/patterns").MethodGuard;
65
+ }>;
66
+ depositFacet: import("@endo/patterns").InterfaceGuard<{
67
+ receive: import("@endo/patterns").MethodGuard;
68
+ }>;
38
69
  };
39
70
  };
40
71
  declare const AmountValueShape: import("@endo/patterns").Matcher;
72
+ import type { AmountValue } from './types.js';
41
73
  export {};
42
74
  //# sourceMappingURL=typeGuards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA,0DAA+C;AAC/C,2DAAiD;AACjD,4DAAmD;AACnD,0DAA+C;AAC/C,iEAA6D;AAC7D,6DAAqD;AACrD,yDAA6C;;;;;;;;;AAqFtC,kCAHI,WAAW,mBAG0C;AASzD,sCAHI,WAAW,yBAGkD;AAYjE,kCAHI,WAAW,qBAG0C;AASzD,sCAHI,WAAW,yBAGkD;AAIxE,8CAA+C;AAE/C,8DAAuE;AAEvE,gEAaE;;;;;;;;AAYF,6DAKG;AAOI,kDAJI,OAAO,mBACP,OAAO,gBACP,OAAO;;;;;;;;EAkEjB;AAlKD,iEAKE"}
1
+ {"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAGA,wGAAwG;AAExG,0DAA+C;AAC/C,2DAAiD;AACjD,4DAAmD;AACnD,0DAA+C;AAC/C,iEAA6D;AAC7D,6DAAqD;AACrD,yDAA6C;;;;;;;;;AA+EtC,kCAHI,WAAW,GACT,KAAK,IAAI,OAAO,YAAY,EAAE,QAAQ,CAEa;AASzD,sCAHI,WAAW,GACT,KAAK,IAAI,OAAO,CAE2C;AAYjE,kCAHI,WAAW,GACT,KAAK,IAAI,QAAQ,CAEkC;AASzD,sCAHI,WAAW,GACT,KAAK,IAAI,OAAO,CAE2C;AAIxE,8CAA+C;AAE/C,8DAAuE;AAEvE,gEAaE;;;;;;;;AAYF;;;;;GAKG;AAOI,kDAJI,OAAO,mBACP,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEjB;AAlKD,iEAKE;iCArEuF,YAAY"}
package/src/typeGuards.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // @jessie-check
2
2
 
3
- import { M, matches } from '@agoric/store';
3
+ import { M, matches, getInterfaceGuardPayload } from '@endo/patterns';
4
+ /** @import {AmountValue, AssetKindForValue, AssetValueForKind, Brand, MathHelpers} from './types.js' */
4
5
 
5
6
  export const BrandShape = M.remotable('Brand');
6
7
  export const IssuerShape = M.remotable('Issuer');
@@ -11,62 +12,56 @@ export const NotifierShape = M.remotable('Notifier');
11
12
  export const MintShape = M.remotable('Mint');
12
13
 
13
14
  /**
14
- * When the AmountValue of an Amount fits the NatValueShape, i.e., when it is
15
- * a non-negative bigint, then it represents that many units of the
16
- * fungible asset represented by that amount. The brand of that amount
17
- * should indeed represent a kind of asset consisting of a countable
18
- * set of fungible units.
15
+ * When the AmountValue of an Amount fits the NatValueShape, i.e., when it is a
16
+ * non-negative bigint, then it represents that many units of the fungible asset
17
+ * represented by that amount. The brand of that amount should indeed represent
18
+ * a kind of asset consisting of a countable set of fungible units.
19
19
  */
20
20
  const NatValueShape = M.nat();
21
21
 
22
22
  /**
23
23
  * When the AmountValue of an Amount fits the CopySetValueShape, i.e., when it
24
- * is a CopySet, then it represents the set of those
25
- * keys, where each key represents some individual non-fungible
26
- * item, like a concert ticket, from the non-fungible asset class
27
- * represented by that amount's brand. The amount itself represents
28
- * the set of these items, as opposed to any of the other items
29
- * from the same asset class.
24
+ * is a CopySet, then it represents the set of those keys, where each key
25
+ * represents some individual non-fungible item, like a concert ticket, from the
26
+ * non-fungible asset class represented by that amount's brand. The amount
27
+ * itself represents the set of these items, as opposed to any of the other
28
+ * items from the same asset class.
30
29
  *
31
- * If a given value class represents concert tickets, it seems bizarre
32
- * that we can form amounts of any key. The hard constraint is that
33
- * the code that holds the mint for that asset class---the one associated
34
- * with that brand, only mints the items representing the real units
35
- * of that asset class as defined by it. Anyone else can put together
36
- * an amount expressing, for example, that they "want" some items that
37
- * will never be minted. That want will never be satisfied.
38
- * "You can't always get..."
30
+ * If a given value class represents concert tickets, it seems bizarre that we
31
+ * can form amounts of any key. The hard constraint is that the code that holds
32
+ * the mint for that asset class---the one associated with that brand, only
33
+ * mints the items representing the real units of that asset class as defined by
34
+ * it. Anyone else can put together an amount expressing, for example, that they
35
+ * "want" some items that will never be minted. That want will never be
36
+ * satisfied. "You can't always get..."
39
37
  */
40
38
  const CopySetValueShape = M.set();
41
39
 
42
40
  /**
43
- * When the AmountValue of an Amount fits the SetValueShape, i.e., when it
44
- * is a CopyArray of passable Keys. This representation is deprecated.
41
+ * When the AmountValue of an Amount fits the SetValueShape, i.e., when it is a
42
+ * CopyArray of passable Keys. This representation is deprecated.
45
43
  *
46
44
  * @deprecated Please change from using array-based SetValues to CopySet-based
47
- * CopySetValues.
45
+ * CopySetValues.
48
46
  */
49
47
  const SetValueShape = M.arrayOf(M.key());
50
48
 
51
49
  /**
52
50
  * When the AmountValue of an Amount fits the CopyBagValueShape, i.e., when it
53
- * is a CopyBag, then it represents the bag (multiset) of those
54
- * keys, where each key represents some individual semi-fungible
55
- * item, like a concert ticket, from the semi-fungible asset class
56
- * represented by that amount's brand. The number of times that key
57
- * appears in the bag is the number of fungible units of that key.
58
- * The amount itself represents
59
- * the bag of these items, as opposed to any of the other items
60
- * from the same asset class.
51
+ * is a CopyBag, then it represents the bag (multiset) of those keys, where each
52
+ * key represents some individual semi-fungible item, like a concert ticket,
53
+ * from the semi-fungible asset class represented by that amount's brand. The
54
+ * number of times that key appears in the bag is the number of fungible units
55
+ * of that key. The amount itself represents the bag of these items, as opposed
56
+ * to any of the other items from the same asset class.
61
57
  *
62
- * If a given value class represents concert tickets, it seems bizarre
63
- * that we can form amounts of any key. The hard constraint is that
64
- * the code that holds the mint for that asset class---the one associated
65
- * with that brand, only mints the items representing the real units
66
- * of that asset class as defined by it. Anyone else can put together
67
- * an amount expressing, for example, that they "want" some items that
68
- * will never be minted. That want will never be satisfied.
69
- * "You can't always get..."
58
+ * If a given value class represents concert tickets, it seems bizarre that we
59
+ * can form amounts of any key. The hard constraint is that the code that holds
60
+ * the mint for that asset class---the one associated with that brand, only
61
+ * mints the items representing the real units of that asset class as defined by
62
+ * it. Anyone else can put together an amount expressing, for example, that they
63
+ * "want" some items that will never be minted. That want will never be
64
+ * satisfied. "You can't always get..."
70
65
  */
71
66
  const CopyBagValueShape = M.bag();
72
67
 
@@ -106,11 +101,11 @@ export const isCopySetValue = value => matches(value, CopySetValueShape);
106
101
  harden(isCopySetValue);
107
102
 
108
103
  /**
109
- * Returns true if value is a pass by copy array structure. Does not
110
- * check for duplicates. To check for duplicates, use setMathHelpers.coerce.
104
+ * Returns true if value is a pass by copy array structure. Does not check for
105
+ * duplicates. To check for duplicates, use setMathHelpers.coerce.
111
106
  *
112
107
  * @deprecated Please change from using array-based SetValues to CopySet-based
113
- * CopySetValues.
108
+ * CopySetValues.
114
109
  * @param {AmountValue} value
115
110
  * @returns {value is SetValue}
116
111
  */
@@ -218,7 +213,7 @@ export const makeIssuerInterfaces = (
218
213
  });
219
214
 
220
215
  const DepositFacetI = M.interface('DepositFacet', {
221
- receive: PurseI.methodGuards.deposit,
216
+ receive: getInterfaceGuardPayload(PurseI).methodGuards.deposit,
222
217
  });
223
218
 
224
219
  const PurseIKit = harden({