@agoric/zoe 0.26.3-dev-fa844b5.0 → 0.26.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/bundles/bundle-contractFacet-js-meta.json +84 -84
- package/bundles/bundle-contractFacet.d.ts +7 -0
- package/bundles/bundle-contractFacet.d.ts.map +1 -0
- package/package.json +15 -15
- package/src/cleanProposal.d.ts +9 -0
- package/src/cleanProposal.d.ts.map +1 -0
- package/src/contractFacet/allocationMath.d.ts +7 -0
- package/src/contractFacet/allocationMath.d.ts.map +1 -0
- package/src/contractFacet/evalContractCode.d.ts +2 -0
- package/src/contractFacet/evalContractCode.d.ts.map +1 -0
- package/src/contractFacet/exit.d.ts +2 -0
- package/src/contractFacet/exit.d.ts.map +1 -0
- package/src/contractFacet/internal-types.d.ts +8 -0
- package/src/contractFacet/internal-types.d.ts.map +1 -0
- package/src/contractFacet/offerHandlerStorage.d.ts +5 -0
- package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -0
- package/src/contractFacet/offerSafety.d.ts +34 -0
- package/src/contractFacet/offerSafety.d.ts.map +1 -0
- package/src/contractFacet/reallocate.d.ts +3 -0
- package/src/contractFacet/reallocate.d.ts.map +1 -0
- package/src/contractFacet/rightsConservation.d.ts +12 -0
- package/src/contractFacet/rightsConservation.d.ts.map +1 -0
- package/src/contractFacet/vatRoot.d.ts +14 -0
- package/src/contractFacet/vatRoot.d.ts.map +1 -0
- package/src/contractFacet/zcfMint.d.ts +8 -0
- package/src/contractFacet/zcfMint.d.ts.map +1 -0
- package/src/contractFacet/zcfSeat.d.ts +3 -0
- package/src/contractFacet/zcfSeat.d.ts.map +1 -0
- package/src/contractFacet/zcfZygote.d.ts +2 -0
- package/src/contractFacet/zcfZygote.d.ts.map +1 -0
- package/src/contractSupport/atomicTransfer.d.ts +6 -0
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -0
- package/src/contractSupport/bondingCurves.d.ts +6 -0
- package/src/contractSupport/bondingCurves.d.ts.map +1 -0
- package/src/contractSupport/durability.d.ts +5 -0
- package/src/contractSupport/durability.d.ts.map +1 -0
- package/src/contractSupport/index.d.ts +14 -0
- package/src/contractSupport/index.d.ts.map +1 -0
- package/src/contractSupport/prepare-ownable.d.ts +11 -0
- package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
- package/src/contractSupport/priceAuthority.d.ts +27 -0
- package/src/contractSupport/priceAuthority.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts +14 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -0
- package/src/contractSupport/priceQuote.d.ts +7 -0
- package/src/contractSupport/priceQuote.d.ts.map +1 -0
- package/src/contractSupport/ratio.d.ts +28 -0
- package/src/contractSupport/ratio.d.ts.map +1 -0
- package/src/contractSupport/recorder.d.ts +143 -0
- package/src/contractSupport/recorder.d.ts.map +1 -0
- package/src/contractSupport/safeMath.d.ts +11 -0
- package/src/contractSupport/safeMath.d.ts.map +1 -0
- package/src/contractSupport/stateMachine.d.ts +6 -0
- package/src/contractSupport/stateMachine.d.ts.map +1 -0
- package/src/contractSupport/statistics.d.ts +7 -0
- package/src/contractSupport/statistics.d.ts.map +1 -0
- package/src/contractSupport/topics.d.ts +22 -0
- package/src/contractSupport/topics.d.ts.map +1 -0
- package/src/contractSupport/types.d.ts +63 -0
- package/src/contractSupport/types.d.ts.map +1 -0
- package/src/contractSupport/zoeHelpers.d.ts +30 -0
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -0
- package/src/contracts/atomicSwap.d.ts +16 -0
- package/src/contracts/atomicSwap.d.ts.map +1 -0
- package/src/contracts/auction/assertBidSeat.d.ts +2 -0
- package/src/contracts/auction/assertBidSeat.d.ts.map +1 -0
- package/src/contracts/auction/firstPriceLogic.d.ts +2 -0
- package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -0
- package/src/contracts/auction/index.d.ts +78 -0
- package/src/contracts/auction/index.d.ts.map +1 -0
- package/src/contracts/auction/secondPriceLogic.d.ts +2 -0
- package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -0
- package/src/contracts/automaticRefund.d.ts +25 -0
- package/src/contracts/automaticRefund.d.ts.map +1 -0
- package/src/contracts/autoswap.d.ts +43 -0
- package/src/contracts/autoswap.d.ts.map +1 -0
- package/src/contracts/barterExchange.d.ts +22 -0
- package/src/contracts/barterExchange.d.ts.map +1 -0
- package/src/contracts/callSpread/calculateShares.d.ts +2 -0
- package/src/contracts/callSpread/calculateShares.d.ts.map +1 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts +60 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/payoffHandler.d.ts +11 -0
- package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -0
- package/src/contracts/callSpread/percent.d.ts +3 -0
- package/src/contracts/callSpread/percent.d.ts.map +1 -0
- package/src/contracts/callSpread/position.d.ts +10 -0
- package/src/contracts/callSpread/position.d.ts.map +1 -0
- package/src/contracts/callSpread/pricedCallSpread.d.ts +66 -0
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/types.d.ts +30 -0
- package/src/contracts/callSpread/types.d.ts.map +1 -0
- package/src/contracts/coveredCall-durable.d.ts +21 -0
- package/src/contracts/coveredCall-durable.d.ts.map +1 -0
- package/src/contracts/coveredCall.d.ts +64 -0
- package/src/contracts/coveredCall.d.ts.map +1 -0
- package/src/contracts/exported.d.ts +2 -0
- package/src/contracts/exported.d.ts.map +1 -0
- package/src/contracts/loan/addCollateral.d.ts +3 -0
- package/src/contracts/loan/addCollateral.d.ts.map +1 -0
- package/src/contracts/loan/borrow.d.ts +3 -0
- package/src/contracts/loan/borrow.d.ts.map +1 -0
- package/src/contracts/loan/close.d.ts +3 -0
- package/src/contracts/loan/close.d.ts.map +1 -0
- package/src/contracts/loan/index.d.ts +64 -0
- package/src/contracts/loan/index.d.ts.map +1 -0
- package/src/contracts/loan/lend.d.ts +3 -0
- package/src/contracts/loan/lend.d.ts.map +1 -0
- package/src/contracts/loan/liquidate.d.ts +3 -0
- package/src/contracts/loan/liquidate.d.ts.map +1 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts +3 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -0
- package/src/contracts/loan/types.d.ts +161 -0
- package/src/contracts/loan/types.d.ts.map +1 -0
- package/src/contracts/loan/updateDebt.d.ts +11 -0
- package/src/contracts/loan/updateDebt.d.ts.map +1 -0
- package/src/contracts/mintAndSellNFT.d.ts +28 -0
- package/src/contracts/mintAndSellNFT.d.ts.map +1 -0
- package/src/contracts/mintPayments.d.ts +30 -0
- package/src/contracts/mintPayments.d.ts.map +1 -0
- package/src/contracts/oracle.d.ts +26 -0
- package/src/contracts/oracle.d.ts.map +1 -0
- package/src/contracts/otcDesk.d.ts +79 -0
- package/src/contracts/otcDesk.d.ts.map +1 -0
- package/src/contracts/priceAggregator.d.ts +107 -0
- package/src/contracts/priceAggregator.d.ts.map +1 -0
- package/src/contracts/priceAggregator.js +0 -1
- package/src/contracts/priceAggregatorTypes.d.ts +77 -0
- package/src/contracts/priceAggregatorTypes.d.ts.map +1 -0
- package/src/contracts/scaledPriceAuthority.d.ts +21 -0
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -0
- package/src/contracts/sellItems.d.ts +30 -0
- package/src/contracts/sellItems.d.ts.map +1 -0
- package/src/contracts/simpleExchange.d.ts +37 -0
- package/src/contracts/simpleExchange.d.ts.map +1 -0
- package/src/contracts/types.d.ts +80 -0
- package/src/contracts/types.d.ts.map +1 -0
- package/src/handleWarning.d.ts +3 -0
- package/src/handleWarning.d.ts.map +1 -0
- package/src/instanceRecordStorage.d.ts +2 -0
- package/src/instanceRecordStorage.d.ts.map +1 -0
- package/src/internal-types.d.ts +179 -0
- package/src/internal-types.d.ts.map +1 -0
- package/src/issuerRecord.d.ts +3 -0
- package/src/issuerRecord.d.ts.map +1 -0
- package/src/issuerStorage.d.ts +14 -0
- package/src/issuerStorage.d.ts.map +1 -0
- package/src/makeHandle.d.ts +4 -0
- package/src/makeHandle.d.ts.map +1 -0
- package/src/typeGuards.d.ts +169 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +46 -0
- package/src/types.d.ts.map +1 -0
- package/src/zoeService/createZCFVat.d.ts +2 -0
- package/src/zoeService/createZCFVat.d.ts.map +1 -0
- package/src/zoeService/escrowStorage.d.ts +7 -0
- package/src/zoeService/escrowStorage.d.ts.map +1 -0
- package/src/zoeService/feeMint.d.ts +23 -0
- package/src/zoeService/feeMint.d.ts.map +1 -0
- package/src/zoeService/installationStorage.d.ts +20 -0
- package/src/zoeService/installationStorage.d.ts.map +1 -0
- package/src/zoeService/instanceAdminStorage.d.ts +103 -0
- package/src/zoeService/instanceAdminStorage.d.ts.map +1 -0
- package/src/zoeService/internal-types.d.ts +90 -0
- package/src/zoeService/internal-types.d.ts.map +1 -0
- package/src/zoeService/invitationQueries.d.ts +6 -0
- package/src/zoeService/invitationQueries.d.ts.map +1 -0
- package/src/zoeService/makeInvitation.d.ts +5 -0
- package/src/zoeService/makeInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/burnInvitation.d.ts +5 -0
- package/src/zoeService/offer/burnInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/offer.d.ts +2 -0
- package/src/zoeService/offer/offer.d.ts.map +1 -0
- package/src/zoeService/originalZoeSeat.d.ts +34 -0
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
- package/src/zoeService/startInstance.d.ts +4 -0
- package/src/zoeService/startInstance.d.ts.map +1 -0
- package/src/zoeService/types.d.ts +224 -0
- package/src/zoeService/types.d.ts.map +1 -0
- package/src/zoeService/utils.test-d.d.ts +2 -0
- package/src/zoeService/utils.test-d.d.ts.map +1 -0
- package/src/zoeService/zoe.d.ts +57 -0
- package/src/zoeService/zoe.d.ts.map +1 -0
- package/src/zoeService/zoe.js +0 -2
- package/src/zoeService/zoeSeat.d.ts +26 -0
- package/src/zoeService/zoeSeat.d.ts.map +1 -0
- package/src/zoeService/zoeStorageManager.d.ts +41 -0
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -0
- package/tools/fakePriceAuthority.d.ts +30 -0
- package/tools/fakePriceAuthority.d.ts.map +1 -0
- package/tools/fakeVatAdmin.d.ts +103 -0
- package/tools/fakeVatAdmin.d.ts.map +1 -0
- package/tools/internal-types.d.ts +12 -0
- package/tools/internal-types.d.ts.map +1 -0
- package/tools/manualPriceAuthority.d.ts +21 -0
- package/tools/manualPriceAuthority.d.ts.map +1 -0
- package/tools/manualTimer.d.ts +44 -0
- package/tools/manualTimer.d.ts.map +1 -0
- package/tools/prepare-test-env-ava.d.ts +2 -0
- package/tools/prepare-test-env-ava.d.ts.map +1 -0
- package/tools/prepare-test-env.d.ts +2 -0
- package/tools/prepare-test-env.d.ts.map +1 -0
- package/tools/scriptedOracle.d.ts +27 -0
- package/tools/scriptedOracle.d.ts.map +1 -0
- package/tools/scriptedPriceAuthority.d.ts +2 -0
- package/tools/scriptedPriceAuthority.d.ts.map +1 -0
- package/tools/setup-zoe.d.ts +33 -0
- package/tools/setup-zoe.d.ts.map +1 -0
- package/tools/types-ambient.d.ts +142 -0
- package/tools/types-ambient.d.ts.map +1 -0
- package/tools/types.d.ts +142 -0
- package/tools/types.d.ts.map +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start an instance of an Oracle that follows a script. The Oracle has access
|
|
3
|
+
* to a timer, and looks in the script for events indexed by the current time.
|
|
4
|
+
* It responds to onQuery() by reporting any current event. This is intended to
|
|
5
|
+
* be useful for tests.
|
|
6
|
+
* The queries return an object that has fields { event, time, query }. event is
|
|
7
|
+
* whatever was in the script indexed by the time. The query is returned in the
|
|
8
|
+
* result, but has no impact on the result. If the script has no entry for the
|
|
9
|
+
* time, the event is 'nothing to report'.
|
|
10
|
+
*
|
|
11
|
+
* @param {Record<string, any>} script
|
|
12
|
+
* @param {Installation<import('../src/contracts/oracle.js').OracleStart>} oracleInstallation
|
|
13
|
+
* @param {import('@agoric/time').TimerService} timer
|
|
14
|
+
* @param {ZoeService} zoe
|
|
15
|
+
* @param {Issuer} feeIssuer
|
|
16
|
+
*/
|
|
17
|
+
export function makeScriptedOracle(script: Record<string, any>, oracleInstallation: Installation<import('../src/contracts/oracle.js').OracleStart>, timer: import('@agoric/time').TimerService, zoe: ZoeService, feeIssuer: Issuer): Promise<{
|
|
18
|
+
publicFacet: {
|
|
19
|
+
query(query: OracleQuery): Promise<unknown>;
|
|
20
|
+
makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
|
|
21
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
22
|
+
query(query: OracleQuery): Promise<unknown>;
|
|
23
|
+
makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
|
|
24
|
+
}>;
|
|
25
|
+
creatorFacet: OracleCreatorFacet;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=scriptedOracle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scriptedOracle.d.ts","sourceRoot":"","sources":["scriptedOracle.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,2CANW,OAAO,MAAM,EAAE,GAAG,CAAC,sBACnB,aAAa,OAAO,4BAA4B,EAAE,WAAW,CAAC,SAC9D,OAAO,cAAc,EAAE,YAAY,OACnC,UAAU,aACV,MAAM;;;;;;;;;GAqChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scriptedPriceAuthority.d.ts","sourceRoot":"","sources":["scriptedPriceAuthority.js"],"names":[],"mappings":"AAWA,yEAoFC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function makeZoeKitForTest(vatAdminSvc?: VatAdminSvc | undefined): {
|
|
2
|
+
zoeService: ZoeService;
|
|
3
|
+
zoeConfigFacet: import("@endo/exo").Guarded<{
|
|
4
|
+
updateZcfBundleId(bundleId: any): void;
|
|
5
|
+
}>;
|
|
6
|
+
feeMintAccess: FeeMintAccess;
|
|
7
|
+
setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
|
|
8
|
+
};
|
|
9
|
+
export function makeZoeForTest(vatAdminSvc?: VatAdminSvc | undefined): ZoeService;
|
|
10
|
+
export function setUpZoeForTest<T extends unknown = unknown>({ setJig, feeIssuerConfig, vatAdminSvc, useNearRemote, }?: {
|
|
11
|
+
setJig?: ((jig: T) => void) | undefined;
|
|
12
|
+
feeIssuerConfig?: FeeIssuerConfig | undefined;
|
|
13
|
+
vatAdminSvc?: VatAdminSvc | undefined;
|
|
14
|
+
useNearRemote?: boolean | undefined;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
zoe: ZoeService;
|
|
17
|
+
feeMintAccessP: FeeMintAccess;
|
|
18
|
+
vatAdminSvc: VatAdminSvc;
|
|
19
|
+
vatAdminState: {
|
|
20
|
+
getExitMessage: () => any;
|
|
21
|
+
getHasExited: () => boolean;
|
|
22
|
+
getExitWithFailure: () => any;
|
|
23
|
+
installBundle: (id: any, bundle: any) => any;
|
|
24
|
+
installNamedBundle: (name: any, id: any, bundle: any) => any;
|
|
25
|
+
getCriticalVatKey: () => {};
|
|
26
|
+
getVatPowers: () => {
|
|
27
|
+
D: (bcap: any) => {
|
|
28
|
+
getBundle: () => * EndoZipBase64Bundle;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
} | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=setup-zoe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"AASO;;;;;;;EAKN;AAKM,kFACoC;AAYpC;IAL+B,MAAM,gBAArB,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;;;;;;;;;;;;;;;;;;GA+BzC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
type PriceQuote = {
|
|
2
|
+
/**
|
|
3
|
+
* Amount whose value is a PriceQuoteValue
|
|
4
|
+
*/
|
|
5
|
+
quoteAmount: Amount<'set'>;
|
|
6
|
+
/**
|
|
7
|
+
* The `quoteAmount` wrapped as a payment
|
|
8
|
+
*/
|
|
9
|
+
quotePayment: ERef<globalThis.Payment<"set">>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A single-valued set of PriceDescriptions. This is the `value` in
|
|
13
|
+
* PriceQuote.quoteAmount (`{ brand, value: PriceQuoteValue }`).
|
|
14
|
+
*/
|
|
15
|
+
type PriceQuoteValue = [PriceDescription];
|
|
16
|
+
/**
|
|
17
|
+
* A description of a single quote
|
|
18
|
+
*/
|
|
19
|
+
type PriceDescription = {
|
|
20
|
+
/**
|
|
21
|
+
* The amount supplied to a trade
|
|
22
|
+
*/
|
|
23
|
+
amountIn: Amount<'nat'>;
|
|
24
|
+
/**
|
|
25
|
+
* The quoted result of trading `amountIn`
|
|
26
|
+
*/
|
|
27
|
+
amountOut: Amount<'nat'>;
|
|
28
|
+
/**
|
|
29
|
+
* The service that gave the `timestamp`
|
|
30
|
+
*/
|
|
31
|
+
timer: import('@agoric/time').TimerService;
|
|
32
|
+
/**
|
|
33
|
+
* A timestamp according to `timer` for the quote
|
|
34
|
+
*/
|
|
35
|
+
timestamp: import('@agoric/time').TimestampRecord;
|
|
36
|
+
/**
|
|
37
|
+
* Additional conditions for the quote
|
|
38
|
+
*/
|
|
39
|
+
conditions?: any;
|
|
40
|
+
};
|
|
41
|
+
type PriceQuoteCreate = (priceQuery: PriceQuery) => ERef<PriceQuote> | undefined;
|
|
42
|
+
type PriceQuoteTrigger = (createQuote: PriceQuoteCreate) => any;
|
|
43
|
+
type PriceAuthorityAdmin = {
|
|
44
|
+
fireTriggers: (createQuote: PriceQuoteCreate) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
type PriceAuthorityKit = {
|
|
47
|
+
priceAuthority: PriceAuthority;
|
|
48
|
+
adminFacet: PriceAuthorityAdmin;
|
|
49
|
+
};
|
|
50
|
+
type MutableQuote = {
|
|
51
|
+
cancel: (reason?: any) => void;
|
|
52
|
+
updateLevel: (amountIn: Amount<'nat'>, amountOut: Amount<'nat'>) => void;
|
|
53
|
+
getPromise: () => ERef<PriceQuote>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* An object that mints PriceQuotes and handles
|
|
57
|
+
* triggers and notifiers for changes in the price
|
|
58
|
+
*/
|
|
59
|
+
type PriceAuthority = {
|
|
60
|
+
/**
|
|
61
|
+
* Get the ERTP issuer of PriceQuotes for a given brandIn/brandOut pair
|
|
62
|
+
*/
|
|
63
|
+
getQuoteIssuer: (brandIn: Brand, brandOut: Brand) => ERef<globalThis.Issuer<"set">>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the timer used in PriceQuotes for a given brandIn/brandOut pair
|
|
66
|
+
*/
|
|
67
|
+
getTimerService: (brandIn: Brand, brandOut: Brand) => ERef<import("@agoric/time").TimerService>;
|
|
68
|
+
/**
|
|
69
|
+
* Be notified of the latest PriceQuotes for a given
|
|
70
|
+
* `amountIn`. The rate at which these are issued may be very different between
|
|
71
|
+
* `priceAuthorities`.
|
|
72
|
+
*/
|
|
73
|
+
makeQuoteNotifier: (amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => ERef<Notifier<PriceQuote>>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolves after `deadline` passes on the
|
|
76
|
+
* priceAuthority's timerService with the price quote of `amountIn` at that time
|
|
77
|
+
*/
|
|
78
|
+
quoteAtTime: (deadline: import('@agoric/time').Timestamp, amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => Promise<PriceQuote>;
|
|
79
|
+
/**
|
|
80
|
+
* Get a quote corresponding to the specified amountIn
|
|
81
|
+
*/
|
|
82
|
+
quoteGiven: (amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => Promise<PriceQuote>;
|
|
83
|
+
/**
|
|
84
|
+
* Get a quote corresponding to the specified amountOut
|
|
85
|
+
*/
|
|
86
|
+
quoteWanted: (brandIn: Brand<'nat'>, amountOut: Amount<'nat'>) => Promise<PriceQuote>;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve when a price quote of `amountIn` exceeds `amountOutLimit`
|
|
89
|
+
*/
|
|
90
|
+
quoteWhenGT: (amountIn: Amount<'nat'>, amountOutLimit: Amount<'nat'>) => Promise<PriceQuote>;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve when a price quote of `amountIn` reaches or exceeds `amountOutLimit`
|
|
93
|
+
*/
|
|
94
|
+
quoteWhenGTE: (amountIn: Amount<'nat'>, amountOutLimit: Amount<'nat'>) => Promise<PriceQuote>;
|
|
95
|
+
/**
|
|
96
|
+
* Resolve when a price quote of `amountIn` reaches or drops below
|
|
97
|
+
* `amountOutLimit`
|
|
98
|
+
*/
|
|
99
|
+
quoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve when the price quote of `amountIn` drops below `amountOutLimit`
|
|
102
|
+
*/
|
|
103
|
+
quoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>;
|
|
104
|
+
/**
|
|
105
|
+
* Resolve when a price quote of `amountIn` exceeds `amountOutLimit`
|
|
106
|
+
*/
|
|
107
|
+
mutableQuoteWhenGT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve when a price quote of `amountIn` reaches or exceeds
|
|
110
|
+
* `amountOutLimit`
|
|
111
|
+
*/
|
|
112
|
+
mutableQuoteWhenGTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve when a price quote of `amountIn` reaches or drops below
|
|
115
|
+
* `amountOutLimit`
|
|
116
|
+
*/
|
|
117
|
+
mutableQuoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
118
|
+
/**
|
|
119
|
+
* Resolve when the price quote of `amountIn` drops below `amountOutLimit`
|
|
120
|
+
*/
|
|
121
|
+
mutableQuoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
122
|
+
};
|
|
123
|
+
type PriceCalculator = (amount: Amount<'nat'>) => Amount<'nat'>;
|
|
124
|
+
type PriceQuery = (calcAmountIn: PriceCalculator, calcAmountOut: PriceCalculator) => {
|
|
125
|
+
amountIn: Amount<'nat'>;
|
|
126
|
+
amountOut: Amount<'nat'>;
|
|
127
|
+
timestamp?: import('@agoric/time').TimestampRecord;
|
|
128
|
+
} | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* A description of a single quote
|
|
131
|
+
*/
|
|
132
|
+
type PriceLevel = {
|
|
133
|
+
/**
|
|
134
|
+
* The amount supplied to a trade
|
|
135
|
+
*/
|
|
136
|
+
amountIn: Amount<'nat'>;
|
|
137
|
+
/**
|
|
138
|
+
* The quoted result of trading `amountIn`
|
|
139
|
+
*/
|
|
140
|
+
amountOut: Amount<'nat'>;
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=types-ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":";;;;iBAIc,OAAO,KAAK,CAAC;;;;;;;;;;uBAOd,CAAC,gBAAgB,CAAC;;;;;;;;cAQjB,OAAO,KAAK,CAAC;;;;eAEb,OAAO,KAAK,CAAC;;;;WAEb,OAAO,cAAc,EAAE,YAA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F,MAAM,kBACA,MAAM;;;;;oCAIZ,MAAM,kBACA,MAAM;;;;;oCAKZ,MAAM,kBACA,MAAM;;;;mCAKZ,MAAM,kBACA,MAAM;;uBAMxB,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,KAAK,OAAO,KAAK,CAAC;iCAK1C,eAAe,iBACf,eAAe,KACb;IAAE,QAAQ,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,SAAS,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,cAAc,EAAE,eAAe,CAAA;CAAE,GAAG,SAAS;;;;;;;;cAOpH,OAAO,KAAK,CAAC;;;;eAEb,OAAO,KAAK,CAAC"}
|
package/tools/types.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export type PriceQuote = {
|
|
2
|
+
/**
|
|
3
|
+
* Amount whose value is a PriceQuoteValue
|
|
4
|
+
*/
|
|
5
|
+
quoteAmount: Amount<'set'>;
|
|
6
|
+
/**
|
|
7
|
+
* The `quoteAmount` wrapped as a payment
|
|
8
|
+
*/
|
|
9
|
+
quotePayment: ERef<globalThis.Payment<"set">>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A single-valued set of PriceDescriptions. This is the `value` in
|
|
13
|
+
* PriceQuote.quoteAmount (`{ brand, value: PriceQuoteValue }`).
|
|
14
|
+
*/
|
|
15
|
+
export type PriceQuoteValue = [PriceDescription];
|
|
16
|
+
/**
|
|
17
|
+
* A description of a single quote
|
|
18
|
+
*/
|
|
19
|
+
export type PriceDescription = {
|
|
20
|
+
/**
|
|
21
|
+
* The amount supplied to a trade
|
|
22
|
+
*/
|
|
23
|
+
amountIn: Amount<'nat'>;
|
|
24
|
+
/**
|
|
25
|
+
* The quoted result of trading `amountIn`
|
|
26
|
+
*/
|
|
27
|
+
amountOut: Amount<'nat'>;
|
|
28
|
+
/**
|
|
29
|
+
* The service that gave the `timestamp`
|
|
30
|
+
*/
|
|
31
|
+
timer: import('@agoric/time').TimerService;
|
|
32
|
+
/**
|
|
33
|
+
* A timestamp according to `timer` for the quote
|
|
34
|
+
*/
|
|
35
|
+
timestamp: import('@agoric/time').TimestampRecord;
|
|
36
|
+
/**
|
|
37
|
+
* Additional conditions for the quote
|
|
38
|
+
*/
|
|
39
|
+
conditions?: any;
|
|
40
|
+
};
|
|
41
|
+
export type PriceQuoteCreate = (priceQuery: PriceQuery) => ERef<PriceQuote> | undefined;
|
|
42
|
+
export type PriceQuoteTrigger = (createQuote: PriceQuoteCreate) => any;
|
|
43
|
+
export type PriceAuthorityAdmin = {
|
|
44
|
+
fireTriggers: (createQuote: PriceQuoteCreate) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
export type PriceAuthorityKit = {
|
|
47
|
+
priceAuthority: PriceAuthority;
|
|
48
|
+
adminFacet: PriceAuthorityAdmin;
|
|
49
|
+
};
|
|
50
|
+
export type MutableQuote = {
|
|
51
|
+
cancel: (reason?: any) => void;
|
|
52
|
+
updateLevel: (amountIn: Amount<'nat'>, amountOut: Amount<'nat'>) => void;
|
|
53
|
+
getPromise: () => ERef<PriceQuote>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* An object that mints PriceQuotes and handles
|
|
57
|
+
* triggers and notifiers for changes in the price
|
|
58
|
+
*/
|
|
59
|
+
export type PriceAuthority = {
|
|
60
|
+
/**
|
|
61
|
+
* Get the ERTP issuer of PriceQuotes for a given brandIn/brandOut pair
|
|
62
|
+
*/
|
|
63
|
+
getQuoteIssuer: (brandIn: Brand, brandOut: Brand) => ERef<globalThis.Issuer<"set">>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the timer used in PriceQuotes for a given brandIn/brandOut pair
|
|
66
|
+
*/
|
|
67
|
+
getTimerService: (brandIn: Brand, brandOut: Brand) => ERef<import("@agoric/time").TimerService>;
|
|
68
|
+
/**
|
|
69
|
+
* Be notified of the latest PriceQuotes for a given
|
|
70
|
+
* `amountIn`. The rate at which these are issued may be very different between
|
|
71
|
+
* `priceAuthorities`.
|
|
72
|
+
*/
|
|
73
|
+
makeQuoteNotifier: (amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => ERef<Notifier<PriceQuote>>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolves after `deadline` passes on the
|
|
76
|
+
* priceAuthority's timerService with the price quote of `amountIn` at that time
|
|
77
|
+
*/
|
|
78
|
+
quoteAtTime: (deadline: import('@agoric/time').Timestamp, amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => Promise<PriceQuote>;
|
|
79
|
+
/**
|
|
80
|
+
* Get a quote corresponding to the specified amountIn
|
|
81
|
+
*/
|
|
82
|
+
quoteGiven: (amountIn: Amount<'nat'>, brandOut: Brand<'nat'>) => Promise<PriceQuote>;
|
|
83
|
+
/**
|
|
84
|
+
* Get a quote corresponding to the specified amountOut
|
|
85
|
+
*/
|
|
86
|
+
quoteWanted: (brandIn: Brand<'nat'>, amountOut: Amount<'nat'>) => Promise<PriceQuote>;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve when a price quote of `amountIn` exceeds `amountOutLimit`
|
|
89
|
+
*/
|
|
90
|
+
quoteWhenGT: (amountIn: Amount<'nat'>, amountOutLimit: Amount<'nat'>) => Promise<PriceQuote>;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve when a price quote of `amountIn` reaches or exceeds `amountOutLimit`
|
|
93
|
+
*/
|
|
94
|
+
quoteWhenGTE: (amountIn: Amount<'nat'>, amountOutLimit: Amount<'nat'>) => Promise<PriceQuote>;
|
|
95
|
+
/**
|
|
96
|
+
* Resolve when a price quote of `amountIn` reaches or drops below
|
|
97
|
+
* `amountOutLimit`
|
|
98
|
+
*/
|
|
99
|
+
quoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve when the price quote of `amountIn` drops below `amountOutLimit`
|
|
102
|
+
*/
|
|
103
|
+
quoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>;
|
|
104
|
+
/**
|
|
105
|
+
* Resolve when a price quote of `amountIn` exceeds `amountOutLimit`
|
|
106
|
+
*/
|
|
107
|
+
mutableQuoteWhenGT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve when a price quote of `amountIn` reaches or exceeds
|
|
110
|
+
* `amountOutLimit`
|
|
111
|
+
*/
|
|
112
|
+
mutableQuoteWhenGTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve when a price quote of `amountIn` reaches or drops below
|
|
115
|
+
* `amountOutLimit`
|
|
116
|
+
*/
|
|
117
|
+
mutableQuoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
118
|
+
/**
|
|
119
|
+
* Resolve when the price quote of `amountIn` drops below `amountOutLimit`
|
|
120
|
+
*/
|
|
121
|
+
mutableQuoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>;
|
|
122
|
+
};
|
|
123
|
+
export type PriceCalculator = (amount: Amount<'nat'>) => Amount<'nat'>;
|
|
124
|
+
export type PriceQuery = (calcAmountIn: PriceCalculator, calcAmountOut: PriceCalculator) => {
|
|
125
|
+
amountIn: Amount<'nat'>;
|
|
126
|
+
amountOut: Amount<'nat'>;
|
|
127
|
+
timestamp?: import('@agoric/time').TimestampRecord;
|
|
128
|
+
} | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* A description of a single quote
|
|
131
|
+
*/
|
|
132
|
+
export type PriceLevel = {
|
|
133
|
+
/**
|
|
134
|
+
* The amount supplied to a trade
|
|
135
|
+
*/
|
|
136
|
+
amountIn: Amount<'nat'>;
|
|
137
|
+
/**
|
|
138
|
+
* The quoted result of trading `amountIn`
|
|
139
|
+
*/
|
|
140
|
+
amountOut: Amount<'nat'>;
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=types.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