@agoric/ertp 0.16.3-u14.0 → 0.16.3-u16.1
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 +35 -26
- package/src/amountMath.d.ts +44 -31
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +130 -120
- 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 +2 -0
- package/src/index.js +8 -0
- package/src/issuerKit.d.ts +30 -6
- package/src/issuerKit.d.ts.map +1 -1
- package/src/issuerKit.js +218 -76
- package/src/legacy-payment-helpers.d.ts +6 -1
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +33 -32
- 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 +7 -8
- 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 +6 -7
- package/src/paymentLedger.d.ts +6 -2
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +71 -90
- package/src/purse.d.ts +19 -9
- package/src/purse.d.ts.map +1 -1
- package/src/purse.js +86 -25
- 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 +41 -9
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +38 -43
- package/src/types.d.ts +250 -215
- package/src/types.d.ts.map +1 -1
- package/src/types.js +305 -326
- package/CHANGELOG.md +0 -775
- 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/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-
|
|
3
|
+
"version": "0.16.3-u16.1",
|
|
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": "^18.12 || ^20.9"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "exit 0",
|
|
12
|
-
"prepack": "
|
|
13
|
-
"postpack": "git clean -f '*.d.ts*'
|
|
12
|
+
"prepack": "tsc --build tsconfig.build.json",
|
|
13
|
+
"postpack": "git clean -f '*.d.ts*'",
|
|
14
14
|
"test": "ava",
|
|
15
15
|
"test:c8": "c8 $C8_OPTIONS ava",
|
|
16
16
|
"test:xs": "yarn test:xs-unit && yarn test:xs-worker",
|
|
17
17
|
"test:xs-unit": "ava-xs",
|
|
18
|
-
"test:xs-worker": "SWINGSET_WORKER_TYPE=xs-worker ava -c 2
|
|
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": "run-s --continue-on-error lint:*",
|
|
21
21
|
"lint:eslint": "eslint .",
|
|
22
|
-
"lint:types": "tsc
|
|
22
|
+
"lint:types": "tsc"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -39,45 +39,54 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agoric/assert": "^0.6.1-
|
|
43
|
-
"@agoric/notifier": "^0.
|
|
44
|
-
"@agoric/store": "^0.9.3-
|
|
45
|
-
"@agoric/
|
|
46
|
-
"@agoric/
|
|
47
|
-
"@endo/eventual-send": "
|
|
48
|
-
"@endo/far": "
|
|
49
|
-
"@endo/marshal": "
|
|
50
|
-
"@endo/nat": "
|
|
51
|
-
"@endo/
|
|
42
|
+
"@agoric/assert": "^0.6.1-u16.0",
|
|
43
|
+
"@agoric/notifier": "^0.7.0-u16.1",
|
|
44
|
+
"@agoric/store": "^0.9.3-u16.0",
|
|
45
|
+
"@agoric/vat-data": "^0.5.3-u16.1",
|
|
46
|
+
"@agoric/zone": "^0.3.0-u16.1",
|
|
47
|
+
"@endo/eventual-send": "^1.2.2",
|
|
48
|
+
"@endo/far": "^1.1.2",
|
|
49
|
+
"@endo/marshal": "^1.5.0",
|
|
50
|
+
"@endo/nat": "^5.0.7",
|
|
51
|
+
"@endo/patterns": "^1.4.0",
|
|
52
|
+
"@endo/promise-kit": "^1.1.2"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"ava": "^
|
|
57
|
-
"
|
|
55
|
+
"@agoric/swingset-vat": "^0.33.0-u16.1",
|
|
56
|
+
"@endo/bundle-source": "^3.2.3",
|
|
57
|
+
"@fast-check/ava": "^1.1.5",
|
|
58
|
+
"ava": "^5.3.0",
|
|
59
|
+
"tsd": "^0.30.7"
|
|
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
67
|
"ava-xs": {
|
|
65
68
|
"exclude": [
|
|
66
69
|
"swingsetTests",
|
|
67
70
|
"# fast-check unsupported",
|
|
68
|
-
"test/unitTests/
|
|
69
|
-
"test/unitTests/
|
|
70
|
-
"test/unitTests/
|
|
71
|
+
"test/unitTests/amountProperties.test.js",
|
|
72
|
+
"test/unitTests/inputValidation.test.js",
|
|
73
|
+
"test/unitTests/issuerObj.test.js"
|
|
71
74
|
]
|
|
72
75
|
},
|
|
73
76
|
"ava": {
|
|
74
77
|
"files": [
|
|
75
|
-
"test
|
|
78
|
+
"test/**/*.test.*"
|
|
79
|
+
],
|
|
80
|
+
"require": [
|
|
81
|
+
"@endo/init/debug.js"
|
|
76
82
|
],
|
|
77
83
|
"timeout": "5m"
|
|
78
84
|
},
|
|
79
85
|
"publishConfig": {
|
|
80
86
|
"access": "public"
|
|
81
87
|
},
|
|
82
|
-
"
|
|
88
|
+
"typeCoverage": {
|
|
89
|
+
"atLeast": 91.22
|
|
90
|
+
},
|
|
91
|
+
"gitHead": "2eaeab90b4015e355faea534c1c933351d25b1b9"
|
|
83
92
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -1,46 +1,59 @@
|
|
|
1
|
-
export function assertValueGetHelpers<V
|
|
1
|
+
export function assertValueGetHelpers<V>(value: V): MathHelpers<V>;
|
|
2
|
+
import type { MathHelpers } from './types.js';
|
|
2
3
|
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<
|
|
4
|
+
export function make<B extends Brand, 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;
|
|
5
|
+
export function coerce<A extends Amount>(brand: Brand, allegedAmount: A): A;
|
|
6
|
+
export function getValue<A extends Amount>(brand: Brand, amount: A): A["value"];
|
|
7
|
+
export let makeEmpty: {
|
|
8
|
+
(brand: Brand): Amount<"nat">;
|
|
9
|
+
<K extends AssetKind>(brand: Brand<K>, assetKind: K): Amount<K>;
|
|
9
10
|
};
|
|
10
|
-
export function makeEmptyFromAmount<
|
|
11
|
-
export function isEmpty(amount: Amount
|
|
11
|
+
export function makeEmptyFromAmount<A extends Amount>(amount: A): A;
|
|
12
|
+
export function isEmpty(amount: Amount, brand?: Brand | undefined): boolean;
|
|
12
13
|
export { isGTE };
|
|
13
|
-
export function isEqual<
|
|
14
|
-
export function add<
|
|
15
|
-
export function subtract<
|
|
16
|
-
export function min<
|
|
17
|
-
export function max<
|
|
14
|
+
export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): boolean;
|
|
15
|
+
export function add<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): A;
|
|
16
|
+
export function subtract<L extends Amount, R extends Amount>(leftAmount: L, rightAmount: R, brand?: Brand | undefined): L extends R ? L : never;
|
|
17
|
+
export function min<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
18
|
+
export function max<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Constants for the kinds of assets we support.
|
|
21
22
|
*
|
|
22
|
-
* @type {{
|
|
23
|
+
* @type {{
|
|
24
|
+
* NAT: 'nat';
|
|
25
|
+
* SET: 'set';
|
|
26
|
+
* COPY_SET: 'copySet';
|
|
27
|
+
* COPY_BAG: 'copyBag';
|
|
28
|
+
* }}
|
|
23
29
|
*/
|
|
24
30
|
export const AssetKind: {
|
|
25
|
-
NAT:
|
|
26
|
-
SET:
|
|
27
|
-
COPY_SET:
|
|
28
|
-
COPY_BAG:
|
|
31
|
+
NAT: "nat";
|
|
32
|
+
SET: "set";
|
|
33
|
+
COPY_SET: "copySet";
|
|
34
|
+
COPY_BAG: "copyBag";
|
|
29
35
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @param {AssetKind} allegedAK
|
|
36
|
-
*/
|
|
36
|
+
import type { AssetKind } from './types.js';
|
|
37
|
+
/** @param {Amount} amount */
|
|
38
|
+
export function getAssetKind(amount: Amount): "copySet" | "set" | "nat" | "copyBag";
|
|
39
|
+
/** @param {AssetKind} allegedAK */
|
|
37
40
|
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
41
|
+
import type { Brand } from './types.js';
|
|
42
|
+
import type { NatValue } from './types.js';
|
|
43
|
+
import type { CopySet } from '@endo/patterns';
|
|
44
|
+
import type { CopyBag } from '@endo/patterns';
|
|
45
|
+
import type { SetValue } from './types.js';
|
|
46
|
+
import type { NatAmount } from './types.js';
|
|
47
|
+
import type { CopySetAmount } from './types.js';
|
|
48
|
+
import type { CopyBagAmount } from './types.js';
|
|
49
|
+
import type { SetAmount } from './types.js';
|
|
50
|
+
import type { Amount } from './types.js';
|
|
38
51
|
/**
|
|
39
|
-
* Returns true if the leftAmount is greater than or equal to the
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* whether rectangle A
|
|
43
|
-
*
|
|
52
|
+
* Returns true if the leftAmount is greater than or equal to the rightAmount.
|
|
53
|
+
* The notion of "greater than or equal to" depends on the kind of amount, as
|
|
54
|
+
* defined by the MathHelpers. For example, whether rectangle A is greater than
|
|
55
|
+
* rectangle B depends on whether rectangle A includes rectangle B as defined by
|
|
56
|
+
* the logic in MathHelpers.
|
|
44
57
|
*
|
|
45
58
|
* @template {AssetKind} K
|
|
46
59
|
* @param {Amount<K>} leftAmount
|
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":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