@agoric/ertp 0.16.3-dev-f1638f9.0 → 0.16.3-dev-a477bee.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 +39 -0
- package/exported.js +1 -1
- package/package.json +12 -11
- package/src/amountMath.d.ts +61 -0
- package/src/amountMath.d.ts.map +1 -0
- package/src/amountMath.js +2 -0
- package/src/amountStore.d.ts +9 -0
- package/src/amountStore.d.ts.map +1 -0
- package/src/amountStore.js +2 -0
- package/src/displayInfo.d.ts +5 -0
- package/src/displayInfo.d.ts.map +1 -0
- package/src/displayInfo.js +2 -0
- package/src/index.d.ts +4 -0
- package/src/index.d.ts.map +1 -0
- package/src/issuerKit.d.ts +43 -0
- package/src/issuerKit.d.ts.map +1 -0
- package/src/issuerKit.js +3 -2
- package/src/legacy-payment-helpers.d.ts +9 -0
- package/src/legacy-payment-helpers.d.ts.map +1 -0
- package/src/legacy-payment-helpers.js +2 -0
- package/src/mathHelpers/copyBagMathHelpers.d.ts +4 -0
- package/src/mathHelpers/copyBagMathHelpers.d.ts.map +1 -0
- package/src/mathHelpers/copyBagMathHelpers.js +2 -1
- package/src/mathHelpers/copySetMathHelpers.d.ts +5 -0
- package/src/mathHelpers/copySetMathHelpers.d.ts.map +1 -0
- package/src/mathHelpers/copySetMathHelpers.js +5 -1
- package/src/mathHelpers/natMathHelpers.d.ts +14 -0
- package/src/mathHelpers/natMathHelpers.d.ts.map +1 -0
- package/src/mathHelpers/natMathHelpers.js +1 -1
- package/src/mathHelpers/setMathHelpers.d.ts +8 -0
- package/src/mathHelpers/setMathHelpers.d.ts.map +1 -0
- package/src/mathHelpers/setMathHelpers.js +2 -1
- package/src/payment.d.ts +5 -0
- package/src/payment.d.ts.map +1 -0
- package/src/payment.js +2 -0
- package/src/paymentLedger.d.ts +7 -0
- package/src/paymentLedger.d.ts.map +1 -0
- package/src/paymentLedger.js +5 -0
- package/src/purse.d.ts +24 -0
- package/src/purse.d.ts.map +1 -0
- package/src/purse.js +2 -0
- package/src/transientNotifier.d.ts +5 -0
- package/src/transientNotifier.d.ts.map +1 -0
- package/src/transientNotifier.js +2 -0
- package/src/typeGuards.d.ts +74 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/typeGuards.js +1 -0
- package/src/types.d.ts +382 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +3 -3
- package/src/types-ambient.js +0 -367
package/exported.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable -- doesn't understand .d.ts */
|
|
2
|
+
|
|
3
|
+
export * from './src/types.js';
|
|
4
|
+
|
|
5
|
+
// XXX re-export types into global namespace, for consumers that expect these to
|
|
6
|
+
// be ambient. Why the _ prefix? Because without it TS gets confused between the
|
|
7
|
+
// import and export symbols. h/t https://stackoverflow.com/a/66588974
|
|
8
|
+
// Note one big downside vs ambients is that these types will appear to be on `globalThis`.
|
|
9
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/6512
|
|
10
|
+
import {
|
|
11
|
+
Amount as _Amount,
|
|
12
|
+
Brand as _Brand,
|
|
13
|
+
Issuer as _Issuer,
|
|
14
|
+
IssuerKit as _IssuerKit,
|
|
15
|
+
Mint as _Mint,
|
|
16
|
+
AssetKind as _AssetKind,
|
|
17
|
+
SetValue as _SetValue,
|
|
18
|
+
NatValue as _NatValue,
|
|
19
|
+
DisplayInfo as _DisplayInfo,
|
|
20
|
+
AdditionalDisplayInfo as _AdditionalDisplayInfo,
|
|
21
|
+
Payment as _Payment,
|
|
22
|
+
Purse as _Purse,
|
|
23
|
+
} from './src/types.js';
|
|
24
|
+
declare global {
|
|
25
|
+
export {
|
|
26
|
+
_Amount as Amount,
|
|
27
|
+
_Brand as Brand,
|
|
28
|
+
_Issuer as Issuer,
|
|
29
|
+
_IssuerKit as IssuerKit,
|
|
30
|
+
_Mint as Mint,
|
|
31
|
+
_AssetKind as AssetKind,
|
|
32
|
+
_SetValue as SetValue,
|
|
33
|
+
_NatValue as NatValue,
|
|
34
|
+
_DisplayInfo as DisplayInfo,
|
|
35
|
+
_AdditionalDisplayInfo as AdditionalDisplayInfo,
|
|
36
|
+
_Payment as Payment,
|
|
37
|
+
_Purse as Purse,
|
|
38
|
+
};
|
|
39
|
+
}
|
package/exported.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
// Dummy file for .d.ts twin to declare ambients
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/ertp",
|
|
3
|
-
"version": "0.16.3-dev-
|
|
3
|
+
"version": "0.16.3-dev-a477bee.0+a477bee",
|
|
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",
|
|
@@ -9,8 +9,8 @@
|
|
|
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",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agoric/assert": "0.6.1-dev-
|
|
43
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
44
|
-
"@agoric/store": "0.9.3-dev-
|
|
45
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
46
|
-
"@agoric/zone": "0.2.3-dev-
|
|
42
|
+
"@agoric/assert": "0.6.1-dev-a477bee.0+a477bee",
|
|
43
|
+
"@agoric/notifier": "0.6.3-dev-a477bee.0+a477bee",
|
|
44
|
+
"@agoric/store": "0.9.3-dev-a477bee.0+a477bee",
|
|
45
|
+
"@agoric/vat-data": "0.5.3-dev-a477bee.0+a477bee",
|
|
46
|
+
"@agoric/zone": "0.2.3-dev-a477bee.0+a477bee",
|
|
47
47
|
"@endo/eventual-send": "^1.2.0",
|
|
48
48
|
"@endo/far": "^1.1.0",
|
|
49
49
|
"@endo/marshal": "^1.4.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@endo/promise-kit": "^1.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-dev-a477bee.0+a477bee",
|
|
56
56
|
"@endo/bundle-source": "^3.2.1",
|
|
57
57
|
"@fast-check/ava": "^1.1.5",
|
|
58
58
|
"ava": "^5.3.0",
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"files": [
|
|
62
62
|
"src",
|
|
63
63
|
"NEWS.md",
|
|
64
|
-
"exported.js"
|
|
64
|
+
"exported.js",
|
|
65
|
+
"exported.d.ts"
|
|
65
66
|
],
|
|
66
67
|
"ava-xs": {
|
|
67
68
|
"exclude": [
|
|
@@ -87,5 +88,5 @@
|
|
|
87
88
|
"typeCoverage": {
|
|
88
89
|
"atLeast": 90.61
|
|
89
90
|
},
|
|
90
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "a477bee3be6e0e98b9346c0640380e276cf8423e"
|
|
91
92
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export function assertValueGetHelpers<V extends AmountValue>(value: V): MathHelpers<V>;
|
|
2
|
+
import type { AmountValue } from './types.js';
|
|
3
|
+
import type { MathHelpers } from './types.js';
|
|
4
|
+
export namespace AmountMath {
|
|
5
|
+
export function make<K extends AssetKind>(brand: Brand<K>, allegedValue: AssetValueForKind<K>): Amount<K>;
|
|
6
|
+
export function coerce<K extends AssetKind>(brand: Brand<K>, allegedAmount: Amount<K>): Amount<K>;
|
|
7
|
+
export function getValue<K extends AssetKind>(brand: Brand<K>, amount: Amount<K>): AssetValueForKind<K>;
|
|
8
|
+
export let makeEmpty: {
|
|
9
|
+
(brand: Brand): Amount<"nat">;
|
|
10
|
+
<K extends AssetKind>(brand: Brand, assetKind: K): Amount<K>;
|
|
11
|
+
};
|
|
12
|
+
export function makeEmptyFromAmount<K extends AssetKind>(amount: Amount<K>): Amount<K>;
|
|
13
|
+
export function isEmpty(amount: Amount, brand?: Brand | undefined): boolean;
|
|
14
|
+
export { isGTE };
|
|
15
|
+
export function isEqual<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): boolean;
|
|
16
|
+
export function add<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
17
|
+
export function subtract<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
18
|
+
export function min<K extends AssetKind>(x: Amount<K>, y: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
19
|
+
export function max<K extends AssetKind>(x: Amount<K>, y: Amount<K>, brand?: Brand<K> | undefined): Amount<K>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Constants for the kinds of assets we support.
|
|
23
|
+
*
|
|
24
|
+
* @type {{
|
|
25
|
+
* NAT: 'nat';
|
|
26
|
+
* SET: 'set';
|
|
27
|
+
* COPY_SET: 'copySet';
|
|
28
|
+
* COPY_BAG: 'copyBag';
|
|
29
|
+
* }}
|
|
30
|
+
*/
|
|
31
|
+
export const AssetKind: {
|
|
32
|
+
NAT: 'nat';
|
|
33
|
+
SET: 'set';
|
|
34
|
+
COPY_SET: 'copySet';
|
|
35
|
+
COPY_BAG: 'copyBag';
|
|
36
|
+
};
|
|
37
|
+
import type { AssetKind } from './types.js';
|
|
38
|
+
/** @param {Amount} amount */
|
|
39
|
+
export function getAssetKind(amount: Amount): AssetKindForValue<V>;
|
|
40
|
+
/** @param {AssetKind} allegedAK */
|
|
41
|
+
export function assertAssetKind(allegedAK: AssetKind): void;
|
|
42
|
+
import type { Brand } from './types.js';
|
|
43
|
+
import type { AssetValueForKind } from './types.js';
|
|
44
|
+
import type { Amount } from './types.js';
|
|
45
|
+
/**
|
|
46
|
+
* Returns true if the leftAmount is greater than or equal to the rightAmount.
|
|
47
|
+
* The notion of "greater than or equal to" depends on the kind of amount, as
|
|
48
|
+
* defined by the MathHelpers. For example, whether rectangle A is greater than
|
|
49
|
+
* rectangle B depends on whether rectangle A includes rectangle B as defined by
|
|
50
|
+
* the logic in MathHelpers.
|
|
51
|
+
*
|
|
52
|
+
* @template {AssetKind} K
|
|
53
|
+
* @param {Amount<K>} leftAmount
|
|
54
|
+
* @param {Amount<K>} rightAmount
|
|
55
|
+
* @param {Brand<K>} [brand]
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
declare function isGTE<K extends AssetKind>(leftAmount: Amount<K>, rightAmount: Amount<K>, brand?: Brand<K> | undefined): boolean;
|
|
59
|
+
import type { AssetKindForValue } from './types.js';
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=amountMath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amountMath.d.ts","sourceRoot":"","sources":["amountMath.js"],"names":[],"mappings":"AAuHO,uFAEkC;iCAjHmE,YAAY;iCAAZ,YAAY;;IAyMhH,0GAKL;IAUO,kGAQP;IASS,wGAAyD;;;;;IAwB9C,uFAOpB;IAQQ,4EAOR;;IAYQ,mIAGR;IAcI,iIAIJ;IAcS,sIAIT;IAUI,8GAMuC;IAUvC,8GAMuC;;AAtW9C;;;;;;;;;GASG;AACH,wBAPU;IACT,GAAO,EAAE,KAAK,CAAC;IACf,GAAO,EAAE,KAAK,CAAC;IACf,QAAY,EAAE,SAAS,CAAC;IACxB,QAAY,EAAE,SAAS,CAAC;CACrB,CAOD;+BAnByG,YAAY;AA8WxH,6BAA6B;AAC7B,mEAKC;AA9VD,mCAAmC;AACnC,2CADY,SAAS,QAIpB;2BA1B2G,YAAY;uCAAZ,YAAY;4BAAZ,YAAY;AAqKxH;;;;;;;;;;;;GAYG;AACH,0HAFa,OAAO,CAKnB;uCArL2G,YAAY"}
|
package/src/amountMath.js
CHANGED
|
@@ -6,6 +6,8 @@ import { setMathHelpers } from './mathHelpers/setMathHelpers.js';
|
|
|
6
6
|
import { copySetMathHelpers } from './mathHelpers/copySetMathHelpers.js';
|
|
7
7
|
import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
|
|
8
8
|
|
|
9
|
+
/** @import {Amount, AssetKind, AmountValue, AssetKindForValue, AssetValueForKind, Brand, MathHelpers} from './types.js' */
|
|
10
|
+
|
|
9
11
|
const { quote: q, Fail } = assert;
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function makeAmountStore<K extends AssetKind = AssetKind>(state: object, key: string): AmountStore<K>;
|
|
2
|
+
export type AmountStore<K extends AssetKind = AssetKind> = {
|
|
3
|
+
getAmount: () => Amount<K>;
|
|
4
|
+
increment: (delta: Amount<K>) => void;
|
|
5
|
+
decrement: (delta: Amount<K>) => boolean;
|
|
6
|
+
};
|
|
7
|
+
import type { AssetKind } from './types.js';
|
|
8
|
+
import type { Amount } from './types.js';
|
|
9
|
+
//# sourceMappingURL=amountStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amountStore.d.ts","sourceRoot":"","sources":["amountStore.js"],"names":[],"mappings":"AAkBO,wEAJI,MAAM,OACN,MAAM,kBAiBhB;;;qCAxBmC,IAAI;qCACJ,OAAO;;+BAPiE,YAAY;4BAAZ,YAAY"}
|
package/src/amountStore.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function coerceDisplayInfo(allegedDisplayInfo: AdditionalDisplayInfo, assetKind: AssetKind): DisplayInfo;
|
|
2
|
+
import type { AdditionalDisplayInfo } from './types.js';
|
|
3
|
+
import type { AssetKind } from './types.js';
|
|
4
|
+
import type { DisplayInfo } from './types.js';
|
|
5
|
+
//# sourceMappingURL=displayInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayInfo.d.ts","sourceRoot":"","sources":["displayInfo.js"],"names":[],"mappings":"AAcO,gHAeN;2CAtBgE,YAAY;+BAAZ,YAAY;iCAAZ,YAAY"}
|
package/src/displayInfo.js
CHANGED
|
@@ -5,6 +5,8 @@ import { mustMatch } from '@agoric/store';
|
|
|
5
5
|
|
|
6
6
|
import { DisplayInfoShape } from './typeGuards.js';
|
|
7
7
|
|
|
8
|
+
/** @import {AdditionalDisplayInfo, AssetKind, DisplayInfo} from './types.js' */
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @param {AdditionalDisplayInfo} allegedDisplayInfo
|
|
10
12
|
* @param {AssetKind} assetKind
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function upgradeIssuerKit<K extends import("./types.js").AssetKind>(issuerBaggage: import('@agoric/vat-data').Baggage, optShutdownWithFailure?: ShutdownWithFailure | undefined, recoverySetsOption?: RecoverySetsOption | undefined): IssuerKit<K>;
|
|
2
|
+
export function hasIssuer(baggage: import('@agoric/vat-data').Baggage): boolean;
|
|
3
|
+
export function makeDurableIssuerKit<K extends import("./types.js").AssetKind>(issuerBaggage: import('@agoric/vat-data').Baggage, name: string, assetKind?: K | undefined, displayInfo?: AdditionalDisplayInfo | undefined, optShutdownWithFailure?: ShutdownWithFailure | undefined, { elementShape, recoverySetsOption }?: Partial<{
|
|
4
|
+
elementShape: Pattern;
|
|
5
|
+
recoverySetsOption: RecoverySetsOption;
|
|
6
|
+
}> | undefined): IssuerKit<K>;
|
|
7
|
+
export function prepareIssuerKit<K extends import("./types.js").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 import("./types.js").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>;
|
|
15
|
+
export type IssuerRecord<K extends import("./types.js").AssetKind> = {
|
|
16
|
+
name: string;
|
|
17
|
+
assetKind: K;
|
|
18
|
+
displayInfo: AdditionalDisplayInfo;
|
|
19
|
+
elementShape: Pattern;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* `elementShape`, may only be present for collection-style amounts. If present,
|
|
23
|
+
* it is a `Pattern` that every element of this issuerKits's amounts must
|
|
24
|
+
* satisfy. For example, the Zoe Invitation issuerKit uses an elementShape
|
|
25
|
+
* describing the invitation details for an individual invitation. An invitation
|
|
26
|
+
* purse or payment has an amount that can only be a set of these. (Though
|
|
27
|
+
* typically, the amount of an invitation payment is a singleton set. Such a
|
|
28
|
+
* payment is often referred to in the singular as "an invitation".)
|
|
29
|
+
*
|
|
30
|
+
* `recoverySetsOption` added in upgrade. Note that `IssuerOptionsRecord` is
|
|
31
|
+
* never stored, so we never need to worry about inheriting one from a
|
|
32
|
+
* predecessor predating the introduction of recovery sets. See
|
|
33
|
+
* `RecoverySetsOption` for defaulting behavior.
|
|
34
|
+
*/
|
|
35
|
+
export type IssuerOptionsRecord = {
|
|
36
|
+
elementShape?: Pattern;
|
|
37
|
+
recoverySetsOption?: RecoverySetsOption | undefined;
|
|
38
|
+
};
|
|
39
|
+
import type { ShutdownWithFailure } from '@agoric/swingset-vat';
|
|
40
|
+
import type { RecoverySetsOption } from './types.js';
|
|
41
|
+
import type { IssuerKit } from './types.js';
|
|
42
|
+
import type { AdditionalDisplayInfo } from './types.js';
|
|
43
|
+
//# sourceMappingURL=issuerKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuerKit.d.ts","sourceRoot":"","sources":["issuerKit.js"],"names":[],"mappings":"AA4GO,0FAZI,OAAO,kBAAkB,EAAE,OAAO,+HAyC5C;AAQM,mCAFI,OAAO,kBAAkB,EAAE,OAAO,WAEgB;AAoDtD,8FAdI,OAAO,kBAAkB,EAAE,OAAO,QAClC,MAAM;kBAtBE,OAAO;;8BA4DzB;AAiCM,0FAdI,OAAO,kBAAkB,EAAE,OAAO,QAClC,MAAM;kBAhFE,OAAO;;8BAkIzB;AAqCM,sFAbI,MAAM;kBA1JE,OAAO;;8BAsLvB;;UAvUW,MAAM;eACN,CAAC;;kBAED,OAAO;;;;;;;;;;;;;;;;;mBA8IF,OAAO;;;yCAtJa,sBAAsB;wCAD0B,YAAY;+BAAZ,YAAY;2CAAZ,YAAY"}
|
package/src/issuerKit.js
CHANGED
|
@@ -9,7 +9,8 @@ import { AssetKind, assertAssetKind } from './amountMath.js';
|
|
|
9
9
|
import { coerceDisplayInfo } from './displayInfo.js';
|
|
10
10
|
import { preparePaymentLedger } from './paymentLedger.js';
|
|
11
11
|
|
|
12
|
-
import './types
|
|
12
|
+
/** @import {AdditionalDisplayInfo, RecoverySetsOption, IssuerKit, PaymentLedger} from './types.js' */
|
|
13
|
+
/** @import {ShutdownWithFailure} from '@agoric/swingset-vat' */
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @template {AssetKind} K
|
|
@@ -58,7 +59,7 @@ const setupIssuerKit = (
|
|
|
58
59
|
|
|
59
60
|
// Attenuate the powerful authority to mint and change balances
|
|
60
61
|
/** @type {PaymentLedger<K>} */
|
|
61
|
-
// @ts-expect-error could be instantiated with different subtype
|
|
62
|
+
// @ts-expect-error could be instantiated with a different subtype
|
|
62
63
|
const { issuer, mint, brand, mintRecoveryPurse } = preparePaymentLedger(
|
|
63
64
|
issuerZone,
|
|
64
65
|
name,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function claim<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, optAmountShape?: Pattern): Promise<Payment<K>>;
|
|
2
|
+
export function combine<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentsPs: ERef<Payment<K>>[], optTotalAmount?: Pattern): Promise<Payment<K>>;
|
|
3
|
+
export function split<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, paymentAmountA: Amount<K>): Promise<Payment<K>[]>;
|
|
4
|
+
export function splitMany<K extends AssetKind>(recoveryPurse: ERef<Purse<K>>, srcPaymentP: ERef<Payment<K>>, amounts: Amount<K>[]): Promise<Payment[]>;
|
|
5
|
+
import type { AssetKind } from './types.js';
|
|
6
|
+
import type { Purse } from './types.js';
|
|
7
|
+
import type { Payment } from './types.js';
|
|
8
|
+
import type { Amount } from './types.js';
|
|
9
|
+
//# sourceMappingURL=legacy-payment-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-payment-helpers.d.ts","sourceRoot":"","sources":["legacy-payment-helpers.js"],"names":[],"mappings":"AA+BO,0HAHI,OAAO,uBAYjB;AAiBM,gIAHI,OAAO,uBA2BjB;AAgBM,2JAUN;AAgBM,uJAkBN;+BAvI2F,YAAY;2BAAZ,YAAY;6BAAZ,YAAY;4BAAZ,YAAY"}
|
|
@@ -4,6 +4,8 @@ import { mustMatch } from '@agoric/store';
|
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
5
|
import { AmountMath } from './amountMath.js';
|
|
6
6
|
|
|
7
|
+
/** @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js' */
|
|
8
|
+
|
|
7
9
|
const { Fail } = assert;
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyBagMathHelpers.d.ts","sourceRoot":"","sources":["copyBagMathHelpers.js"],"names":[],"mappings":"AAkBA,4DAA4D;AAC5D,oFAWG;iCAjB4B,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copySetMathHelpers.d.ts","sourceRoot":"","sources":["copySetMathHelpers.js"],"names":[],"mappings":"AAqBA,mCAAmC;AACnC,sDAWG;6BAlBuB,gBAAgB;iCADZ,aAAa"}
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
setDisjointUnion,
|
|
11
11
|
setDisjointSubtract,
|
|
12
12
|
} from '@agoric/store';
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @import {MathHelpers} from '../types.js'
|
|
16
|
+
* @import {CopySet} from '@endo/patterns'
|
|
17
|
+
*/
|
|
14
18
|
|
|
15
19
|
/** @type {CopySet} */
|
|
16
20
|
const empty = makeCopySet([]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fungible digital assets use the natMathHelpers to manage balances - the
|
|
3
|
+
* operations are merely arithmetic on natural, non-negative numbers.
|
|
4
|
+
*
|
|
5
|
+
* Natural numbers are used for fungible erights such as money because rounding
|
|
6
|
+
* issues make floats problematic. All operations should be done with the
|
|
7
|
+
* smallest whole unit such that the `natMathHelpers` never deals with
|
|
8
|
+
* fractional parts.
|
|
9
|
+
*
|
|
10
|
+
* @type {MathHelpers<NatValue>}
|
|
11
|
+
*/
|
|
12
|
+
export const natMathHelpers: MathHelpers<bigint>;
|
|
13
|
+
import type { MathHelpers } from '../types.js';
|
|
14
|
+
//# sourceMappingURL=natMathHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,iDAcG;iCA9BsC,aAAa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Replace array-based SetMath with CopySet-based CopySetMath
|
|
3
|
+
* @type {MathHelpers<SetValue>}
|
|
4
|
+
*/
|
|
5
|
+
export const setMathHelpers: MathHelpers<SetValue>;
|
|
6
|
+
import type { SetValue } from '../types.js';
|
|
7
|
+
import type { MathHelpers } from '../types.js';
|
|
8
|
+
//# sourceMappingURL=setMathHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setMathHelpers.d.ts","sourceRoot":"","sources":["setMathHelpers.js"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,mDAgBG;8BA3BsC,aAAa;iCAAb,aAAa"}
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
coerceToElements,
|
|
10
10
|
elementsCompare,
|
|
11
11
|
} from '@agoric/store';
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
/** @import {MathHelpers, SetValue} from '../types.js' */
|
|
13
14
|
|
|
14
15
|
// Operations for arrays with unique objects identifying and providing
|
|
15
16
|
// information about digital assets. Used for Zoe invites.
|
package/src/payment.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
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>;
|
|
2
|
+
import type { AssetKind } from './types.js';
|
|
3
|
+
import type { Brand } from './types.js';
|
|
4
|
+
import type { Payment } from './types.js';
|
|
5
|
+
//# sourceMappingURL=payment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.js"],"names":[],"mappings":"AAeO,oEANI,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,6BAEN,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,oBAetD;+BAvB4C,YAAY;2BAAZ,YAAY;6BAAZ,YAAY"}
|
package/src/payment.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function preparePaymentLedger<K extends AssetKind>(issuerZone: import('@agoric/zone').Zone, name: string, assetKind: K, displayInfo: DisplayInfo<K>, elementShape: Pattern, recoverySetsState: RecoverySetsOption, optShutdownWithFailure?: ShutdownWithFailure | undefined): PaymentLedger<K>;
|
|
2
|
+
import type { AssetKind } from './types.js';
|
|
3
|
+
import type { DisplayInfo } from './types.js';
|
|
4
|
+
import type { RecoverySetsOption } from './types.js';
|
|
5
|
+
import type { ShutdownWithFailure } from '@agoric/swingset-vat';
|
|
6
|
+
import type { PaymentLedger } from './types.js';
|
|
7
|
+
//# sourceMappingURL=paymentLedger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentLedger.d.ts","sourceRoot":"","sources":["paymentLedger.js"],"names":[],"mappings":"AAmFO,sEATI,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,2DAGN,OAAO,qHA6UjB;+BA9YwH,YAAY;iCAAZ,YAAY;wCAAZ,YAAY;yCAC/F,sBAAsB;mCAD6D,YAAY"}
|
package/src/paymentLedger.js
CHANGED
|
@@ -10,6 +10,11 @@ import { preparePurseKind } from './purse.js';
|
|
|
10
10
|
import '@agoric/store/exported.js';
|
|
11
11
|
import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js'
|
|
15
|
+
* @import {ShutdownWithFailure} from '@agoric/swingset-vat'
|
|
16
|
+
*/
|
|
17
|
+
|
|
13
18
|
const { details: X, quote: q, Fail } = assert;
|
|
14
19
|
|
|
15
20
|
/**
|
package/src/purse.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function preparePurseKind(issuerZone: import('@agoric/zone').Zone, name: string, assetKind: AssetKind, brand: Brand, PurseIKit: {
|
|
2
|
+
purse: import('@endo/patterns').InterfaceGuard<any>;
|
|
3
|
+
depositFacet: import('@endo/patterns').InterfaceGuard<any>;
|
|
4
|
+
}, purseMethods: {
|
|
5
|
+
depositInternal: any;
|
|
6
|
+
withdrawInternal: any;
|
|
7
|
+
}, recoverySetsState: RecoverySetsOption, paymentRecoverySets: globalThis.WeakMapStore<Payment, globalThis.SetStore<Payment>>): () => import("@endo/exo").Guarded<{
|
|
8
|
+
deposit(srcPayment: any, optAmountShape?: undefined): any;
|
|
9
|
+
withdraw(amount: any): any;
|
|
10
|
+
getCurrentAmount(): Amount<AssetKind>;
|
|
11
|
+
getCurrentAmountNotifier(): Notifier<any>;
|
|
12
|
+
getAllegedBrand(): Brand;
|
|
13
|
+
getDepositFacet(): import("@endo/exo").Guarded<{
|
|
14
|
+
receive(...args: any[]): any;
|
|
15
|
+
}>;
|
|
16
|
+
getRecoverySet(): import("@endo/patterns").CopySet<Payment>;
|
|
17
|
+
recoverAll(): Amount<AssetKind>;
|
|
18
|
+
}>;
|
|
19
|
+
import type { AssetKind } from './types.js';
|
|
20
|
+
import type { Brand } from './types.js';
|
|
21
|
+
import type { RecoverySetsOption } from './types.js';
|
|
22
|
+
import type { Payment } from './types.js';
|
|
23
|
+
import type { Amount } from './types.js';
|
|
24
|
+
//# sourceMappingURL=purse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purse.d.ts","sourceRoot":"","sources":["purse.js"],"names":[],"mappings":"AA4BO,6CAfI,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,iDAGN;IACV,KAAS,EAAE,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACxD,YAAgB,EAAE,OAAO,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC5D,gBACO;IACV,eAAmB,EAAE,GAAG,CAAC;IACzB,gBAAoB,EAAE,GAAG,CAAC;CACvB;;;;;;;;;;;GA8JH;+BAjLwG,YAAY;2BAAZ,YAAY;wCAAZ,YAAY;6BAAZ,YAAY;4BAAZ,YAAY"}
|
package/src/purse.js
CHANGED
|
@@ -3,6 +3,8 @@ import { AmountMath } from './amountMath.js';
|
|
|
3
3
|
import { makeTransientNotifierKit } from './transientNotifier.js';
|
|
4
4
|
import { makeAmountStore } from './amountStore.js';
|
|
5
5
|
|
|
6
|
+
/** @import {Amount, AssetKind, AmountValue, AssetKindForValue, RecoverySetsOption, Brand, Payment} from './types.js' */
|
|
7
|
+
|
|
6
8
|
const { Fail } = assert;
|
|
7
9
|
|
|
8
10
|
const EMPTY_COPY_SET = makeCopySet([]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transientNotifier.d.ts","sourceRoot":"","sources":["transientNotifier.js"],"names":[],"mappings":"AAUO;;;EAoBN"}
|
package/src/transientNotifier.js
CHANGED
|
@@ -4,6 +4,8 @@ import { makeScalarBigWeakMapStore } from '@agoric/vat-data';
|
|
|
4
4
|
import { provideLazy } from '@agoric/store';
|
|
5
5
|
import { makeNotifierKit } from '@agoric/notifier';
|
|
6
6
|
|
|
7
|
+
/** @import {Purse} from './types.js' */
|
|
8
|
+
|
|
7
9
|
// Note: Virtual for high cardinality, but *not* durable, and so
|
|
8
10
|
// broken across an upgrade.
|
|
9
11
|
export const makeTransientNotifierKit = () => {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** @import {AmountValue, AssetKindForValue, AssetValueForKind, Brand, MathHelpers} from './types.js' */
|
|
2
|
+
export const BrandShape: import("@endo/patterns").Matcher;
|
|
3
|
+
export const IssuerShape: import("@endo/patterns").Matcher;
|
|
4
|
+
export const PaymentShape: import("@endo/patterns").Matcher;
|
|
5
|
+
export const PurseShape: import("@endo/patterns").Matcher;
|
|
6
|
+
export const DepositFacetShape: import("@endo/patterns").Matcher;
|
|
7
|
+
export const NotifierShape: import("@endo/patterns").Matcher;
|
|
8
|
+
export const MintShape: import("@endo/patterns").Matcher;
|
|
9
|
+
export namespace AmountShape {
|
|
10
|
+
export { BrandShape as brand };
|
|
11
|
+
export { AmountValueShape as value };
|
|
12
|
+
}
|
|
13
|
+
export namespace RatioShape {
|
|
14
|
+
export { AmountShape as numerator };
|
|
15
|
+
export { AmountShape as denominator };
|
|
16
|
+
}
|
|
17
|
+
export function isNatValue(value: AmountValue): value is bigint;
|
|
18
|
+
export function isCopySetValue(value: AmountValue): value is CopySet;
|
|
19
|
+
export function isSetValue(value: AmountValue): value is SetValue;
|
|
20
|
+
export function isCopyBagValue(value: AmountValue): value is CopyBag;
|
|
21
|
+
export const MAX_ABSOLUTE_DECIMAL_PLACES: 100;
|
|
22
|
+
export const AssetKindShape: import("@endo/patterns").Matcher;
|
|
23
|
+
export const DisplayInfoShape: import("@endo/patterns").Matcher;
|
|
24
|
+
export namespace IssuerKitShape {
|
|
25
|
+
export { BrandShape as brand };
|
|
26
|
+
export { MintShape as mint };
|
|
27
|
+
export { PurseShape as mintRecoveryPurse };
|
|
28
|
+
export { IssuerShape as issuer };
|
|
29
|
+
export { DisplayInfoShape as displayInfo };
|
|
30
|
+
}
|
|
31
|
+
export const BrandI: import("@endo/patterns").InterfaceGuard<{
|
|
32
|
+
isMyIssuer: import("@endo/patterns").MethodGuard;
|
|
33
|
+
getAllegedName: import("@endo/patterns").MethodGuard;
|
|
34
|
+
getDisplayInfo: import("@endo/patterns").MethodGuard;
|
|
35
|
+
getAmountShape: import("@endo/patterns").MethodGuard;
|
|
36
|
+
}>;
|
|
37
|
+
export function makeIssuerInterfaces(brandShape?: Pattern, assetKindShape?: Pattern, amountShape?: Pattern): {
|
|
38
|
+
IssuerI: import("@endo/patterns").InterfaceGuard<{
|
|
39
|
+
getBrand: import("@endo/patterns").MethodGuard;
|
|
40
|
+
getAllegedName: import("@endo/patterns").MethodGuard;
|
|
41
|
+
getAssetKind: import("@endo/patterns").MethodGuard;
|
|
42
|
+
getDisplayInfo: import("@endo/patterns").MethodGuard;
|
|
43
|
+
makeEmptyPurse: import("@endo/patterns").MethodGuard;
|
|
44
|
+
isLive: import("@endo/patterns").MethodGuard;
|
|
45
|
+
getAmountOf: import("@endo/patterns").MethodGuard;
|
|
46
|
+
burn: import("@endo/patterns").MethodGuard;
|
|
47
|
+
}>;
|
|
48
|
+
MintI: import("@endo/patterns").InterfaceGuard<{
|
|
49
|
+
getIssuer: import("@endo/patterns").MethodGuard;
|
|
50
|
+
mintPayment: import("@endo/patterns").MethodGuard;
|
|
51
|
+
}>;
|
|
52
|
+
PaymentI: import("@endo/patterns").InterfaceGuard<{
|
|
53
|
+
getAllegedBrand: import("@endo/patterns").MethodGuard;
|
|
54
|
+
}>;
|
|
55
|
+
PurseIKit: {
|
|
56
|
+
purse: import("@endo/patterns").InterfaceGuard<{
|
|
57
|
+
getAllegedBrand: import("@endo/patterns").MethodGuard;
|
|
58
|
+
getCurrentAmount: import("@endo/patterns").MethodGuard;
|
|
59
|
+
getCurrentAmountNotifier: import("@endo/patterns").MethodGuard;
|
|
60
|
+
deposit: import("@endo/patterns").MethodGuard;
|
|
61
|
+
getDepositFacet: import("@endo/patterns").MethodGuard;
|
|
62
|
+
withdraw: import("@endo/patterns").MethodGuard;
|
|
63
|
+
getRecoverySet: import("@endo/patterns").MethodGuard;
|
|
64
|
+
recoverAll: import("@endo/patterns").MethodGuard;
|
|
65
|
+
}>;
|
|
66
|
+
depositFacet: import("@endo/patterns").InterfaceGuard<{
|
|
67
|
+
receive: import("@endo/patterns").MethodGuard;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
declare const AmountValueShape: import("@endo/patterns").Matcher;
|
|
72
|
+
import type { AmountValue } from './types.js';
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=typeGuards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAGA,wGAAwG;AAExG,0DAA+C;AAC/C,2DAAiD;AACjD,4DAAmD;AACnD,0DAA+C;AAC/C,iEAA6D;AAC7D,6DAAqD;AACrD,yDAA6C;;;;;;;;;AA+EtC,gEAAyD;AASzD,qEAAiE;AAYjE,kEAAyD;AASzD,qEAAiE;AAIxE,8CAA+C;AAE/C,8DAAuE;AAEvE,gEAaE;;;;;;;;AAYF;;;;;GAKG;AAOI,kDAJI,OAAO,mBACP,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEjB;AAlKD,iEAKE;iCArEuF,YAAY"}
|
package/src/typeGuards.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
3
|
import { M, matches, getInterfaceGuardPayload } from '@endo/patterns';
|
|
4
|
+
/** @import {AmountValue, AssetKindForValue, AssetValueForKind, Brand, MathHelpers} from './types.js' */
|
|
4
5
|
|
|
5
6
|
export const BrandShape = M.remotable('Brand');
|
|
6
7
|
export const IssuerShape = M.remotable('Issuer');
|