@agoric/zoe 0.26.3-dev-fa844b5.0 → 0.26.3-dev-21fe8d9.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,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zoe provides a framework for deploying and working with smart
|
|
3
|
+
* contracts. It is accessed as a long-lived and well-trusted service
|
|
4
|
+
* that enforces offer safety for the contracts that use it. Zoe has a
|
|
5
|
+
* single `invitationIssuer` for the entirety of its lifetime. By
|
|
6
|
+
* having a reference to Zoe, a user can get the `invitationIssuer`
|
|
7
|
+
* and thus validate any `invitation` they receive from someone else.
|
|
8
|
+
*
|
|
9
|
+
* Zoe has two different facets: the public Zoe service and the
|
|
10
|
+
* contract facet (ZCF). Each contract instance has a copy of ZCF
|
|
11
|
+
* within its vat. The contract and ZCF never have direct access to
|
|
12
|
+
* the users' payments or the Zoe purses.
|
|
13
|
+
*/
|
|
14
|
+
type ZoeService = {
|
|
15
|
+
/**
|
|
16
|
+
* Zoe has a single `invitationIssuer` for the entirety of its
|
|
17
|
+
* lifetime. By having a reference to Zoe, a user can get the
|
|
18
|
+
* `invitationIssuer` and thus validate any `invitation` they receive
|
|
19
|
+
* from someone else. The mint associated with the invitationIssuer
|
|
20
|
+
* creates the ERTP payments that represent the right to interact with
|
|
21
|
+
* a smart contract in particular ways.
|
|
22
|
+
*/
|
|
23
|
+
getInvitationIssuer: GetInvitationIssuer;
|
|
24
|
+
install: InstallBundle;
|
|
25
|
+
installBundleID: InstallBundleID;
|
|
26
|
+
startInstance: import('./utils.js').StartInstance;
|
|
27
|
+
offer: Offer;
|
|
28
|
+
getPublicFacet: import('./utils.js').GetPublicFacet;
|
|
29
|
+
getIssuers: GetIssuers;
|
|
30
|
+
getBrands: GetBrands;
|
|
31
|
+
getTerms: import('./utils.js').GetTerms;
|
|
32
|
+
getOfferFilter: GetOfferFilter;
|
|
33
|
+
getInstallationForInstance: GetInstallationForInstance;
|
|
34
|
+
getInstance: GetInstance;
|
|
35
|
+
getInstallation: GetInstallation;
|
|
36
|
+
/**
|
|
37
|
+
* Return an object with the instance, installation, description, invitation
|
|
38
|
+
* handle, and any custom properties specific to the contract.
|
|
39
|
+
*/
|
|
40
|
+
getInvitationDetails: GetInvitationDetails;
|
|
41
|
+
getFeeIssuer: GetFeeIssuer;
|
|
42
|
+
getConfiguration: GetConfiguration;
|
|
43
|
+
getBundleIDFromInstallation: GetBundleIDFromInstallation;
|
|
44
|
+
getProposalShapeForInvitation: (invitationHandle: InvitationHandle) => Pattern | undefined;
|
|
45
|
+
};
|
|
46
|
+
type GetInvitationIssuer = () => Promise<Issuer<'set'>>;
|
|
47
|
+
type GetFeeIssuer = () => Promise<Issuer<'nat'>>;
|
|
48
|
+
type GetConfiguration = () => {
|
|
49
|
+
feeIssuerConfig: FeeIssuerConfig;
|
|
50
|
+
};
|
|
51
|
+
type GetIssuers = (instance: import('./utils.js').Instance<any>) => Promise<IssuerKeywordRecord>;
|
|
52
|
+
type GetBrands = (instance: import('./utils.js').Instance<any>) => Promise<BrandKeywordRecord>;
|
|
53
|
+
type GetOfferFilter = (instance: import('./utils.js').Instance<any>) => string[];
|
|
54
|
+
type SetOfferFilter = (instance: Instance, strings: string[]) => any;
|
|
55
|
+
type GetInstallationForInstance = (instance: import('./utils.js').Instance<any>) => Promise<Installation>;
|
|
56
|
+
type GetInstance = (invitation: ERef<Invitation<unknown, undefined>>) => Promise<import('./utils.js').Instance<any>>;
|
|
57
|
+
type GetInstallation = (invitation: ERef<Invitation<unknown, undefined>>) => Promise<Installation>;
|
|
58
|
+
type GetInvitationDetails = (invitation: ERef<Invitation<any, any>>) => Promise<InvitationDetails>;
|
|
59
|
+
/**
|
|
60
|
+
* Create an installation by safely evaluating the code and
|
|
61
|
+
* registering it with Zoe. Returns an installation.
|
|
62
|
+
*/
|
|
63
|
+
type InstallBundle = (bundle: * Bundle | SourceBundle, bundleLabel?: string | undefined) => Promise<Installation>;
|
|
64
|
+
/**
|
|
65
|
+
* Create an installation from a Bundle ID. Returns an installation.
|
|
66
|
+
*/
|
|
67
|
+
type InstallBundleID = (bundleID: string, bundleLabel?: string | undefined) => Promise<Installation>;
|
|
68
|
+
/**
|
|
69
|
+
* Verify that an alleged Installation is real, and return the Bundle ID it
|
|
70
|
+
* will use for contract code.
|
|
71
|
+
*/
|
|
72
|
+
type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation<any>>) => Promise<string>;
|
|
73
|
+
/**
|
|
74
|
+
* To redeem an invitation, the user normally provides a proposal (their
|
|
75
|
+
* rules for the offer) as well as payments to be escrowed by Zoe. If
|
|
76
|
+
* either the proposal or payments would be empty, indicate this by
|
|
77
|
+
* omitting that argument or passing undefined, rather than passing an
|
|
78
|
+
* empty record.
|
|
79
|
+
*
|
|
80
|
+
* The proposal has three parts: `want` and `give` are used by Zoe to
|
|
81
|
+
* enforce offer safety, and `exit` is used to specify the particular
|
|
82
|
+
* payout-liveness policy that Zoe can guarantee. `want` and `give`
|
|
83
|
+
* are objects with keywords as keys and amounts as values.
|
|
84
|
+
* `paymentKeywordRecord` is a record with keywords as keys, and the
|
|
85
|
+
* values are the actual payments to be escrowed. A payment is
|
|
86
|
+
* expected for every rule under `give`.
|
|
87
|
+
*/
|
|
88
|
+
type Offer = <Result, Args = undefined>(invitation: ERef<Invitation<Result, Args>>, proposal?: Proposal, paymentKeywordRecord?: PaymentPKeywordRecord, offerArgs?: Args | undefined) => Promise<UserSeat<Result>>;
|
|
89
|
+
/**
|
|
90
|
+
* Zoe uses seats to access or manipulate offers. They let contracts and users
|
|
91
|
+
* interact with them. Zoe has two kinds of seats. ZCFSeats are used within
|
|
92
|
+
* contracts and with zcf methods. UserSeats represent offers external to Zoe
|
|
93
|
+
* and the contract. The party who exercises an invitation and sends the offer()
|
|
94
|
+
* message to Zoe gets a UserSeat that can check payouts' status or retrieve the
|
|
95
|
+
* result of processing the offer in the contract. This varies, but examples are
|
|
96
|
+
* a string and an invitation for another seat.
|
|
97
|
+
*
|
|
98
|
+
* Also, a UserSeat can be handed to an agent outside Zoe and the contract,
|
|
99
|
+
* letting them query or monitor the current state, access the payouts and
|
|
100
|
+
* result, and, if it's allowed for this seat, call tryExit().
|
|
101
|
+
*
|
|
102
|
+
* Since anyone can attempt to exit the seat if they have a reference to it, you
|
|
103
|
+
* should only share a UserSeat with trusted parties.
|
|
104
|
+
*
|
|
105
|
+
* UserSeat includes queries for the associated offer's current state and an
|
|
106
|
+
* operation to request that the offer exit, as follows:
|
|
107
|
+
*/
|
|
108
|
+
type UserSeat<OR extends unknown = unknown> = {
|
|
109
|
+
getProposal: () => Promise<ProposalRecord>;
|
|
110
|
+
/**
|
|
111
|
+
* returns a promise for a KeywordPaymentRecord containing all the payouts from
|
|
112
|
+
* this seat. The promise will resolve after the seat has exited.
|
|
113
|
+
*/
|
|
114
|
+
getPayouts: () => Promise<PaymentPKeywordRecord>;
|
|
115
|
+
/**
|
|
116
|
+
* returns a promise for the Payment corresponding to the indicated keyword.
|
|
117
|
+
* The promise will resolve after the seat has exited.
|
|
118
|
+
*/
|
|
119
|
+
getPayout: (keyword: Keyword) => Promise<Payment<any>>;
|
|
120
|
+
getOfferResult: () => Promise<OR>;
|
|
121
|
+
/**
|
|
122
|
+
* Note: Only works if the seat's `proposal` has an `OnDemand` `exit` clause. Zoe's
|
|
123
|
+
* offer-safety guarantee applies no matter how a seat's interaction with a
|
|
124
|
+
* contract ends. Under normal circumstances, the participant might be able to
|
|
125
|
+
* call `tryExit()`, or the contract might do something explicitly. On exiting,
|
|
126
|
+
* the seat holder gets its current `allocation` and the `seat` can no longer
|
|
127
|
+
* interact with the contract.
|
|
128
|
+
*/
|
|
129
|
+
tryExit?: (() => void) | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Returns true if the seat has exited, false if it is still active.
|
|
132
|
+
*/
|
|
133
|
+
hasExited: () => Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* returns 1 if the proposal's
|
|
136
|
+
* want clause was satisfied by the final allocation, otherwise 0. This is
|
|
137
|
+
* numeric to support a planned enhancement called "multiples" which will allow
|
|
138
|
+
* the return value to be any non-negative number. The promise will resolve
|
|
139
|
+
* after the seat has exited.
|
|
140
|
+
*/
|
|
141
|
+
numWantsSatisfied: () => Promise<0 | 1>;
|
|
142
|
+
/**
|
|
143
|
+
* return a promise for the final allocation. The promise will resolve after the
|
|
144
|
+
* seat has exited.
|
|
145
|
+
*/
|
|
146
|
+
getFinalAllocation: () => Promise<Allocation>;
|
|
147
|
+
/**
|
|
148
|
+
* returns a subscriber that
|
|
149
|
+
* will be notified when the seat has exited or failed.
|
|
150
|
+
*/
|
|
151
|
+
getExitSubscriber: () => Subscriber<Completion>;
|
|
152
|
+
};
|
|
153
|
+
type Proposal = Partial<ProposalRecord>;
|
|
154
|
+
type ProposalRecord = {
|
|
155
|
+
give: AmountKeywordRecord;
|
|
156
|
+
want: AmountKeywordRecord;
|
|
157
|
+
exit: ExitRule;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The keys are keywords, and the values are amounts. For example:
|
|
161
|
+
* { Asset: AmountMath.make(assetBrand, 5n), Price:
|
|
162
|
+
* AmountMath.make(priceBrand, 9n) }
|
|
163
|
+
*/
|
|
164
|
+
type AmountKeywordRecord = Record<Keyword, Amount<any>>;
|
|
165
|
+
type Waker = {
|
|
166
|
+
wake: () => void;
|
|
167
|
+
};
|
|
168
|
+
type OnDemandExitRule = {
|
|
169
|
+
onDemand: null;
|
|
170
|
+
};
|
|
171
|
+
type WaivedExitRule = {
|
|
172
|
+
waived: null;
|
|
173
|
+
};
|
|
174
|
+
type AfterDeadlineExitRule = {
|
|
175
|
+
afterDeadline: {
|
|
176
|
+
timer: import('@agoric/time').TimerService;
|
|
177
|
+
deadline: import('@agoric/time').Timestamp;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* The possible keys are 'waived', 'onDemand', and 'afterDeadline'.
|
|
182
|
+
* `timer` and `deadline` only are used for the `afterDeadline` key.
|
|
183
|
+
* The possible records are:
|
|
184
|
+
* `{ waived: null }`
|
|
185
|
+
* `{ onDemand: null }`
|
|
186
|
+
* `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
|
|
187
|
+
*/
|
|
188
|
+
type ExitRule = OnDemandExitRule | WaivedExitRule | AfterDeadlineExitRule;
|
|
189
|
+
type Instance = import('./utils.js').Instance<any>;
|
|
190
|
+
type ZCFSpec = {
|
|
191
|
+
bundleCap: import('@agoric/swingset-vat').BundleCap;
|
|
192
|
+
} | {
|
|
193
|
+
name: string;
|
|
194
|
+
} | {
|
|
195
|
+
id: string;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Opaque type for a JSONable source bundle
|
|
199
|
+
*/
|
|
200
|
+
type SourceBundle = Record<string, any>;
|
|
201
|
+
type PaymentPKeywordRecord = {
|
|
202
|
+
[x: string]: ERef<globalThis.Payment<any>>;
|
|
203
|
+
};
|
|
204
|
+
type PaymentKeywordRecord = Record<Keyword, Payment<any>>;
|
|
205
|
+
type InvitationDetails = {
|
|
206
|
+
installation: Installation;
|
|
207
|
+
instance: import('./utils.js').Instance<any>;
|
|
208
|
+
handle: InvitationHandle;
|
|
209
|
+
description: string;
|
|
210
|
+
customDetails?: Record<string, any> | undefined;
|
|
211
|
+
};
|
|
212
|
+
type Installation<SF = any> = import('./utils.js').Installation<SF>;
|
|
213
|
+
type InstallationStart<I extends Installation<any>> = import('./utils.js').InstallationStart<I>;
|
|
214
|
+
type FeeIssuerConfig = {
|
|
215
|
+
name: string;
|
|
216
|
+
assetKind: AssetKind;
|
|
217
|
+
displayInfo: DisplayInfo;
|
|
218
|
+
};
|
|
219
|
+
type ZoeFeesConfig = {
|
|
220
|
+
getPublicFacetFee: NatValue;
|
|
221
|
+
};
|
|
222
|
+
type FeeMintAccess = Handle<'feeMintAccess'>;
|
|
223
|
+
import type { VatAdminSvc } from '@agoric/swingset-vat';
|
|
224
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;yBAmBc,mBAAmB;aASnB,aAAa;qBACb,eAAe;mBACf,OAAO,YAAY,EAAE,aAAa;WAClC,KAAK;oBACL,OAAO,YAAY,EAAE,cAAc;gBACnC,UAAU;eACV,SAAS;cACT,OAAO,YAAY,EAAE,QAAQ;oBAC7B,cAAc;gCACd,0BAA0B;iBAC1B,WAAW;qBACX,eAAe;;;;;0BACf,oBAAoB;kBAGpB,YAAY;sBACZ,gBAAgB;iCAChB,2BAA2B;mCAC3B,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,OAAO,GAAG,SAAS;;iCAK5D,QAAQ,OAAO,KAAK,CAAC,CAAC;0BAKtB,QAAQ,OAAO,KAAK,CAAC,CAAC;8BAKtB;IACZ,eAAmB,EAAE,eAAe,CAAC;CAClC;6BAKO,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,QAAQ,mBAAmB,CAAC;4BAK9B,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,QAAQ,kBAAkB,CAAC;iCAK7B,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,MAAM,EAAE;iCAKV,QAAQ,WACR,MAAM,EAAE;6CAKR,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,QAAQ,YAAY,CAAC;yEAMrB,QAAQ,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;6EAM3C,QAAQ,YAAY,CAAC;wEAMrB,QAAQ,iBAAiB,CAAC;;;;;4FAa1B,QAAQ,YAAY,CAAC;;;;+EAYrB,QAAQ,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;+FAgBlB,QAAQ,yBACI,qBAAqB;;;;;;;;;;;;;;;;;;;;;iBA0CnC,MAAM,QAAQ,cAAc,CAAC;;;;;gBAC7B,MAAM,QAAQ,qBAAqB,CAAC;;;;;eAGpC,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,QAAQ,GAAG,CAAC,CAAC;oBAG3C,MAAM,QAAQ,EAAE,CAAC;;;;;;;;;qBACX,IAAI;;;;eAOV,MAAM,QAAQ,OAAO,CAAC;;;;;;;;uBAEtB,MAAM,QAAQ,CAAC,GAAC,CAAC,CAAC;;;;;wBAKlB,MAAM,QAAQ,UAAU,CAAC;;;;;uBAGzB,MAAM,WAAW,UAAU,CAAC;;gBAK7B,QAAQ,cAAc,CAAC;sBAEvB;IAAC,IAAI,EAAE,mBAAmB,CAAC;IACvC,IAAiB,EAAE,mBAAmB,CAAC;IACvC,IAAiB,EAAE,QAAQ,CAAA;CACd;;;;;;2BAID,OAAO,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC;;UAS3B,MAAM,IAAI;;;cAKV,IAAI;;;YAKJ,IAAI;;;mBAKJ;QAAC,KAAK,EAAE,OAAO,cAAc,EAAE,YAAY,CAAC;QAAC,QAAQ,EAAE,OAAO,cAAc,EAAE,SAAS,CAAA;KAAC;;;;;;;;;;gBAIzF,gBAAgB,GAAG,cAAc,GAAG,qBAAqB;gBAWzD,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC;;eAQtB,OAAO,sBAAsB,EAAE,SAAS;;UAAY,MAAM;;;;;;;oBAItE,OAAO,MAAM,EAAE,GAAG,CAAC;;;;4BAMnB,OAAO,OAAO,EAAC,QAAQ,GAAG,CAAC,CAAC;;kBAK3B,YAAY;cACZ,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC;YAClC,gBAAgB;iBAChB,MAAM;;;8BAMP,OAAO,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;sDAKrC,OAAO,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC;;UAKxC,MAAM;eACN,SAAS;iBACT,WAAW;;;uBAKX,QAAQ;;qBAIT,OAAO,eAAe,CAAC;iCAjDN,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test-d.d.ts","sourceRoot":"","sources":["utils.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type ZoeKit = ReturnType<typeof makeDurableZoeKit>;
|
|
2
|
+
/**
|
|
3
|
+
* Create a durable instance of Zoe.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} options
|
|
6
|
+
* @param {Baggage} options.zoeBaggage - the baggage for Zoe durability. Must be provided by caller
|
|
7
|
+
* @param {Promise<VatAdminSvc> | VatAdminSvc} [options.vatAdminSvc] - The vatAdmin Service, which carries the
|
|
8
|
+
* power to create a new vat. If it's not available when makeZoe() is called, it
|
|
9
|
+
* must be provided later using setVatAdminService().
|
|
10
|
+
* @param {import('@agoric/swingset-vat').ShutdownWithFailure} [options.shutdownZoeVat] - a function to
|
|
11
|
+
* shutdown the Zoe Vat. This function needs to use the vatPowers
|
|
12
|
+
* available to a vat.
|
|
13
|
+
* @param {FeeIssuerConfig} [options.feeIssuerConfig]
|
|
14
|
+
* @param {ZCFSpec} [options.zcfSpec] - Pointer to the contract facet bundle.
|
|
15
|
+
*/
|
|
16
|
+
export function makeDurableZoeKit({ zoeBaggage, vatAdminSvc, shutdownZoeVat, feeIssuerConfig, zcfSpec, }: {
|
|
17
|
+
zoeBaggage: Baggage;
|
|
18
|
+
vatAdminSvc?: VatAdminSvc | Promise<VatAdminSvc> | undefined;
|
|
19
|
+
shutdownZoeVat?: import("@agoric/swingset-vat").ShutdownWithFailure | undefined;
|
|
20
|
+
feeIssuerConfig?: FeeIssuerConfig | undefined;
|
|
21
|
+
zcfSpec?: ZCFSpec | undefined;
|
|
22
|
+
}): {
|
|
23
|
+
zoeService: ZoeService;
|
|
24
|
+
zoeConfigFacet: import("@endo/exo").Guarded<{
|
|
25
|
+
updateZcfBundleId(bundleId: any): void;
|
|
26
|
+
}>;
|
|
27
|
+
/** @type {FeeMintAccess} */
|
|
28
|
+
feeMintAccess: FeeMintAccess;
|
|
29
|
+
setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
* Create an instance of Zoe.
|
|
34
|
+
*
|
|
35
|
+
* This will fail upgrades and should only be used in tests through the helper
|
|
36
|
+
* `makeZoeKitForTest`.
|
|
37
|
+
*
|
|
38
|
+
* @param {Promise<VatAdminSvc> | VatAdminSvc} [vatAdminSvc] - The vatAdmin Service, which carries the
|
|
39
|
+
* power to create a new vat. If it's not available when makeZoe() is called, it
|
|
40
|
+
* must be provided later using setVatAdminService().
|
|
41
|
+
* @param {import('@agoric/swingset-vat').ShutdownWithFailure} [shutdownZoeVat] - a function to
|
|
42
|
+
* shutdown the Zoe Vat. This function needs to use the vatPowers
|
|
43
|
+
* available to a vat.
|
|
44
|
+
* @param {FeeIssuerConfig} [feeIssuerConfig]
|
|
45
|
+
* @param {ZCFSpec} [zcfSpec] - Pointer to the contract facet bundle.
|
|
46
|
+
*/
|
|
47
|
+
export function makeZoeKit(vatAdminSvc?: VatAdminSvc | Promise<VatAdminSvc> | undefined, shutdownZoeVat?: import("@agoric/swingset-vat").ShutdownWithFailure | undefined, feeIssuerConfig?: FeeIssuerConfig | undefined, zcfSpec?: ZCFSpec | undefined): {
|
|
48
|
+
zoeService: ZoeService;
|
|
49
|
+
zoeConfigFacet: import("@endo/exo").Guarded<{
|
|
50
|
+
updateZcfBundleId(bundleId: any): void;
|
|
51
|
+
}>;
|
|
52
|
+
/** @type {FeeMintAccess} */
|
|
53
|
+
feeMintAccess: FeeMintAccess;
|
|
54
|
+
setVatAdminService: ((lateVatAdminSvc: any) => void) & import("@endo/eventual-send").RemotableBrand<{}, (lateVatAdminSvc: any) => void>;
|
|
55
|
+
};
|
|
56
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
57
|
+
//# sourceMappingURL=zoe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoe.d.ts","sourceRoot":"","sources":["zoe.js"],"names":[],"mappings":"qBA+Ra,WAAW,wBAAwB,CAAC;AA/PjD;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;IA6MI,4BAA4B;mBAAjB,aAAa;;EAK3B;AAED;;;;;;;;;;;;;;;GAeG;AACH;;;;;IAvBI,4BAA4B;mBAAjB,aAAa;;EA8BxB;6BA7PuB,kBAAkB"}
|
package/src/zoeService/zoe.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function makeZoeSeatAdminFactory(baggage: import('@agoric/vat-data').Baggage): (initialAllocation: Allocation, proposal: ProposalRecord, instanceAdminHelper: InstanceAdminHelper, withdrawFacet: WithdrawFacet, exitObj?: ERef<ExitObj> | undefined, offerResultIsUndefined?: boolean | undefined) => {
|
|
2
|
+
userSeat: import("@endo/exo").Guarded<{
|
|
3
|
+
getProposal(): Promise<any>;
|
|
4
|
+
getPayouts(): Promise<any>;
|
|
5
|
+
getPayout(keyword: any): Promise<any>;
|
|
6
|
+
getOfferResult(): Promise<any>;
|
|
7
|
+
hasExited(): Promise<any>;
|
|
8
|
+
tryExit(): Promise<any>;
|
|
9
|
+
numWantsSatisfied(): Promise<any>;
|
|
10
|
+
getExitSubscriber(): any;
|
|
11
|
+
getFinalAllocation(): any;
|
|
12
|
+
}>;
|
|
13
|
+
zoeSeatAdmin: import("@endo/exo").Guarded<{
|
|
14
|
+
replaceAllocation(replacementAllocation: any): void;
|
|
15
|
+
exit(completion: any): void;
|
|
16
|
+
fail(reason: any): void;
|
|
17
|
+
/** @param {HandleOfferResult} result */
|
|
18
|
+
resolveExitAndResult({ offerResultPromise, exitObj }: HandleOfferResult): void;
|
|
19
|
+
getExitSubscriber(): import("@endo/exo").Guarded<{
|
|
20
|
+
subscribeAfter(publishCount?: bigint): Promise<any>;
|
|
21
|
+
getUpdateSince(updateCount: any): any;
|
|
22
|
+
}>;
|
|
23
|
+
finalPayouts(payments: any): Promise<void>;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=zoeSeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoeSeat.d.ts","sourceRoot":"","sources":["zoeSeat.js"],"names":[],"mappings":"AAoDO,iDAFI,OAAO,kBAAkB,EAAE,OAAO,uBAuWhC,UAAU,YACV,cAAc,uBACd,mBAAmB,iBACnB,aAAa;;;;;;;;;;;;;;;;QAxIlB,wCAAwC;8DAA5B,iBAAiB;;;;;;;EAmKpC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function makeZoeStorageManager(createZCFVat: CreateZCFVat, getBundleCapForID: GetBundleCapForID, shutdownZoeVat: import('@agoric/swingset-vat').ShutdownWithFailure, feeMint: {
|
|
2
|
+
getFeeIssuerKit: GetFeeIssuerKit;
|
|
3
|
+
getFeeIssuer: () => Issuer;
|
|
4
|
+
getFeeBrand: () => Brand;
|
|
5
|
+
}, zoeBaggage: Baggage): import("@endo/exo").GuardedKit<{
|
|
6
|
+
zoeServiceDataAccess: {
|
|
7
|
+
getInvitationIssuer: () => globalThis.Issuer<"set">;
|
|
8
|
+
getBundleIDFromInstallation(allegedInstallation: any): any;
|
|
9
|
+
getPublicFacet(instance: any): any;
|
|
10
|
+
getBrands(instance: any): any;
|
|
11
|
+
getIssuers(instance: any): any;
|
|
12
|
+
getOfferFilter(instance: any): any;
|
|
13
|
+
getTerms(instance: any): any;
|
|
14
|
+
getInstallation(instance: any): any;
|
|
15
|
+
getProposalShapeForInvitation: (invitationHandle: any) => any;
|
|
16
|
+
installBundle: (allegedBundle: any, bundleLabel: any) => any;
|
|
17
|
+
installBundleID(bundleID: any, bundleLabel: any): Promise<Installation<unknown>>;
|
|
18
|
+
};
|
|
19
|
+
makeOfferAccess: {
|
|
20
|
+
getAssetKindByBrand: GetAssetKindByBrand;
|
|
21
|
+
getInstanceAdmin(instance: any): any;
|
|
22
|
+
getProposalShapeForInvitation: (invitationHandle: any) => any;
|
|
23
|
+
getInvitationIssuer: () => globalThis.Issuer<"set">;
|
|
24
|
+
depositPayments(proposal: any, payments: any): Promise<AmountKeywordRecord>;
|
|
25
|
+
};
|
|
26
|
+
startInstanceAccess: {
|
|
27
|
+
makeZoeInstanceStorageManager: MakeZoeInstanceStorageManager;
|
|
28
|
+
/** @type {UnwrapInstallation} */
|
|
29
|
+
unwrapInstallation(installationP: ERef<Installation<any>>): ERef<{
|
|
30
|
+
bundle?: SourceBundle | undefined;
|
|
31
|
+
bundleCap?: any;
|
|
32
|
+
bundleID?: string | undefined;
|
|
33
|
+
installation: Installation<any>;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
invitationIssuerAccess: {
|
|
37
|
+
getInvitationIssuer: () => globalThis.Issuer<"set">;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
41
|
+
//# sourceMappingURL=zoeStorageManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoeStorageManager.d.ts","sourceRoot":"","sources":["zoeStorageManager.js"],"names":[],"mappings":"AAwDO,oDAXI,YAAY,qBAEZ,iBAAiB,kBACjB,OAAO,sBAAsB,EAAE,mBAAmB,WAClD;IACV,eAAoB,EAAE,eAAe,CAAC;IACtC,YAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,WAAgB,EAAE,MAAM,KAAK,CAAC;CAC3B;;;;;;;;;;;;;;;;;;;;;;;QA+ZI,iCAAiC;;;;;;;;;;;GAYxC;6BAjc0B,kBAAkB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} FakePriceAuthorityOptions
|
|
3
|
+
* @property {Brand<'nat'>} actualBrandIn
|
|
4
|
+
* @property {Brand<'nat'>} actualBrandOut
|
|
5
|
+
* @property {Array<number>} [priceList]
|
|
6
|
+
* @property {Array<[number, number]>} [tradeList]
|
|
7
|
+
* @property {ERef<import('@agoric/time').TimerService>} timer
|
|
8
|
+
* @property {import('@agoric/time').RelativeTime} [quoteInterval]
|
|
9
|
+
* @property {ERef<Mint<'set'>>} [quoteMint]
|
|
10
|
+
* @property {Amount<'nat'>} [unitAmountIn]
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* TODO: multiple price Schedules for different goods, or for moving the price
|
|
14
|
+
* in different directions?
|
|
15
|
+
*
|
|
16
|
+
* @param {FakePriceAuthorityOptions} options
|
|
17
|
+
* @returns {Promise<PriceAuthority>}
|
|
18
|
+
*/
|
|
19
|
+
export function makeFakePriceAuthority(options: FakePriceAuthorityOptions): Promise<PriceAuthority>;
|
|
20
|
+
export type FakePriceAuthorityOptions = {
|
|
21
|
+
actualBrandIn: Brand<'nat'>;
|
|
22
|
+
actualBrandOut: Brand<'nat'>;
|
|
23
|
+
priceList?: number[] | undefined;
|
|
24
|
+
tradeList?: [number, number][] | undefined;
|
|
25
|
+
timer: ERef<import("@agoric/time").TimerService>;
|
|
26
|
+
quoteInterval?: import("@agoric/time").RelativeTime | undefined;
|
|
27
|
+
quoteMint?: ERef<globalThis.Mint<"set">> | undefined;
|
|
28
|
+
unitAmountIn?: globalThis.Amount<"nat"> | undefined;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=fakePriceAuthority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakePriceAuthority.d.ts","sourceRoot":"","sources":["fakePriceAuthority.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,gDAHW,yBAAyB,GACvB,QAAQ,cAAc,CAAC,CAqSnC;;mBApTa,MAAM,KAAK,CAAC;oBACZ,MAAM,KAAK,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const zcfBundleCap: any;
|
|
2
|
+
export default fakeVatAdmin;
|
|
3
|
+
export type BundleID = import('@agoric/swingset-vat').BundleID;
|
|
4
|
+
export type EndoZipBase64Bundle = import('@agoric/swingset-vat').EndoZipBase64Bundle;
|
|
5
|
+
export type BundleCap = import('@agoric/swingset-vat').BundleCap;
|
|
6
|
+
declare const fakeVatAdmin: {
|
|
7
|
+
getBundleCap: (bundleID: any) => Promise<any>;
|
|
8
|
+
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
9
|
+
getNamedBundleCap: (name: any) => Promise<any>;
|
|
10
|
+
getBundleIDByName: (name: any) => Promise<string>;
|
|
11
|
+
createVat: (bundleCap: any, { vatParameters }?: {
|
|
12
|
+
vatParameters?: {} | undefined;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
root: unknown;
|
|
15
|
+
adminNode: {
|
|
16
|
+
done: () => Promise<any>;
|
|
17
|
+
terminateWithFailure: () => void;
|
|
18
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
19
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
20
|
+
done: () => Promise<any>;
|
|
21
|
+
terminateWithFailure: () => void;
|
|
22
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
26
|
+
getBundleCap: (bundleID: any) => Promise<any>;
|
|
27
|
+
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
28
|
+
getNamedBundleCap: (name: any) => Promise<any>;
|
|
29
|
+
getBundleIDByName: (name: any) => Promise<string>;
|
|
30
|
+
createVat: (bundleCap: any, { vatParameters }?: {
|
|
31
|
+
vatParameters?: {} | undefined;
|
|
32
|
+
}) => Promise<{
|
|
33
|
+
root: unknown;
|
|
34
|
+
adminNode: {
|
|
35
|
+
done: () => Promise<any>;
|
|
36
|
+
terminateWithFailure: () => void;
|
|
37
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
38
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
39
|
+
done: () => Promise<any>;
|
|
40
|
+
terminateWithFailure: () => void;
|
|
41
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {(...args) => unknown} [testContextSetter]
|
|
47
|
+
* @param {(x: unknown) => unknown} [makeRemote]
|
|
48
|
+
*/
|
|
49
|
+
export function makeFakeVatAdmin(testContextSetter?: ((...args: any[]) => unknown) | undefined, makeRemote?: ((x: unknown) => unknown) | undefined): {
|
|
50
|
+
admin: {
|
|
51
|
+
getBundleCap: (bundleID: any) => Promise<any>;
|
|
52
|
+
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
53
|
+
getNamedBundleCap: (name: any) => Promise<any>;
|
|
54
|
+
getBundleIDByName: (name: any) => Promise<string>;
|
|
55
|
+
createVat: (bundleCap: any, { vatParameters }?: {
|
|
56
|
+
vatParameters?: {} | undefined;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
root: unknown;
|
|
59
|
+
adminNode: {
|
|
60
|
+
done: () => Promise<any>;
|
|
61
|
+
terminateWithFailure: () => void;
|
|
62
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
63
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
64
|
+
done: () => Promise<any>;
|
|
65
|
+
terminateWithFailure: () => void;
|
|
66
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
70
|
+
getBundleCap: (bundleID: any) => Promise<any>;
|
|
71
|
+
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
72
|
+
getNamedBundleCap: (name: any) => Promise<any>;
|
|
73
|
+
getBundleIDByName: (name: any) => Promise<string>;
|
|
74
|
+
createVat: (bundleCap: any, { vatParameters }?: {
|
|
75
|
+
vatParameters?: {} | undefined;
|
|
76
|
+
}) => Promise<{
|
|
77
|
+
root: unknown;
|
|
78
|
+
adminNode: {
|
|
79
|
+
done: () => Promise<any>;
|
|
80
|
+
terminateWithFailure: () => void;
|
|
81
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
82
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
83
|
+
done: () => Promise<any>;
|
|
84
|
+
terminateWithFailure: () => void;
|
|
85
|
+
upgrade: (_bundleCap: any, _options: any) => never;
|
|
86
|
+
}>;
|
|
87
|
+
}>;
|
|
88
|
+
}>;
|
|
89
|
+
vatAdminState: {
|
|
90
|
+
getExitMessage: () => any;
|
|
91
|
+
getHasExited: () => boolean;
|
|
92
|
+
getExitWithFailure: () => any;
|
|
93
|
+
installBundle: (id: any, bundle: any) => any;
|
|
94
|
+
installNamedBundle: (name: any, id: any, bundle: any) => any;
|
|
95
|
+
getCriticalVatKey: () => {};
|
|
96
|
+
getVatPowers: () => {
|
|
97
|
+
D: (bcap: any) => {
|
|
98
|
+
getBundle: () => globalThis.EndoZipBase64Bundle;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=fakeVatAdmin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAsBA,+BAA4C;;uBAR7B,OAAO,sBAAsB,EAAE,QAAQ;kCACvC,OAAO,sBAAsB,EAAE,mBAAmB;wBAGlD,OAAO,sBAAsB,EAAE,SAAS;AAmJvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8C;AA7I9C;;;GAGG;AACH,0EAHwB,OAAO,iCAChB,OAAO,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoIjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ManualTimerAdmin = {
|
|
2
|
+
/**
|
|
3
|
+
* Advance the timer by one tick.
|
|
4
|
+
* DEPRECATED: use `await tickN(1)` instead. `tick` function errors might be
|
|
5
|
+
* thrown synchronously, even though success is signaled by returning anything
|
|
6
|
+
* other than a rejected promise.
|
|
7
|
+
*/
|
|
8
|
+
tick: (msg?: string) => void | Promise<void>;
|
|
9
|
+
tickN: (nTimes: number, msg?: string) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
type ManualTimer = import('@agoric/time').TimerService & ManualTimerAdmin;
|
|
12
|
+
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["internal-types.js"],"names":[],"mappings":";;;;;;;UAIc,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC;WAItC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,QAAQ,IAAI,CAAC;;mBAIhD,OAAO,cAAc,EAAE,YAAY,GAAG,gBAAgB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} options
|
|
3
|
+
* @param {Brand<'nat'>} options.actualBrandIn
|
|
4
|
+
* @param {Brand<'nat'>} options.actualBrandOut
|
|
5
|
+
* @param {Ratio} options.initialPrice
|
|
6
|
+
* @param {import('@agoric/time').TimerService} options.timer
|
|
7
|
+
* @param {IssuerKit<'set'>} [options.quoteIssuerKit]
|
|
8
|
+
* @returns {PriceAuthority & { setPrice: (Ratio) => void; disable: () => void }}
|
|
9
|
+
*/
|
|
10
|
+
export function makeManualPriceAuthority(options: {
|
|
11
|
+
actualBrandIn: Brand<'nat'>;
|
|
12
|
+
actualBrandOut: Brand<'nat'>;
|
|
13
|
+
initialPrice: Ratio;
|
|
14
|
+
timer: import('@agoric/time').TimerService;
|
|
15
|
+
quoteIssuerKit?: globalThis.IssuerKit<"set"> | undefined;
|
|
16
|
+
}): PriceAuthority & {
|
|
17
|
+
setPrice: (Ratio: any) => void;
|
|
18
|
+
disable: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type ManualPriceAuthority = ReturnType<typeof makeManualPriceAuthority>;
|
|
21
|
+
//# sourceMappingURL=manualPriceAuthority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualPriceAuthority.d.ts","sourceRoot":"","sources":["manualPriceAuthority.js"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH;IAPiC,aAAa,EAAnC,MAAM,KAAK,CAAC;IACU,cAAc,EAApC,MAAM,KAAK,CAAC;IACG,YAAY,EAA3B,KAAK;IACwC,KAAK,EAAlD,OAAO,cAAc,EAAE,YAAY;IACR,cAAc;IACvC,cAAc,GAAG;IAAE,QAAQ,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA8E/E;mCACa,WAAW,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default buildManualTimer;
|
|
2
|
+
export type ZoeManualTimerOptions = {
|
|
3
|
+
timeStep?: import('@agoric/time').RelativeTime | bigint;
|
|
4
|
+
eventLoopIteration?: () => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A fake TimerService, for unit tests that do not use a real
|
|
8
|
+
* kernel. You can make time pass by calling `advanceTo(when)`, or one
|
|
9
|
+
* `timeStep` at a time by calling `tick()`.
|
|
10
|
+
*
|
|
11
|
+
* `advanceTo()` merely schedules a wakeup: the actual
|
|
12
|
+
* handlers (in the code under test) are invoked several turns
|
|
13
|
+
* later. Some zoe/etc tests want to poll for the consequences of
|
|
14
|
+
* those invocations. The best approach is to get an appropriate
|
|
15
|
+
* Promise from your code-under-test, wait for it to fire, and then
|
|
16
|
+
* poll. But some libraries do not offer this convenience, especially
|
|
17
|
+
* when they use internal "fire and forget" actions.
|
|
18
|
+
*
|
|
19
|
+
* To support those tests, the manual timer accepts a
|
|
20
|
+
* `eventLoopIteration` option. If provided, each call to `tick()`
|
|
21
|
+
* will wait for all triggered activity to complete before
|
|
22
|
+
* returning. That doesn't mean the `wake()` handler's result promise
|
|
23
|
+
* has fired; it just means there are no settled Promises still trying
|
|
24
|
+
* to execute their callbacks.
|
|
25
|
+
*
|
|
26
|
+
* The following will wait for all such Promise activity to finish
|
|
27
|
+
* before returning from `tick()`:
|
|
28
|
+
*
|
|
29
|
+
* eventLoopIteration = () => new Promise(setImmediate);
|
|
30
|
+
* mt = buildManualTimer(log, startTime, { eventLoopIteration })
|
|
31
|
+
*
|
|
32
|
+
* `tickN(count)` calls `tick()` multiple times, awaiting each one
|
|
33
|
+
*
|
|
34
|
+
* The first argument is called to log 'tick' events, which might help
|
|
35
|
+
* with "golden transcript" -style tests to distinguish tick
|
|
36
|
+
* boundaries
|
|
37
|
+
*
|
|
38
|
+
* @param {(...args: any[]) => void} [log]
|
|
39
|
+
* @param {import('@agoric/time').Timestamp | bigint} [startValue=0n]
|
|
40
|
+
* @param {ZoeManualTimerOptions} [options]
|
|
41
|
+
* @returns {ManualTimer}
|
|
42
|
+
*/
|
|
43
|
+
declare function buildManualTimer(log?: ((...args: any[]) => void) | undefined, startValue?: import("@agoric/time").Timestamp | undefined, options?: ZoeManualTimerOptions | undefined): ManualTimer;
|
|
44
|
+
//# sourceMappingURL=manualTimer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualTimer.d.ts","sourceRoot":"","sources":["manualTimer.js"],"names":[],"mappings":";oCAca;IACZ,QAAW,CAAC,EAAE,OAAO,cAAc,EAAE,YAAY,GAAG,MAAM,CAAC;IAC3D,kBAAqB,CAAC,EAAE,MAAM,QAAQ,IAAI,CAAC,CAAC;CACzC;AAKJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,mDANqB,GAAG,EAAE,KAAK,IAAI,wHAGtB,WAAW,CAuDvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-test-env-ava.d.ts","sourceRoot":"","sources":["prepare-test-env-ava.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-test-env.d.ts","sourceRoot":"","sources":["prepare-test-env.js"],"names":[],"mappings":""}
|