@agoric/ertp 0.16.3-dev-e141f05.0 → 0.16.3-dev-9c9e5cf.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/ertp",
3
- "version": "0.16.3-dev-e141f05.0+e141f05",
3
+ "version": "0.16.3-dev-9c9e5cf.0+9c9e5cf",
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",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
41
41
  "dependencies": {
42
- "@agoric/notifier": "0.6.3-dev-e141f05.0+e141f05",
43
- "@agoric/store": "0.9.3-dev-e141f05.0+e141f05",
44
- "@agoric/vat-data": "0.5.3-dev-e141f05.0+e141f05",
45
- "@agoric/zone": "0.2.3-dev-e141f05.0+e141f05",
42
+ "@agoric/notifier": "0.6.3-dev-9c9e5cf.0+9c9e5cf",
43
+ "@agoric/store": "0.9.3-dev-9c9e5cf.0+9c9e5cf",
44
+ "@agoric/vat-data": "0.5.3-dev-9c9e5cf.0+9c9e5cf",
45
+ "@agoric/zone": "0.2.3-dev-9c9e5cf.0+9c9e5cf",
46
46
  "@endo/errors": "^1.2.4",
47
47
  "@endo/eventual-send": "^1.2.4",
48
48
  "@endo/far": "^1.1.4",
@@ -52,7 +52,7 @@
52
52
  "@endo/promise-kit": "^1.1.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@agoric/swingset-vat": "0.32.3-dev-e141f05.0+e141f05",
55
+ "@agoric/swingset-vat": "0.32.3-dev-9c9e5cf.0+9c9e5cf",
56
56
  "@endo/bundle-source": "^3.3.0",
57
57
  "@fast-check/ava": "^1.1.5",
58
58
  "ava": "^5.3.0",
@@ -88,5 +88,5 @@
88
88
  "typeCoverage": {
89
89
  "atLeast": 91.23
90
90
  },
91
- "gitHead": "e141f05e1bf9f41b7c9a1afd74be18f0569ac469"
91
+ "gitHead": "9c9e5cf884e5f48554300d91ff7629773256f628"
92
92
  }
@@ -10,6 +10,18 @@ export namespace AmountShape {
10
10
  export { BrandShape as brand };
11
11
  export { AmountValueShape as value };
12
12
  }
13
+ /**
14
+ * To be used to guard an amount pattern argument, i.e., an argument which is a
15
+ * pattern that can be used to test amounts. Since amounts are keys, anywhere an
16
+ * amount pattern is expected, an amount can be provided and will match only
17
+ * that concrete amount, i.e., amounts that are `keyEQ` to that amount.
18
+ *
19
+ * The `AmountShape` guard above is an amount pattern. But not all amount
20
+ * patterns are like `AmountShape`. For example, `M.any()` is a valid amount
21
+ * pattern that will admit any amount, but is does not resemble the
22
+ * `AmountShape` pattern above.
23
+ */
24
+ export const AmountPatternShape: import("@endo/patterns").Matcher;
13
25
  export namespace RatioShape {
14
26
  export { AmountShape as numerator };
15
27
  export { AmountShape as denominator };
@@ -1 +1 @@
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"}
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;;;;;AAoE7C;;;;;;;;;;GAUG;AACH,kEAA8C;;;;;AAavC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoEjB;AAjLD,iEAKE;iCArEuF,YAAY"}
package/src/typeGuards.js CHANGED
@@ -77,6 +77,19 @@ export const AmountShape = harden({
77
77
  value: AmountValueShape,
78
78
  });
79
79
 
80
+ /**
81
+ * To be used to guard an amount pattern argument, i.e., an argument which is a
82
+ * pattern that can be used to test amounts. Since amounts are keys, anywhere an
83
+ * amount pattern is expected, an amount can be provided and will match only
84
+ * that concrete amount, i.e., amounts that are `keyEQ` to that amount.
85
+ *
86
+ * The `AmountShape` guard above is an amount pattern. But not all amount
87
+ * patterns are like `AmountShape`. For example, `M.any()` is a valid amount
88
+ * pattern that will admit any amount, but is does not resemble the
89
+ * `AmountShape` pattern above.
90
+ */
91
+ export const AmountPatternShape = M.pattern();
92
+
80
93
  export const RatioShape = harden({
81
94
  numerator: AmountShape,
82
95
  denominator: AmountShape,
@@ -178,7 +191,7 @@ export const makeIssuerInterfaces = (
178
191
  isLive: M.callWhen(M.await(PaymentShape)).returns(M.boolean()),
179
192
  getAmountOf: M.callWhen(M.await(PaymentShape)).returns(amountShape),
180
193
  burn: M.callWhen(M.await(PaymentShape))
181
- .optional(M.pattern())
194
+ .optional(AmountPatternShape)
182
195
  .returns(amountShape),
183
196
  });
184
197
 
@@ -205,7 +218,9 @@ export const makeIssuerInterfaces = (
205
218
  // `srcPayment` is a remotable, leaving it
206
219
  // to this raw method to validate that this remotable is actually
207
220
  // a live payment of the correct brand with sufficient funds.
208
- deposit: M.call(PaymentShape).optional(M.pattern()).returns(amountShape),
221
+ deposit: M.call(PaymentShape)
222
+ .optional(AmountPatternShape)
223
+ .returns(amountShape),
209
224
  getDepositFacet: M.call().returns(DepositFacetShape),
210
225
  withdraw: M.call(amountShape).returns(PaymentShape),
211
226
  getRecoverySet: M.call().returns(M.setOf(PaymentShape)),