@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.
- package/exported.d.ts +37 -0
- package/exported.js +2 -1
- package/package.json +37 -37
- package/src/amountMath.d.ts +46 -38
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +136 -128
- package/src/amountStore.d.ts +9 -0
- package/src/amountStore.d.ts.map +1 -0
- package/src/amountStore.js +34 -0
- package/src/displayInfo.d.ts +3 -0
- package/src/displayInfo.d.ts.map +1 -1
- package/src/displayInfo.js +3 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +4 -0
- package/src/issuerKit.d.ts +29 -9
- package/src/issuerKit.d.ts.map +1 -1
- package/src/issuerKit.js +230 -75
- package/src/legacy-payment-helpers.d.ts +9 -2
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +43 -37
- package/src/mathHelpers/copyBagMathHelpers.d.ts +3 -4
- package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copyBagMathHelpers.js +4 -5
- package/src/mathHelpers/copySetMathHelpers.d.ts +3 -3
- package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copySetMathHelpers.js +6 -4
- package/src/mathHelpers/natMathHelpers.d.ts +8 -7
- package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/natMathHelpers.js +8 -9
- package/src/mathHelpers/setMathHelpers.d.ts +2 -0
- package/src/mathHelpers/setMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/setMathHelpers.js +2 -1
- package/src/payment.d.ts +4 -2
- package/src/payment.d.ts.map +1 -1
- package/src/payment.js +8 -8
- package/src/paymentLedger.d.ts +8 -2
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +80 -97
- package/src/purse.d.ts +19 -9
- package/src/purse.d.ts.map +1 -1
- package/src/purse.js +86 -26
- package/src/ratio.d.ts +48 -0
- package/src/ratio.d.ts.map +1 -0
- package/src/ratio.js +441 -0
- package/src/safeMath.d.ts +11 -0
- package/src/safeMath.d.ts.map +1 -0
- package/src/safeMath.js +50 -0
- package/src/transientNotifier.d.ts +1 -1
- package/src/transientNotifier.d.ts.map +1 -1
- package/src/transientNotifier.js +5 -0
- package/src/typeGuards.d.ts +64 -13
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +70 -57
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +254 -220
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +474 -0
- package/CHANGELOG.md +0 -743
- package/src/types-ambient.d.ts +0 -376
- package/src/types-ambient.d.ts.map +0 -1
- package/src/types-ambient.js +0 -440
- package/src/types.js +0 -441
package/src/safeMath.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Nat } from '@endo/nat';
|
|
2
|
+
|
|
3
|
+
/** @typedef {(x: number | bigint, y: number | bigint) => bigint} NatOp */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* These operations should be used for calculations with the values of basic
|
|
7
|
+
* fungible tokens.
|
|
8
|
+
*
|
|
9
|
+
* natSafeMath is designed to be used directly, and so it needs to validate the
|
|
10
|
+
* inputs, as well as the outputs when necessary.
|
|
11
|
+
*/
|
|
12
|
+
export const natSafeMath = harden({
|
|
13
|
+
/** @type {NatOp} */
|
|
14
|
+
// BigInts don't observably overflow
|
|
15
|
+
add: (x, y) => Nat(x) + Nat(y),
|
|
16
|
+
/** @type {NatOp} */
|
|
17
|
+
subtract: (x, y) => Nat(Nat(x) - Nat(y)),
|
|
18
|
+
/** @type {NatOp} */
|
|
19
|
+
multiply: (x, y) => Nat(x) * Nat(y),
|
|
20
|
+
/** @type {NatOp} */
|
|
21
|
+
floorDivide: (x, y) => Nat(x) / Nat(y),
|
|
22
|
+
/** @type {NatOp} */
|
|
23
|
+
ceilDivide: (x, y) => {
|
|
24
|
+
y = Nat(y);
|
|
25
|
+
return Nat(Nat(x) + y - 1n) / y;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Divide using half-to-even (aka Banker's Rounding) as in IEEE 774 default
|
|
29
|
+
* rounding
|
|
30
|
+
*
|
|
31
|
+
* @type {NatOp}
|
|
32
|
+
*/
|
|
33
|
+
bankersDivide: (a, b) => {
|
|
34
|
+
a = Nat(a);
|
|
35
|
+
b = Nat(b);
|
|
36
|
+
|
|
37
|
+
const div = a / b;
|
|
38
|
+
const rem = a % b;
|
|
39
|
+
// if remainder > half divisor, should have rounded up instead of down, so add 1
|
|
40
|
+
if (rem * 2n > b) {
|
|
41
|
+
return div + 1n;
|
|
42
|
+
} else if (rem * 2n === b) {
|
|
43
|
+
// Add 1 if result is odd to get an even return value
|
|
44
|
+
if (div % 2n === 1n) return div + 1n;
|
|
45
|
+
}
|
|
46
|
+
return div;
|
|
47
|
+
},
|
|
48
|
+
/** @type {(x: number | bigint, y: number | bigint) => boolean} */
|
|
49
|
+
isGTE: (x, y) => Nat(x) >= Nat(y),
|
|
50
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transientNotifier.d.ts","sourceRoot":"","sources":["transientNotifier.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transientNotifier.d.ts","sourceRoot":"","sources":["transientNotifier.js"],"names":[],"mappings":"AAaO;;;EAoBN"}
|
package/src/transientNotifier.js
CHANGED
|
@@ -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 {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 = () => {
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {AmountValue, Ratio} from './types.js'
|
|
3
|
+
* @import {TypedPattern} from '@agoric/internal'
|
|
4
|
+
* @import {CopyBag, CopySet, Pattern} from '@endo/patterns';
|
|
5
|
+
*/
|
|
1
6
|
export const BrandShape: import("@endo/patterns").Matcher;
|
|
2
7
|
export const IssuerShape: import("@endo/patterns").Matcher;
|
|
3
8
|
export const PaymentShape: import("@endo/patterns").Matcher;
|
|
@@ -9,14 +14,24 @@ export namespace AmountShape {
|
|
|
9
14
|
export { BrandShape as brand };
|
|
10
15
|
export { AmountValueShape as value };
|
|
11
16
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* To be used to guard an amount pattern argument, i.e., an argument which is a
|
|
19
|
+
* pattern that can be used to test amounts. Since amounts are keys, anywhere an
|
|
20
|
+
* amount pattern is expected, an amount can be provided and will match only
|
|
21
|
+
* that concrete amount, i.e., amounts that are `keyEQ` to that amount.
|
|
22
|
+
*
|
|
23
|
+
* The `AmountShape` guard above is an amount pattern. But not all amount
|
|
24
|
+
* patterns are like `AmountShape`. For example, `M.any()` is a valid amount
|
|
25
|
+
* pattern that will admit any amount, but is does not resemble the
|
|
26
|
+
* `AmountShape` pattern above.
|
|
27
|
+
*/
|
|
28
|
+
export const AmountPatternShape: import("@endo/patterns").Matcher;
|
|
29
|
+
/** @type {TypedPattern<Ratio>} */
|
|
30
|
+
export const RatioShape: TypedPattern<Ratio>;
|
|
31
|
+
export function isNatValue(value: AmountValue): value is import("./types.js").NatValue;
|
|
32
|
+
export function isCopySetValue(value: AmountValue): value is CopySet;
|
|
18
33
|
export function isSetValue(value: AmountValue): value is SetValue;
|
|
19
|
-
export function isCopyBagValue(value: AmountValue): value is CopyBag
|
|
34
|
+
export function isCopyBagValue(value: AmountValue): value is CopyBag;
|
|
20
35
|
export const MAX_ABSOLUTE_DECIMAL_PLACES: 100;
|
|
21
36
|
export const AssetKindShape: import("@endo/patterns").Matcher;
|
|
22
37
|
export const DisplayInfoShape: import("@endo/patterns").Matcher;
|
|
@@ -27,16 +42,52 @@ export namespace IssuerKitShape {
|
|
|
27
42
|
export { IssuerShape as issuer };
|
|
28
43
|
export { DisplayInfoShape as displayInfo };
|
|
29
44
|
}
|
|
30
|
-
export const BrandI: import("@endo/patterns").InterfaceGuard
|
|
45
|
+
export const BrandI: import("@endo/patterns").InterfaceGuard<{
|
|
46
|
+
isMyIssuer: import("@endo/patterns").MethodGuard;
|
|
47
|
+
getAllegedName: import("@endo/patterns").MethodGuard;
|
|
48
|
+
getDisplayInfo: import("@endo/patterns").MethodGuard;
|
|
49
|
+
getAmountShape: import("@endo/patterns").MethodGuard;
|
|
50
|
+
}>;
|
|
31
51
|
export function makeIssuerInterfaces(brandShape?: Pattern, assetKindShape?: Pattern, amountShape?: Pattern): {
|
|
32
|
-
IssuerI: import("@endo/patterns").InterfaceGuard
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
IssuerI: import("@endo/patterns").InterfaceGuard<{
|
|
53
|
+
getBrand: import("@endo/patterns").MethodGuard;
|
|
54
|
+
getAllegedName: import("@endo/patterns").MethodGuard;
|
|
55
|
+
getAssetKind: import("@endo/patterns").MethodGuard;
|
|
56
|
+
getDisplayInfo: import("@endo/patterns").MethodGuard;
|
|
57
|
+
makeEmptyPurse: import("@endo/patterns").MethodGuard;
|
|
58
|
+
isLive: import("@endo/patterns").MethodGuard;
|
|
59
|
+
getAmountOf: import("@endo/patterns").MethodGuard;
|
|
60
|
+
burn: import("@endo/patterns").MethodGuard;
|
|
61
|
+
}>;
|
|
62
|
+
MintI: import("@endo/patterns").InterfaceGuard<{
|
|
63
|
+
getIssuer: import("@endo/patterns").MethodGuard;
|
|
64
|
+
mintPayment: import("@endo/patterns").MethodGuard;
|
|
65
|
+
}>;
|
|
66
|
+
PaymentI: import("@endo/patterns").InterfaceGuard<{
|
|
67
|
+
getAllegedBrand: import("@endo/patterns").MethodGuard;
|
|
68
|
+
}>;
|
|
35
69
|
PurseIKit: {
|
|
36
|
-
purse: import("@endo/patterns").InterfaceGuard
|
|
37
|
-
|
|
70
|
+
purse: import("@endo/patterns").InterfaceGuard<{
|
|
71
|
+
getAllegedBrand: import("@endo/patterns").MethodGuard;
|
|
72
|
+
getCurrentAmount: import("@endo/patterns").MethodGuard;
|
|
73
|
+
getCurrentAmountNotifier: import("@endo/patterns").MethodGuard;
|
|
74
|
+
deposit: import("@endo/patterns").MethodGuard;
|
|
75
|
+
getDepositFacet: import("@endo/patterns").MethodGuard;
|
|
76
|
+
withdraw: import("@endo/patterns").MethodGuard;
|
|
77
|
+
getRecoverySet: import("@endo/patterns").MethodGuard;
|
|
78
|
+
recoverAll: import("@endo/patterns").MethodGuard;
|
|
79
|
+
}>;
|
|
80
|
+
depositFacet: import("@endo/patterns").InterfaceGuard<{
|
|
81
|
+
receive: import("@endo/patterns").MethodGuard;
|
|
82
|
+
}>;
|
|
38
83
|
};
|
|
39
84
|
};
|
|
40
85
|
declare const AmountValueShape: import("@endo/patterns").Matcher;
|
|
86
|
+
import type { Ratio } from './types.js';
|
|
87
|
+
import type { TypedPattern } from '@agoric/internal';
|
|
88
|
+
import type { AmountValue } from './types.js';
|
|
89
|
+
import type { CopySet } from '@endo/patterns';
|
|
90
|
+
import type { CopyBag } from '@endo/patterns';
|
|
91
|
+
import type { Pattern } from '@endo/patterns';
|
|
41
92
|
export {};
|
|
42
93
|
//# sourceMappingURL=typeGuards.d.ts.map
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,0DAA+C;AAC/C,2DAAiD;AACjD,4DAAmD;AACnD,0DAA+C;AAC/C,iEAA6D;AAC7D,6DAAqD;AACrD,yDAA6C;;;;;AAkE7C;;;;;;;;;;GAUG;AACH,kEAA8C;AAE9C,kCAAkC;AAClC,yBADW,aAAa,KAAK,CAAC,CACiD;AASxE,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,0CAA2C,GAAG,CAAC;AAE/C,8DAAuE;AAEvE,gEAaE;;;;;;;;AAaF;;;;;GAKG;AAOI,kDAJI,OAAO,mBACP,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEjB;AAhLD,iEAKE;2BAxEmC,YAAY;kCAClB,kBAAkB;iCADZ,YAAY;6BAEL,gBAAgB;6BAAhB,gBAAgB;6BAAhB,gBAAgB"}
|
package/src/typeGuards.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
import { M, matches } from '@
|
|
3
|
+
import { M, matches, getInterfaceGuardPayload } from '@endo/patterns';
|
|
4
|
+
/**
|
|
5
|
+
* @import {AmountValue, Ratio} from './types.js'
|
|
6
|
+
* @import {TypedPattern} from '@agoric/internal'
|
|
7
|
+
* @import {CopyBag, CopySet, Pattern} from '@endo/patterns';
|
|
8
|
+
*/
|
|
4
9
|
|
|
5
10
|
export const BrandShape = M.remotable('Brand');
|
|
6
11
|
export const IssuerShape = M.remotable('Issuer');
|
|
@@ -11,62 +16,56 @@ export const NotifierShape = M.remotable('Notifier');
|
|
|
11
16
|
export const MintShape = M.remotable('Mint');
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
|
-
* When the AmountValue of an Amount fits the NatValueShape, i.e., when it is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* set of fungible units.
|
|
19
|
+
* When the AmountValue of an Amount fits the NatValueShape, i.e., when it is a
|
|
20
|
+
* non-negative bigint, then it represents that many units of the fungible asset
|
|
21
|
+
* represented by that amount. The brand of that amount should indeed represent
|
|
22
|
+
* a kind of asset consisting of a countable set of fungible units.
|
|
19
23
|
*/
|
|
20
24
|
const NatValueShape = M.nat();
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* 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
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* from the same asset class.
|
|
28
|
+
* is a CopySet, then it represents the set of those keys, where each key
|
|
29
|
+
* represents some individual non-fungible item, like a concert ticket, from the
|
|
30
|
+
* non-fungible asset class represented by that amount's brand. The amount
|
|
31
|
+
* itself represents the set of these items, as opposed to any of the other
|
|
32
|
+
* items from the same asset class.
|
|
30
33
|
*
|
|
31
|
-
* If a given value class represents concert tickets, it seems bizarre
|
|
32
|
-
*
|
|
33
|
-
* the
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* "You can't always get..."
|
|
34
|
+
* If a given value class represents concert tickets, it seems bizarre that we
|
|
35
|
+
* can form amounts of any key. The hard constraint is that the code that holds
|
|
36
|
+
* the mint for that asset class---the one associated with that brand, only
|
|
37
|
+
* mints the items representing the real units of that asset class as defined by
|
|
38
|
+
* it. Anyone else can put together an amount expressing, for example, that they
|
|
39
|
+
* "want" some items that will never be minted. That want will never be
|
|
40
|
+
* satisfied. "You can't always get..."
|
|
39
41
|
*/
|
|
40
42
|
const CopySetValueShape = M.set();
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
|
-
* When the AmountValue of an Amount fits the SetValueShape, i.e., when it
|
|
44
|
-
*
|
|
45
|
+
* When the AmountValue of an Amount fits the SetValueShape, i.e., when it is a
|
|
46
|
+
* CopyArray of passable Keys. This representation is deprecated.
|
|
45
47
|
*
|
|
46
48
|
* @deprecated Please change from using array-based SetValues to CopySet-based
|
|
47
|
-
*
|
|
49
|
+
* CopySetValues.
|
|
48
50
|
*/
|
|
49
51
|
const SetValueShape = M.arrayOf(M.key());
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* 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
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* the bag of these items, as opposed to any of the other items
|
|
60
|
-
* from the same asset class.
|
|
55
|
+
* is a CopyBag, then it represents the bag (multiset) of those keys, where each
|
|
56
|
+
* key represents some individual semi-fungible item, like a concert ticket,
|
|
57
|
+
* from the semi-fungible asset class represented by that amount's brand. The
|
|
58
|
+
* number of times that key appears in the bag is the number of fungible units
|
|
59
|
+
* of that key. The amount itself represents the bag of these items, as opposed
|
|
60
|
+
* to any of the other items from the same asset class.
|
|
61
61
|
*
|
|
62
|
-
* If a given value class represents concert tickets, it seems bizarre
|
|
63
|
-
*
|
|
64
|
-
* the
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* "You can't always get..."
|
|
62
|
+
* If a given value class represents concert tickets, it seems bizarre that we
|
|
63
|
+
* can form amounts of any key. The hard constraint is that the code that holds
|
|
64
|
+
* the mint for that asset class---the one associated with that brand, only
|
|
65
|
+
* mints the items representing the real units of that asset class as defined by
|
|
66
|
+
* it. Anyone else can put together an amount expressing, for example, that they
|
|
67
|
+
* "want" some items that will never be minted. That want will never be
|
|
68
|
+
* satisfied. "You can't always get..."
|
|
70
69
|
*/
|
|
71
70
|
const CopyBagValueShape = M.bag();
|
|
72
71
|
|
|
@@ -77,15 +76,25 @@ const AmountValueShape = M.or(
|
|
|
77
76
|
CopyBagValueShape,
|
|
78
77
|
);
|
|
79
78
|
|
|
80
|
-
export const AmountShape =
|
|
81
|
-
|
|
82
|
-
value: AmountValueShape,
|
|
83
|
-
});
|
|
79
|
+
export const AmountShape = { brand: BrandShape, value: AmountValueShape };
|
|
80
|
+
harden(AmountShape);
|
|
84
81
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
/**
|
|
83
|
+
* To be used to guard an amount pattern argument, i.e., an argument which is a
|
|
84
|
+
* pattern that can be used to test amounts. Since amounts are keys, anywhere an
|
|
85
|
+
* amount pattern is expected, an amount can be provided and will match only
|
|
86
|
+
* that concrete amount, i.e., amounts that are `keyEQ` to that amount.
|
|
87
|
+
*
|
|
88
|
+
* The `AmountShape` guard above is an amount pattern. But not all amount
|
|
89
|
+
* patterns are like `AmountShape`. For example, `M.any()` is a valid amount
|
|
90
|
+
* pattern that will admit any amount, but is does not resemble the
|
|
91
|
+
* `AmountShape` pattern above.
|
|
92
|
+
*/
|
|
93
|
+
export const AmountPatternShape = M.pattern();
|
|
94
|
+
|
|
95
|
+
/** @type {TypedPattern<Ratio>} */
|
|
96
|
+
export const RatioShape = { numerator: AmountShape, denominator: AmountShape };
|
|
97
|
+
harden(RatioShape);
|
|
89
98
|
|
|
90
99
|
/**
|
|
91
100
|
* Returns true if value is a Nat bigint.
|
|
@@ -106,11 +115,11 @@ export const isCopySetValue = value => matches(value, CopySetValueShape);
|
|
|
106
115
|
harden(isCopySetValue);
|
|
107
116
|
|
|
108
117
|
/**
|
|
109
|
-
* Returns true if value is a pass by copy array structure. Does not
|
|
110
|
-
*
|
|
118
|
+
* Returns true if value is a pass by copy array structure. Does not check for
|
|
119
|
+
* duplicates. To check for duplicates, use setMathHelpers.coerce.
|
|
111
120
|
*
|
|
112
121
|
* @deprecated Please change from using array-based SetValues to CopySet-based
|
|
113
|
-
*
|
|
122
|
+
* CopySetValues.
|
|
114
123
|
* @param {AmountValue} value
|
|
115
124
|
* @returns {value is SetValue}
|
|
116
125
|
*/
|
|
@@ -146,13 +155,14 @@ export const DisplayInfoShape = M.splitRecord(
|
|
|
146
155
|
},
|
|
147
156
|
);
|
|
148
157
|
|
|
149
|
-
export const IssuerKitShape =
|
|
158
|
+
export const IssuerKitShape = {
|
|
150
159
|
brand: BrandShape,
|
|
151
160
|
mint: MintShape,
|
|
152
161
|
mintRecoveryPurse: PurseShape,
|
|
153
162
|
issuer: IssuerShape,
|
|
154
163
|
displayInfo: DisplayInfoShape,
|
|
155
|
-
}
|
|
164
|
+
};
|
|
165
|
+
harden(IssuerKitShape);
|
|
156
166
|
|
|
157
167
|
// //////////////////////// Interfaces /////////////////////////////////////////
|
|
158
168
|
|
|
@@ -183,7 +193,7 @@ export const makeIssuerInterfaces = (
|
|
|
183
193
|
isLive: M.callWhen(M.await(PaymentShape)).returns(M.boolean()),
|
|
184
194
|
getAmountOf: M.callWhen(M.await(PaymentShape)).returns(amountShape),
|
|
185
195
|
burn: M.callWhen(M.await(PaymentShape))
|
|
186
|
-
.optional(
|
|
196
|
+
.optional(AmountPatternShape)
|
|
187
197
|
.returns(amountShape),
|
|
188
198
|
});
|
|
189
199
|
|
|
@@ -210,7 +220,9 @@ export const makeIssuerInterfaces = (
|
|
|
210
220
|
// `srcPayment` is a remotable, leaving it
|
|
211
221
|
// to this raw method to validate that this remotable is actually
|
|
212
222
|
// a live payment of the correct brand with sufficient funds.
|
|
213
|
-
deposit: M.call(PaymentShape)
|
|
223
|
+
deposit: M.call(PaymentShape)
|
|
224
|
+
.optional(AmountPatternShape)
|
|
225
|
+
.returns(amountShape),
|
|
214
226
|
getDepositFacet: M.call().returns(DepositFacetShape),
|
|
215
227
|
withdraw: M.call(amountShape).returns(PaymentShape),
|
|
216
228
|
getRecoverySet: M.call().returns(M.setOf(PaymentShape)),
|
|
@@ -218,13 +230,14 @@ export const makeIssuerInterfaces = (
|
|
|
218
230
|
});
|
|
219
231
|
|
|
220
232
|
const DepositFacetI = M.interface('DepositFacet', {
|
|
221
|
-
receive: PurseI.methodGuards.deposit,
|
|
233
|
+
receive: getInterfaceGuardPayload(PurseI).methodGuards.deposit,
|
|
222
234
|
});
|
|
223
235
|
|
|
224
|
-
const PurseIKit =
|
|
236
|
+
const PurseIKit = {
|
|
225
237
|
purse: PurseI,
|
|
226
238
|
depositFacet: DepositFacetI,
|
|
227
|
-
}
|
|
239
|
+
};
|
|
240
|
+
harden(PurseIKit);
|
|
228
241
|
|
|
229
242
|
return harden({
|
|
230
243
|
IssuerI,
|