@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/exported.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
|
|
2
|
+
/** @see {@link /docs/typescript.md} */
|
|
3
|
+
/* eslint-disable -- doesn't understand .d.ts */
|
|
4
|
+
|
|
5
|
+
import '@agoric/notifier/exported.js';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Amount as _Amount,
|
|
9
|
+
Brand as _Brand,
|
|
10
|
+
Issuer as _Issuer,
|
|
11
|
+
IssuerKit as _IssuerKit,
|
|
12
|
+
Mint as _Mint,
|
|
13
|
+
AssetKind as _AssetKind,
|
|
14
|
+
SetValue as _SetValue,
|
|
15
|
+
NatValue as _NatValue,
|
|
16
|
+
DisplayInfo as _DisplayInfo,
|
|
17
|
+
AdditionalDisplayInfo as _AdditionalDisplayInfo,
|
|
18
|
+
Payment as _Payment,
|
|
19
|
+
Purse as _Purse,
|
|
20
|
+
} from './src/types.js';
|
|
21
|
+
declare global {
|
|
22
|
+
// @ts-ignore TS2666: Exports and export assignments are not permitted in module augmentations.
|
|
23
|
+
export {
|
|
24
|
+
_Amount as Amount,
|
|
25
|
+
_Brand as Brand,
|
|
26
|
+
_Issuer as Issuer,
|
|
27
|
+
_IssuerKit as IssuerKit,
|
|
28
|
+
_Mint as Mint,
|
|
29
|
+
_AssetKind as AssetKind,
|
|
30
|
+
_SetValue as SetValue,
|
|
31
|
+
_NatValue as NatValue,
|
|
32
|
+
_DisplayInfo as DisplayInfo,
|
|
33
|
+
_AdditionalDisplayInfo as AdditionalDisplayInfo,
|
|
34
|
+
_Payment as Payment,
|
|
35
|
+
_Purse as Purse,
|
|
36
|
+
};
|
|
37
|
+
}
|
package/exported.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// Dummy file for .d.ts twin to declare ambients
|
|
2
|
+
export {};
|
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": "
|
|
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 $C8_OPTIONS ava",
|
|
16
|
-
"test:xs": "yarn test:xs-
|
|
17
|
-
"test:xs-unit": "
|
|
18
|
-
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2
|
|
15
|
+
"test:c8": "c8 --all ${C8_OPTIONS:-} ava",
|
|
16
|
+
"test:xs": "yarn test:xs-worker",
|
|
17
|
+
"test:xs-unit": "exit 0",
|
|
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": "
|
|
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,45 +39,45 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agoric/
|
|
43
|
-
"@agoric/
|
|
44
|
-
"@agoric/
|
|
45
|
-
"@agoric/
|
|
46
|
-
"@
|
|
47
|
-
"@endo/eventual-send": "
|
|
48
|
-
"@endo/far": "
|
|
49
|
-
"@endo/marshal": "
|
|
50
|
-
"@endo/nat": "
|
|
51
|
-
"@endo/
|
|
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"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"ava": "^
|
|
57
|
-
"
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-fbe72e7.0.fbe72e7",
|
|
56
|
+
"@endo/bundle-source": "^4.1.2",
|
|
57
|
+
"@fast-check/ava": "^1.1.5",
|
|
58
|
+
"ava": "^5.3.0",
|
|
59
|
+
"tsd": "^0.33.0"
|
|
58
60
|
},
|
|
59
61
|
"files": [
|
|
60
62
|
"src",
|
|
61
63
|
"NEWS.md",
|
|
62
|
-
"exported.js"
|
|
64
|
+
"exported.js",
|
|
65
|
+
"exported.d.ts"
|
|
63
66
|
],
|
|
64
|
-
"ava-xs": {
|
|
65
|
-
"exclude": [
|
|
66
|
-
"swingsetTests",
|
|
67
|
-
"# fast-check unsupported",
|
|
68
|
-
"test/unitTests/test-amountProperties.js",
|
|
69
|
-
"test/unitTests/test-inputValidation.js",
|
|
70
|
-
"test/unitTests/test-issuerObj.js"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
67
|
"ava": {
|
|
74
68
|
"files": [
|
|
75
|
-
"test
|
|
69
|
+
"test/**/*.test.*"
|
|
70
|
+
],
|
|
71
|
+
"require": [
|
|
72
|
+
"@endo/init/debug.js"
|
|
76
73
|
],
|
|
77
74
|
"timeout": "5m"
|
|
78
75
|
},
|
|
79
76
|
"publishConfig": {
|
|
80
77
|
"access": "public"
|
|
81
78
|
},
|
|
82
|
-
"
|
|
79
|
+
"typeCoverage": {
|
|
80
|
+
"atLeast": 92.99
|
|
81
|
+
},
|
|
82
|
+
"gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
|
|
83
83
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -1,46 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for the kinds of assets we support.
|
|
3
|
+
*/
|
|
4
|
+
export type AssetKind = (typeof AssetKind)[keyof typeof AssetKind];
|
|
5
|
+
export namespace AssetKind {
|
|
6
|
+
let NAT: "nat";
|
|
7
|
+
let SET: "set";
|
|
8
|
+
let COPY_SET: "copySet";
|
|
9
|
+
let COPY_BAG: "copyBag";
|
|
10
|
+
}
|
|
11
|
+
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
1
12
|
export function assertValueGetHelpers<V extends AmountValue>(value: V): MathHelpers<V>;
|
|
2
13
|
export namespace AmountMath {
|
|
3
|
-
export function make<
|
|
4
|
-
export function coerce<
|
|
5
|
-
export function getValue<
|
|
6
|
-
export
|
|
7
|
-
(brand: Brand
|
|
8
|
-
<K extends AssetKind>(brand: 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
|
+
export function coerce<A extends Amount>(brand: Brand, allegedAmount: A): A;
|
|
16
|
+
export function getValue<A extends Amount>(brand: Brand, amount: A): A["value"];
|
|
17
|
+
export let makeEmpty: {
|
|
18
|
+
(brand: Brand): Amount<"nat">;
|
|
19
|
+
<K extends AssetKind>(brand: Brand<K>, assetKind: K): Amount<K>;
|
|
9
20
|
};
|
|
10
|
-
export function makeEmptyFromAmount<
|
|
11
|
-
export function isEmpty(amount: Amount
|
|
21
|
+
export function makeEmptyFromAmount<A extends Amount>(amount: A): A;
|
|
22
|
+
export function isEmpty(amount: Amount, brand?: Brand): boolean;
|
|
12
23
|
export { isGTE };
|
|
13
|
-
export function isEqual<
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
18
32
|
}
|
|
33
|
+
export function getAssetKind(amount: Amount): "copySet" | "copyBag" | "set" | "nat";
|
|
34
|
+
import type { AmountValue } from './types.js';
|
|
35
|
+
import type { MathHelpers } from './types.js';
|
|
36
|
+
import type { Brand } from './types.js';
|
|
37
|
+
import type { NatValue } from './types.js';
|
|
38
|
+
import type { CopySet } from '@endo/patterns';
|
|
39
|
+
import type { CopyBag } from '@endo/patterns';
|
|
40
|
+
import type { SetValue } from './types.js';
|
|
41
|
+
import type { NatAmount } from './types.js';
|
|
42
|
+
import type { CopySetAmount } from './types.js';
|
|
43
|
+
import type { CopyBagAmount } from './types.js';
|
|
44
|
+
import type { SetAmount } from './types.js';
|
|
45
|
+
import type { Amount } from './types.js';
|
|
19
46
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
NAT: 'nat';
|
|
26
|
-
SET: 'set';
|
|
27
|
-
COPY_SET: 'copySet';
|
|
28
|
-
COPY_BAG: 'copyBag';
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @param {Amount} amount
|
|
32
|
-
*/
|
|
33
|
-
export function getAssetKind(amount: Amount): AssetKindForValue<V>;
|
|
34
|
-
/**
|
|
35
|
-
* @param {AssetKind} allegedAK
|
|
36
|
-
*/
|
|
37
|
-
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
38
|
-
/**
|
|
39
|
-
* Returns true if the leftAmount is greater than or equal to the
|
|
40
|
-
* rightAmount. The notion of "greater than or equal to" depends
|
|
41
|
-
* on the kind of amount, as defined by the MathHelpers. For example,
|
|
42
|
-
* whether rectangle A is greater than rectangle B depends on whether rectangle
|
|
43
|
-
* A includes rectangle B as defined by the logic in MathHelpers.
|
|
47
|
+
* Returns true if the leftAmount is greater than or equal to the rightAmount.
|
|
48
|
+
* The notion of "greater than or equal to" depends on the kind of amount, as
|
|
49
|
+
* defined by the MathHelpers. For example, whether rectangle A is greater than
|
|
50
|
+
* rectangle B depends on whether rectangle A includes rectangle B as defined by
|
|
51
|
+
* the logic in MathHelpers.
|
|
44
52
|
*
|
|
45
53
|
* @template {AssetKind} K
|
|
46
54
|
* @param {Amount<K>} leftAmount
|
|
@@ -48,6 +56,6 @@ export function assertAssetKind(allegedAK: AssetKind): void;
|
|
|
48
56
|
* @param {Brand<K>} [brand]
|
|
49
57
|
* @returns {boolean}
|
|
50
58
|
*/
|
|
51
|
-
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;
|
|
52
60
|
export {};
|
|
53
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":"
|
|
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,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