@agoric/ertp 0.16.3-other-dev-d15096d.0.d15096d → 0.16.3-other-dev-ecf44df.0.ecf44df
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 +23 -34
- package/src/amountMath.d.ts +1 -1
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +15 -20
- package/src/displayInfo.d.ts.map +1 -1
- package/src/displayInfo.js +0 -2
- package/src/index.js +0 -3
- package/src/issuerKit.d.ts +3 -3
- package/src/issuerKit.d.ts.map +1 -1
- package/src/issuerKit.js +3 -5
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +0 -2
- package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copyBagMathHelpers.js +0 -2
- package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/copySetMathHelpers.js +0 -2
- package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/natMathHelpers.js +0 -2
- package/src/mathHelpers/setMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/setMathHelpers.js +0 -2
- package/src/payment.d.ts.map +1 -1
- package/src/payment.js +0 -2
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +5 -8
- package/src/purse.d.ts +6 -4
- package/src/purse.d.ts.map +1 -1
- package/src/purse.js +2 -0
- package/src/ratio.d.ts +6 -2
- package/src/ratio.d.ts.map +1 -1
- package/src/ratio.js +4 -5
- package/src/transientNotifier.d.ts.map +1 -1
- package/src/transientNotifier.js +1 -2
- package/src/typeGuards.d.ts +118 -42
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +17 -7
- package/src/types.d.ts +4 -4
- package/src/types.d.ts.map +1 -1
- package/src/types.js +477 -0
- package/exported.d.ts +0 -37
- package/exported.js +0 -2
- package/src/types.ts +0 -474
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/ertp",
|
|
3
|
-
"version": "0.16.3-other-dev-
|
|
3
|
+
"version": "0.16.3-other-dev-ecf44df.0.ecf44df",
|
|
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": "^22.11 || ^24.14"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "yarn run -T
|
|
13
|
-
"postpack": "
|
|
12
|
+
"prepack": "yarn run -T prepack-package",
|
|
13
|
+
"postpack": "yarn run -T postpack-package",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
16
16
|
"test:xs": "yarn test:xs-worker",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2 test/swingsetTests",
|
|
19
19
|
"lint-fix": "yarn lint:eslint --fix",
|
|
20
20
|
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
21
|
-
"lint:eslint": "
|
|
22
|
-
"lint:types": "yarn run -T
|
|
21
|
+
"lint:eslint": "node ../../scripts/eslint-repo.mjs .",
|
|
22
|
+
"lint:types": "yarn run -T tsgo --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -39,45 +39,34 @@
|
|
|
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.
|
|
47
|
-
"@endo/eventual-send": "^1.
|
|
42
|
+
"@agoric/notifier": "0.6.3-other-dev-ecf44df.0.ecf44df",
|
|
43
|
+
"@agoric/store": "0.9.3-other-dev-ecf44df.0.ecf44df",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-other-dev-ecf44df.0.ecf44df",
|
|
45
|
+
"@agoric/zone": "0.2.3-other-dev-ecf44df.0.ecf44df",
|
|
46
|
+
"@endo/errors": "^1.3.1",
|
|
47
|
+
"@endo/eventual-send": "^1.5.0",
|
|
48
48
|
"@endo/far": "^1.1.14",
|
|
49
|
-
"@endo/marshal": "^1.
|
|
50
|
-
"@endo/nat": "^5.
|
|
51
|
-
"@endo/patterns": "^1.
|
|
52
|
-
"@endo/promise-kit": "^1.1
|
|
49
|
+
"@endo/marshal": "^1.10.0",
|
|
50
|
+
"@endo/nat": "^5.2.0",
|
|
51
|
+
"@endo/patterns": "^1.9.1",
|
|
52
|
+
"@endo/promise-kit": "^1.2.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-other-dev-
|
|
56
|
-
"@endo/bundle-source": "^4.
|
|
57
|
-
"@fast-check/ava": "^
|
|
58
|
-
"ava": "^
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-ecf44df.0.ecf44df",
|
|
56
|
+
"@endo/bundle-source": "^4.3.2",
|
|
57
|
+
"@fast-check/ava": "^3.0.1",
|
|
58
|
+
"ava": "^8.0.1",
|
|
59
59
|
"tsd": "^0.33.0"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"src",
|
|
63
|
-
"NEWS.md"
|
|
64
|
-
"exported.js",
|
|
65
|
-
"exported.d.ts"
|
|
63
|
+
"NEWS.md"
|
|
66
64
|
],
|
|
67
|
-
"ava": {
|
|
68
|
-
"files": [
|
|
69
|
-
"test/**/*.test.*"
|
|
70
|
-
],
|
|
71
|
-
"require": [
|
|
72
|
-
"@endo/init/debug.js"
|
|
73
|
-
],
|
|
74
|
-
"timeout": "5m"
|
|
75
|
-
},
|
|
76
65
|
"publishConfig": {
|
|
77
66
|
"access": "public"
|
|
78
67
|
},
|
|
79
68
|
"typeCoverage": {
|
|
80
|
-
"atLeast":
|
|
69
|
+
"atLeast": 93.15
|
|
81
70
|
},
|
|
82
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ecf44df5eadcc7a1d68745f056fca19155fb5231"
|
|
83
72
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export namespace AmountMath {
|
|
|
30
30
|
export function min<A extends Amount>(x: A, y: A, brand?: Brand): A;
|
|
31
31
|
export function max<A extends Amount>(x: A, y: A, brand?: Brand): A;
|
|
32
32
|
}
|
|
33
|
-
export function getAssetKind(amount: Amount): "copySet" | "
|
|
33
|
+
export function getAssetKind(amount: Amount): "copySet" | "copyBag" | "set" | "nat";
|
|
34
34
|
import type { AmountValue } from './types.js';
|
|
35
35
|
import type { MathHelpers } from './types.js';
|
|
36
36
|
import type { Brand } from './types.js';
|
package/src/amountMath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":";;;wBAkBa,CAAC,OAAO,SAAS,EAAE,MAAM,OAAO,SAAS,CAAC;;;;;;;AAYhD,2CADK,SAAS,QAIpB;AA8EM,sCAJoB,CAAC,SAAf,WAAa,SACf,CAAC,GACC,YAAY,CAAC,CAAC,CAG8C;;IAwGjE,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,CAUb;IASS,yBALY,CAAC,SAAV,MAAQ,SACV,KAAK,UACL,CAAC,GACC,CAAC,CAAC,OAAO,CAAC,CAE4C;0BAM7C;QACrB,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;IAgBiB,oCAJC,CAAC,SAAV,MAAQ,UACV,CAAC,GACC,CAAC,CAOb;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,CAO8B;IAUvC,oBANiB,CAAC,SAAV,MAAQ,KACV,CAAC,KACD,CAAC,UACD,KAAK,GACH,CAAC,CAO8B;;AAKvC,qCADK,MAAM,yCAKjB;iCA1XoJ,YAAY;iCAAZ,YAAY;2BAAZ,YAAY;8BAAZ,YAAY;6BADzH,gBAAgB;6BAAhB,gBAAgB;8BAC6F,YAAY;+BAAZ,YAAY;mCAAZ,YAAY;mCAAZ,YAAY;+BAAZ,YAAY;4BAAZ,YAAY;AA2JjK;;;;;;;;;;;;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
|
@@ -8,7 +8,7 @@ import { copySetMathHelpers } from './mathHelpers/copySetMathHelpers.js';
|
|
|
8
8
|
import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @import {CopyBag, CopySet} from '@endo/patterns';
|
|
11
|
+
* @import {CopyBag, CopySet, Key} from '@endo/patterns';
|
|
12
12
|
* @import {Amount, AmountValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
|
|
|
16
16
|
/**
|
|
17
17
|
* Constants for the kinds of assets we support.
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @typedef {(typeof AssetKind)[keyof typeof AssetKind]} AssetKind
|
|
20
20
|
*/
|
|
21
21
|
export const AssetKind = /** @type {const} */ ({
|
|
22
22
|
NAT: 'nat',
|
|
@@ -110,8 +110,7 @@ const assertValueGetAssetKind = value => {
|
|
|
110
110
|
* @returns {MathHelpers<V>}
|
|
111
111
|
*/
|
|
112
112
|
export const assertValueGetHelpers = value =>
|
|
113
|
-
|
|
114
|
-
helpers[assertValueGetAssetKind(value)];
|
|
113
|
+
/** @type {MathHelpers<V>} */ (helpers[assertValueGetAssetKind(value)]);
|
|
115
114
|
|
|
116
115
|
/**
|
|
117
116
|
* @type {(allegedBrand: Brand<any>, brand?: Brand<any>) => void}
|
|
@@ -238,8 +237,7 @@ export const AmountMath = {
|
|
|
238
237
|
brand === allegedBrand ||
|
|
239
238
|
Fail`The brand in the allegedAmount ${allegedAmount} in 'coerce' didn't match the specified brand ${brand}.`;
|
|
240
239
|
// Will throw on inappropriate value
|
|
241
|
-
|
|
242
|
-
return AmountMath.make(brand, allegedValue);
|
|
240
|
+
return /** @type {A} */ (AmountMath.make(brand, allegedValue));
|
|
243
241
|
},
|
|
244
242
|
/**
|
|
245
243
|
* Extract and return the value.
|
|
@@ -254,18 +252,18 @@ export const AmountMath = {
|
|
|
254
252
|
* Return the amount representing an empty amount. This is the identity
|
|
255
253
|
* element for MathHelpers.add and MatHelpers.subtract.
|
|
256
254
|
*
|
|
257
|
-
|
|
255
|
+
*/
|
|
256
|
+
makeEmpty: /** @type {{
|
|
258
257
|
* (brand: Brand): Amount<'nat'>;
|
|
259
258
|
* <K extends AssetKind>(brand: Brand<K>, assetKind: K): Amount<K>;
|
|
260
|
-
* }}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
},
|
|
259
|
+
* }} */ (
|
|
260
|
+
(brand, assetKind = /** @type {const} */ ('nat')) => {
|
|
261
|
+
assertRemotable(brand, 'brand');
|
|
262
|
+
assertAssetKind(assetKind);
|
|
263
|
+
const value = helpers[assetKind].doMakeEmpty();
|
|
264
|
+
return harden({ brand, value });
|
|
265
|
+
}
|
|
266
|
+
),
|
|
269
267
|
/**
|
|
270
268
|
* Return the amount representing an empty amount, using another amount as the
|
|
271
269
|
* template for the brand and assetKind.
|
|
@@ -278,8 +276,7 @@ export const AmountMath = {
|
|
|
278
276
|
assertRecord(amount, 'amount');
|
|
279
277
|
const { brand, value } = amount;
|
|
280
278
|
const assetKind = assertValueGetAssetKind(value);
|
|
281
|
-
|
|
282
|
-
return AmountMath.makeEmpty(brand, assetKind);
|
|
279
|
+
return /** @type {A} */ (AmountMath.makeEmpty(brand, assetKind));
|
|
283
280
|
},
|
|
284
281
|
/**
|
|
285
282
|
* Return true if the Amount is empty. Otherwise false.
|
|
@@ -362,7 +359,6 @@ export const AmountMath = {
|
|
|
362
359
|
* @returns {A}
|
|
363
360
|
*/
|
|
364
361
|
min: (x, y, brand = undefined) =>
|
|
365
|
-
// eslint-disable-next-line no-nested-ternary
|
|
366
362
|
isGTE(x, y, brand)
|
|
367
363
|
? y
|
|
368
364
|
: isGTE(y, x, brand)
|
|
@@ -378,7 +374,6 @@ export const AmountMath = {
|
|
|
378
374
|
* @returns {A}
|
|
379
375
|
*/
|
|
380
376
|
max: (x, y, brand = undefined) =>
|
|
381
|
-
// eslint-disable-next-line no-nested-ternary
|
|
382
377
|
isGTE(x, y, brand)
|
|
383
378
|
? x
|
|
384
379
|
: isGTE(y, x)
|
package/src/displayInfo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayInfo.d.ts","sourceRoot":"","sources":["displayInfo.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"displayInfo.d.ts","sourceRoot":"","sources":["displayInfo.js"],"names":[],"mappings":"AAYO,sDAJI,qBAAqB,aACrB,SAAS,GACP,WAAW,CAiBvB;2CAtBgE,YAAY;+BAAZ,YAAY;iCAAZ,YAAY"}
|
package/src/displayInfo.js
CHANGED
package/src/index.js
CHANGED
package/src/issuerKit.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export function upgradeIssuerKit<K extends AssetKind>(issuerBaggage: Baggage, optShutdownWithFailure?: ShutdownWithFailure, recoverySetsOption?: RecoverySetsOption): IssuerKit<K>;
|
|
2
2
|
export function hasIssuer(baggage: Baggage): boolean;
|
|
3
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
|
|
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
|
|
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 CastedPattern<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 CastedPattern<infer T extends Key> ? IssuerKit<K, T> : IssuerKit<K>;
|
|
6
6
|
export type IssuerRecord<K extends AssetKind> = {
|
|
7
7
|
name: string;
|
|
8
8
|
assetKind: K;
|
|
@@ -34,6 +34,6 @@ import type { RecoverySetsOption } from './types.js';
|
|
|
34
34
|
import type { IssuerKit } from './types.js';
|
|
35
35
|
import type { AdditionalDisplayInfo } from './types.js';
|
|
36
36
|
import type { Key } from '@endo/patterns';
|
|
37
|
-
import type {
|
|
37
|
+
import type { CastedPattern } from '@endo/patterns';
|
|
38
38
|
import type { Pattern } from '@endo/patterns';
|
|
39
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":"AAgHO,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,cAAc,MAAM,CAAC,SAAS,GAAG,CAAC,GAChE,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,cAAc,MAAM,CAAC,SAAS,GAAG,CAAC,GAChE,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;mCAGf,gBAAgB;6BAHjB,gBAAgB"}
|
package/src/issuerKit.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
import { assert, Fail } from '@endo/errors';
|
|
4
2
|
import { assertPattern } from '@agoric/store';
|
|
5
3
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
@@ -13,7 +11,7 @@ import { preparePaymentLedger } from './paymentLedger.js';
|
|
|
13
11
|
* @import {Key, Pattern} from '@endo/patterns';
|
|
14
12
|
* @import {Zone} from '@agoric/base-zone';
|
|
15
13
|
* @import {ShutdownWithFailure} from '@agoric/swingset-vat';
|
|
16
|
-
* @import {
|
|
14
|
+
* @import {CastedPattern} from '@endo/patterns';
|
|
17
15
|
* @import {Baggage} from '@agoric/vat-data';
|
|
18
16
|
* @import {AdditionalDisplayInfo, RecoverySetsOption, IssuerKit, PaymentLedger} from './types.js';
|
|
19
17
|
*/
|
|
@@ -255,7 +253,7 @@ harden(makeDurableIssuerKit);
|
|
|
255
253
|
* anything else is corrupted by that corrupted state. See
|
|
256
254
|
* https://github.com/Agoric/agoric-sdk/issues/3434
|
|
257
255
|
* @param {O} [options]
|
|
258
|
-
* @returns {O['elementShape'] extends
|
|
256
|
+
* @returns {O['elementShape'] extends CastedPattern<infer T extends Key>
|
|
259
257
|
* ? IssuerKit<K, T>
|
|
260
258
|
* : IssuerKit<K>}
|
|
261
259
|
*/
|
|
@@ -331,7 +329,7 @@ harden(prepareIssuerKit);
|
|
|
331
329
|
* anything else is corrupted by that corrupted state. See
|
|
332
330
|
* https://github.com/Agoric/agoric-sdk/issues/3434
|
|
333
331
|
* @param {O} [options]
|
|
334
|
-
* @returns {O['elementShape'] extends
|
|
332
|
+
* @returns {O['elementShape'] extends CastedPattern<infer T extends Key>
|
|
335
333
|
* ? IssuerKit<K, T>
|
|
336
334
|
* : IssuerKit<K>}
|
|
337
335
|
*/
|
|
@@ -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":"AAiCO,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyBagMathHelpers.d.ts","sourceRoot":"","sources":["copyBagMathHelpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyBagMathHelpers.d.ts","sourceRoot":"","sources":["copyBagMathHelpers.js"],"names":[],"mappings":"AAmBA,mCAAmC;AACnC,iCADW,YAAY,OAAO,CAAC,CAY5B;6BAlBuB,gBAAgB;iCADZ,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copySetMathHelpers.d.ts","sourceRoot":"","sources":["copySetMathHelpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copySetMathHelpers.d.ts","sourceRoot":"","sources":["copySetMathHelpers.js"],"names":[],"mappings":"AAmBA,mCAAmC;AACnC,iCADW,YAAY,OAAO,CAAC,CAY5B;6BAlBuB,gBAAgB;iCADZ,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AACH,6BAFU,YAAY,QAAQ,CAAC,CAgB5B;8BA7BsC,aAAa;iCAAb,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setMathHelpers.d.ts","sourceRoot":"","sources":["setMathHelpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setMathHelpers.d.ts","sourceRoot":"","sources":["setMathHelpers.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,6BAFU,YAAY,QAAQ,CAAC,CAkB5B;8BA3BsC,aAAa;iCAAb,aAAa"}
|
package/src/payment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAiBO,mCAPkB,CAAC,SAAb,SAAW,cACb,IAAI,QACJ,MAAM,SACN,MAAM,CAAC,CAAC,YACR,eAAe,GAAG,CAAC,GACjB,MAAM,QAAQ,CAAC,EAAE,GAAG,CAAC,CAejC;+BA3B2C,YAAY;0BACjC,cAAc;2BADO,YAAY;oCAEvB,gBAAgB;6BAFL,YAAY"}
|
package/src/payment.js
CHANGED
|
@@ -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":"AAqFO,qCAVkB,CAAC,SAAb,SAAW,cACb,IAAI,QACJ,MAAM,aACN,CAAC,eACD,YAAY,CAAC,CAAC,gBACd,OAAO,qBACP,kBAAkB,2BAClB,mBAAmB,GACjB,cAAc,CAAC,CAAC,CAwT5B;+BA7XwH,YAAY;0BAJ9G,mBAAmB;iCAI+E,YAAY;6BALtG,gBAAgB;wCAK0E,YAAY;yCAF/F,sBAAsB;mCAE6D,YAAY"}
|
package/src/paymentLedger.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
|
-
/// <reference types="@agoric/store/exported.js" />
|
|
4
|
-
|
|
5
1
|
import { q, Fail, annotateError, X } from '@endo/errors';
|
|
6
2
|
import { isPromise } from '@endo/promise-kit';
|
|
7
3
|
import { mustMatch, M, keyEQ } from '@endo/patterns';
|
|
@@ -13,10 +9,12 @@ import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
|
|
|
13
9
|
/**
|
|
14
10
|
* @import {Key, Pattern} from '@endo/patterns';
|
|
15
11
|
* @import {Zone} from '@agoric/base-zone';
|
|
16
|
-
* @import {
|
|
12
|
+
* @import {CastedPattern} from '@endo/patterns';
|
|
17
13
|
* @import {ShutdownWithFailure} from '@agoric/swingset-vat';
|
|
18
14
|
* @import {AmountStore} from './amountStore.js';
|
|
19
15
|
* @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js';
|
|
16
|
+
* @import {WeakMapStore} from '@agoric/store';
|
|
17
|
+
* @import {SetStore} from '@agoric/store';
|
|
20
18
|
*/
|
|
21
19
|
|
|
22
20
|
/**
|
|
@@ -24,7 +22,7 @@ import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
|
|
|
24
22
|
* @param {Brand} brand
|
|
25
23
|
* @param {K} assetKind
|
|
26
24
|
* @param {Pattern} elementShape
|
|
27
|
-
* @returns {
|
|
25
|
+
* @returns {CastedPattern<Amount<K>>}
|
|
28
26
|
*/
|
|
29
27
|
const amountShapeFromElementShape = (brand, assetKind, elementShape) => {
|
|
30
28
|
let valueShape;
|
|
@@ -206,9 +204,8 @@ export const preparePaymentLedger = (
|
|
|
206
204
|
}
|
|
207
205
|
};
|
|
208
206
|
|
|
209
|
-
/** @type {(allegedAmount: Amount) => Amount} */
|
|
207
|
+
/** @type {<K extends AssetKind>(allegedAmount: Amount<K>) => Amount<K>} */
|
|
210
208
|
const coerce = allegedAmount => AmountMath.coerce(brand, allegedAmount);
|
|
211
|
-
/** @type {(left: Amount, right: Amount) => boolean} */
|
|
212
209
|
|
|
213
210
|
/**
|
|
214
211
|
* Methods like deposit() have an optional second parameter `optAmountShape`
|
package/src/purse.d.ts
CHANGED
|
@@ -7,19 +7,21 @@ export function preparePurseKind(issuerZone: Zone, name: string, assetKind: Asse
|
|
|
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
|
+
}, InterfaceGuard<any>>;
|
|
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").
|
|
18
|
-
}
|
|
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
|
+
}, InterfaceGuard<any>>;
|
|
19
19
|
import type { Zone } from '@agoric/zone';
|
|
20
20
|
import type { AssetKind } from './types.js';
|
|
21
21
|
import type { Brand } from './types.js';
|
|
22
22
|
import type { InterfaceGuard } from '@endo/patterns';
|
|
23
23
|
import type { RecoverySetsOption } from './types.js';
|
|
24
24
|
import type { Payment } from './types.js';
|
|
25
|
+
import type { SetStore } from '@agoric/store';
|
|
26
|
+
import type { WeakMapStore } from '@agoric/store';
|
|
25
27
|
//# sourceMappingURL=purse.d.ts.map
|
package/src/purse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"purse.d.ts","sourceRoot":"","sources":["purse.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"purse.d.ts","sourceRoot":"","sources":["purse.js"],"names":[],"mappings":"AAiCO,6CAfI,IAAI,QACJ,MAAM,aACN,SAAS,SACT,KAAK,aACL;IACN,KAAK,EAAE,eAAe,GAAG,CAAC,CAAC;IAC3B,YAAY,EAAE,eAAe,GAAG,CAAC,CAAC;CACnC,gBACO;IACN,eAAe,EAAE,GAAG,CAAC;IACrB,gBAAgB,EAAE,GAAG,CAAC;CACvB,qBACO,kBAAkB,uBAClB,aAAa,OAAO,EAAE,SAAS,OAAO,CAAC,CAAC;;;;;;;;;;;wBA4JlD;0BAnLsB,cAAc;+BAD2B,YAAY;2BAAZ,YAAY;oCAE3C,gBAAgB;wCAFe,YAAY;6BAAZ,YAAY;8BAIjD,eAAe;kCADX,eAAe"}
|
package/src/purse.js
CHANGED
|
@@ -8,6 +8,8 @@ import { makeAmountStore } from './amountStore.js';
|
|
|
8
8
|
* @import {AssetKind, RecoverySetsOption, Brand, Payment} from './types.js'
|
|
9
9
|
* @import {Zone} from '@agoric/zone';
|
|
10
10
|
* @import {InterfaceGuard} from '@endo/patterns';
|
|
11
|
+
* @import {WeakMapStore} from '@agoric/store';
|
|
12
|
+
* @import {SetStore} from '@agoric/store';
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
const EMPTY_COPY_SET = makeCopySet([]);
|
package/src/ratio.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {unknown} specimen
|
|
3
|
+
* @returns {asserts specimen is ParsableNumber}
|
|
4
|
+
*/
|
|
5
|
+
export function assertParsableNumber(specimen: unknown): asserts specimen is ParsableNumber;
|
|
1
6
|
export function assertIsRatio(ratio: any): void;
|
|
2
7
|
export function makeRatio(numerator: bigint, numeratorBrand: Brand, denominator?: bigint, denominatorBrand?: Brand): Ratio;
|
|
3
|
-
export function makeRatioFromAmounts(numeratorAmount: Amount
|
|
8
|
+
export function makeRatioFromAmounts(numeratorAmount: Amount<"nat">, denominatorAmount: Amount<"nat">): Ratio;
|
|
4
9
|
/** @type {ScaleAmount} */
|
|
5
10
|
export const floorMultiplyBy: ScaleAmount;
|
|
6
11
|
/** @type {ScaleAmount} */
|
|
@@ -35,7 +40,6 @@ export function ratioGTE(left: Ratio, right: Ratio): boolean;
|
|
|
35
40
|
export function ratiosSame(left: Ratio, right: Ratio): boolean;
|
|
36
41
|
export function quantize(ratio: Ratio, newDen: bigint): Ratio;
|
|
37
42
|
export function parseRatio(numeric: ParsableNumber, numeratorBrand: Brand<"nat">, denominatorBrand?: Brand<"nat">): Ratio;
|
|
38
|
-
export function assertParsableNumber(specimen: unknown): asserts specimen is ParsableNumber;
|
|
39
43
|
export function ratioToNumber(ratio: Ratio): number;
|
|
40
44
|
export type Ratio = {
|
|
41
45
|
numerator: Amount<"nat">;
|
package/src/ratio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"AAoaA;;;GAGG;AACH,+CAHW,OAAO,GACL,QAAQ,QAAQ,IAAI,cAAc,CAK9C;AAnXM,gDAcN;AASM,qCANI,MAAM,kBACN,KAAK,gBACL,MAAM,qBACN,KAAK,GACH,KAAK,CAejB;AAOM,sDAJI,OAAO,KAAK,CAAC,qBACb,OAAO,KAAK,CAAC,GACX,KAAK,CAWjB;AA2BD,0BAA0B;AAC1B,8BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,6BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,yBADW,WAAW,CAGpB;AA2BF;;;;GAIG;AACH,4BAFU,WAAW,CAInB;AAEF;;;;GAIG;AACH,2BAFU,WAAW,CAInB;AAEF;;;;;GAKG;AACH,uBAFU,WAAW,CAInB;AAMK,mCAHI,KAAK,GACH,KAAK,CAWjB;AAOM,gCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAwBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAmBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CA8BjB;AAQM,gCAHI,KAAK,GACH,KAAK,CAcjB;AAOM,+BAJI,KAAK,SACL,KAAK,GACH,OAAO,CAkBnB;AAUM,iCAJI,KAAK,SACL,KAAK,GACH,OAAO,CAOnB;AAWM,gCAJI,KAAK,UACL,MAAM,GACJ,KAAK,CAiBjB;AAaM,oCALI,cAAc,kBACd,MAAM,KAAK,CAAC,qBACZ,MAAM,KAAK,CAAC,GACV,KAAK,CAmBjB;AAiBM,qCAHI,KAAK,GACH,MAAM,CAMlB;;eAvaa,OAAO,KAAK,CAAC;iBACb,OAAO,KAAK,CAAC;;mCAKhB,OAAO,KAAK,CAAC,SACb,KAAK,KACH,OAAO,KAAK,CAAC;6BA+WZ,MAAM,GAAG,MAAM,GAAG,MAAM;2BA/XkB,cAAc;4BAAd,cAAc"}
|
package/src/ratio.js
CHANGED
|
@@ -93,15 +93,14 @@ export const makeRatio = (
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
* @param {Amount} numeratorAmount
|
|
97
|
-
* @param {Amount} denominatorAmount
|
|
96
|
+
* @param {Amount<'nat'>} numeratorAmount
|
|
97
|
+
* @param {Amount<'nat'>} denominatorAmount
|
|
98
98
|
* @returns {Ratio}
|
|
99
99
|
*/
|
|
100
100
|
export const makeRatioFromAmounts = (numeratorAmount, denominatorAmount) => {
|
|
101
101
|
AmountMath.coerce(numeratorAmount.brand, numeratorAmount);
|
|
102
102
|
AmountMath.coerce(denominatorAmount.brand, denominatorAmount);
|
|
103
103
|
return makeRatio(
|
|
104
|
-
// @ts-expect-error value can be any AmountValue but makeRatio() supports only bigint
|
|
105
104
|
numeratorAmount.value,
|
|
106
105
|
numeratorAmount.brand,
|
|
107
106
|
denominatorAmount.value,
|
|
@@ -423,10 +422,10 @@ export const parseRatio = (
|
|
|
423
422
|
* @param {unknown} specimen
|
|
424
423
|
* @returns {asserts specimen is ParsableNumber}
|
|
425
424
|
*/
|
|
426
|
-
export
|
|
425
|
+
export function assertParsableNumber(specimen) {
|
|
427
426
|
const match = `${specimen}`.match(NUMERIC_RE);
|
|
428
427
|
match || Fail`Invalid numeric data: ${specimen}`;
|
|
429
|
-
}
|
|
428
|
+
}
|
|
430
429
|
|
|
431
430
|
/**
|
|
432
431
|
* Ratios might be greater or less than one.
|
|
@@ -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":"AAYO;;;EAoBN"}
|
package/src/transientNotifier.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
1
|
import { makeScalarBigWeakMapStore } from '@agoric/vat-data';
|
|
4
2
|
import { provideLazy } from '@agoric/store';
|
|
5
3
|
import { makeNotifierKit } from '@agoric/notifier';
|
|
@@ -7,6 +5,7 @@ import { makeNotifierKit } from '@agoric/notifier';
|
|
|
7
5
|
/**
|
|
8
6
|
* @import {Purse} from './types.js';
|
|
9
7
|
* @import {NotifierRecord} from '@agoric/notifier';
|
|
8
|
+
* @import {WeakMapStore} from '@agoric/store';
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
// Note: Virtual for high cardinality, but *not* durable, and so
|