@agoric/ertp 0.16.3-other-dev-8f8782b.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.
Files changed (63) hide show
  1. package/exported.d.ts +37 -0
  2. package/exported.js +2 -1
  3. package/package.json +37 -37
  4. package/src/amountMath.d.ts +46 -38
  5. package/src/amountMath.d.ts.map +1 -1
  6. package/src/amountMath.js +136 -128
  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 +3 -1
  13. package/src/index.d.ts +1 -0
  14. package/src/index.js +4 -0
  15. package/src/issuerKit.d.ts +29 -9
  16. package/src/issuerKit.d.ts.map +1 -1
  17. package/src/issuerKit.js +230 -75
  18. package/src/legacy-payment-helpers.d.ts +9 -2
  19. package/src/legacy-payment-helpers.d.ts.map +1 -1
  20. package/src/legacy-payment-helpers.js +43 -37
  21. package/src/mathHelpers/copyBagMathHelpers.d.ts +3 -4
  22. package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -1
  23. package/src/mathHelpers/copyBagMathHelpers.js +4 -5
  24. package/src/mathHelpers/copySetMathHelpers.d.ts +3 -3
  25. package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -1
  26. package/src/mathHelpers/copySetMathHelpers.js +6 -4
  27. package/src/mathHelpers/natMathHelpers.d.ts +8 -7
  28. package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
  29. package/src/mathHelpers/natMathHelpers.js +8 -9
  30. package/src/mathHelpers/setMathHelpers.d.ts +2 -0
  31. package/src/mathHelpers/setMathHelpers.d.ts.map +1 -1
  32. package/src/mathHelpers/setMathHelpers.js +2 -1
  33. package/src/payment.d.ts +4 -2
  34. package/src/payment.d.ts.map +1 -1
  35. package/src/payment.js +8 -8
  36. package/src/paymentLedger.d.ts +8 -2
  37. package/src/paymentLedger.d.ts.map +1 -1
  38. package/src/paymentLedger.js +80 -97
  39. package/src/purse.d.ts +19 -9
  40. package/src/purse.d.ts.map +1 -1
  41. package/src/purse.js +86 -26
  42. package/src/ratio.d.ts +48 -0
  43. package/src/ratio.d.ts.map +1 -0
  44. package/src/ratio.js +441 -0
  45. package/src/safeMath.d.ts +11 -0
  46. package/src/safeMath.d.ts.map +1 -0
  47. package/src/safeMath.js +50 -0
  48. package/src/transientNotifier.d.ts +1 -1
  49. package/src/transientNotifier.d.ts.map +1 -1
  50. package/src/transientNotifier.js +5 -0
  51. package/src/typeGuards.d.ts +64 -13
  52. package/src/typeGuards.d.ts.map +1 -1
  53. package/src/typeGuards.js +70 -57
  54. package/src/types-index.d.ts +2 -0
  55. package/src/types-index.js +2 -0
  56. package/src/types.d.ts +254 -220
  57. package/src/types.d.ts.map +1 -1
  58. package/src/types.ts +474 -0
  59. package/CHANGELOG.md +0 -743
  60. package/src/types-ambient.d.ts +0 -376
  61. package/src/types-ambient.d.ts.map +0 -1
  62. package/src/types-ambient.js +0 -440
  63. package/src/types.js +0 -441
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;;;WAiBc,MAAM,CAAC,CAAC;WACR,kBAAkB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;0BAIrB,QAAQ,WAAc,OAAO,GAAG,OAAO;;;;wBAwBvC,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS;qDAOrC,CAAC,SAAS,KAAK,GAAG,QAAQ,GACtC,CAAG,SAAS,KAAK,WACjB,CAAG,SAAS,SAAS,GAAG,OAAO,GAC/B,CAAG,SAAS,SAAS,GAAG,OAAO,GAC/B,KAAO;uDAMK,CAAC,SAAS,QAAQ,GAAG,KAAK,GACtC,CAAI,iBAAoB,KAAK,GAC7B,CAAI,SAAS,OAAO,GAAG,SAAS,GAChC,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AAE,CAAC,KAAK,OAAO,CAAC;IAC1C;;;OAGG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IAChC;;;;OAIG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;CACtC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC"}
package/src/types.ts ADDED
@@ -0,0 +1,474 @@
1
+ import type { LatestTopic } from '@agoric/notifier';
2
+ import type { ERef } from '@endo/far';
3
+ import type { RemotableObject } from '@endo/pass-style';
4
+ import type { CopyBag, CopySet, Key, Pattern } from '@endo/patterns';
5
+ import type { TypeTag } from '@agoric/internal/src/tagged.js';
6
+ import type { AssetKind } from './amountMath.js';
7
+
8
+ export type { AssetKind } from './amountMath.js';
9
+
10
+ export type NatAmount = {
11
+ brand: Brand<'nat'>;
12
+ value: bigint;
13
+ };
14
+ export type SetAmount<K extends Key> = {
15
+ brand: Brand<'set'>;
16
+ value: K[];
17
+ };
18
+ export type CopySetAmount<K extends Key> = {
19
+ brand: Brand<'copySet'>;
20
+ value: CopySet<K>;
21
+ };
22
+ export type CopyBagAmount<K extends Key> = {
23
+ brand: Brand<'copyBag'>;
24
+ value: CopyBag<K>;
25
+ };
26
+ export type AnyAmount = {
27
+ brand: Brand<any>;
28
+ value: any;
29
+ };
30
+ /**
31
+ * Amounts are descriptions of digital assets, answering the questions "how
32
+ * much" and "of what kind". Amounts are values labeled with a brand.
33
+ * AmountMath executes the logic of how amounts are changed when digital
34
+ * assets are merged, separated, or otherwise manipulated. For example, a
35
+ * deposit of 2 bucks into a purse that already has 3 bucks gives a new purse
36
+ * balance of 5 bucks. An empty purse has 0 bucks. AmountMath relies heavily
37
+ * on polymorphic MathHelpers, which manipulate the unbranded portion.
38
+ */
39
+ export type Amount<
40
+ K extends AssetKind = AssetKind,
41
+ M extends Key = Key,
42
+ > = K extends 'nat'
43
+ ? NatAmount
44
+ : K extends 'set'
45
+ ? SetAmount<M>
46
+ : K extends 'copySet'
47
+ ? CopySetAmount<M>
48
+ : K extends 'copyBag'
49
+ ? CopyBagAmount<M>
50
+ : AnyAmount;
51
+ /**
52
+ * An `AmountValue` describes a set or quantity of assets that can be owned or
53
+ * shared.
54
+ *
55
+ * A fungible `AmountValue` uses a non-negative bigint to represent a quantity
56
+ * of that many assets.
57
+ *
58
+ * A non-fungible `AmountValue` uses an array or CopySet of `Key`s to represent
59
+ * a set of whatever asset each key represents. A `Key` is a passable value
60
+ * that can be used as an element in a set (SetStore or CopySet) or as the key
61
+ * in a map (MapStore or CopyMap).
62
+ *
63
+ * `SetValue` is for the deprecated set representation, using an array directly
64
+ * to represent the array of its elements. `CopySet` is the proper
65
+ * representation using a CopySet.
66
+ *
67
+ * A semi-fungible `CopyBag` is represented as a `CopyBag` of `Key` objects.
68
+ * "Bag" is synonymous with MultiSet, where an element of a bag can be present
69
+ * once or more times, i.e., some positive bigint number of times,
70
+ * representing that quantity of the asset represented by that key.
71
+ */
72
+ export type AmountValue =
73
+ | NatValue
74
+ | SetValue
75
+ | CopySet
76
+ | import('@endo/patterns').CopyBag;
77
+ /**
78
+ * See doc-comment
79
+ * for `AmountValue`.
80
+ */
81
+ export type AssetValueForKind<
82
+ K extends AssetKind,
83
+ M extends Key = Key,
84
+ > = K extends 'nat'
85
+ ? NatValue
86
+ : K extends 'set'
87
+ ? SetValue<M>
88
+ : K extends 'copySet'
89
+ ? CopySet<M>
90
+ : K extends 'copyBag'
91
+ ? CopyBag<M>
92
+ : never;
93
+ export type AssetKindForValue<V extends AmountValue> = V extends NatValue
94
+ ? 'nat'
95
+ : V extends SetValue
96
+ ? 'set'
97
+ : V extends CopySet
98
+ ? 'copySet'
99
+ : V extends import('@endo/patterns').CopyBag
100
+ ? 'copyBag'
101
+ : never;
102
+
103
+ export type Ratio = { numerator: Amount<'nat'>; denominator: Amount<'nat'> };
104
+
105
+ /** @deprecated */
106
+ export type DisplayInfo<K extends AssetKind = AssetKind> = {
107
+ /**
108
+ * Tells the display software how many
109
+ * decimal places to move the decimal over to the left, or in other words,
110
+ * which position corresponds to whole numbers. We require fungible digital
111
+ * assets to be represented in integers, in the smallest unit (i.e. USD might
112
+ * be represented in mill, a thousandth of a dollar. In that case,
113
+ * `decimalPlaces` would be 3.) This property is optional, and for
114
+ * non-fungible digital assets, should not be specified. The decimalPlaces
115
+ * property should be used for _display purposes only_. Any other use is an
116
+ * anti-pattern.
117
+ */
118
+ decimalPlaces?: number | undefined;
119
+ /**
120
+ * - the kind of asset, either AssetKind.NAT (fungible)
121
+ * or AssetKind.SET or AssetKind.COPY_SET (non-fungible)
122
+ */
123
+ assetKind: K;
124
+ };
125
+ export type BrandMethods<K extends AssetKind> = {
126
+ /**
127
+ * Should be used with `issuer.getBrand` to ensure an issuer and brand match.
128
+ */
129
+ isMyIssuer: (allegedIssuer: ERef<Issuer<K>>) => Promise<boolean>;
130
+ getAllegedName: () => string;
131
+ /** @deprecated look up in boardAux */
132
+ getDisplayInfo: () => DisplayInfo<K>;
133
+ getAmountShape: () => Pattern;
134
+ };
135
+ /**
136
+ * The brand identifies the
137
+ * kind of issuer, and has a function to get the alleged name for the kind of
138
+ * asset described. The alleged name (such as 'BTC' or 'moola') is provided by
139
+ * the maker of the issuer and should not be trusted as accurate.
140
+ *
141
+ * Every amount created by a particular issuer will share the same brand, but
142
+ * recipients cannot rely on the brand to verify that a purported amount
143
+ * represents the issuer they intended, since the same brand can be reused by
144
+ * a misbehaving issuer.
145
+ */
146
+ export type Brand<K extends AssetKind = AssetKind> = RemotableObject &
147
+ BrandMethods<K>;
148
+ /**
149
+ * Return true if the payment continues to exist.
150
+ *
151
+ * If the payment is a promise, the operation will proceed upon fulfillment.
152
+ */
153
+ export type IssuerIsLive = (payment: ERef<Payment>) => Promise<boolean>;
154
+ /**
155
+ * Get the amount of digital assets in the payment.
156
+ * Because the payment is not trusted, we cannot call a method on it directly,
157
+ * and must use the issuer instead.
158
+ *
159
+ * If the payment is a promise, the operation will proceed upon fulfillment.
160
+ */
161
+ export type IssuerGetAmountOf<K extends AssetKind, M extends Key = Key> = (
162
+ payment: ERef<Payment<K, M>>,
163
+ ) => Promise<Amount<K, M>>;
164
+ /**
165
+ * Burn all of the digital assets in the payment.
166
+ * `optAmountShape` is optional. If the `optAmountShape` pattern is present,
167
+ * the amount of the digital assets in the payment must match
168
+ * `optAmountShape`, to prevent sending the wrong payment and other
169
+ * confusion.
170
+ *
171
+ * If the payment is a promise, the operation will proceed upon fulfillment.
172
+ *
173
+ * As always with optional `Pattern` arguments, keep in mind that technically
174
+ * the value `undefined` itself is a valid `Key` and therefore a valid
175
+ * `Pattern`. But in optional pattern position, a top level `undefined` will
176
+ * be interpreted as absence. If you want to express a `Pattern` that will
177
+ * match only `undefined`, use `M.undefined()` instead.
178
+ */
179
+ export type IssuerBurn = (
180
+ payment: ERef<Payment>,
181
+ optAmountShape?: Pattern,
182
+ ) => Promise<Amount>;
183
+ /**
184
+ * Work around JSDoc union handling
185
+ */
186
+ export type IssuerMethods<K extends AssetKind, M extends Key> = {
187
+ /**
188
+ * Get the Brand for this Issuer. The Brand
189
+ * indicates the type of digital asset and is shared by the mint, the issuer,
190
+ * and any purses and payments of this particular kind. The brand is not
191
+ * closely held, so this function should not be trusted to identify an issuer
192
+ * alone. Fake digital assets and amount can use another issuer's brand.
193
+ */
194
+ getBrand: () => Brand<K>;
195
+ /**
196
+ * Get the allegedName for this
197
+ * mint/issuer
198
+ */
199
+ getAllegedName: () => string;
200
+ /**
201
+ * Get the kind of MathHelpers used by this
202
+ * Issuer.
203
+ */
204
+ getAssetKind: () => K;
205
+ /** @deprecated look up in boardAux */
206
+ getDisplayInfo: () => DisplayInfo<K>;
207
+ /**
208
+ * Make an empty purse of this
209
+ * brand.
210
+ */
211
+ makeEmptyPurse: () => Purse<K, M>;
212
+ isLive: IssuerIsLive;
213
+ getAmountOf: IssuerGetAmountOf<K, M>;
214
+ burn: IssuerBurn;
215
+ };
216
+ /**
217
+ * The issuer cannot
218
+ * mint a new amount, but it can create empty purses and payments. The issuer
219
+ * can also transform payments (splitting payments, combining payments,
220
+ * burning payments, and claiming payments exclusively). The issuer should be
221
+ * gotten from a trusted source and then relied upon as the decider of whether
222
+ * an untrusted payment is valid.
223
+ */
224
+ export type Issuer<
225
+ K extends AssetKind = AssetKind,
226
+ M extends Key = Key,
227
+ > = RemotableObject & IssuerMethods<K, M>;
228
+ export type PaymentLedger<K extends AssetKind = AssetKind> = {
229
+ mint: Mint<K>;
230
+ /**
231
+ * Externally useful only if this issuer
232
+ * uses recovery sets. Can be used to get the recovery set associated with
233
+ * minted payments that are still live.
234
+ */
235
+ mintRecoveryPurse: Purse<K>;
236
+ issuer: Issuer<K>;
237
+ brand: Brand<K>;
238
+ };
239
+ export type IssuerKit<K extends AssetKind = AssetKind, M extends Key = Key> = {
240
+ mint: Mint<K, M>;
241
+ /**
242
+ * Externally useful only if this
243
+ * issuer uses recovery sets. Can be used to get the recovery set associated
244
+ * with minted payments that are still live.
245
+ */
246
+ mintRecoveryPurse: Purse<K, M>;
247
+ issuer: Issuer<K, M>;
248
+ brand: Brand<K>;
249
+ displayInfo: DisplayInfo;
250
+ };
251
+ export type AdditionalDisplayInfo = {
252
+ /**
253
+ * Tells the display software how many
254
+ * decimal places to move the decimal over to the left, or in other words,
255
+ * which position corresponds to whole numbers. We require fungible digital
256
+ * assets to be represented in integers, in the smallest unit (i.e. USD might
257
+ * be represented in mill, a thousandth of a dollar. In that case,
258
+ * `decimalPlaces` would be 3.) This property is optional, and for
259
+ * non-fungible digital assets, should not be specified. The decimalPlaces
260
+ * property should be used for _display purposes only_. Any other use is an
261
+ * anti-pattern.
262
+ */
263
+ decimalPlaces?: number | undefined;
264
+ assetKind?: AssetKind | undefined;
265
+ };
266
+ /**
267
+ * Holding a Mint carries the right to issue new digital
268
+ * assets. These assets all have the same kind, which is called a Brand.
269
+ */
270
+ export type Mint<K extends AssetKind = AssetKind, M extends Key = Key> = {
271
+ /**
272
+ * Gets the Issuer for this mint.
273
+ */
274
+ getIssuer: () => Issuer<K, M>;
275
+ /**
276
+ * Creates a new
277
+ * Payment containing newly minted amount.
278
+ */
279
+ mintPayment: (newAmount: Amount<K>) => Payment<K, M>;
280
+ };
281
+ /**
282
+ * Issuers first became durable with mandatory recovery sets. Later they were
283
+ * made optional, but there is no support for converting from one state to the
284
+ * other. Thus, absence of a `RecoverySetsOption` state is equivalent to
285
+ * `'hasRecoverySets'`. In the absence of a `recoverySetsOption` parameter,
286
+ * upgradeIssuerKit defaults to the predecessor's `RecoverySetsOption` state, or
287
+ * `'hasRecoverySets'` if none.
288
+ *
289
+ * At this time, issuers started in one of the states (`'noRecoverySets'`, or
290
+ * `'hasRecoverySets'`) cannot be converted to the other on upgrade. If this
291
+ * transition is needed, it can likely be supported in a future upgrade. File an
292
+ * issue on github and explain what you need and why.
293
+ */
294
+ export type RecoverySetsOption = 'hasRecoverySets' | 'noRecoverySets';
295
+ export type DepositFacetReceive = (
296
+ payment: Payment,
297
+ optAmountShape?: Pattern,
298
+ ) => Amount;
299
+ export type DepositFacet = {
300
+ /**
301
+ * Deposit all the contents of payment
302
+ * into the purse that made this facet, returning the amount. If the optional
303
+ * argument `optAmount` does not equal the amount of digital assets in the
304
+ * payment, throw an error.
305
+ *
306
+ * If payment is a promise, throw an error.
307
+ */
308
+ receive: DepositFacetReceive;
309
+ };
310
+ /**
311
+ * Purses hold amount of
312
+ * digital assets of the same brand, but unlike Payments, they are not meant
313
+ * to be sent to others. To transfer digital assets, a Payment should be
314
+ * withdrawn from a Purse. The amount of digital assets in a purse can change
315
+ * through the action of deposit() and withdraw().
316
+ */
317
+ export type Purse<
318
+ K extends AssetKind = AssetKind,
319
+ M extends Key = Key,
320
+ > = RemotableObject & PurseMethods<K, M>;
321
+ /**
322
+ * The primary use for Purses and Payments is for
323
+ * currency-like and goods-like digital assets, but they can also be used to
324
+ * represent other kinds of rights, such as the right to participate in a
325
+ * particular contract.
326
+ */
327
+ export type PurseMethods<
328
+ K extends AssetKind = AssetKind,
329
+ M extends Key = Key,
330
+ > = {
331
+ /**
332
+ * Get the alleged Brand for this
333
+ * Purse
334
+ */
335
+ getAllegedBrand: () => Brand<K>;
336
+ /**
337
+ * Get the amount contained in
338
+ * this purse.
339
+ */
340
+ getCurrentAmount: () => Amount<K, M>;
341
+ /**
342
+ * Get a
343
+ * lossy notifier for changes to this purse's balance.
344
+ */
345
+ getCurrentAmountNotifier: () => LatestTopic<Amount<K, M>>;
346
+ /**
347
+ * Deposit all the contents of payment into this purse, returning the amount. If
348
+ * the optional argument `optAmount` does not equal the amount of digital
349
+ * assets in the payment, throw an error.
350
+ *
351
+ * If payment is a promise, throw an error.
352
+ */
353
+ deposit: <P extends Payment<K, M>>(
354
+ payment: P,
355
+ optAmountShape?: Pattern,
356
+ ) => P extends Payment<K, M> ? Amount<K, M> : never;
357
+ /**
358
+ * Return an object whose
359
+ * `receive` method deposits to the current Purse.
360
+ */
361
+ getDepositFacet: () => DepositFacet;
362
+ /**
363
+ * Withdraw amount
364
+ * from this purse into a new Payment.
365
+ */
366
+ withdraw: (amount: Amount<K, M>) => Payment<K, M>;
367
+ /**
368
+ * The set of payments
369
+ * withdrawn from this purse that are still live. These are the payments that
370
+ * can still be recovered in emergencies by, for example, depositing into this
371
+ * purse. Such a deposit action is like canceling an outstanding check because
372
+ * you're tired of waiting for it. Once your cancellation is acknowledged, you
373
+ * can spend the assets at stake on other things. Afterwards, if the recipient
374
+ * of the original check finally gets around to depositing it, their deposit
375
+ * fails.
376
+ *
377
+ * Returns an empty set if this issuer does not support recovery sets.
378
+ */
379
+ getRecoverySet: () => CopySet<Payment<K, M>>;
380
+ /**
381
+ * For use in emergencies, such as
382
+ * coming back from a traumatic crash and upgrade. This deposits all the
383
+ * payments in this purse's recovery set into the purse itself, returning the
384
+ * total amount of assets recovered.
385
+ *
386
+ * Returns an empty amount if this issuer does not support recovery sets.
387
+ */
388
+ recoverAll: () => Amount<K, M>;
389
+ };
390
+ /**
391
+ * Payments hold amount
392
+ * of digital assets of the same brand in transit. Payments can be deposited
393
+ * in purses, split into multiple payments, combined, and claimed (getting an
394
+ * exclusive payment). Payments are linear, meaning that either a payment has
395
+ * the same amount of digital assets it started with, or it is used up
396
+ * entirely. It is impossible to partially use a payment.
397
+ *
398
+ * Payments are often received from other actors and therefore should not be
399
+ * trusted themselves. To get the amount of digital assets in a payment, use
400
+ * the trusted issuer: issuer.getAmountOf(payment),
401
+ *
402
+ * Payments can be converted to Purses by getting a trusted issuer and calling
403
+ * `issuer.makeEmptyPurse()` to create a purse, then
404
+ * `purse.deposit(payment)`.
405
+ */
406
+ export type Payment<
407
+ K extends AssetKind = AssetKind,
408
+ M extends Key = Key,
409
+ > = RemotableObject &
410
+ TypeTag<
411
+ {
412
+ /**
413
+ * Get the allegedBrand, indicating
414
+ * the type of digital asset this payment purports to be, and which issuer to
415
+ * use. Because payments are not trusted, any method calls on payments should
416
+ * be treated with suspicion and verified elsewhere.
417
+ */
418
+ getAllegedBrand: () => Brand<K>;
419
+ },
420
+ 'Set-like value type',
421
+ M
422
+ >;
423
+
424
+ /**
425
+ * All of the difference in how digital asset
426
+ * amount are manipulated can be reduced to the behavior of the math on
427
+ * values. We extract this custom logic into mathHelpers. MathHelpers are
428
+ * about value arithmetic, whereas AmountMath is about amounts, which are the
429
+ * values labeled with a brand. AmountMath use mathHelpers to do their value
430
+ * arithmetic, and then brand the results, making a new amount.
431
+ *
432
+ * The MathHelpers are designed to be called only from AmountMath, and so all
433
+ * methods but coerce can assume their inputs are valid. They only need to do
434
+ * output validation, and only when there is a possibility of invalid output.
435
+ */
436
+ export type MathHelpers<V extends AmountValue> = {
437
+ /**
438
+ * Check the kind of this value and
439
+ * throw if it is not the expected kind.
440
+ */
441
+ doCoerce: (allegedValue: V) => V;
442
+ /**
443
+ * Get the representation for the identity
444
+ * element (often 0 or an empty array)
445
+ */
446
+ doMakeEmpty: () => V;
447
+ /**
448
+ * Is the value the identity
449
+ * element?
450
+ */
451
+ doIsEmpty: (value: V) => boolean;
452
+ /**
453
+ * Is the left greater than
454
+ * or equal to the right?
455
+ */
456
+ doIsGTE: (left: V, right: V) => boolean;
457
+ /**
458
+ * Does left equal right?
459
+ */
460
+ doIsEqual: (left: V, right: V) => boolean;
461
+ /**
462
+ * Return the left combined with the
463
+ * right.
464
+ */
465
+ doAdd: (left: V, right: V) => V;
466
+ /**
467
+ * Return what remains after
468
+ * removing the right from the left. If something in the right was not in the
469
+ * left, we throw an error.
470
+ */
471
+ doSubtract: (left: V, right: V) => V;
472
+ };
473
+ export type NatValue = bigint;
474
+ export type SetValue<K extends Key = Key> = K[];