@agoric/ertp 0.16.3-other-dev-3eb1a1d.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/package.json +24 -24
- package/src/amountMath.d.ts +14 -10
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +15 -11
- package/src/issuerKit.d.ts +9 -14
- package/src/issuerKit.d.ts.map +1 -1
- package/src/issuerKit.js +34 -21
- package/src/legacy-payment-helpers.d.ts +6 -4
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +15 -9
- package/src/payment.d.ts +1 -1
- package/src/payment.d.ts.map +1 -1
- package/src/payment.js +2 -1
- package/src/paymentLedger.d.ts +3 -1
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +10 -8
- package/src/purse.d.ts +2 -2
- 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/typeGuards.d.ts +4 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +1 -0
- package/src/types.d.ts +3 -3
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +16 -10
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/ertp",
|
|
3
|
-
"version": "0.16.3-other-dev-
|
|
3
|
+
"version": "0.16.3-other-dev-fbe72e7.0.fbe72e7",
|
|
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",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^
|
|
8
|
+
"node": "^20.9 || ^22.11"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "tsc --build tsconfig.build.json",
|
|
13
|
-
"postpack": "git clean -f '*.d
|
|
12
|
+
"prepack": "yarn run -T tsc --build tsconfig.build.json",
|
|
13
|
+
"postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'",
|
|
14
14
|
"test": "ava",
|
|
15
|
-
"test:c8": "c8 --all $C8_OPTIONS ava",
|
|
15
|
+
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
16
16
|
"test:xs": "yarn test:xs-worker",
|
|
17
17
|
"test:xs-unit": "exit 0",
|
|
18
18
|
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 test/swingsetTests",
|
|
19
19
|
"lint-fix": "yarn lint:eslint --fix",
|
|
20
|
-
"lint": "run-s --continue-on-error lint:*",
|
|
21
|
-
"lint:eslint": "eslint .",
|
|
22
|
-
"lint:types": "tsc"
|
|
20
|
+
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
21
|
+
"lint:eslint": "yarn run -T eslint .",
|
|
22
|
+
"lint:types": "yarn run -T tsc"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -39,24 +39,24 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agoric/notifier": "0.6.3-other-dev-
|
|
43
|
-
"@agoric/store": "0.9.3-other-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-other-dev-
|
|
45
|
-
"@agoric/zone": "0.2.3-other-dev-
|
|
46
|
-
"@endo/errors": "^1.2.
|
|
47
|
-
"@endo/eventual-send": "^1.
|
|
48
|
-
"@endo/far": "^1.1.
|
|
49
|
-
"@endo/marshal": "^1.
|
|
50
|
-
"@endo/nat": "^5.
|
|
51
|
-
"@endo/patterns": "^1.
|
|
52
|
-
"@endo/promise-kit": "^1.1.
|
|
42
|
+
"@agoric/notifier": "0.6.3-other-dev-fbe72e7.0.fbe72e7",
|
|
43
|
+
"@agoric/store": "0.9.3-other-dev-fbe72e7.0.fbe72e7",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-other-dev-fbe72e7.0.fbe72e7",
|
|
45
|
+
"@agoric/zone": "0.2.3-other-dev-fbe72e7.0.fbe72e7",
|
|
46
|
+
"@endo/errors": "^1.2.13",
|
|
47
|
+
"@endo/eventual-send": "^1.3.4",
|
|
48
|
+
"@endo/far": "^1.1.14",
|
|
49
|
+
"@endo/marshal": "^1.8.0",
|
|
50
|
+
"@endo/nat": "^5.1.3",
|
|
51
|
+
"@endo/patterns": "^1.7.0",
|
|
52
|
+
"@endo/promise-kit": "^1.1.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-other-dev-
|
|
56
|
-
"@endo/bundle-source": "^
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
|
|
56
|
+
"@endo/bundle-source": "^4.1.2",
|
|
57
57
|
"@fast-check/ava": "^1.1.5",
|
|
58
58
|
"ava": "^5.3.0",
|
|
59
|
-
"tsd": "^0.
|
|
59
|
+
"tsd": "^0.33.0"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"src",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
79
|
"typeCoverage": {
|
|
80
|
-
"atLeast":
|
|
80
|
+
"atLeast": 92.99
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
|
|
83
83
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export namespace AssetKind {
|
|
|
9
9
|
let COPY_BAG: "copyBag";
|
|
10
10
|
}
|
|
11
11
|
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
12
|
-
export function assertValueGetHelpers<V>(value: V): MathHelpers<V>;
|
|
12
|
+
export function assertValueGetHelpers<V extends AmountValue>(value: V): MathHelpers<V>;
|
|
13
13
|
export namespace AmountMath {
|
|
14
|
-
export function make<B extends Brand
|
|
14
|
+
export function make<B extends Brand<any>, V extends NatValue | CopySet | CopyBag | SetValue>(brand: B, allegedValue: V): B extends Brand<"nat"> ? NatAmount : V extends NatValue ? NatAmount : V extends CopySet ? CopySetAmount<V["payload"][0]> : V extends CopyBag ? CopyBagAmount<V["payload"][0][0]> : V extends SetValue ? SetAmount<V[0]> : never;
|
|
15
15
|
export function coerce<A extends Amount>(brand: Brand, allegedAmount: A): A;
|
|
16
16
|
export function getValue<A extends Amount>(brand: Brand, amount: A): A["value"];
|
|
17
17
|
export let makeEmpty: {
|
|
@@ -19,15 +19,19 @@ export namespace AmountMath {
|
|
|
19
19
|
<K extends AssetKind>(brand: Brand<K>, assetKind: K): Amount<K>;
|
|
20
20
|
};
|
|
21
21
|
export function makeEmptyFromAmount<A extends Amount>(amount: A): A;
|
|
22
|
-
export function isEmpty(amount: Amount, brand?: Brand
|
|
22
|
+
export function isEmpty(amount: Amount, brand?: Brand): boolean;
|
|
23
23
|
export { isGTE };
|
|
24
|
-
export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): boolean;
|
|
25
|
+
export let add: {
|
|
26
|
+
<A extends CopyBag, B extends CopyBag>(leftAmount: CopyBagAmount<A>, rightAmount: CopyBagAmount<B>, brand?: Brand): CopyBagAmount<A | B>;
|
|
27
|
+
<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): A;
|
|
28
|
+
};
|
|
29
|
+
export function subtract<L extends Amount, R extends Amount>(leftAmount: L, rightAmount: R, brand?: Brand): L extends R ? L : never;
|
|
30
|
+
export function min<A extends Amount>(x: A, y: A, brand?: Brand): A;
|
|
31
|
+
export function max<A extends Amount>(x: A, y: A, brand?: Brand): A;
|
|
29
32
|
}
|
|
30
|
-
export function getAssetKind(amount: Amount): "copySet" | "
|
|
33
|
+
export function getAssetKind(amount: Amount): "copySet" | "copyBag" | "set" | "nat";
|
|
34
|
+
import type { AmountValue } from './types.js';
|
|
31
35
|
import type { MathHelpers } from './types.js';
|
|
32
36
|
import type { Brand } from './types.js';
|
|
33
37
|
import type { NatValue } from './types.js';
|
|
@@ -52,6 +56,6 @@ import type { Amount } from './types.js';
|
|
|
52
56
|
* @param {Brand<K>} [brand]
|
|
53
57
|
* @returns {boolean}
|
|
54
58
|
*/
|
|
55
|
-
declare function isGTE<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K>
|
|
59
|
+
declare function isGTE<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K>): boolean;
|
|
56
60
|
export {};
|
|
57
61
|
//# sourceMappingURL=amountMath.d.ts.map
|
package/src/amountMath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":";;;wBAkBU,CAAC,OAAO,SAAS,EAAE,MAAM,OAAO,SAAS,CAAC;;;;;;;AAY7C,2CADK,SAAS,QAIpB;AA8EM,
|
|
1
|
+
{"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":";;;wBAkBU,CAAC,OAAO,SAAS,EAAE,MAAM,OAAO,SAAS,CAAC;;;;;;;AAY7C,2CADK,SAAS,QAIpB;AA8EM,sCAJoB,CAAC,SAAf,WAAa,SACf,CAAC,GACC,YAAY,CAAC,CAAC,CAIc;;IAwGjC,qBAhBoB,CAAC,SAAd,MAAO,GAAG,CAAE,EAC8B,CAAC,SAA1C,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAS,SAC3C,CAAC,gBACD,CAAC,GACC,CAAC,SAAS,MAAM,KAAK,CAAC,GAC1B,SAAS,GACT,CAAC,SAAS,QAAQ,GAChB,SAAS,GACT,CAAC,SAAS,OAAO,GACf,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9B,CAAC,SAAS,OAAO,GACf,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACjC,CAAC,SAAS,QAAQ,GAChB,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,GACf,KAAK,CAQrB;IAUO,uBALc,CAAC,SAAV,MAAQ,SACV,KAAK,iBACL,CAAC,GACC,CAAC,CAWb;IASS,yBALY,CAAC,SAAV,MAAQ,SACV,KAAK,UACL,CAAC,GACC,CAAC,CAAC,OAAO,CAAC,CAE4C;0BAKzD;QACT,CAAK,KAAK,EAAE,KAAK,GAAG,OAAO,KAAK,CAAC,CAAC;QAClC,CAAK,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;KACjE;IAiBiB,oCAJC,CAAC,SAAV,MAAQ,UACV,CAAC,GACC,CAAC,CAQb;IAQQ,gCAJE,MAAM,UACN,KAAK,GACH,OAAO,CASnB;;IAYQ,wBANa,CAAC,SAAV,MAAQ,cACV,CAAC,eACD,CAAC,UACD,KAAK,GACH,OAAO,CAKnB;oBAQS;QACT,CAAK,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,OAAO,EACnC,UAAU,EAAE,cAAc,CAAC,CAAC,EAC5B,WAAW,EAAE,cAAc,CAAC,CAAC,EAC7B,KAAK,CAAC,EAAE,KAAK,GACZ,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAK,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;KACrE;IAqBM,yBAPY,CAAC,SAAV,MAAQ,EACC,CAAC,SAAV,MAAQ,cACV,CAAC,eACD,CAAC,UACD,KAAK,GACH,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAOnC;IAUI,oBANiB,CAAC,SAAV,MAAQ,KACV,CAAC,KACD,CAAC,UACD,KAAK,GACH,CAAC,CAQ8B;IAUvC,oBANiB,CAAC,SAAV,MAAQ,KACV,CAAC,KACD,CAAC,UACD,KAAK,GACH,CAAC,CAQ8B;;AAKvC,qCADK,MAAM,yCAKjB;iCA/XoJ,YAAY;iCAAZ,YAAY;2BAAZ,YAAY;8BAAZ,YAAY;6BAD9H,gBAAgB;6BAAhB,gBAAgB;8BACkG,YAAY;+BAAZ,YAAY;mCAAZ,YAAY;mCAAZ,YAAY;+BAAZ,YAAY;4BAAZ,YAAY;AA4JjK;;;;;;;;;;;;GAYG;AACH,uBANyB,CAAC,SAAZ,SAAU,cACb,OAAO,CAAC,CAAC,eACT,OAAO,CAAC,CAAC,UACT,MAAM,CAAC,CAAC,GACN,OAAO,CAKnB"}
|
package/src/amountMath.js
CHANGED
|
@@ -9,7 +9,7 @@ import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @import {CopyBag, CopySet} from '@endo/patterns';
|
|
12
|
-
* @import {Amount, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
|
|
12
|
+
* @import {Amount, AmountValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// NB: AssetKind is both a constant for enumerated values and a type for those values.
|
|
@@ -105,7 +105,7 @@ const assertValueGetAssetKind = value => {
|
|
|
105
105
|
*
|
|
106
106
|
* Made available only for testing, but it is harmless for other uses.
|
|
107
107
|
*
|
|
108
|
-
* @template V
|
|
108
|
+
* @template {AmountValue} V
|
|
109
109
|
* @param {V} value
|
|
110
110
|
* @returns {MathHelpers<V>}
|
|
111
111
|
*/
|
|
@@ -113,7 +113,9 @@ export const assertValueGetHelpers = value =>
|
|
|
113
113
|
// @ts-expect-error cast
|
|
114
114
|
helpers[assertValueGetAssetKind(value)];
|
|
115
115
|
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* @type {(allegedBrand: Brand<any>, brand?: Brand<any>) => void}
|
|
118
|
+
*/
|
|
117
119
|
const optionalBrandCheck = (allegedBrand, brand) => {
|
|
118
120
|
if (brand !== undefined) {
|
|
119
121
|
assertRemotable(brand, 'brand');
|
|
@@ -156,7 +158,7 @@ const checkLRAndGetHelpers = (leftAmount, rightAmount, brand = undefined) => {
|
|
|
156
158
|
* @param {MathHelpers<AssetValueForKind<K>>} h
|
|
157
159
|
* @param {Amount<K>} leftAmount
|
|
158
160
|
* @param {Amount<K>} rightAmount
|
|
159
|
-
* @returns {[K
|
|
161
|
+
* @returns {[AssetValueForKind<K>, AssetValueForKind<K>]}
|
|
160
162
|
*/
|
|
161
163
|
const coerceLR = (h, leftAmount, rightAmount) => {
|
|
162
164
|
// @ts-expect-error could be arbitrary subtype
|
|
@@ -197,7 +199,7 @@ export const AmountMath = {
|
|
|
197
199
|
*
|
|
198
200
|
* Does not verify that the Brand's AssetKind matches the value's.
|
|
199
201
|
*
|
|
200
|
-
* @template {Brand} B
|
|
202
|
+
* @template {Brand<any>} B
|
|
201
203
|
* @template {NatValue | CopySet | CopyBag | SetValue} V
|
|
202
204
|
* @param {B} brand
|
|
203
205
|
* @param {V} allegedValue
|
|
@@ -316,16 +318,18 @@ export const AmountMath = {
|
|
|
316
318
|
* amount, it usually means including all of the elements from both left and
|
|
317
319
|
* right.
|
|
318
320
|
*
|
|
319
|
-
* @
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
321
|
+
* @type {{
|
|
322
|
+
* <A extends CopyBag, B extends CopyBag>(
|
|
323
|
+
* leftAmount: CopyBagAmount<A>,
|
|
324
|
+
* rightAmount: CopyBagAmount<B>,
|
|
325
|
+
* brand?: Brand,
|
|
326
|
+
* ): CopyBagAmount<A | B>;
|
|
327
|
+
* <A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand): A;
|
|
328
|
+
* }}
|
|
324
329
|
*/
|
|
325
330
|
add: (leftAmount, rightAmount, brand = undefined) => {
|
|
326
331
|
const h = checkLRAndGetHelpers(leftAmount, rightAmount, brand);
|
|
327
332
|
const value = h.doAdd(...coerceLR(h, leftAmount, rightAmount));
|
|
328
|
-
// @ts-expect-error different subtype
|
|
329
333
|
return harden({ brand: leftAmount.brand, value });
|
|
330
334
|
},
|
|
331
335
|
/**
|
package/src/issuerKit.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
export function upgradeIssuerKit<K extends AssetKind>(issuerBaggage:
|
|
2
|
-
export function hasIssuer(baggage:
|
|
3
|
-
export function makeDurableIssuerKit<K extends AssetKind>(issuerBaggage:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}> | undefined): IssuerKit<K>;
|
|
7
|
-
export function prepareIssuerKit<K extends AssetKind>(issuerBaggage: import("@agoric/vat-data").Baggage, name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, options?: Partial<{
|
|
8
|
-
elementShape: Pattern;
|
|
9
|
-
recoverySetsOption: RecoverySetsOption;
|
|
10
|
-
}> | undefined): IssuerKit<K>;
|
|
11
|
-
export function makeIssuerKit<K extends AssetKind = "nat">(name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, { elementShape, recoverySetsOption }?: Partial<{
|
|
12
|
-
elementShape: Pattern;
|
|
13
|
-
recoverySetsOption: RecoverySetsOption;
|
|
14
|
-
}> | undefined): IssuerKit<K, any>;
|
|
1
|
+
export function upgradeIssuerKit<K extends AssetKind>(issuerBaggage: Baggage, optShutdownWithFailure?: ShutdownWithFailure, recoverySetsOption?: RecoverySetsOption): IssuerKit<K>;
|
|
2
|
+
export function hasIssuer(baggage: Baggage): boolean;
|
|
3
|
+
export function makeDurableIssuerKit<K extends AssetKind>(issuerBaggage: Baggage, name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, { elementShape, recoverySetsOption }?: IssuerOptionsRecord): IssuerKit<K>;
|
|
4
|
+
export function prepareIssuerKit<O extends IssuerOptionsRecord, K extends AssetKind>(issuerBaggage: Baggage, name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, options?: O): O["elementShape"] extends TypedPattern<infer T extends Key> ? IssuerKit<K, T> : IssuerKit<K>;
|
|
5
|
+
export function makeIssuerKit<K extends AssetKind = "nat", O extends IssuerOptionsRecord = {}>(name: string, assetKind?: K, displayInfo?: AdditionalDisplayInfo, optShutdownWithFailure?: ShutdownWithFailure, { elementShape, recoverySetsOption }?: O): O["elementShape"] extends TypedPattern<infer T extends Key> ? IssuerKit<K, T> : IssuerKit<K>;
|
|
15
6
|
export type IssuerRecord<K extends AssetKind> = {
|
|
16
7
|
name: string;
|
|
17
8
|
assetKind: K;
|
|
@@ -37,8 +28,12 @@ export type IssuerOptionsRecord = Partial<{
|
|
|
37
28
|
recoverySetsOption: RecoverySetsOption;
|
|
38
29
|
}>;
|
|
39
30
|
import { AssetKind } from './amountMath.js';
|
|
31
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
40
32
|
import type { ShutdownWithFailure } from '@agoric/swingset-vat';
|
|
41
33
|
import type { RecoverySetsOption } from './types.js';
|
|
42
34
|
import type { IssuerKit } from './types.js';
|
|
43
35
|
import type { AdditionalDisplayInfo } from './types.js';
|
|
36
|
+
import type { Key } from '@endo/patterns';
|
|
37
|
+
import type { TypedPattern } from '@agoric/internal';
|
|
38
|
+
import type { Pattern } from '@endo/patterns';
|
|
44
39
|
//# sourceMappingURL=issuerKit.d.ts.map
|
package/src/issuerKit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuerKit.d.ts","sourceRoot":"","sources":["issuerKit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"issuerKit.d.ts","sourceRoot":"","sources":["issuerKit.js"],"names":[],"mappings":"AAkHO,iCAbkB,CAAC,SAAZ,SAAU,iBACb,OAAO,2BACP,mBAAmB,uBAOnB,kBAAkB,GAEhB,UAAU,CAAC,CAAC,CA4BxB;AAQM,mCAFI,OAAO,WAE2C;AAoDtD,qCA1BkB,CAAC,SAAZ,SAAU,iBAYb,OAAO,QACP,MAAM,cACN,CAAC,gBACD,qBAAqB,2BACrB,mBAAmB,yCAOnB,mBAAmB,GACjB,UAAU,CAAC,CAAC,CA2BxB;AAoCM,iCA7B4B,CAAC,SAAtB,mBAAoB,EACT,CAAC,SAAZ,SAAU,iBAYb,OAAO,QACP,MAAM,cACN,CAAC,gBACD,qBAAqB,2BACrB,mBAAmB,YAOnB,CAAC,GACC,CAAC,CAAC,cAAc,CAAC,SAAS,aAAa,MAAM,CAAC,SAAS,GAAG,CAAC,GAC/D,UAAU,CAAC,EAAE,CAAC,CAAC,GACf,UAAU,CAAC,CAAC,CAyCpB;AAqCM,8BAzBmB,CAAC,SAAb,SAAU,UACY,CAAC,SAAvB,mBAAoB,aACvB,MAAM,cAMN,CAAC,gBAGD,qBAAqB,2BAErB,mBAAmB,yCAOnB,CAAC,GACC,CAAC,CAAC,cAAc,CAAC,SAAS,aAAa,MAAM,CAAC,SAAS,GAAG,CAAC,GAC/D,UAAU,CAAC,EAAE,CAAC,CAAC,GACf,UAAU,CAAC,CAAC,CAmBlB;yBA7UsB,CAAC,SAAZ,SAAU;UAEV,MAAM;eACN,CAAC;iBACD,qBAAqB;kBACrB,OAAO;;;;;;;;;;;;;;;;kCA0IR,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC;0BAhKsC,iBAAiB;6BASlC,kBAAkB;yCAFN,sBAAsB;wCAG0B,YAAY;+BAAZ,YAAY;2CAAZ,YAAY;yBALnE,gBAAgB;kCAGhB,kBAAkB;6BAHlB,gBAAgB"}
|
package/src/issuerKit.js
CHANGED
|
@@ -9,8 +9,14 @@ import { AssetKind, assertAssetKind } from './amountMath.js';
|
|
|
9
9
|
import { coerceDisplayInfo } from './displayInfo.js';
|
|
10
10
|
import { preparePaymentLedger } from './paymentLedger.js';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @import {Key, Pattern} from '@endo/patterns';
|
|
14
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
15
|
+
* @import {ShutdownWithFailure} from '@agoric/swingset-vat';
|
|
16
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
17
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
18
|
+
* @import {AdditionalDisplayInfo, RecoverySetsOption, IssuerKit, PaymentLedger} from './types.js';
|
|
19
|
+
*/
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* @template {AssetKind} K
|
|
@@ -26,7 +32,7 @@ import { preparePaymentLedger } from './paymentLedger.js';
|
|
|
26
32
|
*
|
|
27
33
|
* @template {AssetKind} K
|
|
28
34
|
* @param {IssuerRecord<K>} issuerRecord
|
|
29
|
-
* @param {
|
|
35
|
+
* @param {Zone} issuerZone
|
|
30
36
|
* @param {RecoverySetsOption} recoverySetsState Omitted from issuerRecord
|
|
31
37
|
* because it was added in an upgrade.
|
|
32
38
|
* @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
|
|
@@ -94,7 +100,7 @@ const RECOVERY_SETS_STATE = 'recoverySetsState';
|
|
|
94
100
|
* make a new one.
|
|
95
101
|
*
|
|
96
102
|
* @template {AssetKind} K
|
|
97
|
-
* @param {
|
|
103
|
+
* @param {Baggage} issuerBaggage
|
|
98
104
|
* @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
|
|
99
105
|
* the middle of an atomic action (which btw should never happen), it
|
|
100
106
|
* potentially leaves its ledger in a corrupted state. If this function was
|
|
@@ -138,7 +144,7 @@ harden(upgradeIssuerKit);
|
|
|
138
144
|
/**
|
|
139
145
|
* Does baggage already have an issuerKit?
|
|
140
146
|
*
|
|
141
|
-
* @param {
|
|
147
|
+
* @param {Baggage} baggage
|
|
142
148
|
*/
|
|
143
149
|
export const hasIssuer = baggage => baggage.has(INSTANCE_KEY);
|
|
144
150
|
|
|
@@ -178,7 +184,7 @@ export const hasIssuer = baggage => baggage.has(INSTANCE_KEY);
|
|
|
178
184
|
* basic fungible tokens.
|
|
179
185
|
*
|
|
180
186
|
* `displayInfo` gives information to the UI on how to display the amount.
|
|
181
|
-
* @param {
|
|
187
|
+
* @param {Baggage} issuerBaggage
|
|
182
188
|
* @param {string} name
|
|
183
189
|
* @param {K} [assetKind]
|
|
184
190
|
* @param {AdditionalDisplayInfo} [displayInfo]
|
|
@@ -224,6 +230,7 @@ harden(makeDurableIssuerKit);
|
|
|
224
230
|
* Used to either revive a predecessor issuerKit, or to make a new durable one
|
|
225
231
|
* if it is absent, and to place it in baggage for the next successor.
|
|
226
232
|
*
|
|
233
|
+
* @template {IssuerOptionsRecord} O
|
|
227
234
|
* @template {AssetKind} K The name becomes part of the brand in asset
|
|
228
235
|
* descriptions. The name is useful for debugging and double-checking
|
|
229
236
|
* assumptions, but should not be trusted wrt any external namespace. For
|
|
@@ -236,7 +243,7 @@ harden(makeDurableIssuerKit);
|
|
|
236
243
|
* basic fungible tokens.
|
|
237
244
|
*
|
|
238
245
|
* `displayInfo` gives information to the UI on how to display the amount.
|
|
239
|
-
* @param {
|
|
246
|
+
* @param {Baggage} issuerBaggage
|
|
240
247
|
* @param {string} name
|
|
241
248
|
* @param {K} [assetKind]
|
|
242
249
|
* @param {AdditionalDisplayInfo} [displayInfo]
|
|
@@ -247,8 +254,10 @@ harden(makeDurableIssuerKit);
|
|
|
247
254
|
* unit of computation, like the enclosing vat, can be shutdown before
|
|
248
255
|
* anything else is corrupted by that corrupted state. See
|
|
249
256
|
* https://github.com/Agoric/agoric-sdk/issues/3434
|
|
250
|
-
* @param {
|
|
251
|
-
* @returns {
|
|
257
|
+
* @param {O} [options]
|
|
258
|
+
* @returns {O['elementShape'] extends TypedPattern<infer T extends Key>
|
|
259
|
+
* ? IssuerKit<K, T>
|
|
260
|
+
* : IssuerKit<K>}
|
|
252
261
|
*/
|
|
253
262
|
export const prepareIssuerKit = (
|
|
254
263
|
issuerBaggage,
|
|
@@ -257,6 +266,7 @@ export const prepareIssuerKit = (
|
|
|
257
266
|
assetKind = AssetKind.NAT,
|
|
258
267
|
displayInfo = harden({}),
|
|
259
268
|
optShutdownWithFailure = undefined,
|
|
269
|
+
// @ts-expect-error could have a different subtype of IssuerOptionsRecord
|
|
260
270
|
options = {},
|
|
261
271
|
) => {
|
|
262
272
|
if (hasIssuer(issuerBaggage)) {
|
|
@@ -285,6 +295,7 @@ export const prepareIssuerKit = (
|
|
|
285
295
|
optShutdownWithFailure,
|
|
286
296
|
options,
|
|
287
297
|
);
|
|
298
|
+
// @ts-expect-error cast to the type parameter
|
|
288
299
|
return issuerKit;
|
|
289
300
|
}
|
|
290
301
|
};
|
|
@@ -299,21 +310,19 @@ harden(prepareIssuerKit);
|
|
|
299
310
|
* Currently used for testing only. Should probably continue to be used for
|
|
300
311
|
* testing only.
|
|
301
312
|
*
|
|
302
|
-
* @template {AssetKind} [K='nat']
|
|
313
|
+
* @template {AssetKind} [K='nat']
|
|
314
|
+
* @template {IssuerOptionsRecord} [O={}]
|
|
315
|
+
* @param {string} name The name becomes part of the brand in asset
|
|
303
316
|
* descriptions. The name is useful for debugging and double-checking
|
|
304
317
|
* assumptions, but should not be trusted wrt any external namespace. For
|
|
305
318
|
* example, anyone could create a new issuer kit with name 'BTC', but it is
|
|
306
319
|
* not bitcoin or even related. It is only the name according to that issuer
|
|
307
320
|
* and brand.
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* `displayInfo` gives information to the UI on how to display the amount.
|
|
314
|
-
* @param {string} name
|
|
315
|
-
* @param {K} [assetKind]
|
|
316
|
-
* @param {AdditionalDisplayInfo} [displayInfo]
|
|
321
|
+
* @param {K} [assetKind] The assetKind will be used to import a specific
|
|
322
|
+
* mathHelpers from the mathHelpers library. For example, natMathHelpers, the
|
|
323
|
+
* default, is used for basic fungible tokens.
|
|
324
|
+
* @param {AdditionalDisplayInfo} [displayInfo] `displayInfo` gives information
|
|
325
|
+
* to the UI on how to display the amount.
|
|
317
326
|
* @param {ShutdownWithFailure} [optShutdownWithFailure] If this issuer fails in
|
|
318
327
|
* the middle of an atomic action (which btw should never happen), it
|
|
319
328
|
* potentially leaves its ledger in a corrupted state. If this function was
|
|
@@ -321,8 +330,10 @@ harden(prepareIssuerKit);
|
|
|
321
330
|
* unit of computation, like the enclosing vat, can be shutdown before
|
|
322
331
|
* anything else is corrupted by that corrupted state. See
|
|
323
332
|
* https://github.com/Agoric/agoric-sdk/issues/3434
|
|
324
|
-
* @param {
|
|
325
|
-
* @returns {
|
|
333
|
+
* @param {O} [options]
|
|
334
|
+
* @returns {O['elementShape'] extends TypedPattern<infer T extends Key>
|
|
335
|
+
* ? IssuerKit<K, T>
|
|
336
|
+
* : IssuerKit<K>}
|
|
326
337
|
*/
|
|
327
338
|
export const makeIssuerKit = (
|
|
328
339
|
name,
|
|
@@ -330,8 +341,10 @@ export const makeIssuerKit = (
|
|
|
330
341
|
assetKind = AssetKind.NAT,
|
|
331
342
|
displayInfo = harden({}),
|
|
332
343
|
optShutdownWithFailure = undefined,
|
|
344
|
+
// @ts-expect-error O could be instantiated with a different subtype
|
|
333
345
|
{ elementShape = undefined, recoverySetsOption = undefined } = {},
|
|
334
346
|
) =>
|
|
347
|
+
// @ts-expect-error cast
|
|
335
348
|
makeDurableIssuerKit(
|
|
336
349
|
makeScalarBigMapStore('dropped issuer kit', { durable: true }),
|
|
337
350
|
name,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export function claim<
|
|
2
|
-
export function combine<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentsPs: ERef<Payment<K>>[], optTotalAmount?: Pattern): Promise<Payment<K>>;
|
|
1
|
+
export function claim<K extends AssetKind, T extends Key>(recoveryPurse: ERef<Purse<K, T>>, srcPaymentP: ERef<Payment<K, T>>, optAmountShape?: Pattern): Promise<Payment<K, T>>;
|
|
2
|
+
export function combine<K extends AssetKind, T extends Key>(recoveryPurse: ERef<Purse<K, T>>, srcPaymentsPs: ERef<Payment<K, T>>[], optTotalAmount?: Pattern): Promise<Payment<K, T>>;
|
|
3
3
|
export function split<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, paymentAmountA: Amount<K>): Promise<Payment<K>[]>;
|
|
4
4
|
export function splitMany<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, amounts: Amount<K>[]): Promise<Payment[]>;
|
|
5
|
-
import type {
|
|
5
|
+
import type { AssetKind } from './types.js';
|
|
6
|
+
import type { Key } from '@endo/patterns';
|
|
6
7
|
import type { Purse } from './types.js';
|
|
7
8
|
import type { ERef } from '@endo/far';
|
|
8
|
-
import type {
|
|
9
|
+
import type { Payment } from './types.js';
|
|
10
|
+
import type { Pattern } from '@endo/patterns';
|
|
9
11
|
import type { Amount } from './types.js';
|
|
10
12
|
//# sourceMappingURL=legacy-payment-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-payment-helpers.d.ts","sourceRoot":"","sources":["legacy-payment-helpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"legacy-payment-helpers.d.ts","sourceRoot":"","sources":["legacy-payment-helpers.js"],"names":[],"mappings":"AAmCO,sBAPkB,CAAC,SAAb,SAAW,EACL,CAAC,SAAP,GAAK,iBACP,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,eACjB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,mBACnB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAWlC;AAkBM,wBAPkB,CAAC,SAAb,SAAW,EACL,CAAC,SAAP,GAAK,iBACP,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,iBACjB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,mBACrB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CA8BlC;AAgBM,sBANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAChB,OAAO,CAAC,CAAC,GACP,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAYjC;AAgBM,0BANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,eACd,KAAK,QAAQ,CAAC,CAAC,CAAC,WAChB,OAAO,CAAC,CAAC,EAAE,GACT,OAAO,CAAC,OAAO,EAAE,CAAC,CAoB9B;+BA5ImD,YAAY;yBADjC,gBAAgB;2BACK,YAAY;0BAFzC,WAAW;6BAEkB,YAAY;6BADjC,gBAAgB;4BACK,YAAY"}
|
|
@@ -7,6 +7,7 @@ import { AmountMath } from './amountMath.js';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @import {ERef} from '@endo/far';
|
|
10
|
+
* @import {Key, Pattern} from '@endo/patterns';
|
|
10
11
|
* @import {Amount, AssetKind, Payment, Purse} from './types.js';
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -25,11 +26,12 @@ import { AmountMath } from './amountMath.js';
|
|
|
25
26
|
*/
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* @template {
|
|
29
|
-
* @
|
|
30
|
-
* @param {ERef<
|
|
29
|
+
* @template {AssetKind} K
|
|
30
|
+
* @template {Key} T type of values in set-like kind
|
|
31
|
+
* @param {ERef<Purse<K, T>>} recoveryPurse
|
|
32
|
+
* @param {ERef<Payment<K, T>>} srcPaymentP
|
|
31
33
|
* @param {Pattern} [optAmountShape]
|
|
32
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<Payment<K, T>>}
|
|
33
35
|
*/
|
|
34
36
|
export const claim = async (
|
|
35
37
|
recoveryPurse,
|
|
@@ -37,7 +39,6 @@ export const claim = async (
|
|
|
37
39
|
optAmountShape = undefined,
|
|
38
40
|
) => {
|
|
39
41
|
const srcPayment = await srcPaymentP;
|
|
40
|
-
// @ts-expect-error XXX could be instantiated with a different subtype
|
|
41
42
|
return E.when(E(recoveryPurse).deposit(srcPayment, optAmountShape), amount =>
|
|
42
43
|
E(recoveryPurse).withdraw(amount),
|
|
43
44
|
);
|
|
@@ -53,10 +54,11 @@ harden(claim);
|
|
|
53
54
|
* origin.
|
|
54
55
|
*
|
|
55
56
|
* @template {AssetKind} K
|
|
56
|
-
* @
|
|
57
|
-
* @param {ERef<
|
|
57
|
+
* @template {Key} T type of values in set-like kind
|
|
58
|
+
* @param {ERef<Purse<K, T>>} recoveryPurse
|
|
59
|
+
* @param {ERef<Payment<K, T>>[]} srcPaymentsPs
|
|
58
60
|
* @param {Pattern} [optTotalAmount]
|
|
59
|
-
* @returns {Promise<Payment<K>>}
|
|
61
|
+
* @returns {Promise<Payment<K, T>>}
|
|
60
62
|
*/
|
|
61
63
|
export const combine = async (
|
|
62
64
|
recoveryPurse,
|
|
@@ -69,7 +71,11 @@ export const combine = async (
|
|
|
69
71
|
E(brandP).getDisplayInfo(),
|
|
70
72
|
...srcPaymentsPs,
|
|
71
73
|
]);
|
|
72
|
-
|
|
74
|
+
|
|
75
|
+
// XXX Brand lacks M
|
|
76
|
+
const emptyAmount = /** @type {Amount<K, T>} */ (
|
|
77
|
+
AmountMath.makeEmpty(brand, displayInfo.assetKind)
|
|
78
|
+
);
|
|
73
79
|
const amountPs = srcPayments.map(srcPayment =>
|
|
74
80
|
E(recoveryPurse).deposit(srcPayment),
|
|
75
81
|
);
|
package/src/payment.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function preparePaymentKind<K extends AssetKind>(issuerZone: import("@agoric/zone").Zone, name: string, brand: Brand<K>, PaymentI: import("@endo/patterns").InterfaceGuard<any>): () => Payment<K>;
|
|
1
|
+
export function preparePaymentKind<K extends AssetKind>(issuerZone: import("@agoric/zone").Zone, name: string, brand: Brand<K>, PaymentI: import("@endo/patterns").InterfaceGuard<any>): () => Payment<K, any>;
|
|
2
2
|
import type { AssetKind } from './types.js';
|
|
3
3
|
import type { Brand } from './types.js';
|
|
4
4
|
import type { Payment } from './types.js';
|
package/src/payment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,mCAPkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,SACN,MAAM,CAAC,CAAC,YACR,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,GAC1C,MAAM,QAAQ,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,mCAPkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,SACN,MAAM,CAAC,CAAC,YACR,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,GAC1C,MAAM,QAAQ,CAAC,EAAE,GAAG,CAAC,CAejC;+BAxB4C,YAAY;2BAAZ,YAAY;6BAAZ,YAAY"}
|
package/src/payment.js
CHANGED
|
@@ -11,7 +11,7 @@ import { initEmpty } from '@agoric/store';
|
|
|
11
11
|
* @param {string} name
|
|
12
12
|
* @param {Brand<K>} brand
|
|
13
13
|
* @param {import('@endo/patterns').InterfaceGuard<any>} PaymentI
|
|
14
|
-
* @returns {() => Payment<K>}
|
|
14
|
+
* @returns {() => Payment<K, any>}
|
|
15
15
|
*/
|
|
16
16
|
export const preparePaymentKind = (issuerZone, name, brand, PaymentI) => {
|
|
17
17
|
const makePayment = issuerZone.exoClass(
|
|
@@ -24,6 +24,7 @@ export const preparePaymentKind = (issuerZone, name, brand, PaymentI) => {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
);
|
|
27
|
+
// @ts-expect-error [tag] for tagged type not defined in runtime
|
|
27
28
|
return makePayment;
|
|
28
29
|
};
|
|
29
30
|
harden(preparePaymentKind);
|
package/src/paymentLedger.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export function preparePaymentLedger<K extends AssetKind>(issuerZone:
|
|
1
|
+
export function preparePaymentLedger<K extends AssetKind>(issuerZone: Zone, name: string, assetKind: K, displayInfo: DisplayInfo<K>, elementShape: Pattern, recoverySetsState: RecoverySetsOption, optShutdownWithFailure?: ShutdownWithFailure): PaymentLedger<K>;
|
|
2
2
|
import type { AssetKind } from './types.js';
|
|
3
|
+
import type { Zone } from '@agoric/base-zone';
|
|
3
4
|
import type { DisplayInfo } from './types.js';
|
|
5
|
+
import type { Pattern } from '@endo/patterns';
|
|
4
6
|
import type { RecoverySetsOption } from './types.js';
|
|
5
7
|
import type { ShutdownWithFailure } from '@agoric/swingset-vat';
|
|
6
8
|
import type { PaymentLedger } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAuFO,qCAVkB,CAAC,SAAb,SAAW,cACb,IAAI,QACJ,MAAM,aACN,CAAC,eACD,YAAY,CAAC,CAAC,gBACd,OAAO,qBACP,kBAAkB,2BAClB,mBAAmB,GACjB,cAAc,CAAC,CAAC,CAyT5B;+BA5XwH,YAAY;0BAJ9G,mBAAmB;iCAI+E,YAAY;6BALtG,gBAAgB;wCAK0E,YAAY;yCAF/F,sBAAsB;mCAE6D,YAAY"}
|
package/src/paymentLedger.js
CHANGED
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
/// <reference types="@agoric/store/exported.js" />
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { q, Fail, annotateError, X } from '@endo/errors';
|
|
6
6
|
import { isPromise } from '@endo/promise-kit';
|
|
7
|
-
import { mustMatch, M, keyEQ } from '@
|
|
7
|
+
import { mustMatch, M, keyEQ } from '@endo/patterns';
|
|
8
8
|
import { AmountMath } from './amountMath.js';
|
|
9
9
|
import { preparePaymentKind } from './payment.js';
|
|
10
10
|
import { preparePurseKind } from './purse.js';
|
|
11
|
-
|
|
12
11
|
import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
|
-
* @import {
|
|
16
|
-
* @import {
|
|
14
|
+
* @import {Key, Pattern} from '@endo/patterns';
|
|
15
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
17
16
|
* @import {TypedPattern} from '@agoric/internal';
|
|
17
|
+
* @import {ShutdownWithFailure} from '@agoric/swingset-vat';
|
|
18
|
+
* @import {AmountStore} from './amountStore.js';
|
|
19
|
+
* @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js';
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -74,7 +76,7 @@ const amountShapeFromElementShape = (brand, assetKind, elementShape) => {
|
|
|
74
76
|
* minting and transfer authority originates here.
|
|
75
77
|
*
|
|
76
78
|
* @template {AssetKind} K
|
|
77
|
-
* @param {
|
|
79
|
+
* @param {Zone} issuerZone
|
|
78
80
|
* @param {string} name
|
|
79
81
|
* @param {K} assetKind
|
|
80
82
|
* @param {DisplayInfo<K>} displayInfo
|
|
@@ -239,7 +241,7 @@ export const preparePaymentLedger = (
|
|
|
239
241
|
/**
|
|
240
242
|
* Used by the purse code to implement purse.deposit
|
|
241
243
|
*
|
|
242
|
-
* @param {
|
|
244
|
+
* @param {AmountStore} balanceStore
|
|
243
245
|
* @param {Payment} srcPayment
|
|
244
246
|
* @param {Pattern} [optAmountShape]
|
|
245
247
|
* @returns {Amount}
|
|
@@ -273,7 +275,7 @@ export const preparePaymentLedger = (
|
|
|
273
275
|
/**
|
|
274
276
|
* Used by the purse code to implement purse.withdraw
|
|
275
277
|
*
|
|
276
|
-
* @param {
|
|
278
|
+
* @param {AmountStore} balanceStore
|
|
277
279
|
* @param {Amount} amount - the amount to be withdrawn
|
|
278
280
|
* @param {SetStore<Payment>} [recoverySet]
|
|
279
281
|
* @returns {Payment}
|
package/src/purse.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ export function preparePurseKind(issuerZone: import("@agoric/zone").Zone, name:
|
|
|
7
7
|
}, recoverySetsState: RecoverySetsOption, paymentRecoverySets: WeakMapStore<Payment, SetStore<Payment>>): () => import("@endo/exo").Guarded<{
|
|
8
8
|
deposit(srcPayment: any, optAmountShape?: undefined): any;
|
|
9
9
|
withdraw(amount: any): any;
|
|
10
|
-
getCurrentAmount(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").
|
|
10
|
+
getCurrentAmount(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key>;
|
|
11
11
|
getCurrentAmountNotifier(): import("@agoric/notifier").Notifier<any>;
|
|
12
12
|
getAllegedBrand(): Brand;
|
|
13
13
|
getDepositFacet(): import("@endo/exo").Guarded<{
|
|
14
14
|
receive(...args: any[]): any;
|
|
15
15
|
}>;
|
|
16
16
|
getRecoverySet(): import("@endo/patterns").CopySet<any>;
|
|
17
|
-
recoverAll(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").
|
|
17
|
+
recoverAll(): import("./types.js").NatAmount | import("./types.js").CopySetAmount<import("@endo/patterns").Key> | import("./types.js").CopyBagAmount<import("@endo/patterns").Key> | import("./types.js").SetAmount<import("@endo/patterns").Key>;
|
|
18
18
|
}>;
|
|
19
19
|
import type { AssetKind } from './types.js';
|
|
20
20
|
import type { Brand } from './types.js';
|