@agoric/ertp 0.16.3-dev-eb7e9eb.0 → 0.16.3-u11.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/CHANGELOG.md +743 -0
- package/package.json +17 -17
- package/src/amountMath.d.ts +13 -14
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +63 -57
- package/src/issuerKit.d.ts +3 -3
- package/src/issuerKit.d.ts.map +1 -1
- package/src/issuerKit.js +57 -51
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +28 -23
- package/src/mathHelpers/copyBagMathHelpers.d.ts +3 -1
- package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copyBagMathHelpers.js +3 -1
- package/src/mathHelpers/copySetMathHelpers.d.ts +3 -1
- package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copySetMathHelpers.js +3 -1
- package/src/mathHelpers/natMathHelpers.d.ts +7 -6
- package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/natMathHelpers.js +7 -6
- package/src/payment.d.ts +1 -1
- package/src/payment.d.ts.map +1 -1
- package/src/paymentLedger.d.ts +1 -1
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +40 -36
- package/src/typeGuards.d.ts +6 -36
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +41 -35
- package/src/types-ambient.d.ts +174 -177
- package/src/types-ambient.d.ts.map +1 -1
- package/src/types-ambient.js +280 -212
- package/src/types.d.ts +174 -177
- package/src/types.d.ts.map +1 -1
- package/src/types.js +280 -212
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copySetMathHelpers.d.ts","sourceRoot":"","sources":["copySetMathHelpers.js"],"names":[],"mappings":"AAiBA
|
|
1
|
+
{"version":3,"file":"copySetMathHelpers.d.ts","sourceRoot":"","sources":["copySetMathHelpers.js"],"names":[],"mappings":"AAiBA;;GAEG;AACH,iCAFU,YAAY,OAAO,CAAC,CAa3B"}
|
|
@@ -15,7 +15,9 @@ import '../types-ambient.js';
|
|
|
15
15
|
/** @type {CopySet} */
|
|
16
16
|
const empty = makeCopySet([]);
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @type {MathHelpers<CopySet>}
|
|
20
|
+
*/
|
|
19
21
|
export const copySetMathHelpers = harden({
|
|
20
22
|
doCoerce: set => {
|
|
21
23
|
mustMatch(set, M.set(), 'set of amount');
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Fungible digital assets use the natMathHelpers to manage balances -
|
|
3
|
-
* operations are merely arithmetic on natural, non-negative
|
|
2
|
+
* Fungible digital assets use the natMathHelpers to manage balances -
|
|
3
|
+
* the operations are merely arithmetic on natural, non-negative
|
|
4
|
+
* numbers.
|
|
4
5
|
*
|
|
5
|
-
* Natural numbers are used for fungible erights such as money because
|
|
6
|
-
* issues make floats problematic. All operations should be
|
|
7
|
-
* smallest whole unit such that the `natMathHelpers` never
|
|
8
|
-
* fractional parts.
|
|
6
|
+
* Natural numbers are used for fungible erights such as money because
|
|
7
|
+
* rounding issues make floats problematic. All operations should be
|
|
8
|
+
* done with the smallest whole unit such that the `natMathHelpers` never
|
|
9
|
+
* deals with fractional parts.
|
|
9
10
|
*
|
|
10
11
|
* @type {MathHelpers<NatValue>}
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,6BAFU,YAAY,QAAQ,CAAC,CAgB5B"}
|
|
@@ -8,13 +8,14 @@ const { Fail } = assert;
|
|
|
8
8
|
const empty = 0n;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Fungible digital assets use the natMathHelpers to manage balances -
|
|
12
|
-
* operations are merely arithmetic on natural, non-negative
|
|
11
|
+
* Fungible digital assets use the natMathHelpers to manage balances -
|
|
12
|
+
* the operations are merely arithmetic on natural, non-negative
|
|
13
|
+
* numbers.
|
|
13
14
|
*
|
|
14
|
-
* Natural numbers are used for fungible erights such as money because
|
|
15
|
-
* issues make floats problematic. All operations should be
|
|
16
|
-
* smallest whole unit such that the `natMathHelpers` never
|
|
17
|
-
* fractional parts.
|
|
15
|
+
* Natural numbers are used for fungible erights such as money because
|
|
16
|
+
* rounding issues make floats problematic. All operations should be
|
|
17
|
+
* done with the smallest whole unit such that the `natMathHelpers` never
|
|
18
|
+
* deals with fractional parts.
|
|
18
19
|
*
|
|
19
20
|
* @type {MathHelpers<NatValue>}
|
|
20
21
|
*/
|
package/src/payment.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function preparePaymentKind<K extends AssetKind>(issuerBaggage:
|
|
1
|
+
export function preparePaymentKind<K extends AssetKind>(issuerBaggage: MapStore<string, unknown>, name: string, brand: Brand<K>, PaymentI: InterfaceGuard): () => Payment<K>;
|
|
2
2
|
export type Baggage = import('@agoric/vat-data').Baggage;
|
|
3
3
|
//# sourceMappingURL=payment.d.ts.map
|
package/src/payment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,wGALI,MAAM,6BAEN,cAAc,oBAgBxB;sBAvBa,OAAO,kBAAkB,EAAE,OAAO"}
|
package/src/paymentLedger.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function preparePaymentLedger<K extends AssetKind>(issuerBaggage:
|
|
1
|
+
export function preparePaymentLedger<K extends AssetKind>(issuerBaggage: MapStore<string, unknown>, name: string, assetKind: K, displayInfo: DisplayInfo<K>, elementShape: Pattern, optShutdownWithFailure?: import("@agoric/swingset-vat").ShutdownWithFailure | undefined): PaymentLedger<K>;
|
|
2
2
|
export type Baggage = import('@agoric/vat-data').Baggage;
|
|
3
3
|
//# sourceMappingURL=paymentLedger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAoFO,
|
|
1
|
+
{"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAoFO,0GAPI,MAAM,2DAGN,OAAO,6GA+UjB;sBA9Ya,OAAO,kBAAkB,EAAE,OAAO"}
|
package/src/paymentLedger.js
CHANGED
|
@@ -70,8 +70,8 @@ const amountShapeFromElementShape = (brand, assetKind, elementShape) => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Make the paymentLedger, the source of truth for the balances of
|
|
74
|
-
* minting and transfer authority originates here.
|
|
73
|
+
* Make the paymentLedger, the source of truth for the balances of
|
|
74
|
+
* payments. All minting and transfer authority originates here.
|
|
75
75
|
*
|
|
76
76
|
* @template {AssetKind} K
|
|
77
77
|
* @param {Baggage} issuerBaggage
|
|
@@ -146,21 +146,22 @@ export const preparePaymentLedger = (
|
|
|
146
146
|
);
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* A withdrawn live payment is associated with the recovery set of
|
|
150
|
-
* it was withdrawn from. Let's call these "recoverable"
|
|
151
|
-
* recoverable payments are live, but not all live
|
|
152
|
-
* We do the bookkeeping for payment recovery
|
|
153
|
-
* recoverable payments to the recovery set they are
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
149
|
+
* A withdrawn live payment is associated with the recovery set of
|
|
150
|
+
* the purse it was withdrawn from. Let's call these "recoverable"
|
|
151
|
+
* payments. All recoverable payments are live, but not all live
|
|
152
|
+
* payments are recoverable. We do the bookkeeping for payment recovery
|
|
153
|
+
* with this weakmap from recoverable payments to the recovery set they are
|
|
154
|
+
* in.
|
|
155
|
+
* A bunch of interesting invariants here:
|
|
156
|
+
* * Every payment that is a key in the outer `paymentRecoverySets`
|
|
157
|
+
* weakMap is also in the recovery set indexed by that payment.
|
|
158
|
+
* * Implied by the above but worth stating: the payment is only
|
|
159
|
+
* in at most one recovery set.
|
|
160
|
+
* * A recovery set only contains such payments.
|
|
161
|
+
* * Every purse is associated with exactly one recovery set unique to
|
|
162
|
+
* it.
|
|
163
|
+
* * A purse's recovery set only contains payments withdrawn from
|
|
164
|
+
* that purse and not yet consumed.
|
|
164
165
|
*
|
|
165
166
|
* @type {WeakMapStore<Payment, SetStore<Payment>>}
|
|
166
167
|
*/
|
|
@@ -171,7 +172,8 @@ export const preparePaymentLedger = (
|
|
|
171
172
|
|
|
172
173
|
/**
|
|
173
174
|
* To maintain the invariants listed in the `paymentRecoverySets` comment,
|
|
174
|
-
* `initPayment` should contain the only
|
|
175
|
+
* `initPayment` should contain the only
|
|
176
|
+
* call to `paymentLedger.init`.
|
|
175
177
|
*
|
|
176
178
|
* @param {Payment} payment
|
|
177
179
|
* @param {Amount} amount
|
|
@@ -187,7 +189,8 @@ export const preparePaymentLedger = (
|
|
|
187
189
|
|
|
188
190
|
/**
|
|
189
191
|
* To maintain the invariants listed in the `paymentRecoverySets` comment,
|
|
190
|
-
* `deletePayment` should contain the only
|
|
192
|
+
* `deletePayment` should contain the only
|
|
193
|
+
* call to `paymentLedger.delete`.
|
|
191
194
|
*
|
|
192
195
|
* @param {Payment} payment
|
|
193
196
|
*/
|
|
@@ -200,18 +203,19 @@ export const preparePaymentLedger = (
|
|
|
200
203
|
}
|
|
201
204
|
};
|
|
202
205
|
|
|
203
|
-
/** @type {(left: Amount, right: Amount) => Amount} */
|
|
206
|
+
/** @type {(left: Amount, right: Amount) => Amount } */
|
|
204
207
|
const add = (left, right) => AmountMath.add(left, right, brand);
|
|
205
|
-
/** @type {(left: Amount, right: Amount) => Amount} */
|
|
208
|
+
/** @type {(left: Amount, right: Amount) => Amount } */
|
|
206
209
|
const subtract = (left, right) => AmountMath.subtract(left, right, brand);
|
|
207
210
|
/** @type {(allegedAmount: Amount) => Amount} */
|
|
208
211
|
const coerce = allegedAmount => AmountMath.coerce(brand, allegedAmount);
|
|
209
|
-
/** @type {(left: Amount, right: Amount) => boolean} */
|
|
212
|
+
/** @type {(left: Amount, right: Amount) => boolean } */
|
|
210
213
|
|
|
211
214
|
/**
|
|
212
|
-
* Methods like deposit() have an optional second parameter
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
+
* Methods like deposit() have an optional second parameter
|
|
216
|
+
* `optAmountShape`
|
|
217
|
+
* which, if present, is supposed to match the balance of the
|
|
218
|
+
* payment. This helper function does that check.
|
|
215
219
|
*
|
|
216
220
|
* Note: `optAmountShape` is user-supplied with no previous validation.
|
|
217
221
|
*
|
|
@@ -239,10 +243,10 @@ export const preparePaymentLedger = (
|
|
|
239
243
|
/**
|
|
240
244
|
* Used by the purse code to implement purse.deposit
|
|
241
245
|
*
|
|
242
|
-
* @param {Amount} currentBalance - the current balance of the purse
|
|
243
|
-
*
|
|
244
|
-
* @param {(newPurseBalance: Amount) => void} updatePurseBalance -
|
|
245
|
-
*
|
|
246
|
+
* @param {Amount} currentBalance - the current balance of the purse
|
|
247
|
+
* before a deposit
|
|
248
|
+
* @param {(newPurseBalance: Amount) => void} updatePurseBalance -
|
|
249
|
+
* commit the purse balance
|
|
246
250
|
* @param {Payment} srcPayment
|
|
247
251
|
* @param {Pattern} [optAmountShape]
|
|
248
252
|
* @returns {Amount}
|
|
@@ -278,10 +282,10 @@ export const preparePaymentLedger = (
|
|
|
278
282
|
/**
|
|
279
283
|
* Used by the purse code to implement purse.withdraw
|
|
280
284
|
*
|
|
281
|
-
* @param {Amount} currentBalance - the current balance of the purse
|
|
282
|
-
*
|
|
283
|
-
* @param {(newPurseBalance: Amount) => void} updatePurseBalance -
|
|
284
|
-
*
|
|
285
|
+
* @param {Amount} currentBalance - the current balance of the purse
|
|
286
|
+
* before a withdrawal
|
|
287
|
+
* @param {(newPurseBalance: Amount) => void} updatePurseBalance -
|
|
288
|
+
* commit the purse balance
|
|
285
289
|
* @param {Amount} amount - the amount to be withdrawn
|
|
286
290
|
* @param {SetStore<Payment>} recoverySet
|
|
287
291
|
* @returns {Payment}
|
|
@@ -374,9 +378,9 @@ export const preparePaymentLedger = (
|
|
|
374
378
|
/**
|
|
375
379
|
* Provides for the recovery of newly minted but not-yet-deposited payments.
|
|
376
380
|
*
|
|
377
|
-
* Because the `mintRecoveryPurse` is placed in baggage, even if the
|
|
378
|
-
* `makeIssuerKit` drops it on the floor, it can still be
|
|
379
|
-
* emergency upgrade.
|
|
381
|
+
* Because the `mintRecoveryPurse` is placed in baggage, even if the
|
|
382
|
+
* caller of `makeIssuerKit` drops it on the floor, it can still be
|
|
383
|
+
* recovered in an emergency upgrade.
|
|
380
384
|
*
|
|
381
385
|
* @type {Purse<K>}
|
|
382
386
|
*/
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -27,44 +27,14 @@ export namespace IssuerKitShape {
|
|
|
27
27
|
export { IssuerShape as issuer };
|
|
28
28
|
export { DisplayInfoShape as displayInfo };
|
|
29
29
|
}
|
|
30
|
-
export const BrandI: import("@endo/patterns").InterfaceGuard
|
|
31
|
-
isMyIssuer: any;
|
|
32
|
-
getAllegedName: any;
|
|
33
|
-
getDisplayInfo: any;
|
|
34
|
-
getAmountShape: any;
|
|
35
|
-
}>;
|
|
30
|
+
export const BrandI: import("@endo/patterns").InterfaceGuard;
|
|
36
31
|
export function makeIssuerInterfaces(brandShape?: Pattern, assetKindShape?: Pattern, amountShape?: Pattern): {
|
|
37
|
-
IssuerI: import("@endo/patterns").InterfaceGuard
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
getAssetKind: any;
|
|
41
|
-
getDisplayInfo: any;
|
|
42
|
-
makeEmptyPurse: any;
|
|
43
|
-
isLive: any;
|
|
44
|
-
getAmountOf: any;
|
|
45
|
-
burn: any;
|
|
46
|
-
}>;
|
|
47
|
-
MintI: import("@endo/patterns").InterfaceGuard<{
|
|
48
|
-
getIssuer: any;
|
|
49
|
-
mintPayment: any;
|
|
50
|
-
}>;
|
|
51
|
-
PaymentI: import("@endo/patterns").InterfaceGuard<{
|
|
52
|
-
getAllegedBrand: any;
|
|
53
|
-
}>;
|
|
32
|
+
IssuerI: import("@endo/patterns").InterfaceGuard;
|
|
33
|
+
MintI: import("@endo/patterns").InterfaceGuard;
|
|
34
|
+
PaymentI: import("@endo/patterns").InterfaceGuard;
|
|
54
35
|
PurseIKit: {
|
|
55
|
-
purse: import("@endo/patterns").InterfaceGuard
|
|
56
|
-
|
|
57
|
-
getCurrentAmount: any;
|
|
58
|
-
getCurrentAmountNotifier: any;
|
|
59
|
-
deposit: any;
|
|
60
|
-
getDepositFacet: any;
|
|
61
|
-
withdraw: any;
|
|
62
|
-
getRecoverySet: any;
|
|
63
|
-
recoverAll: any;
|
|
64
|
-
}>;
|
|
65
|
-
depositFacet: import("@endo/patterns").InterfaceGuard<{
|
|
66
|
-
receive: any;
|
|
67
|
-
}>;
|
|
36
|
+
purse: import("@endo/patterns").InterfaceGuard;
|
|
37
|
+
depositFacet: import("@endo/patterns").InterfaceGuard;
|
|
68
38
|
};
|
|
69
39
|
};
|
|
70
40
|
declare const AmountValueShape: import("@endo/patterns").Matcher;
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -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;;;;;;;;;
|
|
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"}
|
package/src/typeGuards.js
CHANGED
|
@@ -11,56 +11,62 @@ export const NotifierShape = M.remotable('Notifier');
|
|
|
11
11
|
export const MintShape = M.remotable('Mint');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* When the AmountValue of an Amount fits the NatValueShape, i.e., when it is
|
|
15
|
-
* non-negative bigint, then it represents that many units of the
|
|
16
|
-
* represented by that amount. The brand of that amount
|
|
17
|
-
* a kind of asset consisting of a countable
|
|
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.
|
|
18
19
|
*/
|
|
19
20
|
const NatValueShape = M.nat();
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* When the AmountValue of an Amount fits the CopySetValueShape, i.e., when it
|
|
23
|
-
* is a CopySet, then it represents the set of those
|
|
24
|
-
* represents some individual non-fungible
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* items
|
|
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.
|
|
28
30
|
*
|
|
29
|
-
* If a given value class represents concert tickets, it seems bizarre
|
|
30
|
-
* can form amounts of any key. The hard constraint is that
|
|
31
|
-
* the mint for that asset class---the one associated
|
|
32
|
-
* mints the items representing the real units
|
|
33
|
-
* it. Anyone else can put together
|
|
34
|
-
*
|
|
35
|
-
*
|
|
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..."
|
|
36
39
|
*/
|
|
37
40
|
const CopySetValueShape = M.set();
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
|
-
* When the AmountValue of an Amount fits the SetValueShape, i.e., when it
|
|
41
|
-
* CopyArray of passable Keys. This representation is deprecated.
|
|
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.
|
|
42
45
|
*
|
|
43
46
|
* @deprecated Please change from using array-based SetValues to CopySet-based
|
|
44
|
-
*
|
|
47
|
+
* CopySetValues.
|
|
45
48
|
*/
|
|
46
49
|
const SetValueShape = M.arrayOf(M.key());
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* When the AmountValue of an Amount fits the CopyBagValueShape, i.e., when it
|
|
50
|
-
* is a CopyBag, then it represents the bag (multiset) of those
|
|
51
|
-
* key represents some individual semi-fungible
|
|
52
|
-
* from the semi-fungible asset class
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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.
|
|
56
61
|
*
|
|
57
|
-
* If a given value class represents concert tickets, it seems bizarre
|
|
58
|
-
* can form amounts of any key. The hard constraint is that
|
|
59
|
-
* the mint for that asset class---the one associated
|
|
60
|
-
* mints the items representing the real units
|
|
61
|
-
* it. Anyone else can put together
|
|
62
|
-
*
|
|
63
|
-
*
|
|
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..."
|
|
64
70
|
*/
|
|
65
71
|
const CopyBagValueShape = M.bag();
|
|
66
72
|
|
|
@@ -100,11 +106,11 @@ export const isCopySetValue = value => matches(value, CopySetValueShape);
|
|
|
100
106
|
harden(isCopySetValue);
|
|
101
107
|
|
|
102
108
|
/**
|
|
103
|
-
* Returns true if value is a pass by copy array structure. Does not
|
|
104
|
-
* duplicates. To check for duplicates, use setMathHelpers.coerce.
|
|
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.
|
|
105
111
|
*
|
|
106
112
|
* @deprecated Please change from using array-based SetValues to CopySet-based
|
|
107
|
-
*
|
|
113
|
+
* CopySetValues.
|
|
108
114
|
* @param {AmountValue} value
|
|
109
115
|
* @returns {value is SetValue}
|
|
110
116
|
*/
|