@agoric/ertp 0.16.3-other-dev-1f26562.0 → 0.16.3-other-dev-3eb1a1d.0
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 -35
- package/src/amountMath.d.ts +42 -38
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +131 -127
- 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 +30 -5
- 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 +34 -34
- 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 +6 -7
- package/src/paymentLedger.d.ts +6 -2
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +76 -95
- package/src/purse.d.ts +19 -9
- package/src/purse.d.ts.map +1 -1
- package/src/purse.js +86 -26
- 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 +60 -13
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +69 -57
- package/src/types-index.d.ts +2 -0
- package/src/types-index.js +2 -0
- package/src/types.d.ts +253 -219
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +468 -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-3eb1a1d.0+3eb1a1d",
|
|
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*' '*.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
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,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-3eb1a1d.0+3eb1a1d",
|
|
43
|
+
"@agoric/store": "0.9.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
45
|
+
"@agoric/zone": "0.2.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
46
|
+
"@endo/errors": "^1.2.8",
|
|
47
|
+
"@endo/eventual-send": "^1.2.8",
|
|
48
|
+
"@endo/far": "^1.1.9",
|
|
49
|
+
"@endo/marshal": "^1.6.2",
|
|
50
|
+
"@endo/nat": "^5.0.13",
|
|
51
|
+
"@endo/patterns": "^1.4.7",
|
|
52
|
+
"@endo/promise-kit": "^1.1.8"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"ava": "^
|
|
57
|
-
"
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-3eb1a1d.0+3eb1a1d",
|
|
56
|
+
"@endo/bundle-source": "^3.5.0",
|
|
57
|
+
"@fast-check/ava": "^1.1.5",
|
|
58
|
+
"ava": "^5.3.0",
|
|
59
|
+
"tsd": "^0.31.1"
|
|
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": 91.76
|
|
81
|
+
},
|
|
82
|
+
"gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
|
|
83
83
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
export function assertValueGetHelpers<V extends AmountValue>(value: V): MathHelpers<V>;
|
|
2
|
-
export namespace AmountMath {
|
|
3
|
-
export function make<K extends AssetKind>(brand: Brand<K>, allegedValue: AssetValueForKind<K>): Amount<K>;
|
|
4
|
-
export function coerce<K extends AssetKind>(brand: Brand<K>, allegedAmount: Amount<K>): Amount<K>;
|
|
5
|
-
export function getValue<K extends AssetKind>(brand: Brand<K>, amount: Amount<K>): AssetValueForKind<K>;
|
|
6
|
-
export const makeEmpty: {
|
|
7
|
-
(brand: Brand<AssetKind>): Amount<"nat">;
|
|
8
|
-
<K extends AssetKind>(brand: Brand<AssetKind>, assetKind: K): Amount<K>;
|
|
9
|
-
};
|
|
10
|
-
export function makeEmptyFromAmount<K extends AssetKind>(amount: Amount<K>): Amount<K>;
|
|
11
|
-
export function isEmpty(amount: Amount<AssetKind>, brand?: Brand<AssetKind> | undefined): boolean;
|
|
12
|
-
export { isGTE };
|
|
13
|
-
export function isEqual<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): boolean;
|
|
14
|
-
export function add<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
15
|
-
export function subtract<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
16
|
-
export function min<K extends AssetKind>(x: Amount<K>, y: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
17
|
-
export function max<K extends AssetKind>(x: Amount<K>, y: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
18
|
-
}
|
|
19
1
|
/**
|
|
20
2
|
* Constants for the kinds of assets we support.
|
|
21
|
-
*
|
|
22
|
-
* @type {{ NAT: 'nat', SET: 'set', COPY_SET: 'copySet', COPY_BAG: 'copyBag' }}
|
|
23
|
-
*/
|
|
24
|
-
export const AssetKind: {
|
|
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
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
|
+
}
|
|
37
11
|
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
12
|
+
export function assertValueGetHelpers<V>(value: V): MathHelpers<V>;
|
|
13
|
+
export namespace AmountMath {
|
|
14
|
+
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;
|
|
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>;
|
|
20
|
+
};
|
|
21
|
+
export function makeEmptyFromAmount<A extends Amount>(amount: A): A;
|
|
22
|
+
export function isEmpty(amount: Amount, brand?: Brand | undefined): boolean;
|
|
23
|
+
export { isGTE };
|
|
24
|
+
export function isEqual<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): boolean;
|
|
25
|
+
export function add<A extends Amount>(leftAmount: A, rightAmount: A, brand?: Brand | undefined): A;
|
|
26
|
+
export function subtract<L extends Amount, R extends Amount>(leftAmount: L, rightAmount: R, brand?: Brand | undefined): L extends R ? L : never;
|
|
27
|
+
export function min<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
28
|
+
export function max<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
29
|
+
}
|
|
30
|
+
export function getAssetKind(amount: Amount): "copySet" | "set" | "nat" | "copyBag";
|
|
31
|
+
import type { MathHelpers } from './types.js';
|
|
32
|
+
import type { Brand } from './types.js';
|
|
33
|
+
import type { NatValue } from './types.js';
|
|
34
|
+
import type { CopySet } from '@endo/patterns';
|
|
35
|
+
import type { CopyBag } from '@endo/patterns';
|
|
36
|
+
import type { SetValue } from './types.js';
|
|
37
|
+
import type { NatAmount } from './types.js';
|
|
38
|
+
import type { CopySetAmount } from './types.js';
|
|
39
|
+
import type { CopyBagAmount } from './types.js';
|
|
40
|
+
import type { SetAmount } from './types.js';
|
|
41
|
+
import type { Amount } from './types.js';
|
|
38
42
|
/**
|
|
39
|
-
* Returns true if the leftAmount is greater than or equal to the
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* whether rectangle A
|
|
43
|
-
*
|
|
43
|
+
* Returns true if the leftAmount is greater than or equal to the rightAmount.
|
|
44
|
+
* The notion of "greater than or equal to" depends on the kind of amount, as
|
|
45
|
+
* defined by the MathHelpers. For example, whether rectangle A is greater than
|
|
46
|
+
* rectangle B depends on whether rectangle A includes rectangle B as defined by
|
|
47
|
+
* the logic in MathHelpers.
|
|
44
48
|
*
|
|
45
49
|
* @template {AssetKind} K
|
|
46
50
|
* @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":"","sources":["amountMath.js"],"names":[],"mappings":";;;wBAkBU,CAAC,OAAO,SAAS,EAAE,MAAM,OAAO,SAAS,CAAC;;;;;;;AAY7C,2CADK,SAAS,QAIpB;AA8EM,sCAJM,CAAC,SACH,CAAC,GACC,YAAY,CAAC,CAAC,CAIc;;IAsGjC,qBAhBe,CAAC,SAAT,KAAO,EACmC,CAAC,SAA1C,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAS,SAC3C,CAAC,gBACD,CAAC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