@agoric/ertp 0.16.3-upgrade-16-dev-0df76a7.0 → 0.16.3-upgrade-17-dev-e67cd91.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/package.json +17 -17
- package/src/amountMath.d.ts +4 -0
- package/src/amountMath.d.ts.map +1 -1
- package/src/amountMath.js +1 -2
- package/src/displayInfo.js +1 -1
- package/src/issuerKit.js +1 -1
- package/src/legacy-payment-helpers.d.ts.map +1 -1
- package/src/legacy-payment-helpers.js +4 -5
- package/src/mathHelpers/natMathHelpers.d.ts.map +1 -1
- package/src/mathHelpers/natMathHelpers.js +1 -1
- package/src/paymentLedger.d.ts.map +1 -1
- package/src/paymentLedger.js +6 -5
- package/src/purse.d.ts.map +1 -1
- package/src/purse.js +1 -2
- package/src/transientNotifier.js +1 -1
- package/src/typeGuards.d.ts +12 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +17 -2
- package/src/types.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/ertp",
|
|
3
|
-
"version": "0.16.3-upgrade-
|
|
3
|
+
"version": "0.16.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
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",
|
|
@@ -39,24 +39,24 @@
|
|
|
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": "^1.2.
|
|
48
|
-
"@endo/far": "^1.1.
|
|
49
|
-
"@endo/marshal": "^1.5.
|
|
50
|
-
"@endo/nat": "^5.0.
|
|
51
|
-
"@endo/patterns": "^1.4.
|
|
52
|
-
"@endo/promise-kit": "^1.1.
|
|
42
|
+
"@agoric/notifier": "0.6.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
43
|
+
"@agoric/store": "0.9.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
45
|
+
"@agoric/zone": "0.2.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
46
|
+
"@endo/errors": "^1.2.5",
|
|
47
|
+
"@endo/eventual-send": "^1.2.5",
|
|
48
|
+
"@endo/far": "^1.1.5",
|
|
49
|
+
"@endo/marshal": "^1.5.3",
|
|
50
|
+
"@endo/nat": "^5.0.10",
|
|
51
|
+
"@endo/patterns": "^1.4.3",
|
|
52
|
+
"@endo/promise-kit": "^1.1.5"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agoric/swingset-vat": "0.
|
|
56
|
-
"@endo/bundle-source": "^3.
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-upgrade-17-dev-e67cd91.0+e67cd91",
|
|
56
|
+
"@endo/bundle-source": "^3.4.0",
|
|
57
57
|
"@fast-check/ava": "^1.1.5",
|
|
58
58
|
"ava": "^5.3.0",
|
|
59
|
-
"tsd": "^0.
|
|
59
|
+
"tsd": "^0.31.1"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"src",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
88
|
"typeCoverage": {
|
|
89
|
-
"atLeast": 91.
|
|
89
|
+
"atLeast": 91.23
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "e67cd918f33dafb1708bd4341f2a737b79fa574f"
|
|
92
92
|
}
|
package/src/amountMath.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export namespace AmountMath {
|
|
|
17
17
|
export function min<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
18
18
|
export function max<A extends Amount>(x: A, y: A, brand?: Brand | undefined): A;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @import {CopyBag, CopySet} from '@endo/patterns';
|
|
22
|
+
* @import {Amount, AssetKind, AmountValue, AssetKindForValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
|
|
23
|
+
*/
|
|
20
24
|
/**
|
|
21
25
|
* Constants for the kinds of assets we support.
|
|
22
26
|
*
|
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":"AAkHO,sCAJM,CAAC,SACH,CAAC,GACC,YAAY,CAAC,CAAC,CAIc;iCAzG0I,YAAY;;IA+MvL,qBAhBe,CAAC,SAAT,KAAO,EACmC,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,CAWb;IASS,yBALY,CAAC,SAAV,MAAQ,SACV,KAAK,UACL,CAAC,GACC,CAAC,CAAC,OAAO,CAAC,CAE4C;0BAKzD;QACT,CAAK,KAAK,EAAE,KAAK,GAAG,OAAO,KAAK,CAAC,CAAC;QAClC,CAAK,CAAmB,SAAT,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;KACjE;IAiBiB,oCAJC,CAAC,SAAV,MAAQ,UACV,CAAC,GACC,CAAC,CAQb;IAQQ,gCAJE,MAAM,8BAEJ,OAAO,CASnB;;IAYQ,wBANa,CAAC,SAAV,MAAQ,cACV,CAAC,eACD,CAAC,8BAEC,OAAO,CAKnB;IAcI,oBANiB,CAAC,SAAV,MAAQ,cACV,CAAC,eACD,CAAC,8BAEC,CAAC,CAOb;IAeS,yBAPY,CAAC,SAAV,MAAQ,EACC,CAAC,SAAV,MAAQ,cACV,CAAC,eACD,CAAC,8BAEC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAOnC;IAUI,oBANiB,CAAC,SAAV,MAAQ,KACV,CAAC,KACD,CAAC,8BAEC,CAAC,CAQ8B;IAUvC,oBANiB,CAAC,SAAV,MAAQ,KACV,CAAC,KACD,CAAC,8BAEC,CAAC,CAQ8B;;AAvX9C;;;GAGG;AAEH;;;;;;;;;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;+BAlBgL,YAAY;AAyX/L,6BAA6B;AAC7B,qCADY,MAAM,yCAKjB;AAzWD,mCAAmC;AACnC,2CADY,SAAS,QAIpB;2BAzBkL,YAAY;8BAAZ,YAAY;6BAD5J,gBAAgB;6BAAhB,gBAAgB;8BACgI,YAAY;+BAAZ,YAAY;mCAAZ,YAAY;mCAAZ,YAAY;+BAAZ,YAAY;4BAAZ,YAAY;AA6J/L;;;;;;;;;;;;GAYG;AACH,uBANyB,CAAC,SAAZ,SAAU,cACb,OAAO,CAAC,CAAC,eACT,OAAO,CAAC,CAAC,iCAEP,OAAO,CAKnB"}
|
package/src/amountMath.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { q, Fail } from '@endo/errors';
|
|
1
2
|
import { passStyleOf, assertRemotable, assertRecord } from '@endo/marshal';
|
|
2
3
|
|
|
3
4
|
import { M, matches } from '@agoric/store';
|
|
@@ -11,8 +12,6 @@ import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js';
|
|
|
11
12
|
* @import {Amount, AssetKind, AmountValue, AssetKindForValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js';
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
|
-
const { quote: q, Fail } = assert;
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* Constants for the kinds of assets we support.
|
|
18
17
|
*
|
package/src/displayInfo.js
CHANGED
package/src/issuerKit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
import { assert, Fail } from '@
|
|
3
|
+
import { assert, Fail } from '@endo/errors';
|
|
4
4
|
import { assertPattern } from '@agoric/store';
|
|
5
5
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
6
6
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
@@ -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,sBANgB,CAAC,SAAX,OAAS,iBACX,KAAK,KAAK,CAAC,eACX,KAAK,CAAC,CAAC,mBACP,OAAO,GACL,OAAO,CAAC,CAAC,CAAC,CAYtB;AAiBM,wBANkB,CAAC,SAAb,SAAW,iBACb,KAAK,MAAM,CAAC,CAAC,CAAC,iBACd,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,mBAClB,OAAO,GACL,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CA0B/B;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;6BAvI0F,YAAY;2BAAZ,YAAY;0BADhF,WAAW;+BACyD,YAAY;4BAAZ,YAAY"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Fail } from '@endo/errors';
|
|
4
4
|
import { E } from '@endo/far';
|
|
5
|
+
import { mustMatch } from '@agoric/store';
|
|
5
6
|
import { AmountMath } from './amountMath.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* @import {ERef} from '@endo/far'
|
|
9
|
-
* @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js'
|
|
9
|
+
* @import {ERef} from '@endo/far';
|
|
10
|
+
* @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js';
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
const { Fail } = assert;
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* @file This file contains safer helper function alternatives to the similarly
|
|
16
15
|
* named methods on issuer. These are parameterized by a purse used for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,6BAFU,YAAY,QAAQ,CAAC,CAgB5B;
|
|
1
|
+
{"version":3,"file":"natMathHelpers.d.ts","sourceRoot":"","sources":["natMathHelpers.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,6BAFU,YAAY,QAAQ,CAAC,CAgB5B;8BA7BsC,aAAa;iCAAb,aAAa"}
|
|
@@ -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":"AAsFO,qCAVkB,CAAC,SAAb,SAAW,cACb,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,aACN,CAAC,eACD,YAAY,CAAC,CAAC,gBACd,OAAO,qBACP,kBAAkB,6DAEhB,cAAc,CAAC,CAAC,CAyT5B;+BA9XwH,YAAY;iCAAZ,YAAY;wCAAZ,YAAY;yCAC/F,sBAAsB;mCAD6D,YAAY"}
|
package/src/paymentLedger.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/// <reference types="@agoric/store/exported.js" />
|
|
4
4
|
|
|
5
5
|
/* eslint-disable no-use-before-define */
|
|
6
|
+
import { X, q, Fail, annotateError } from '@endo/errors';
|
|
6
7
|
import { isPromise } from '@endo/promise-kit';
|
|
7
8
|
import { mustMatch, M, keyEQ } from '@agoric/store';
|
|
8
9
|
import { AmountMath } from './amountMath.js';
|
|
@@ -14,15 +15,15 @@ import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
|
|
|
14
15
|
/**
|
|
15
16
|
* @import {Amount, AssetKind, DisplayInfo, PaymentLedger, Payment, Brand, RecoverySetsOption, Purse, Issuer, Mint} from './types.js'
|
|
16
17
|
* @import {ShutdownWithFailure} from '@agoric/swingset-vat'
|
|
17
|
-
* @import {
|
|
18
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
const { details: X, quote: q, Fail } = assert;
|
|
21
|
-
|
|
22
21
|
/**
|
|
22
|
+
* @template {AssetKind} K
|
|
23
23
|
* @param {Brand} brand
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {K} assetKind
|
|
25
25
|
* @param {Pattern} elementShape
|
|
26
|
+
* @returns {TypedPattern<Amount<K>>}
|
|
26
27
|
*/
|
|
27
28
|
const amountShapeFromElementShape = (brand, assetKind, elementShape) => {
|
|
28
29
|
let valueShape;
|
|
@@ -133,7 +134,7 @@ export const preparePaymentLedger = (
|
|
|
133
134
|
try {
|
|
134
135
|
optShutdownWithFailure(reason);
|
|
135
136
|
} catch (errInShutdown) {
|
|
136
|
-
|
|
137
|
+
annotateError(errInShutdown, X`Caused by: ${reason}`);
|
|
137
138
|
throw errInShutdown;
|
|
138
139
|
}
|
|
139
140
|
}
|
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":"AA2BO,6CAfI,OAAO,cAAc,EAAE,IAAI,QAC3B,MAAM,aACN,SAAS,SACT,KAAK,aACL;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,qBACO,kBAAkB,uBAClB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;;;;;;;;;;;GA4JlD;+BA/KwG,YAAY;2BAAZ,YAAY;wCAAZ,YAAY;6BAAZ,YAAY"}
|
package/src/purse.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fail } from '@endo/errors';
|
|
1
2
|
import { M, makeCopySet } from '@agoric/store';
|
|
2
3
|
import { AmountMath } from './amountMath.js';
|
|
3
4
|
import { makeTransientNotifierKit } from './transientNotifier.js';
|
|
@@ -5,8 +6,6 @@ import { makeAmountStore } from './amountStore.js';
|
|
|
5
6
|
|
|
6
7
|
/** @import {Amount, AssetKind, AmountValue, AssetKindForValue, RecoverySetsOption, Brand, Payment} from './types.js' */
|
|
7
8
|
|
|
8
|
-
const { Fail } = assert;
|
|
9
|
-
|
|
10
9
|
const EMPTY_COPY_SET = makeCopySet([]);
|
|
11
10
|
|
|
12
11
|
// TODO Type InterfaceGuard better than InterfaceGuard<any>
|
package/src/transientNotifier.js
CHANGED
|
@@ -6,7 +6,7 @@ import { makeNotifierKit } from '@agoric/notifier';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @import {Purse} from './types.js';
|
|
9
|
-
* @import {LatestTopic, NotifierRecord} from '@agoric/notifier'
|
|
9
|
+
* @import {LatestTopic, NotifierRecord} from '@agoric/notifier';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
// Note: Virtual for high cardinality, but *not* durable, and so
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -10,6 +10,18 @@ export namespace AmountShape {
|
|
|
10
10
|
export { BrandShape as brand };
|
|
11
11
|
export { AmountValueShape as value };
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* To be used to guard an amount pattern argument, i.e., an argument which is a
|
|
15
|
+
* pattern that can be used to test amounts. Since amounts are keys, anywhere an
|
|
16
|
+
* amount pattern is expected, an amount can be provided and will match only
|
|
17
|
+
* that concrete amount, i.e., amounts that are `keyEQ` to that amount.
|
|
18
|
+
*
|
|
19
|
+
* The `AmountShape` guard above is an amount pattern. But not all amount
|
|
20
|
+
* patterns are like `AmountShape`. For example, `M.any()` is a valid amount
|
|
21
|
+
* pattern that will admit any amount, but is does not resemble the
|
|
22
|
+
* `AmountShape` pattern above.
|
|
23
|
+
*/
|
|
24
|
+
export const AmountPatternShape: import("@endo/patterns").Matcher;
|
|
13
25
|
export namespace RatioShape {
|
|
14
26
|
export { AmountShape as numerator };
|
|
15
27
|
export { AmountShape as denominator };
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +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
|
|
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;;;;;AAoE7C;;;;;;;;;;GAUG;AACH,kEAA8C;;;;;AAavC,kCAHI,WAAW,GACT,KAAK,IAAI,OAAO,YAAY,EAAE,QAAQ,CAEa;AASzD,sCAHI,WAAW,GACT,KAAK,IAAI,OAAO,CAE2C;AAYjE,kCAHI,WAAW,GACT,KAAK,IAAI,QAAQ,CAEkC;AASzD,sCAHI,WAAW,GACT,KAAK,IAAI,OAAO,CAE2C;AAIxE,8CAA+C;AAE/C,8DAAuE;AAEvE,gEAaE;;;;;;;;AAYF;;;;;GAKG;AAOI,kDAJI,OAAO,mBACP,OAAO,gBACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoEjB;AAjLD,iEAKE;iCArEuF,YAAY"}
|
package/src/typeGuards.js
CHANGED
|
@@ -77,6 +77,19 @@ export const AmountShape = harden({
|
|
|
77
77
|
value: AmountValueShape,
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* To be used to guard an amount pattern argument, i.e., an argument which is a
|
|
82
|
+
* pattern that can be used to test amounts. Since amounts are keys, anywhere an
|
|
83
|
+
* amount pattern is expected, an amount can be provided and will match only
|
|
84
|
+
* that concrete amount, i.e., amounts that are `keyEQ` to that amount.
|
|
85
|
+
*
|
|
86
|
+
* The `AmountShape` guard above is an amount pattern. But not all amount
|
|
87
|
+
* patterns are like `AmountShape`. For example, `M.any()` is a valid amount
|
|
88
|
+
* pattern that will admit any amount, but is does not resemble the
|
|
89
|
+
* `AmountShape` pattern above.
|
|
90
|
+
*/
|
|
91
|
+
export const AmountPatternShape = M.pattern();
|
|
92
|
+
|
|
80
93
|
export const RatioShape = harden({
|
|
81
94
|
numerator: AmountShape,
|
|
82
95
|
denominator: AmountShape,
|
|
@@ -178,7 +191,7 @@ export const makeIssuerInterfaces = (
|
|
|
178
191
|
isLive: M.callWhen(M.await(PaymentShape)).returns(M.boolean()),
|
|
179
192
|
getAmountOf: M.callWhen(M.await(PaymentShape)).returns(amountShape),
|
|
180
193
|
burn: M.callWhen(M.await(PaymentShape))
|
|
181
|
-
.optional(
|
|
194
|
+
.optional(AmountPatternShape)
|
|
182
195
|
.returns(amountShape),
|
|
183
196
|
});
|
|
184
197
|
|
|
@@ -205,7 +218,9 @@ export const makeIssuerInterfaces = (
|
|
|
205
218
|
// `srcPayment` is a remotable, leaving it
|
|
206
219
|
// to this raw method to validate that this remotable is actually
|
|
207
220
|
// a live payment of the correct brand with sufficient funds.
|
|
208
|
-
deposit: M.call(PaymentShape)
|
|
221
|
+
deposit: M.call(PaymentShape)
|
|
222
|
+
.optional(AmountPatternShape)
|
|
223
|
+
.returns(amountShape),
|
|
209
224
|
getDepositFacet: M.call().returns(DepositFacetShape),
|
|
210
225
|
withdraw: M.call(amountShape).returns(PaymentShape),
|
|
211
226
|
getRecoverySet: M.call().returns(M.setOf(PaymentShape)),
|
package/src/types.js
CHANGED
|
@@ -5,9 +5,9 @@ export {};
|
|
|
5
5
|
|
|
6
6
|
/// <reference types="ses" />
|
|
7
7
|
/**
|
|
8
|
-
* @import {Passable, RemotableObject} from '@endo/pass-style'
|
|
9
|
-
* @import {CopyBag, CopySet, Key} from '@endo/patterns'
|
|
10
|
-
* @import {LatestTopic, NotifierRecord} from '@agoric/notifier'
|
|
8
|
+
* @import {Passable, RemotableObject} from '@endo/pass-style';
|
|
9
|
+
* @import {CopyBag, CopySet, Key} from '@endo/patterns';
|
|
10
|
+
* @import {LatestTopic, NotifierRecord} from '@agoric/notifier';
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/** @typedef {{ brand: Brand<'nat'>; value: bigint }} NatAmount */
|