@agoric/zoe 0.26.3-dev-aa68d8f.0 → 0.26.3-dev-651b051.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/bundles/bundle-contractFacet-js-meta.json +258 -253
- package/bundles/bundle-contractFacet.js +1 -1
- package/package.json +27 -27
- package/src/cleanProposal.d.ts +1 -1
- package/src/cleanProposal.d.ts.map +1 -1
- package/src/cleanProposal.js +8 -0
- package/src/contractFacet/offerHandlerStorage.d.ts +4 -1
- package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
- package/src/contractFacet/offerHandlerStorage.js +11 -3
- package/src/contractFacet/types-ambient.d.ts +10 -5
- package/src/contractFacet/vatRoot.d.ts +1 -1
- package/src/contractFacet/vatRoot.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.d.ts +1 -1
- package/src/contractFacet/zcfMint.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.js +2 -3
- package/src/contractFacet/zcfSeat.js +1 -1
- package/src/contractSupport/durability.d.ts +1 -1
- package/src/contractSupport/durability.d.ts.map +1 -1
- package/src/contractSupport/durability.js +1 -1
- package/src/contractSupport/priceAuthority.d.ts +2 -1
- package/src/contractSupport/priceAuthority.d.ts.map +1 -1
- package/src/contractSupport/priceAuthority.js +1 -1
- package/src/contractSupport/priceAuthorityInitial.d.ts +2 -1
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityInitial.js +1 -1
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -1
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityQuoteMint.js +8 -1
- package/src/contractSupport/priceAuthorityTransform.d.ts +3 -2
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityTransform.js +5 -5
- package/src/contractSupport/priceQuote.d.ts +3 -3
- package/src/contractSupport/priceQuote.d.ts.map +1 -1
- package/src/contractSupport/ratio.d.ts.map +1 -1
- package/src/contractSupport/ratio.js +18 -13
- package/src/contractSupport/recorder.d.ts +13 -13
- package/src/contractSupport/recorder.d.ts.map +1 -1
- package/src/contractSupport/recorder.js +3 -3
- package/src/contractSupport/zoeHelpers.d.ts +1 -1
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
- package/src/contracts/auction/index.d.ts +2 -2
- package/src/contracts/automaticRefund.d.ts +1 -1
- package/src/contracts/autoswap.d.ts.map +1 -1
- package/src/contracts/autoswap.js +4 -2
- package/src/contracts/barterExchange.d.ts +1 -1
- package/src/contracts/callSpread/pricedCallSpread.d.ts +1 -1
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
- package/src/contracts/callSpread/pricedCallSpread.js +1 -0
- package/src/contracts/loan/borrow.d.ts.map +1 -1
- package/src/contracts/loan/borrow.js +3 -1
- package/src/contracts/mintPayments.d.ts +6 -6
- package/src/contracts/oracle.d.ts +2 -2
- package/src/contracts/otcDesk.d.ts +1 -1
- package/src/contracts/priceAggregator.d.ts +5 -4
- package/src/contracts/priceAggregator.d.ts.map +1 -1
- package/src/contracts/priceAggregator.js +2 -5
- package/src/contracts/simpleExchange.d.ts +1 -1
- package/src/internal-types.d.ts +5 -4
- package/src/internal-types.d.ts.map +1 -1
- package/src/internal-types.js +7 -4
- package/src/typeGuards.d.ts +1 -1
- package/src/types-ambient.d.ts +5 -8
- package/src/types-ambient.d.ts.map +1 -1
- package/src/types-ambient.js +3 -5
- package/src/zoeService/escrowStorage.js +1 -1
- package/src/zoeService/feeMint.d.ts +1 -1
- package/src/zoeService/makeInvitation.d.ts +2 -2
- package/src/zoeService/makeInvitation.d.ts.map +1 -1
- package/src/zoeService/makeInvitation.js +3 -0
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
- package/src/zoeService/originalZoeSeat.js +4 -3
- package/src/zoeService/startInstance.d.ts.map +1 -1
- package/src/zoeService/startInstance.js +6 -1
- package/src/zoeService/types-ambient.d.ts +2 -2
- package/src/zoeService/types-ambient.d.ts.map +1 -1
- package/src/zoeService/types-ambient.js +2 -2
- package/src/zoeService/utils.d.ts +17 -17
- package/src/zoeService/zoe.d.ts +2 -2
- package/src/zoeService/zoeSeat.d.ts.map +1 -1
- package/src/zoeService/zoeSeat.js +3 -2
- package/src/zoeService/zoeStorageManager.d.ts +3 -3
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
- package/src/zoeService/zoeStorageManager.js +3 -1
- package/tools/fakePriceAuthority.d.ts +3 -3
- package/tools/fakePriceAuthority.d.ts.map +1 -1
- package/tools/fakePriceAuthority.js +12 -9
- package/tools/fakeVatAdmin.d.ts +6 -6
- package/tools/manualTimer.d.ts +5 -5
- package/tools/manualTimer.d.ts.map +1 -1
- package/tools/manualTimer.js +6 -4
- package/tools/scriptedOracle.d.ts +1 -1
- package/tools/setup-zoe.d.ts +1 -1
- package/tools/types.d.ts +4 -4
- package/tools/types.d.ts.map +1 -1
- package/tools/types.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/zoe",
|
|
3
|
-
"version": "0.26.3-dev-
|
|
3
|
+
"version": "0.26.3-dev-651b051.0+651b051",
|
|
4
4
|
"description": "Zoe: the Smart Contract Framework for Offer Enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/zoeService/zoe.js",
|
|
@@ -43,33 +43,33 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agoric/assert": "0.6.1-dev-
|
|
47
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
48
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
49
|
-
"@agoric/internal": "0.3.3-dev-
|
|
50
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
51
|
-
"@agoric/store": "0.9.3-dev-
|
|
52
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
53
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
54
|
-
"@agoric/time": "0.3.3-dev-
|
|
55
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
56
|
-
"@agoric/zone": "0.2.3-dev-
|
|
57
|
-
"@endo/bundle-source": "^3.2.
|
|
58
|
-
"@endo/captp": "^4.
|
|
59
|
-
"@endo/common": "^1.2.
|
|
60
|
-
"@endo/eventual-send": "^1.2.
|
|
61
|
-
"@endo/exo": "^1.
|
|
62
|
-
"@endo/far": "^1.1.
|
|
63
|
-
"@endo/import-bundle": "^1.1.
|
|
64
|
-
"@endo/marshal": "^1.
|
|
65
|
-
"@endo/nat": "^5.0.
|
|
66
|
-
"@endo/patterns": "^1.
|
|
67
|
-
"@endo/promise-kit": "^1.1.
|
|
46
|
+
"@agoric/assert": "0.6.1-dev-651b051.0+651b051",
|
|
47
|
+
"@agoric/base-zone": "0.1.1-dev-651b051.0+651b051",
|
|
48
|
+
"@agoric/ertp": "0.16.3-dev-651b051.0+651b051",
|
|
49
|
+
"@agoric/internal": "0.3.3-dev-651b051.0+651b051",
|
|
50
|
+
"@agoric/notifier": "0.6.3-dev-651b051.0+651b051",
|
|
51
|
+
"@agoric/store": "0.9.3-dev-651b051.0+651b051",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-651b051.0+651b051",
|
|
53
|
+
"@agoric/swingset-vat": "0.32.3-dev-651b051.0+651b051",
|
|
54
|
+
"@agoric/time": "0.3.3-dev-651b051.0+651b051",
|
|
55
|
+
"@agoric/vat-data": "0.5.3-dev-651b051.0+651b051",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-651b051.0+651b051",
|
|
57
|
+
"@endo/bundle-source": "^3.2.3",
|
|
58
|
+
"@endo/captp": "^4.2.0",
|
|
59
|
+
"@endo/common": "^1.2.2",
|
|
60
|
+
"@endo/eventual-send": "^1.2.2",
|
|
61
|
+
"@endo/exo": "^1.5.0",
|
|
62
|
+
"@endo/far": "^1.1.2",
|
|
63
|
+
"@endo/import-bundle": "^1.1.2",
|
|
64
|
+
"@endo/marshal": "^1.5.0",
|
|
65
|
+
"@endo/nat": "^5.0.7",
|
|
66
|
+
"@endo/patterns": "^1.4.0",
|
|
67
|
+
"@endo/promise-kit": "^1.1.2",
|
|
68
68
|
"yargs-parser": "^21.1.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
72
|
-
"@endo/init": "^1.1.
|
|
71
|
+
"@agoric/kmarshal": "0.1.1-dev-651b051.0+651b051",
|
|
72
|
+
"@endo/init": "^1.1.2",
|
|
73
73
|
"ava": "^5.3.0",
|
|
74
74
|
"c8": "^9.1.0",
|
|
75
75
|
"import-meta-resolve": "^2.2.1",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"access": "public"
|
|
140
140
|
},
|
|
141
141
|
"typeCoverage": {
|
|
142
|
-
"atLeast": 84.
|
|
142
|
+
"atLeast": 84.91
|
|
143
143
|
},
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "651b05136f236230c67c8b40224540c585beaa54"
|
|
145
145
|
}
|
package/src/cleanProposal.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export function cleanKeywords(uncleanKeywordRecord: {
|
|
|
4
4
|
[name: string]: any;
|
|
5
5
|
}): string[];
|
|
6
6
|
export function coerceAmountPatternKeywordRecord(allegedAmountKeywordRecord: any, getAssetKindByBrand: any): Record<string | number | symbol, any>;
|
|
7
|
-
export function coerceAmountKeywordRecord(allegedAmountKeywordRecord:
|
|
7
|
+
export function coerceAmountKeywordRecord(allegedAmountKeywordRecord: unknown, getAssetKindByBrand: any): AmountKeywordRecord;
|
|
8
8
|
export function cleanProposal(proposal: Proposal, getAssetKindByBrand: GetAssetKindByBrand): ProposalRecord;
|
|
9
9
|
//# sourceMappingURL=cleanProposal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAYpB;AAEM,
|
|
1
|
+
{"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAYpB;AAEM,mJAsBN;AAQM,sEAJI,OAAO,6BAEL,mBAAmB,CAa/B;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B"}
|
package/src/cleanProposal.js
CHANGED
|
@@ -57,6 +57,7 @@ export const coerceAmountPatternKeywordRecord = (
|
|
|
57
57
|
getAssetKindByBrand,
|
|
58
58
|
) => {
|
|
59
59
|
cleanKeywords(allegedAmountKeywordRecord);
|
|
60
|
+
// FIXME objectMap should constrain the mapping function by the record's type
|
|
60
61
|
return objectMap(allegedAmountKeywordRecord, amount => {
|
|
61
62
|
// Check that each value can be coerced using the AmountMath
|
|
62
63
|
// indicated by brand. `AmountMath.coerce` throws if coercion fails.
|
|
@@ -75,6 +76,12 @@ export const coerceAmountPatternKeywordRecord = (
|
|
|
75
76
|
});
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @param {unknown} allegedAmountKeywordRecord
|
|
82
|
+
* @param {*} getAssetKindByBrand
|
|
83
|
+
* @returns {AmountKeywordRecord}
|
|
84
|
+
*/
|
|
78
85
|
export const coerceAmountKeywordRecord = (
|
|
79
86
|
allegedAmountKeywordRecord,
|
|
80
87
|
getAssetKindByBrand,
|
|
@@ -84,6 +91,7 @@ export const coerceAmountKeywordRecord = (
|
|
|
84
91
|
getAssetKindByBrand,
|
|
85
92
|
);
|
|
86
93
|
assertKey(result);
|
|
94
|
+
// @ts-expect-error checked cast
|
|
87
95
|
return result;
|
|
88
96
|
};
|
|
89
97
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export function makeOfferHandlerStorage(zcfBaggage: any): {
|
|
2
|
-
storeOfferHandler: (offerHandler:
|
|
2
|
+
storeOfferHandler: (offerHandler: any) => Handle<"Invitation">;
|
|
3
3
|
takeOfferHandler: (invitationHandle: InvitationHandle, details?: Details) => OfferHandler;
|
|
4
4
|
};
|
|
5
|
+
export type PassableOfferHandler = RemotableBrand<any, any> & RemotableObject & OfferHandler<unknown, never>;
|
|
6
|
+
import type { RemotableBrand } from '@endo/eventual-send';
|
|
7
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
5
8
|
//# sourceMappingURL=offerHandlerStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AAiBO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;oCA9DgC,qBAAqB;qCACpB,kBAAkB"}
|
|
@@ -6,9 +6,18 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data';
|
|
|
6
6
|
|
|
7
7
|
import { defineDurableHandle } from '../makeHandle.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @import {RemotableBrand} from '@endo/eventual-send';
|
|
11
|
+
* @import {RemotableObject} from '@endo/pass-style';
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {RemotableBrand & RemotableObject & OfferHandler} PassableOfferHandler
|
|
16
|
+
*/
|
|
17
|
+
|
|
9
18
|
export const makeOfferHandlerStorage = zcfBaggage => {
|
|
10
19
|
const makeInvitationHandle = defineDurableHandle(zcfBaggage, 'Invitation');
|
|
11
|
-
/** @type {WeakMapStore<InvitationHandle,
|
|
20
|
+
/** @type {WeakMapStore<InvitationHandle, PassableOfferHandler>} */
|
|
12
21
|
|
|
13
22
|
// ZCF needs to ephemerally hold on to ephemeral handlers, and durably hold
|
|
14
23
|
// onto handlers that are intended to be durable. We keep two stores and store
|
|
@@ -18,13 +27,12 @@ export const makeOfferHandlerStorage = zcfBaggage => {
|
|
|
18
27
|
const invitationHandleToEphemeralHandler = makeScalarWeakMapStore(
|
|
19
28
|
'invitationHandleToEphemeralHandler',
|
|
20
29
|
);
|
|
21
|
-
/** @type {WeakMapStore<InvitationHandle,
|
|
30
|
+
/** @type {WeakMapStore<InvitationHandle, PassableOfferHandler>} */
|
|
22
31
|
const invitationHandleToDurableHandler = provideDurableWeakMapStore(
|
|
23
32
|
zcfBaggage,
|
|
24
33
|
'invitationHandleToDurableHandler',
|
|
25
34
|
);
|
|
26
35
|
|
|
27
|
-
/** @type {(offerHandler: OfferHandler) => InvitationHandle} */
|
|
28
36
|
const storeOfferHandler = offerHandler => {
|
|
29
37
|
if (typeof offerHandler === 'function') {
|
|
30
38
|
offerHandler = ToFarFunction('offerHandler', offerHandler);
|
|
@@ -6,6 +6,8 @@ type IssuerOptionsRecord = import('@agoric/ertp').IssuerOptionsRecord;
|
|
|
6
6
|
type Completion = any;
|
|
7
7
|
type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
|
|
8
8
|
|
|
9
|
+
type InvitationAmount = Amount<'set', InvitationDetails>;
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Zoe Contract Facet
|
|
11
13
|
*
|
|
@@ -38,10 +40,10 @@ type ZCF<CT extends unknown = Record<string, unknown>> = {
|
|
|
38
40
|
* @returns the AmountMath and brand synchronously accessible after
|
|
39
41
|
* saving
|
|
40
42
|
*/
|
|
41
|
-
saveIssuer: (
|
|
42
|
-
issuerP: ERef<
|
|
43
|
+
saveIssuer: <I extends Issuer>(
|
|
44
|
+
issuerP: ERef<I>,
|
|
43
45
|
keyword: Keyword,
|
|
44
|
-
) => Promise<IssuerRecord<
|
|
46
|
+
) => Promise<I extends Issuer<infer K, infer M> ? IssuerRecord<K, M> : never>;
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* Make a credible Zoe invitation for a particular smart contract
|
|
@@ -162,7 +164,7 @@ type ZCFMint<K extends AssetKind = AssetKind> = {
|
|
|
162
164
|
* normally an instanceof Error.
|
|
163
165
|
*/
|
|
164
166
|
type ZCFSeatFail = (reason: unknown) => Error;
|
|
165
|
-
type ZCFSeat = {
|
|
167
|
+
type ZCFSeat = import('@endo/pass-style').RemotableObject & {
|
|
166
168
|
exit: (completion?: Completion) => void;
|
|
167
169
|
fail: ZCFSeatFail;
|
|
168
170
|
getSubscriber: () => Promise<Subscriber<Allocation>>;
|
|
@@ -243,7 +245,10 @@ type AdminFacet = import('../zoeService/utils').AdminFacet<any>;
|
|
|
243
245
|
|
|
244
246
|
declare const OfferReturn: unique symbol;
|
|
245
247
|
declare const OfferArgs: unique symbol;
|
|
246
|
-
type Invitation<R = unknown, A = undefined> = Payment<
|
|
248
|
+
type Invitation<R = unknown, A = undefined> = Payment<
|
|
249
|
+
'set',
|
|
250
|
+
InvitationDetails
|
|
251
|
+
> & {
|
|
247
252
|
// because TS is structural, without this the generic is ignored
|
|
248
253
|
[OfferReturn]?: R;
|
|
249
254
|
[OfferArgs]?: A;
|
|
@@ -10,5 +10,5 @@ export function buildRootObject(powers: TerminationVatPowers & {
|
|
|
10
10
|
zoeService: ZoeService;
|
|
11
11
|
invitationIssuer: Issuer<"set">;
|
|
12
12
|
privateArgs?: any;
|
|
13
|
-
}, baggage: import("@agoric/vat-data").Baggage): Promise<import("@endo/eventual-send").RemotableBrand<{}, {}>>;
|
|
13
|
+
}, baggage: import("@agoric/vat-data").Baggage): Promise<import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {}>>;
|
|
14
14
|
//# sourceMappingURL=vatRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vatRoot.d.ts","sourceRoot":"","sources":["vatRoot.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH;mBAJwC,aAAa;;;gBACC,UAAU;sBAAoB,MAAM,CAAC,KAAK,CAAC;kBAAgB,GAAG;YACzG,OAAO,kBAAkB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"vatRoot.d.ts","sourceRoot":"","sources":["vatRoot.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH;mBAJwC,aAAa;;;gBACC,UAAU;sBAAoB,MAAM,CAAC,KAAK,CAAC;kBAAgB,GAAG;YACzG,OAAO,kBAAkB,EAAE,OAAO,iIA+D5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function sumAmountKeywordRecord
|
|
1
|
+
export function sumAmountKeywordRecord(amr: AmountKeywordRecord, issuerRecord: IssuerRecord): Amount;
|
|
2
2
|
export function prepareZcMint(zcfBaggage: import("@agoric/vat-data").Baggage, recordIssuer: {
|
|
3
3
|
(keyword: string, issuerRecord: IssuerRecord): void;
|
|
4
4
|
}, getAssetKindByBrand: GetAssetKindByBrand, makeEmptySeatKit: (exit?: undefined) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcfMint.d.ts","sourceRoot":"","sources":["zcfMint.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zcfMint.d.ts","sourceRoot":"","sources":["zcfMint.js"],"names":[],"mappings":"AAqBO,4CAJI,mBAAmB,gBACnB,YAAY,GACV,MAAM,CAYlB;AASM,0CANI,OAAO,kBAAkB,EAAE,OAAO,gBAClC;IAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,uBACvD,mBAAmB,oBACnB,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAAE,eACnE,kBAAkB,IAoHE,CAAC,wCAFnB,MAAM,YACN,IAAI,CAAC,OAAO,CACM,CAAC,AADL,CAAC,CAAC,KACd,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAWjC"}
|
|
@@ -15,10 +15,9 @@ import './types-ambient.js';
|
|
|
15
15
|
const { Fail } = assert;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @template {AssetKind} K
|
|
19
18
|
* @param {AmountKeywordRecord} amr
|
|
20
|
-
* @param {IssuerRecord
|
|
21
|
-
* @returns {Amount
|
|
19
|
+
* @param {IssuerRecord} issuerRecord
|
|
20
|
+
* @returns {Amount}
|
|
22
21
|
*/
|
|
23
22
|
export const sumAmountKeywordRecord = (amr, issuerRecord) => {
|
|
24
23
|
const empty = AmountMath.makeEmpty(
|
|
@@ -206,7 +206,7 @@ export const createSeatManager = (
|
|
|
206
206
|
assertActive(self);
|
|
207
207
|
const currentAllocation = getCurrentAllocation(self);
|
|
208
208
|
if (currentAllocation[keyword] !== undefined) {
|
|
209
|
-
// @ts-expect-error
|
|
209
|
+
// @ts-expect-error never checks brand
|
|
210
210
|
return currentAllocation[keyword];
|
|
211
211
|
}
|
|
212
212
|
if (!brand) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makeEphemeraProvider<E extends {}, K extends
|
|
1
|
+
export function makeEphemeraProvider<E extends {}, K extends WeakKey>(init: (key: K) => E): (key: K) => E;
|
|
2
2
|
export function provideEmptySeat(zcf: ZCF, baggage: import("@agoric/swingset-liveslots").Baggage, name: string): ZCFSeat;
|
|
3
3
|
export function provideAll<T extends Record<string, () => ERef<any>>>(baggage: MapStore<string, any>, thunks: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
4
4
|
export function provideSingleton<T extends () => ERef<any>>(mapStore: import("@agoric/vat-data").Baggage, key: string, makeValue: T, withValue?: ((value: Awaited<ReturnType<T>>) => void) | undefined): Promise<Awaited<ReturnType<T>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAaO,qCAOiB,CAAC,aATR,CAAC,
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAaO,qCAOiB,CAAC,aATR,CAAC,wBAAP,CAAC,GAAG,EAAE,CAAC,KASM,CAAC,AATD,eASA,CAAC,CAWxB;AAWM,sCALI,GAAG,WACH,OAAO,4BAA4B,EAAE,OAAO,QAC5C,MAAM,GACJ,OAAO,CAInB;AAiCM,2BAFmD,CAAC,8BAHxB,IAAI,CAAC,GAAG,CAAC,YACjC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UAE0B,CAAC,AAD/C,GACC,OAAO,CAAC,GAAG,CAAC,IAAI,MAA6B,CAAC,AAAvB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAAC,CAuBlE;AAgBM,iCAFiC,CAAC,eALrB,IAAI,CAAC,GAAG,CAAC,YAClB,OAAO,kBAAkB,EAAE,OAAO,OAClC,MAAM,aAGuB,CAAC,AAF7B,uBACO,OAAO,CAAC,UAAU,CACG,CAAC,AADF,CAAC,CAAC,KAAK,IAAI,gBACrC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAc3C"}
|
|
@@ -8,7 +8,7 @@ import { E } from '@endo/eventual-send';
|
|
|
8
8
|
* representative also remains.
|
|
9
9
|
*
|
|
10
10
|
* @template {{}} E Ephemeral state
|
|
11
|
-
* @template {
|
|
11
|
+
* @template {WeakKey} K key on which to provision
|
|
12
12
|
* @param {(key: K) => E} init
|
|
13
13
|
*/
|
|
14
14
|
export const makeEphemeraProvider = init => {
|
|
@@ -15,7 +15,7 @@ export const PriceAuthorityI: import("@endo/patterns").InterfaceGuard<{
|
|
|
15
15
|
mutableQuoteWhenGT: import("@endo/patterns").MethodGuard;
|
|
16
16
|
}>;
|
|
17
17
|
export function makeOnewayPriceAuthorityKit(opts: {
|
|
18
|
-
quoteIssuer: Issuer<"set">;
|
|
18
|
+
quoteIssuer: globalThis.Issuer<"set", PriceDescription>;
|
|
19
19
|
notifier: ERef<Notifier<unknown>>;
|
|
20
20
|
timer: ERef<import("@agoric/time").TimerService>;
|
|
21
21
|
createQuote: PriceQuoteCreate;
|
|
@@ -24,6 +24,7 @@ export function makeOnewayPriceAuthorityKit(opts: {
|
|
|
24
24
|
}): PriceAuthorityKit;
|
|
25
25
|
export type CompareAmount = (amount: Amount, amountLimit: Amount) => boolean;
|
|
26
26
|
export type Trigger = (createInstantQuote: PriceQuoteCreate) => Promise<void>;
|
|
27
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
27
28
|
import type { PriceQuoteCreate } from '@agoric/zoe/tools/types.js';
|
|
28
29
|
import type { PriceAuthorityKit } from '@agoric/zoe/tools/types.js';
|
|
29
30
|
//# sourceMappingURL=priceAuthority.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAuthority.d.ts","sourceRoot":"","sources":["priceAuthority.js"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;GAiBG;AAYI
|
|
1
|
+
{"version":3,"file":"priceAuthority.d.ts","sourceRoot":"","sources":["priceAuthority.js"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;GAiBG;AAYI;;cAPI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;WACvB,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC;;mBAEzC,KAAK,CAAC,KAAK,CAAC;oBACZ,KAAK,CAAC,KAAK,CAAC;sBAyTtB;qCA7WU,MAAM,eACN,MAAM,KACJ,OAAO;gEAkBP,OAAO,CAAC,IAAI,CAAC;sCA7ByI,4BAA4B;sCAA5B,4BAA4B;uCAA5B,4BAA4B"}
|
|
@@ -65,7 +65,7 @@ export const PriceAuthorityI = M.interface('PriceAuthority', {
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @param {object} opts
|
|
68
|
-
* @param {Issuer<'set'>} opts.quoteIssuer
|
|
68
|
+
* @param {Issuer<'set', PriceDescription>} opts.quoteIssuer
|
|
69
69
|
* @param {ERef<Notifier<unknown>>} opts.notifier
|
|
70
70
|
* @param {ERef<import('@agoric/time').TimerService>} opts.timer
|
|
71
71
|
* @param {PriceQuoteCreate} opts.createQuote
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export function makeInitialTransform(priceOutPerIn: Ratio, priceAuthority: PriceAuthority, quoteMint: ERef<Mint<"set">>, brandIn: Brand<"nat">, brandOut: Brand<"nat">): PriceAuthority;
|
|
1
|
+
export function makeInitialTransform(priceOutPerIn: Ratio, priceAuthority: PriceAuthority, quoteMint: globalThis.ERef<globalThis.Mint<"set", PriceDescription>>, brandIn: Brand<"nat">, brandOut: Brand<"nat">): PriceAuthority;
|
|
2
2
|
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
3
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
3
4
|
//# sourceMappingURL=priceAuthorityInitial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAuthorityInitial.d.ts","sourceRoot":"","sources":["priceAuthorityInitial.js"],"names":[],"mappings":"AA8BO,oDAPI,KAAK,
|
|
1
|
+
{"version":3,"file":"priceAuthorityInitial.d.ts","sourceRoot":"","sources":["priceAuthorityInitial.js"],"names":[],"mappings":"AA8BO,oDAPI,KAAK,iHAGL,KAAK,CAAC,KAAK,CAAC,YACZ,KAAK,CAAC,KAAK,CAAC,kBA0FtB;oCAvG4F,4BAA4B;sCAA5B,4BAA4B"}
|
|
@@ -23,7 +23,7 @@ import { mintQuote } from './priceAuthorityTransform.js';
|
|
|
23
23
|
*
|
|
24
24
|
* @param {Ratio} priceOutPerIn
|
|
25
25
|
* @param {PriceAuthority} priceAuthority
|
|
26
|
-
* @param {ERef<Mint<'set'>>} quoteMint
|
|
26
|
+
* @param {ERef<Mint<'set', PriceDescription>>} quoteMint
|
|
27
27
|
* @param {Brand<'nat'>} brandIn
|
|
28
28
|
* @param {Brand<'nat'>} brandOut
|
|
29
29
|
* @returns {PriceAuthority}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export function provideQuoteMint(baggage: import("@agoric/vat-data").Baggage): ERef<Mint<"set">>;
|
|
1
|
+
export function provideQuoteMint(baggage: import("@agoric/vat-data").Baggage): globalThis.ERef<globalThis.Mint<"set", PriceDescription>>;
|
|
2
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
2
3
|
//# sourceMappingURL=priceAuthorityQuoteMint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAuthorityQuoteMint.d.ts","sourceRoot":"","sources":["priceAuthorityQuoteMint.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"priceAuthorityQuoteMint.d.ts","sourceRoot":"","sources":["priceAuthorityQuoteMint.js"],"names":[],"mappings":"AAaO,0CAHI,OAAO,kBAAkB,EAAE,OAAO,6DAmB5C;sCAxB0G,4BAA4B"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { AssetKind, prepareIssuerKit } from '@agoric/ertp';
|
|
2
2
|
import { provideDurableMapStore } from '@agoric/vat-data';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {EOnly} from '@endo/eventual-send';
|
|
6
|
+
* @import {MutableQuote, PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
7
|
+
*/
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
*
|
|
6
11
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
7
|
-
* @returns {ERef<Mint<'set'>>}
|
|
12
|
+
* @returns {ERef<Mint<'set', PriceDescription>>}
|
|
8
13
|
*/
|
|
9
14
|
export const provideQuoteMint = baggage => {
|
|
10
15
|
const issuerBaggage = provideDurableMapStore(
|
|
11
16
|
baggage,
|
|
12
17
|
'quoteMintIssuerBaggage',
|
|
13
18
|
);
|
|
19
|
+
/** @type {IssuerKit<'set', PriceDescription>} */
|
|
20
|
+
// @ts-expect-error cast
|
|
14
21
|
const issuerKit = prepareIssuerKit(
|
|
15
22
|
issuerBaggage,
|
|
16
23
|
'quote',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function mintQuote(quoteBrand: Brand<"set">, amountIn: Amount<"nat">, amountOut: Amount<"nat">, timer:
|
|
1
|
+
export function mintQuote(quoteBrand: Brand<"set">, amountIn: Amount<"nat">, amountOut: Amount<"nat">, timer: import("@agoric/time").TimerService, timestamp: import("@agoric/time").TimestampRecord, quoteMint: globalThis.ERef<globalThis.Mint<"set", PriceDescription>>): Promise<PriceQuote>;
|
|
2
2
|
export function makePriceAuthorityTransform({ quoteMint, sourcePriceAuthority, sourceBrandIn, sourceBrandOut, actualBrandIn, actualBrandOut, makeSourceAmountIn, makeSourceAmountOut, transformSourceAmountIn, transformSourceAmountOut, }: {
|
|
3
|
-
quoteMint: ERef<Mint<"set">>;
|
|
3
|
+
quoteMint: globalThis.ERef<globalThis.Mint<"set", PriceDescription>>;
|
|
4
4
|
sourcePriceAuthority: globalThis.ERef<PriceAuthority>;
|
|
5
5
|
sourceBrandIn: Brand<"nat">;
|
|
6
6
|
sourceBrandOut: Brand<"nat">;
|
|
@@ -11,6 +11,7 @@ export function makePriceAuthorityTransform({ quoteMint, sourcePriceAuthority, s
|
|
|
11
11
|
transformSourceAmountIn?: ((sourceAmountIn: Amount<"nat">) => Amount<"nat">) | undefined;
|
|
12
12
|
transformSourceAmountOut?: ((sourceAmountOut: Amount<"nat">) => Amount<"nat">) | undefined;
|
|
13
13
|
}): Promise<PriceAuthority>;
|
|
14
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
14
15
|
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
15
16
|
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
16
17
|
//# sourceMappingURL=priceAuthorityTransform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAuthorityTransform.d.ts","sourceRoot":"","sources":["priceAuthorityTransform.js"],"names":[],"mappings":"AAoBO,sCARI,KAAK,CAAC,KAAK,CAAC,YACZ,MAAM,CAAC,KAAK,CAAC,aACb,MAAM,CAAC,KAAK,CAAC,SACb,
|
|
1
|
+
{"version":3,"file":"priceAuthorityTransform.d.ts","sourceRoot":"","sources":["priceAuthorityTransform.js"],"names":[],"mappings":"AAoBO,sCARI,KAAK,CAAC,KAAK,CAAC,YACZ,MAAM,CAAC,KAAK,CAAC,aACb,MAAM,CAAC,KAAK,CAAC,SACb,OAAO,cAAc,EAAE,YAAY,aACnC,OAAO,cAAc,EAAE,eAAe,6FAqBhD;AAeM;;;mBATI,KAAK,CAAC,KAAK,CAAC;oBACZ,KAAK,CAAC,KAAK,CAAC;;;qCAGD,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;uCAC9B,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;gDAC1B,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;kDAC9B,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC;4BA4N3D;sCAtQ6E,4BAA4B;gCAA5B,4BAA4B;oCAA5B,4BAA4B"}
|
|
@@ -6,16 +6,16 @@ import { makeNotifier } from '@agoric/notifier';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @import {EOnly} from '@endo/eventual-send';
|
|
9
|
-
* @import {MutableQuote, PriceAuthority, PriceQuote,
|
|
9
|
+
* @import {MutableQuote, PriceAuthority, PriceQuote, PriceDescription,} from '@agoric/zoe/tools/types.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {Brand<'set'>} quoteBrand
|
|
14
14
|
* @param {Amount<'nat'>} amountIn
|
|
15
15
|
* @param {Amount<'nat'>} amountOut
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {import('@agoric/time').
|
|
18
|
-
* @param {ERef<Mint<'set'>>} quoteMint
|
|
16
|
+
* @param {import('@agoric/time').TimerService} timer
|
|
17
|
+
* @param {import('@agoric/time').TimestampRecord} timestamp
|
|
18
|
+
* @param {ERef<Mint<'set', PriceDescription>>} quoteMint
|
|
19
19
|
* @returns {Promise<PriceQuote>}
|
|
20
20
|
*/
|
|
21
21
|
export const mintQuote = async (
|
|
@@ -39,7 +39,7 @@ export const mintQuote = async (
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* @param {object} opts
|
|
42
|
-
* @param {ERef<Mint<'set'>>} opts.quoteMint
|
|
42
|
+
* @param {ERef<Mint<'set', PriceDescription>>} opts.quoteMint
|
|
43
43
|
* @param {ERef<PriceAuthority>} opts.sourcePriceAuthority
|
|
44
44
|
* @param {Brand<'nat'>} opts.sourceBrandIn
|
|
45
45
|
* @param {Brand<'nat'>} opts.sourceBrandOut
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function getPriceDescription(quote: PriceQuote): PriceDescription;
|
|
2
|
-
export function getAmountIn(quote: PriceQuote):
|
|
3
|
-
export function getAmountOut(quote: PriceQuote):
|
|
2
|
+
export function getAmountIn(quote: PriceQuote): import("@agoric/ertp/exported.js").NatAmount;
|
|
3
|
+
export function getAmountOut(quote: PriceQuote): import("@agoric/ertp/exported.js").NatAmount;
|
|
4
4
|
/** @type {(quote: PriceQuote) => import('@agoric/time').Timestamp} */
|
|
5
5
|
export const getTimestamp: (quote: PriceQuote) => import("@agoric/time").Timestamp;
|
|
6
|
-
export function unitAmount(brand: Brand<"nat">): Promise<
|
|
6
|
+
export function unitAmount(brand: Brand<"nat">): Promise<import("@agoric/ertp/exported.js").NatAmount>;
|
|
7
7
|
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
8
8
|
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
9
9
|
//# sourceMappingURL=priceQuote.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceQuote.d.ts","sourceRoot":"","sources":["priceQuote.js"],"names":[],"mappings":"AAqBO,yEAIN;AAGM,
|
|
1
|
+
{"version":3,"file":"priceQuote.d.ts","sourceRoot":"","sources":["priceQuote.js"],"names":[],"mappings":"AAqBO,yEAIN;AAGM,6FAAgE;AAEhE,8FAAkE;AACzE,sEAAsE;AACtE,kDADkC,OAAO,cAAc,EAAE,SAAS,CACQ;AAGnE,kCADK,KAAK,CAAC,KAAK,CAAC,yDAMvB;gCAjC4F,4BAA4B;sCAA5B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"AAwCO,gDAcN;AASM,qCANI,MAAM,kBACN,KAAK,sFAGH,KAAK,
|
|
1
|
+
{"version":3,"file":"ratio.d.ts","sourceRoot":"","sources":["ratio.js"],"names":[],"mappings":"AAwCO,gDAcN;AASM,qCANI,MAAM,kBACN,KAAK,sFAGH,KAAK,CAejB;AAOM,sDAJI,MAAM,qBACN,MAAM,GACJ,KAAK,CAYjB;AA2BD,0BAA0B;AAC1B,8BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,6BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,yBADW,WAAW,CAGpB;AA2BF,0BAA0B;AAC1B,4BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,2BADW,WAAW,CAGpB;AAEF,0BAA0B;AAC1B,uBADW,WAAW,CAGpB;AAMK,mCAHI,KAAK,GACH,KAAK,CAWjB;AAOM,gCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAwBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CAmBjB;AAOM,qCAJI,KAAK,SACL,KAAK,GACH,KAAK,CA8BjB;AAQM,gCAHI,KAAK,GACH,KAAK,CAcjB;AAOM,+BAJI,KAAK,SACL,KAAK,GACH,OAAO,CAkBnB;AASM,iCAJI,KAAK,SACL,KAAK,GACH,OAAO,CAOnB;AASM,gCAJI,KAAK,UACL,MAAM,GACJ,KAAK,CAajB;AAaM,oCALI,cAAc,kBACd,KAAK,oDAEH,KAAK,CAmBjB;AAMM,+CAHI,OAAO,GACL,OAAO,CAAC,QAAQ,IAAI,cAAc,CAK9C;AAQM,qCAHI,KAAK,GACH,MAAM,CAMlB;6BAhDa,MAAM,GAAG,MAAM,GAAG,MAAM"}
|
|
@@ -70,7 +70,6 @@ export const makeRatio = (
|
|
|
70
70
|
denominator > 0n ||
|
|
71
71
|
Fail`No infinite ratios! Denominator was 0 ${q(denominatorBrand)}`;
|
|
72
72
|
|
|
73
|
-
// @ts-expect-error cast to return type because make() ensures
|
|
74
73
|
return harden({
|
|
75
74
|
numerator: AmountMath.make(numeratorBrand, numerator),
|
|
76
75
|
denominator: AmountMath.make(denominatorBrand, denominator),
|
|
@@ -98,6 +97,7 @@ export const makeRatioFromAmounts = (numeratorAmount, denominatorAmount) => {
|
|
|
98
97
|
* @param {Amount<'nat'>} amount
|
|
99
98
|
* @param {Ratio} ratio
|
|
100
99
|
* @param {*} divideOp
|
|
100
|
+
* @returns {Amount<'nat'>}
|
|
101
101
|
*/
|
|
102
102
|
const multiplyHelper = (amount, ratio, divideOp) => {
|
|
103
103
|
AmountMath.coerce(amount.brand, amount);
|
|
@@ -107,12 +107,14 @@ const multiplyHelper = (amount, ratio, divideOp) => {
|
|
|
107
107
|
ratio.denominator.brand,
|
|
108
108
|
)}`;
|
|
109
109
|
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
return /** @type {Amount<'nat'>} */ (
|
|
111
|
+
AmountMath.make(
|
|
112
|
+
ratio.numerator.brand,
|
|
113
|
+
divideOp(
|
|
114
|
+
multiply(amount.value, ratio.numerator.value),
|
|
115
|
+
ratio.denominator.value,
|
|
116
|
+
),
|
|
117
|
+
)
|
|
116
118
|
);
|
|
117
119
|
};
|
|
118
120
|
|
|
@@ -135,6 +137,7 @@ export const multiplyBy = (amount, ratio) => {
|
|
|
135
137
|
* @param {Amount<'nat'>} amount
|
|
136
138
|
* @param {Ratio} ratio
|
|
137
139
|
* @param {*} divideOp
|
|
140
|
+
* @returns {Amount<'nat'>}
|
|
138
141
|
*/
|
|
139
142
|
const divideHelper = (amount, ratio, divideOp) => {
|
|
140
143
|
AmountMath.coerce(amount.brand, amount);
|
|
@@ -144,12 +147,14 @@ const divideHelper = (amount, ratio, divideOp) => {
|
|
|
144
147
|
ratio.numerator.brand,
|
|
145
148
|
)}`;
|
|
146
149
|
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
return /** @type {Amount<'nat'>} */ (
|
|
151
|
+
AmountMath.make(
|
|
152
|
+
ratio.denominator.brand,
|
|
153
|
+
divideOp(
|
|
154
|
+
multiply(amount.value, ratio.denominator.value),
|
|
155
|
+
ratio.numerator.value,
|
|
156
|
+
),
|
|
157
|
+
)
|
|
153
158
|
);
|
|
154
159
|
};
|
|
155
160
|
|
|
@@ -9,17 +9,17 @@ export function prepareRecorder(baggage: import("@agoric/vat-data").Baggage, mar
|
|
|
9
9
|
/**
|
|
10
10
|
* Marshalls before writing to storage or publisher to help ensure the two streams match.
|
|
11
11
|
*
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {any} value
|
|
13
13
|
* @returns {Promise<void>}
|
|
14
14
|
*/
|
|
15
|
-
write(value:
|
|
15
|
+
write(value: any): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Like `write` but prevents future writes and terminates the publisher.
|
|
18
18
|
*
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {any} value
|
|
20
20
|
* @returns {Promise<void>}
|
|
21
21
|
*/
|
|
22
|
-
writeFinal(value:
|
|
22
|
+
writeFinal(value: any): Promise<void>;
|
|
23
23
|
}>;
|
|
24
24
|
export function defineRecorderKit({ makeRecorder, makeDurablePublishKit }: {
|
|
25
25
|
makeRecorder: MakeRecorder;
|
|
@@ -55,17 +55,17 @@ export function prepareRecorderKitMakers(baggage: import("@agoric/vat-data").Bag
|
|
|
55
55
|
/**
|
|
56
56
|
* Marshalls before writing to storage or publisher to help ensure the two streams match.
|
|
57
57
|
*
|
|
58
|
-
* @param {
|
|
58
|
+
* @param {any} value
|
|
59
59
|
* @returns {Promise<void>}
|
|
60
60
|
*/
|
|
61
|
-
write(value:
|
|
61
|
+
write(value: any): Promise<void>;
|
|
62
62
|
/**
|
|
63
63
|
* Like `write` but prevents future writes and terminates the publisher.
|
|
64
64
|
*
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {any} value
|
|
66
66
|
* @returns {Promise<void>}
|
|
67
67
|
*/
|
|
68
|
-
writeFinal(value:
|
|
68
|
+
writeFinal(value: any): Promise<void>;
|
|
69
69
|
}>;
|
|
70
70
|
makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: TypedMatcher<T> | undefined) => RecorderKit<T>;
|
|
71
71
|
makeERecorderKit: <T_1>(storageNodeP: ERef<StorageNode>, valueShape?: TypedMatcher<T_1> | undefined) => EventualRecorderKit<T_1>;
|
|
@@ -98,17 +98,17 @@ export function prepareMockRecorderKitMakers(): {
|
|
|
98
98
|
/**
|
|
99
99
|
* Marshalls before writing to storage or publisher to help ensure the two streams match.
|
|
100
100
|
*
|
|
101
|
-
* @param {
|
|
101
|
+
* @param {any} value
|
|
102
102
|
* @returns {Promise<void>}
|
|
103
103
|
*/
|
|
104
|
-
write(value:
|
|
104
|
+
write(value: any): Promise<void>;
|
|
105
105
|
/**
|
|
106
106
|
* Like `write` but prevents future writes and terminates the publisher.
|
|
107
107
|
*
|
|
108
|
-
* @param {
|
|
108
|
+
* @param {any} value
|
|
109
109
|
* @returns {Promise<void>}
|
|
110
110
|
*/
|
|
111
|
-
writeFinal(value:
|
|
111
|
+
writeFinal(value: any): Promise<void>;
|
|
112
112
|
}>;
|
|
113
113
|
makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: TypedMatcher<T> | undefined) => RecorderKit<T>;
|
|
114
114
|
makeERecorderKit: <T_1>(storageNodeP: ERef<StorageNode>, valueShape?: TypedMatcher<T_1> | undefined) => EventualRecorderKit<T_1>;
|
|
@@ -135,7 +135,7 @@ export type MakeERecorderKit = ReturnType<typeof defineERecorderKit>;
|
|
|
135
135
|
* This is a Pattern but since that's `any`, including in the typedef turns the
|
|
136
136
|
* whole thing to `any`.
|
|
137
137
|
*/
|
|
138
|
-
export type TypedMatcher<T> = {
|
|
138
|
+
export type TypedMatcher<T> = import("@endo/patterns").Matcher & {
|
|
139
139
|
validatedType?: T;
|
|
140
140
|
};
|
|
141
141
|
export type MatchedType<TM extends TypedMatcher<any>> = TM extends TypedMatcher<infer T> ? T : never;
|