@agoric/zoe 0.27.0-upgrade-20-dev-ef71cfd.0 → 0.27.0-upgrade-19-devnet-dev-5428c4d.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.
Files changed (159) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +275 -270
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +29 -29
  4. package/src/cleanProposal.d.ts +0 -2
  5. package/src/cleanProposal.d.ts.map +1 -1
  6. package/src/cleanProposal.js +2 -4
  7. package/src/contractFacet/exit.d.ts +1 -1
  8. package/src/contractFacet/exit.d.ts.map +1 -1
  9. package/src/contractFacet/internal-types.d.ts +8 -0
  10. package/src/contractFacet/internal-types.d.ts.map +1 -0
  11. package/src/contractFacet/internal-types.js +15 -0
  12. package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
  13. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  14. package/src/contractFacet/rightsConservation.js +1 -0
  15. package/src/contractFacet/{types.ts → types-ambient.d.ts} +29 -66
  16. package/src/contractFacet/types-ambient.js +1 -0
  17. package/src/contractFacet/vatRoot.d.ts +2 -8
  18. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  19. package/src/contractFacet/vatRoot.js +4 -5
  20. package/src/contractFacet/zcfMint.d.ts +2 -3
  21. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  22. package/src/contractFacet/zcfMint.js +7 -7
  23. package/src/contractFacet/zcfSeat.js +2 -2
  24. package/src/contractFacet/zcfZygote.d.ts +1 -9
  25. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  26. package/src/contractFacet/zcfZygote.js +5 -17
  27. package/src/contractSupport/atomicTransfer.d.ts +0 -6
  28. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  29. package/src/contractSupport/atomicTransfer.js +0 -4
  30. package/src/contractSupport/bondingCurves.js +1 -1
  31. package/src/contractSupport/index.d.ts +2 -2
  32. package/src/contractSupport/index.js +19 -2
  33. package/src/contractSupport/priceAuthorityInitial.d.ts +0 -2
  34. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  35. package/src/contractSupport/priceAuthorityInitial.js +1 -3
  36. package/src/contractSupport/ratio.d.ts +37 -0
  37. package/src/contractSupport/ratio.d.ts.map +1 -0
  38. package/src/contractSupport/ratio.js +419 -0
  39. package/src/contractSupport/safeMath.d.ts +11 -0
  40. package/src/contractSupport/safeMath.d.ts.map +1 -0
  41. package/src/contractSupport/safeMath.js +49 -0
  42. package/src/contractSupport/types-ambient.d.ts.map +1 -1
  43. package/src/contractSupport/types-ambient.js +0 -1
  44. package/src/contractSupport/zoeHelpers.d.ts +1 -6
  45. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  46. package/src/contractSupport/zoeHelpers.js +0 -1
  47. package/src/contracts/atomicSwap.d.ts +1 -1
  48. package/src/contracts/auction/index.d.ts +3 -3
  49. package/src/contracts/automaticRefund.d.ts +3 -3
  50. package/src/contracts/autoswap.d.ts +0 -4
  51. package/src/contracts/autoswap.d.ts.map +1 -1
  52. package/src/contracts/autoswap.js +0 -4
  53. package/src/contracts/barterExchange.d.ts +2 -2
  54. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  55. package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
  56. package/src/contracts/coveredCall-durable.d.ts +1 -1
  57. package/src/contracts/coveredCall.d.ts +1 -1
  58. package/src/contracts/loan/index.d.ts +1 -1
  59. package/src/contracts/loan/types-ambient.d.ts +13 -13
  60. package/src/contracts/loan/types-ambient.d.ts.map +1 -1
  61. package/src/contracts/loan/types-ambient.js +17 -17
  62. package/src/contracts/mintPayments.d.ts +2 -2
  63. package/src/contracts/oracle.d.ts +0 -3
  64. package/src/contracts/oracle.d.ts.map +1 -1
  65. package/src/contracts/oracle.js +0 -1
  66. package/src/contracts/priceAggregator.d.ts +0 -2
  67. package/src/contracts/priceAggregator.d.ts.map +1 -1
  68. package/src/contracts/priceAggregator.js +8 -10
  69. package/src/contracts/scaledPriceAuthority.d.ts +0 -1
  70. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  71. package/src/contracts/scaledPriceAuthority.js +0 -1
  72. package/src/contracts/sellItems.d.ts +1 -1
  73. package/src/contracts/simpleExchange.d.ts +0 -5
  74. package/src/contracts/simpleExchange.d.ts.map +1 -1
  75. package/src/contracts/simpleExchange.js +0 -4
  76. package/src/contracts/types-ambient.d.ts +7 -7
  77. package/src/contracts/types-ambient.d.ts.map +1 -1
  78. package/src/contracts/types-ambient.js +7 -7
  79. package/src/contracts/valueVow.contract.d.ts +2 -5
  80. package/src/contracts/valueVow.contract.d.ts.map +1 -1
  81. package/src/contracts/valueVow.contract.js +0 -1
  82. package/src/instanceRecordStorage.d.ts.map +1 -1
  83. package/src/instanceRecordStorage.js +1 -3
  84. package/src/internal-types.d.ts +5 -15
  85. package/src/internal-types.d.ts.map +1 -1
  86. package/src/internal-types.js +4 -9
  87. package/src/issuerRecord.d.ts +2 -3
  88. package/src/issuerRecord.d.ts.map +1 -1
  89. package/src/issuerRecord.js +2 -6
  90. package/src/issuerStorage.d.ts +2 -3
  91. package/src/issuerStorage.d.ts.map +1 -1
  92. package/src/issuerStorage.js +5 -6
  93. package/src/typeGuards.d.ts +6 -10
  94. package/src/typeGuards.d.ts.map +1 -1
  95. package/src/typeGuards.js +5 -7
  96. package/src/types-ambient.d.ts +40 -0
  97. package/src/types-ambient.d.ts.map +1 -1
  98. package/src/types-ambient.js +42 -4
  99. package/src/zoeService/feeMint.d.ts +0 -1
  100. package/src/zoeService/feeMint.d.ts.map +1 -1
  101. package/src/zoeService/feeMint.js +0 -4
  102. package/src/zoeService/installationStorage.d.ts +2 -3
  103. package/src/zoeService/installationStorage.d.ts.map +1 -1
  104. package/src/zoeService/installationStorage.js +5 -2
  105. package/src/zoeService/internal-types.d.ts +3 -11
  106. package/src/zoeService/internal-types.d.ts.map +1 -1
  107. package/src/zoeService/internal-types.js +3 -9
  108. package/src/zoeService/invitationQueries.d.ts +3 -3
  109. package/src/zoeService/invitationQueries.js +3 -3
  110. package/src/zoeService/makeInvitation.d.ts +0 -1
  111. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  112. package/src/zoeService/makeInvitation.js +0 -3
  113. package/src/zoeService/offer/offer.d.ts +0 -1
  114. package/src/zoeService/offer/offer.d.ts.map +1 -1
  115. package/src/zoeService/offer/offer.js +1 -3
  116. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  117. package/src/zoeService/originalZoeSeat.js +1 -0
  118. package/src/zoeService/startInstance.d.ts.map +1 -1
  119. package/src/zoeService/startInstance.js +2 -0
  120. package/src/zoeService/types-ambient.d.ts +226 -0
  121. package/src/zoeService/types-ambient.d.ts.map +1 -1
  122. package/src/zoeService/types-ambient.js +327 -4
  123. package/src/zoeService/utils.d.ts +5 -13
  124. package/src/zoeService/utils.test-d.ts +0 -1
  125. package/src/zoeService/zoe.d.ts +1 -11
  126. package/src/zoeService/zoe.d.ts.map +1 -1
  127. package/src/zoeService/zoe.js +1 -8
  128. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  129. package/src/zoeService/zoeSeat.js +2 -1
  130. package/src/zoeService/zoeStorageManager.d.ts +5 -5
  131. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  132. package/src/zoeService/zoeStorageManager.js +3 -4
  133. package/tools/fakeVatAdmin.d.ts +2 -9
  134. package/tools/fakeVatAdmin.d.ts.map +1 -1
  135. package/tools/fakeVatAdmin.js +10 -18
  136. package/tools/manualPriceAuthority.d.ts +1 -4
  137. package/tools/manualPriceAuthority.d.ts.map +1 -1
  138. package/tools/manualPriceAuthority.js +0 -1
  139. package/tools/scriptedOracle.d.ts +2 -6
  140. package/tools/scriptedOracle.d.ts.map +1 -1
  141. package/tools/scriptedOracle.js +0 -4
  142. package/tools/setup-zoe.d.ts +6 -12
  143. package/tools/setup-zoe.d.ts.map +1 -1
  144. package/tools/setup-zoe.js +5 -38
  145. package/tools/test-utils.d.ts +1 -1
  146. package/tools/test-utils.js +1 -1
  147. package/tools/types.d.ts +0 -1
  148. package/tools/types.d.ts.map +1 -1
  149. package/tools/types.js +0 -1
  150. package/src/contractFacet/types.d.ts +0 -184
  151. package/src/contractFacet/types.d.ts.map +0 -1
  152. package/src/types-index.d.ts +0 -4
  153. package/src/types-index.js +0 -2
  154. package/src/types.d.ts +0 -29
  155. package/src/types.d.ts.map +0 -1
  156. package/src/types.ts +0 -44
  157. package/src/zoeService/types.d.ts +0 -238
  158. package/src/zoeService/types.d.ts.map +0 -1
  159. package/src/zoeService/types.ts +0 -307
@@ -2,5 +2,4 @@ export function prepareInvitationKit(baggage: import("@agoric/vat-data").Baggage
2
2
  invitationIssuer: globalThis.Issuer<"set", InvitationDetails>;
3
3
  invitationKit: globalThis.IssuerKit<"set", InvitationDetails>;
4
4
  };
5
- import type { InvitationDetails } from '@agoric/zoe';
6
5
  //# sourceMappingURL=makeInvitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeInvitation.d.ts","sourceRoot":"","sources":["makeInvitation.js"],"names":[],"mappings":"AAmBO,8CAHI,OAAO,kBAAkB,EAAE,OAAO,mBAClC,OAAO,sBAAsB,EAAE,mBAAmB,GAAG,SAAS;;;EA+BxE;uCAzCoD,aAAa"}
1
+ {"version":3,"file":"makeInvitation.d.ts","sourceRoot":"","sources":["makeInvitation.js"],"names":[],"mappings":"AAgBO,8CAHI,OAAO,kBAAkB,EAAE,OAAO,mBAClC,OAAO,sBAAsB,EAAE,mBAAmB,GAAG,SAAS;;;EA+BxE"}
@@ -4,9 +4,6 @@ import { Fail, q } from '@endo/errors';
4
4
  import { provideDurableMapStore } from '@agoric/vat-data';
5
5
  import { AssetKind, hasIssuer, prepareIssuerKit } from '@agoric/ertp';
6
6
  import { InvitationElementShape } from '../typeGuards.js';
7
- /**
8
- * @import {FeeIssuerConfig, InvitationDetails} from '@agoric/zoe';
9
- */
10
7
 
11
8
  /**
12
9
  * Not deprecated because the first use below is still correct.
@@ -1,3 +1,2 @@
1
1
  export function makeOfferMethod(offerDataAccess: any): Offer;
2
- import type { Offer } from '@agoric/zoe';
3
2
  //# sourceMappingURL=offer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offer.d.ts","sourceRoot":"","sources":["offer.js"],"names":[],"mappings":"AAeO,6DA0DN;2BA7DuB,aAAa"}
1
+ {"version":3,"file":"offer.d.ts","sourceRoot":"","sources":["offer.js"],"names":[],"mappings":"AAaO,6DA0DN"}
@@ -9,9 +9,7 @@ import { cleanProposal } from '../../cleanProposal.js';
9
9
  import { burnInvitation } from './burnInvitation.js';
10
10
  import { makeInvitationQueryFns } from '../invitationQueries.js';
11
11
 
12
- /**
13
- * @import {Offer} from '@agoric/zoe';
14
- */
12
+ import '../internal-types.js';
15
13
 
16
14
  export const makeOfferMethod = offerDataAccess => {
17
15
  /** @type {Offer} */
@@ -1 +1 @@
1
- {"version":3,"file":"originalZoeSeat.d.ts","sourceRoot":"","sources":["originalZoeSeat.js"],"names":[],"mappings":";;;;;;;;;;AA4BA;;;;;;;;;;GAGG;;;;;;;;;;;;AA+CI,oDAHI,OAAO,kBAAkB,EAAE,OAAO,yBAClC,MAAM,UAAU,CAAC,GAAG,CAAC,QAoR/B"}
1
+ {"version":3,"file":"originalZoeSeat.d.ts","sourceRoot":"","sources":["originalZoeSeat.js"],"names":[],"mappings":";;;;;;;;;;AA6BA;;;;;;;;;;GAGG;;;;;;;;;;;;AA+CI,oDAHI,OAAO,kBAAkB,EAAE,OAAO,yBAClC,MAAM,UAAU,CAAC,GAAG,CAAC,QAoR/B"}
@@ -7,6 +7,7 @@ import { makePromiseKit } from '@endo/promise-kit';
7
7
  import { NonNullish } from '@agoric/internal';
8
8
 
9
9
  import { satisfiesWant } from '../contractFacet/offerSafety.js';
10
+ import '../types-ambient.js';
10
11
  import '../internal-types.js';
11
12
  import {
12
13
  AmountKeywordRecordShape,
@@ -1 +1 @@
1
- {"version":3,"file":"startInstance.d.ts","sourceRoot":"","sources":["startInstance.js"],"names":[],"mappings":"AAkCO,uDANI,IAAI,CAAC,iBAAiB,EAAE,+BAA+B,GAAG,oBAAoB,CAAC,oBAC/E,MAAM,IAAI,CAAC,SAAS,CAAC,uBACrB,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,cACzB,OAAO,GACL,OAAO,YAAY,EAAE,aAAa,CAqW9C;+BA7WgD,sBAAsB;6BAF7C,kBAAkB"}
1
+ {"version":3,"file":"startInstance.d.ts","sourceRoot":"","sources":["startInstance.js"],"names":[],"mappings":"AAoCO,uDANI,IAAI,CAAC,iBAAiB,EAAE,+BAA+B,GAAG,oBAAoB,CAAC,oBAC/E,MAAM,IAAI,CAAC,SAAS,CAAC,uBACrB,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,cACzB,OAAO,GACL,OAAO,YAAY,EAAE,aAAa,CAqW9C;+BA7WgD,sBAAsB;6BAF7C,kBAAkB"}
@@ -19,6 +19,8 @@ import {
19
19
  InstanceAdminShape,
20
20
  } from '../typeGuards.js';
21
21
 
22
+ // import '../internal-types.js';
23
+
22
24
  /**
23
25
  * @import {Baggage} from '@agoric/vat-data';
24
26
  * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
@@ -1 +1,227 @@
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
+ /**
45
+ * Return the pattern (if any) associated with the invitationHandle that a
46
+ * proposal is required to match to be accepted by zoe.offer().
47
+ */
48
+ getProposalShapeForInvitation: (invitationHandle: InvitationHandle) => import("@endo/patterns").Pattern | undefined;
49
+ };
50
+ type GetInvitationIssuer = () => Promise<Issuer<"set", InvitationDetails>>;
51
+ type GetFeeIssuer = () => Promise<Issuer<"nat">>;
52
+ type GetConfiguration = () => {
53
+ feeIssuerConfig: FeeIssuerConfig;
54
+ };
55
+ type GetIssuers = (instance: import("./utils.js").Instance<any>) => Promise<IssuerKeywordRecord>;
56
+ type GetBrands = (instance: import("./utils.js").Instance<any>) => Promise<BrandKeywordRecord>;
57
+ type GetOfferFilter = (instance: import("./utils.js").Instance<any>) => string[];
58
+ type SetOfferFilter = (instance: Instance, strings: string[]) => any;
59
+ type GetInstallationForInstance = (instance: import("./utils.js").Instance<any>) => Promise<Installation>;
60
+ type GetInstance = (invitation: ERef<Invitation>) => Promise<import("./utils.js").Instance<any>>;
61
+ type GetInstallation = (invitation: ERef<Invitation>) => Promise<Installation>;
62
+ type GetInvitationDetails = (invitation: ERef<Invitation<any, any>>) => Promise<InvitationDetails>;
63
+ /**
64
+ * Create an installation by safely evaluating the code and
65
+ * registering it with Zoe. Returns an installation.
66
+ */
67
+ type InstallBundle = (bundle: Bundle | SourceBundle, bundleLabel?: string | undefined) => Promise<Installation>;
68
+ /**
69
+ * Create an installation from a Bundle ID. Returns an installation.
70
+ */
71
+ type InstallBundleID = (bundleID: BundleID, bundleLabel?: string | undefined) => Promise<Installation>;
72
+ /**
73
+ * Verify that an alleged Installation is real, and return the Bundle ID it
74
+ * will use for contract code.
75
+ */
76
+ type GetBundleIDFromInstallation = (allegedInstallation: ERef<Installation>) => Promise<BundleID>;
77
+ /**
78
+ * To redeem an invitation, the user normally provides a proposal (their
79
+ * rules for the offer) as well as payments to be escrowed by Zoe. If
80
+ * either the proposal or payments would be empty, indicate this by
81
+ * omitting that argument or passing undefined, rather than passing an
82
+ * empty record.
83
+ *
84
+ * The proposal has three parts: `want` and `give` are used by Zoe to
85
+ * enforce offer safety, and `exit` is used to specify the particular
86
+ * payout-liveness policy that Zoe can guarantee. `want` and `give`
87
+ * are objects with keywords as keys and amounts as values.
88
+ * `paymentKeywordRecord` is a record with keywords as keys, and the
89
+ * values are the actual payments to be escrowed. A payment is
90
+ * expected for every rule under `give`.
91
+ */
92
+ type Offer = <Result, Args = undefined>(invitation: ERef<Invitation<Result, Args>>, proposal?: Proposal, paymentKeywordRecord?: PaymentPKeywordRecord, offerArgs?: Args) => Promise<UserSeat<Result>>;
93
+ /**
94
+ * Zoe uses seats to access or manipulate offers. They let contracts and users
95
+ * interact with them. Zoe has two kinds of seats. ZCFSeats are used within
96
+ * contracts and with zcf methods. UserSeats represent offers external to Zoe
97
+ * and the contract. The party who exercises an invitation and sends the offer()
98
+ * message to Zoe gets a UserSeat that can check payouts' status or retrieve the
99
+ * result of processing the offer in the contract. This varies, but examples are
100
+ * a string and an invitation for another seat.
101
+ *
102
+ * Also, a UserSeat can be handed to an agent outside Zoe and the contract,
103
+ * letting them query or monitor the current state, access the payouts and
104
+ * result, and, if it's allowed for this seat, call tryExit().
105
+ *
106
+ * Since anyone can attempt to exit the seat if they have a reference to it, you
107
+ * should only share a UserSeat with trusted parties.
108
+ *
109
+ * UserSeat includes queries for the associated offer's current state and an
110
+ * operation to request that the offer exit, as follows:
111
+ */
112
+ type UserSeat<OR extends unknown = unknown> = {
113
+ getProposal: () => Promise<ProposalRecord>;
114
+ /**
115
+ * returns a promise for a KeywordPaymentRecord containing all the payouts from
116
+ * this seat. The promise will resolve after the seat has exited.
117
+ */
118
+ getPayouts: () => Promise<PaymentPKeywordRecord>;
119
+ /**
120
+ * returns a promise for the Payment corresponding to the indicated keyword.
121
+ * The promise will resolve after the seat has exited. If there is no payment
122
+ * corresponding to the keyword, an error will be thrown. (It used to return
123
+ * undefined.)
124
+ */
125
+ getPayout: (keyword: Keyword) => Promise<Payment<any, any>>;
126
+ getOfferResult: () => Promise<OR>;
127
+ /**
128
+ * Note: Only works if the seat's `proposal` has an `OnDemand` `exit` clause. Zoe's
129
+ * offer-safety guarantee applies no matter how a seat's interaction with a
130
+ * contract ends. Under normal circumstances, the participant might be able to
131
+ * call `tryExit()`, or the contract might do something explicitly. On exiting,
132
+ * the seat holder gets its current `allocation` and the `seat` can no longer
133
+ * interact with the contract.
134
+ */
135
+ tryExit?: (() => void) | undefined;
136
+ /**
137
+ * Returns true if the seat has exited, false if it is still active.
138
+ */
139
+ hasExited: () => Promise<boolean>;
140
+ /**
141
+ * returns 1 if the proposal's
142
+ * want clause was satisfied by the final allocation, otherwise 0. This is
143
+ * numeric to support a planned enhancement called "multiples" which will allow
144
+ * the return value to be any non-negative number. The promise will resolve
145
+ * after the seat has exited.
146
+ */
147
+ numWantsSatisfied: () => Promise<0 | 1>;
148
+ /**
149
+ * return a promise for the final allocation. The promise will resolve after the
150
+ * seat has exited.
151
+ */
152
+ getFinalAllocation: () => Promise<Allocation>;
153
+ /**
154
+ * returns a subscriber that
155
+ * will be notified when the seat has exited or failed.
156
+ */
157
+ getExitSubscriber: () => Subscriber<Completion>;
158
+ };
159
+ type Proposal = Partial<ProposalRecord>;
160
+ type ProposalRecord = {
161
+ give: AmountKeywordRecord;
162
+ want: AmountKeywordRecord;
163
+ exit: ExitRule;
164
+ };
165
+ /**
166
+ * The keys are keywords, and the values are amounts. For example:
167
+ * { Asset: AmountMath.make(assetBrand, 5n), Price:
168
+ * AmountMath.make(priceBrand, 9n) }
169
+ */
170
+ type AmountKeywordRecord = Record<Keyword, import("@agoric/ertp/src/types.js").AnyAmount>;
171
+ type Waker = {
172
+ wake: () => void;
173
+ };
174
+ type OnDemandExitRule = {
175
+ onDemand: null;
176
+ };
177
+ type WaivedExitRule = {
178
+ waived: null;
179
+ };
180
+ type AfterDeadlineExitRule = {
181
+ afterDeadline: {
182
+ timer: import("@agoric/time").TimerService;
183
+ deadline: import("@agoric/time").Timestamp;
184
+ };
185
+ };
186
+ /**
187
+ * The possible keys are 'waived', 'onDemand', and 'afterDeadline'.
188
+ * `timer` and `deadline` only are used for the `afterDeadline` key.
189
+ * The possible records are:
190
+ * `{ waived: null }`
191
+ * `{ onDemand: null }`
192
+ * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
193
+ */
194
+ type ExitRule = OnDemandExitRule | WaivedExitRule | AfterDeadlineExitRule;
195
+ type Instance = import("./utils.js").Instance<any>;
196
+ type ZCFSpec = {
197
+ bundleCap: import("@agoric/swingset-vat").BundleCap;
198
+ } | {
199
+ name: string;
200
+ } | {
201
+ id: BundleID;
202
+ };
203
+ /**
204
+ * Opaque type for a JSONable source bundle
205
+ */
206
+ type SourceBundle = Record<string, any>;
207
+ type PaymentPKeywordRecord = Record<Keyword, ERef<Payment<any>>>;
208
+ type PaymentKeywordRecord = Record<Keyword, Payment<any>>;
209
+ type InvitationDetails = {
210
+ installation: Installation;
211
+ instance: import("./utils.js").Instance<any>;
212
+ handle: InvitationHandle;
213
+ description: string;
214
+ customDetails?: Record<string, any> | undefined;
215
+ };
216
+ type Installation<SF = any> = import("./utils.js").Installation<SF>;
217
+ type InstallationStart<I extends Installation> = import("./utils.js").InstallationStart<I>;
218
+ type FeeIssuerConfig = {
219
+ name: string;
220
+ assetKind: AssetKind;
221
+ displayInfo: DisplayInfo;
222
+ };
223
+ type ZoeFeesConfig = {
224
+ getPublicFacetFee: NatValue;
225
+ };
226
+ type FeeMintAccess = Handle<"feeMintAccess">;
1
227
  //# sourceMappingURL=types-ambient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.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,gBAAgB,EAAE,OAAO,GAAG,SAAS;;iCAOrF,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;0BAKzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;8BAKtB;IACR,eAAe,EAAE,eAAe,CAAC;CAClC;6BAKO,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,OAAO,CAAC,mBAAmB,CAAC;4BAK9B,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,KAChC,OAAO,CAAC,kBAAkB,CAAC;iCAK7B,OAAO,YAAY,E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,CAAC,eAAe,CAAC"}
@@ -1,5 +1,328 @@
1
- /** @file @deprecated */
1
+ // @jessie-check
2
2
 
3
- console.error(
4
- 'NOTICE: src/zoeService/types-ambient.js no longer provides types; use explicit imports or the top level `/exported.js`',
5
- );
3
+ /// <reference types="ses" />
4
+
5
+ /**
6
+ * @typedef {object} ZoeService
7
+ *
8
+ * Zoe provides a framework for deploying and working with smart
9
+ * contracts. It is accessed as a long-lived and well-trusted service
10
+ * that enforces offer safety for the contracts that use it. Zoe has a
11
+ * single `invitationIssuer` for the entirety of its lifetime. By
12
+ * having a reference to Zoe, a user can get the `invitationIssuer`
13
+ * and thus validate any `invitation` they receive from someone else.
14
+ *
15
+ * Zoe has two different facets: the public Zoe service and the
16
+ * contract facet (ZCF). Each contract instance has a copy of ZCF
17
+ * within its vat. The contract and ZCF never have direct access to
18
+ * the users' payments or the Zoe purses.
19
+ *
20
+ * @property {GetInvitationIssuer} getInvitationIssuer
21
+ *
22
+ * Zoe has a single `invitationIssuer` for the entirety of its
23
+ * lifetime. By having a reference to Zoe, a user can get the
24
+ * `invitationIssuer` and thus validate any `invitation` they receive
25
+ * from someone else. The mint associated with the invitationIssuer
26
+ * creates the ERTP payments that represent the right to interact with
27
+ * a smart contract in particular ways.
28
+ *
29
+ * @property {InstallBundle} install
30
+ * @property {InstallBundleID} installBundleID
31
+ * @property {import('./utils.js').StartInstance} startInstance
32
+ * @property {Offer} offer
33
+ * @property {import('./utils.js').GetPublicFacet} getPublicFacet
34
+ * @property {GetIssuers} getIssuers
35
+ * @property {GetBrands} getBrands
36
+ * @property {import('./utils.js').GetTerms} getTerms
37
+ * @property {GetOfferFilter} getOfferFilter
38
+ * @property {GetInstallationForInstance} getInstallationForInstance
39
+ * @property {GetInstance} getInstance
40
+ * @property {GetInstallation} getInstallation
41
+ * @property {GetInvitationDetails} getInvitationDetails
42
+ * Return an object with the instance, installation, description, invitation
43
+ * handle, and any custom properties specific to the contract.
44
+ * @property {GetFeeIssuer} getFeeIssuer
45
+ * @property {GetConfiguration} getConfiguration
46
+ * @property {GetBundleIDFromInstallation} getBundleIDFromInstallation
47
+ * @property {(invitationHandle: InvitationHandle) => import('@endo/patterns').Pattern | undefined} getProposalShapeForInvitation
48
+ * Return the pattern (if any) associated with the invitationHandle that a
49
+ * proposal is required to match to be accepted by zoe.offer().
50
+ */
51
+
52
+ /**
53
+ * @callback GetInvitationIssuer
54
+ * @returns {Promise<Issuer<'set', InvitationDetails>>}
55
+ */
56
+
57
+ /**
58
+ * @callback GetFeeIssuer
59
+ * @returns {Promise<Issuer<'nat'>>}
60
+ */
61
+
62
+ /**
63
+ * @callback GetConfiguration
64
+ * @returns {{
65
+ * feeIssuerConfig: FeeIssuerConfig,
66
+ * }}
67
+ */
68
+
69
+ /**
70
+ * @callback GetIssuers
71
+ * @param {import('./utils.js').Instance<any>} instance
72
+ * @returns {Promise<IssuerKeywordRecord>}
73
+ */
74
+
75
+ /**
76
+ * @callback GetBrands
77
+ * @param {import('./utils.js').Instance<any>} instance
78
+ * @returns {Promise<BrandKeywordRecord>}
79
+ */
80
+
81
+ /**
82
+ * @callback GetOfferFilter
83
+ * @param {import('./utils.js').Instance<any>} instance
84
+ * @returns {string[]}
85
+ */
86
+
87
+ /**
88
+ * @callback SetOfferFilter
89
+ * @param {Instance} instance
90
+ * @param {string[]} strings
91
+ */
92
+
93
+ /**
94
+ * @callback GetInstallationForInstance
95
+ * @param {import('./utils.js').Instance<any>} instance
96
+ * @returns {Promise<Installation>}
97
+ */
98
+
99
+ /**
100
+ * @callback GetInstance
101
+ * @param {ERef<Invitation>} invitation
102
+ * @returns {Promise<import('./utils.js').Instance<any>>}
103
+ */
104
+
105
+ /**
106
+ * @callback GetInstallation
107
+ * @param {ERef<Invitation>} invitation
108
+ * @returns {Promise<Installation>}
109
+ */
110
+
111
+ /**
112
+ * @callback GetInvitationDetails
113
+ * @param {ERef<Invitation<any, any>>} invitation
114
+ * @returns {Promise<InvitationDetails>}
115
+ */
116
+
117
+ // TODO remove support for source bundles, leaving only support for hash bundles.
118
+ // https://github.com/Agoric/agoric-sdk/issues/4565
119
+ /**
120
+ * @callback InstallBundle
121
+ *
122
+ * Create an installation by safely evaluating the code and
123
+ * registering it with Zoe. Returns an installation.
124
+ *
125
+ * @param {Bundle | SourceBundle} bundle
126
+ * @param {string} [bundleLabel]
127
+ * @returns {Promise<Installation>}
128
+ */
129
+
130
+ // TODO consolidate installBundleID into install.
131
+ // https://github.com/Agoric/agoric-sdk/issues/4974
132
+ /**
133
+ * @callback InstallBundleID
134
+ *
135
+ * Create an installation from a Bundle ID. Returns an installation.
136
+ *
137
+ * @param {BundleID} bundleID
138
+ * @param {string} [bundleLabel]
139
+ * @returns {Promise<Installation>}
140
+ */
141
+
142
+ /**
143
+ * @callback GetBundleIDFromInstallation
144
+ *
145
+ * Verify that an alleged Installation is real, and return the Bundle ID it
146
+ * will use for contract code.
147
+ *
148
+ * @param {ERef<Installation>} allegedInstallation
149
+ * @returns {Promise<BundleID>}
150
+ */
151
+
152
+ /**
153
+ * @typedef {<Result, Args = undefined>(
154
+ * invitation: ERef<Invitation<Result, Args>>,
155
+ * proposal?: Proposal,
156
+ * paymentKeywordRecord?: PaymentPKeywordRecord,
157
+ * offerArgs?: Args,
158
+ * ) => Promise<UserSeat<Result>>
159
+ * } Offer
160
+ *
161
+ * To redeem an invitation, the user normally provides a proposal (their
162
+ * rules for the offer) as well as payments to be escrowed by Zoe. If
163
+ * either the proposal or payments would be empty, indicate this by
164
+ * omitting that argument or passing undefined, rather than passing an
165
+ * empty record.
166
+ *
167
+ * The proposal has three parts: `want` and `give` are used by Zoe to
168
+ * enforce offer safety, and `exit` is used to specify the particular
169
+ * payout-liveness policy that Zoe can guarantee. `want` and `give`
170
+ * are objects with keywords as keys and amounts as values.
171
+ * `paymentKeywordRecord` is a record with keywords as keys, and the
172
+ * values are the actual payments to be escrowed. A payment is
173
+ * expected for every rule under `give`.
174
+ */
175
+
176
+ /**
177
+ * Zoe uses seats to access or manipulate offers. They let contracts and users
178
+ * interact with them. Zoe has two kinds of seats. ZCFSeats are used within
179
+ * contracts and with zcf methods. UserSeats represent offers external to Zoe
180
+ * and the contract. The party who exercises an invitation and sends the offer()
181
+ * message to Zoe gets a UserSeat that can check payouts' status or retrieve the
182
+ * result of processing the offer in the contract. This varies, but examples are
183
+ * a string and an invitation for another seat.
184
+ *
185
+ * Also, a UserSeat can be handed to an agent outside Zoe and the contract,
186
+ * letting them query or monitor the current state, access the payouts and
187
+ * result, and, if it's allowed for this seat, call tryExit().
188
+ *
189
+ * Since anyone can attempt to exit the seat if they have a reference to it, you
190
+ * should only share a UserSeat with trusted parties.
191
+ *
192
+ * UserSeat includes queries for the associated offer's current state and an
193
+ * operation to request that the offer exit, as follows:
194
+ *
195
+ * @see {@link https://docs.agoric.com/zoe/api/zoe.html#userseat-object}}
196
+ * @template {object} [OR=unknown]
197
+ * @typedef {object} UserSeat
198
+ * @property {() => Promise<ProposalRecord>} getProposal
199
+ * @property {() => Promise<PaymentPKeywordRecord>} getPayouts
200
+ * returns a promise for a KeywordPaymentRecord containing all the payouts from
201
+ * this seat. The promise will resolve after the seat has exited.
202
+ * @property {(keyword: Keyword) => Promise<Payment<any, any>>} getPayout
203
+ * returns a promise for the Payment corresponding to the indicated keyword.
204
+ * The promise will resolve after the seat has exited. If there is no payment
205
+ * corresponding to the keyword, an error will be thrown. (It used to return
206
+ * undefined.)
207
+ * @property {() => Promise<OR>} getOfferResult
208
+ * @property {() => void} [tryExit]
209
+ * Note: Only works if the seat's `proposal` has an `OnDemand` `exit` clause. Zoe's
210
+ * offer-safety guarantee applies no matter how a seat's interaction with a
211
+ * contract ends. Under normal circumstances, the participant might be able to
212
+ * call `tryExit()`, or the contract might do something explicitly. On exiting,
213
+ * the seat holder gets its current `allocation` and the `seat` can no longer
214
+ * interact with the contract.
215
+ * @property {() => Promise<boolean>} hasExited
216
+ * Returns true if the seat has exited, false if it is still active.
217
+ * @property {() => Promise<0|1>} numWantsSatisfied returns 1 if the proposal's
218
+ * want clause was satisfied by the final allocation, otherwise 0. This is
219
+ * numeric to support a planned enhancement called "multiples" which will allow
220
+ * the return value to be any non-negative number. The promise will resolve
221
+ * after the seat has exited.
222
+ * @property {() => Promise<Allocation>} getFinalAllocation
223
+ * return a promise for the final allocation. The promise will resolve after the
224
+ * seat has exited.
225
+ * @property {() => Subscriber<Completion>} getExitSubscriber returns a subscriber that
226
+ * will be notified when the seat has exited or failed.
227
+ */
228
+
229
+ /**
230
+ * @typedef {Partial<ProposalRecord>} Proposal
231
+ *
232
+ * @typedef {{give: AmountKeywordRecord,
233
+ * want: AmountKeywordRecord,
234
+ * exit: ExitRule
235
+ * }} ProposalRecord
236
+ */
237
+
238
+ /**
239
+ * @typedef {Record<Keyword, import('@agoric/ertp/src/types.js').AnyAmount>} AmountKeywordRecord
240
+ *
241
+ * The keys are keywords, and the values are amounts. For example:
242
+ * { Asset: AmountMath.make(assetBrand, 5n), Price:
243
+ * AmountMath.make(priceBrand, 9n) }
244
+ */
245
+
246
+ /**
247
+ * @typedef {object} Waker
248
+ * @property {() => void} wake
249
+ */
250
+
251
+ /**
252
+ * @typedef {object} OnDemandExitRule
253
+ * @property {null} onDemand
254
+ */
255
+
256
+ /**
257
+ * @typedef {object} WaivedExitRule
258
+ * @property {null} waived
259
+ */
260
+
261
+ /**
262
+ * @typedef {object} AfterDeadlineExitRule
263
+ * @property {{timer: import('@agoric/time').TimerService, deadline: import('@agoric/time').Timestamp}} afterDeadline
264
+ */
265
+
266
+ /**
267
+ * @typedef {OnDemandExitRule | WaivedExitRule | AfterDeadlineExitRule} ExitRule
268
+ *
269
+ * The possible keys are 'waived', 'onDemand', and 'afterDeadline'.
270
+ * `timer` and `deadline` only are used for the `afterDeadline` key.
271
+ * The possible records are:
272
+ * `{ waived: null }`
273
+ * `{ onDemand: null }`
274
+ * `{ afterDeadline: { timer :Timer<Deadline>, deadline :Deadline } }`
275
+ */
276
+
277
+ /**
278
+ * @typedef {import('./utils.js').Instance<any>} Instance
279
+ */
280
+
281
+ /**
282
+ * @typedef {{bundleCap: import('@agoric/swingset-vat').BundleCap } | {name: string} | {id: BundleID}} ZCFSpec
283
+ */
284
+
285
+ /**
286
+ * @typedef {Record<string, any>} SourceBundle
287
+ * Opaque type for a JSONable source bundle
288
+ */
289
+
290
+ /**
291
+ * @typedef {Record<Keyword,ERef<Payment<any>>>} PaymentPKeywordRecord
292
+ * @typedef {Record<Keyword,Payment<any>>} PaymentKeywordRecord
293
+ */
294
+
295
+ /**
296
+ * @typedef {object} InvitationDetails
297
+ * @property {Installation} installation
298
+ * @property {import('./utils.js').Instance<any>} instance
299
+ * @property {InvitationHandle} handle
300
+ * @property {string} description
301
+ * @property {Record<string, any>} [customDetails]
302
+ */
303
+
304
+ /**
305
+ * @template [SF=any] contract start function
306
+ * @typedef {import('./utils.js').Installation<SF>} Installation
307
+ */
308
+
309
+ /**
310
+ * @template {Installation} I
311
+ * @typedef {import('./utils.js').InstallationStart<I>} InstallationStart
312
+ */
313
+
314
+ /**
315
+ * @typedef {object} FeeIssuerConfig
316
+ * @property {string} name
317
+ * @property {AssetKind} assetKind
318
+ * @property {DisplayInfo} displayInfo
319
+ */
320
+
321
+ /**
322
+ * @typedef {object} ZoeFeesConfig
323
+ * @property {NatValue} getPublicFacetFee
324
+ */
325
+
326
+ /**
327
+ * @typedef {Handle<'feeMintAccess'>} FeeMintAccess
328
+ */