@agoric/zoe 0.26.3-dev-97cb715.0 → 0.26.3-dev-3da32ff.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 +89 -89
- package/bundles/bundle-contractFacet.js +1 -1
- package/exported.js +1 -1
- package/package.json +11 -11
- package/src/contractFacet/types-ambient.d.ts +247 -0
- package/src/contractFacet/types-ambient.js +1 -0
- package/src/contractFacet/zcfMint.js +1 -1
- package/src/typeGuards.js +1 -1
- package/src/zoeService/internal-types.d.ts +1 -1
- package/src/zoeService/internal-types.d.ts.map +1 -1
- package/src/zoeService/internal-types.js +1 -1
- package/src/contractFacet/types.d.ts +0 -207
- package/src/contractFacet/types.d.ts.map +0 -1
- package/src/contractFacet/types.js +0 -277
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
// @jessie-check
|
|
2
|
-
|
|
3
|
-
/// <reference types="ses"/>
|
|
4
|
-
|
|
5
|
-
/** @template T @typedef {import('@endo/pass-style').CopyRecord<T>} CopyRecord */
|
|
6
|
-
/** @typedef {import('@agoric/ertp').IssuerOptionsRecord} IssuerOptionsRecord */
|
|
7
|
-
|
|
8
|
-
// XXX can be tighter than 'any'
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {any} Completion
|
|
11
|
-
* Any passable non-thenable. Often an explanatory string.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @callback ZCFMakeEmptySeatKit
|
|
16
|
-
* @param {ExitRule} [exit]
|
|
17
|
-
* @returns {ZcfSeatKit}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @template {object} [CT=Record<string, unknown>] Contract's custom terms
|
|
22
|
-
* @typedef {object} ZCF Zoe Contract Facet
|
|
23
|
-
*
|
|
24
|
-
* The Zoe interface specific to a contract instance. The Zoe Contract
|
|
25
|
-
* Facet is an API object used by running contract instances to access
|
|
26
|
-
* the Zoe state for that instance. The Zoe Contract Facet is accessed
|
|
27
|
-
* synchronously from within the contract, and usually is referred to
|
|
28
|
-
* in code as zcf.
|
|
29
|
-
*
|
|
30
|
-
* @property {(transfers: TransferPart[]) => void} atomicRearrange - atomically reallocate amounts among seats.
|
|
31
|
-
* @property {Reallocate} reallocate - reallocate amounts among seats.
|
|
32
|
-
* Deprecated: Use atomicRearrange instead.
|
|
33
|
-
* @property {(keyword: Keyword) => void} assertUniqueKeyword - check
|
|
34
|
-
* whether a keyword is valid and unique and could be added in
|
|
35
|
-
* `saveIssuer`
|
|
36
|
-
* @property {SaveIssuer} saveIssuer - save an issuer to ZCF and Zoe
|
|
37
|
-
* and get the AmountMath and brand synchronously accessible after
|
|
38
|
-
* saving
|
|
39
|
-
* @property {MakeInvitation} makeInvitation
|
|
40
|
-
* @property {(completion: Completion) => void} shutdown
|
|
41
|
-
* @property {ShutdownWithFailure} shutdownWithFailure
|
|
42
|
-
* @property {() => ERef<ZoeService>} getZoeService
|
|
43
|
-
* @property {() => Issuer<'set'>} getInvitationIssuer
|
|
44
|
-
* @property {() => StandardTerms & CT} getTerms
|
|
45
|
-
* @property {<K extends AssetKind>(issuer: Issuer<K>) => Brand<K>} getBrandForIssuer
|
|
46
|
-
* @property {<K extends AssetKind>(brand: Brand<K>) => Issuer<K>} getIssuerForBrand
|
|
47
|
-
* @property {GetAssetKindByBrand} getAssetKind
|
|
48
|
-
* @property {<K extends AssetKind = 'nat'>(
|
|
49
|
-
* keyword: Keyword,
|
|
50
|
-
* assetKind?: K,
|
|
51
|
-
* displayInfo?: AdditionalDisplayInfo,
|
|
52
|
-
* options?: IssuerOptionsRecord
|
|
53
|
-
* ) => Promise<ZCFMint<K>>} makeZCFMint
|
|
54
|
-
* @property {ZCFRegisterFeeMint} registerFeeMint
|
|
55
|
-
* @property {ZCFMakeEmptySeatKit} makeEmptySeatKit
|
|
56
|
-
* @property {SetTestJig} setTestJig
|
|
57
|
-
* @property {() => Promise<void>} stopAcceptingOffers
|
|
58
|
-
* @property {(strings: Array<string>) => Promise<void>} setOfferFilter
|
|
59
|
-
* @property {() => Promise<Array<string>>} getOfferFilter
|
|
60
|
-
* @property {() => Instance} getInstance
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated reallocate(). Use zcf.atomicRearrange() instead
|
|
65
|
-
*
|
|
66
|
-
* @typedef {(seat1: ZCFSeat, seat2: ZCFSeat, ...seatRest:
|
|
67
|
-
* Array<ZCFSeat>) => void} Reallocate
|
|
68
|
-
*
|
|
69
|
-
* The contract can reallocate over seats, which commits the staged
|
|
70
|
-
* allocation for each seat. On commit, the staged allocation becomes
|
|
71
|
-
* the current allocation and the staged allocation is deleted.
|
|
72
|
-
*
|
|
73
|
-
* The reallocation will only succeed if the reallocation 1) conserves
|
|
74
|
-
* rights (the amounts specified have the same total value as the
|
|
75
|
-
* current total amount), and 2) is 'offer-safe' for all parties
|
|
76
|
-
* involved. All seats that have staged allocations must be included
|
|
77
|
-
* as arguments to `reallocate`, or an error is thrown. Additionally,
|
|
78
|
-
* an error is thrown if any seats included in `reallocate` do not
|
|
79
|
-
* have a staged allocation.
|
|
80
|
-
*
|
|
81
|
-
* The reallocation is partial, meaning that it applies only to the
|
|
82
|
-
* seats passed in as arguments. By induction, if rights conservation
|
|
83
|
-
* and offer safety hold before, they will hold after a safe
|
|
84
|
-
* reallocation, even though we only re-validate for the seats whose
|
|
85
|
-
* allocations will change. Since rights are conserved for the change,
|
|
86
|
-
* overall rights will be unchanged, and a reallocation can only
|
|
87
|
-
* effect offer safety for seats whose allocations change.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @typedef {[
|
|
92
|
-
* fromSeat?: ZCFSeat,
|
|
93
|
-
* toSeat?: ZCFSeat,
|
|
94
|
-
* fromAmounts?: AmountKeywordRecord,
|
|
95
|
-
* toAmounts?: AmountKeywordRecord
|
|
96
|
-
* ]} TransferPart
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @callback SaveIssuer
|
|
101
|
-
*
|
|
102
|
-
* Informs Zoe about an issuer and returns a promise for acknowledging
|
|
103
|
-
* when the issuer is added and ready.
|
|
104
|
-
*
|
|
105
|
-
* @param {ERef<Issuer>} issuerP Promise for issuer
|
|
106
|
-
* @param {Keyword} keyword Keyword for added issuer
|
|
107
|
-
* @returns {Promise<IssuerRecord<*>>} Issuer is added and ready
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @typedef {<Result>(
|
|
112
|
-
* offerHandler: OfferHandler<Result>,
|
|
113
|
-
* description: string,
|
|
114
|
-
* customDetails?: object,
|
|
115
|
-
* proposalShape?: Pattern,
|
|
116
|
-
* ) => Promise<Invitation<Awaited<Result>>>
|
|
117
|
-
* } MakeInvitation
|
|
118
|
-
*
|
|
119
|
-
* Make a credible Zoe invitation for a particular smart contract
|
|
120
|
-
* indicated by the `instance` in the details of the invitation. Zoe
|
|
121
|
-
* also puts the `installation` and a unique `handle` in the details
|
|
122
|
-
* of the invitation. The contract must provide a `description` for
|
|
123
|
-
* the invitation and should include whatever information is necessary
|
|
124
|
-
* for a potential buyer of the invitation to know what they are
|
|
125
|
-
* getting in the `customDetails`. `customDetails` will be
|
|
126
|
-
* placed in the details of the invitation.
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @callback ZCFRegisterFeeMint
|
|
131
|
-
* @param {Keyword} keyword
|
|
132
|
-
* @param {FeeMintAccess} allegedFeeMintAccess - an object that
|
|
133
|
-
* purports to be the object that grants access to the fee mint
|
|
134
|
-
* @returns {Promise<ZCFMint<'nat'>>}
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Provide a jig object for testing purposes only.
|
|
139
|
-
*
|
|
140
|
-
* The contract code provides a callback whose return result will
|
|
141
|
-
* be made available to the test that started this contract. The
|
|
142
|
-
* supplied callback will only be called in a testing context,
|
|
143
|
-
* never in production; i.e., it is only called if `testJigSetter`
|
|
144
|
-
* was supplied.
|
|
145
|
-
*
|
|
146
|
-
* If no, `testFn` is supplied, then an empty jig will be used.
|
|
147
|
-
* An additional `zcf` property set to the current ContractFacet
|
|
148
|
-
* will be appended to the returned jig object (overriding any
|
|
149
|
-
* provided by the `testFn`).
|
|
150
|
-
*
|
|
151
|
-
* @callback SetTestJig
|
|
152
|
-
* @param {() => Record<string, unknown>} testFn
|
|
153
|
-
* @returns {void}
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @template {AssetKind} [K=AssetKind]
|
|
158
|
-
* @typedef {object} ZCFMint
|
|
159
|
-
* @property {() => IssuerRecord<K>} getIssuerRecord
|
|
160
|
-
* @property {(gains: AmountKeywordRecord, zcfSeat?: ZCFSeat) => ZCFSeat} mintGains
|
|
161
|
-
* All the amounts in gains must be of this ZCFMint's brand.
|
|
162
|
-
* The gains' keywords are in the namespace of that seat.
|
|
163
|
-
* Add the gains to that seat's allocation.
|
|
164
|
-
* The resulting state must be offer safe. (Currently, increasing assets can
|
|
165
|
-
* never violate offer safety anyway.)
|
|
166
|
-
*
|
|
167
|
-
* Mint that amount of assets into the pooled purse.
|
|
168
|
-
* If a seat is provided, it is returned. Otherwise a new seat is
|
|
169
|
-
* returned.
|
|
170
|
-
*
|
|
171
|
-
* @property {(losses: AmountKeywordRecord,
|
|
172
|
-
* zcfSeat: ZCFSeat,
|
|
173
|
-
* ) => void} burnLosses
|
|
174
|
-
* All the amounts in losses must be of this ZCFMint's brand.
|
|
175
|
-
* The losses' keywords are in the namespace of that seat.
|
|
176
|
-
* Subtract losses from that seat's allocation.
|
|
177
|
-
* The resulting state must be offer safe.
|
|
178
|
-
*
|
|
179
|
-
* Burn that amount of assets from the pooled purse.
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @callback ZCFSeatFail
|
|
184
|
-
*
|
|
185
|
-
* fail called with the reason for this failure, where reason is
|
|
186
|
-
* normally an instanceof Error.
|
|
187
|
-
* @param {unknown} reason
|
|
188
|
-
* @returns {Error}
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @callback ZCFGetAmountAllocated
|
|
193
|
-
* The brand is used for filling in an empty amount if the `keyword`
|
|
194
|
-
* is not present in the allocation
|
|
195
|
-
* @param {Keyword} keyword
|
|
196
|
-
* @param {Brand} [brand]
|
|
197
|
-
* @returns {Amount<any>}
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @typedef {object} ZCFSeat
|
|
202
|
-
* @property {(completion?: Completion) => void} exit
|
|
203
|
-
* @property {ZCFSeatFail} fail
|
|
204
|
-
* @property {() => Promise<Subscriber<Allocation>>} getSubscriber
|
|
205
|
-
* @property {() => boolean} hasExited
|
|
206
|
-
* @property {() => ProposalRecord} getProposal
|
|
207
|
-
* @property {ZCFGetAmountAllocated} getAmountAllocated
|
|
208
|
-
* @property {() => Allocation} getCurrentAllocation
|
|
209
|
-
* @property {() => Allocation} getStagedAllocation
|
|
210
|
-
* Deprecated: Use atomicRearrange instead
|
|
211
|
-
* @property {() => boolean} hasStagedAllocation
|
|
212
|
-
* Deprecated: Use atomicRearrange instead
|
|
213
|
-
* @property {(newAllocation: Allocation) => boolean} isOfferSafe
|
|
214
|
-
* @property {(amountKeywordRecord: AmountKeywordRecord) => AmountKeywordRecord} incrementBy
|
|
215
|
-
* Deprecated: Use atomicRearrange instead
|
|
216
|
-
* @property {(amountKeywordRecord: AmountKeywordRecord) => AmountKeywordRecord} decrementBy
|
|
217
|
-
* Deprecated: Use atomicRearrange instead
|
|
218
|
-
* @property {() => void} clear
|
|
219
|
-
* Deprecated: Use atomicRearrange instead
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* @typedef {{ zcfSeat: ZCFSeat, userSeat: ERef<UserSeat>}} ZcfSeatKit
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @template {object} OR Offer results
|
|
228
|
-
* @typedef {(seat: ZCFSeat, offerArgs?: object) => OR} HandleOffer
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @template {object} [OR=unknown] Offer results
|
|
233
|
-
* @typedef {HandleOffer<OR> | { handle: HandleOffer<OR> }} OfferHandler
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* @typedef ContractMeta
|
|
238
|
-
* @property {CopyRecord<Pattern>} [customTermsShape]
|
|
239
|
-
* @property {CopyRecord<Pattern>} [privateArgsShape]
|
|
240
|
-
* @property {'none' | 'canBeUpgraded' | 'canUpgrade'} [upgradability='none']
|
|
241
|
-
*/
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* API for a contract start function.
|
|
245
|
-
*
|
|
246
|
-
* CAVEAT: assumes synchronous
|
|
247
|
-
*
|
|
248
|
-
* @deprecated define function signature directly
|
|
249
|
-
*
|
|
250
|
-
* @template {object} [PF=any] Public facet
|
|
251
|
-
* @template {object} [CF=any] Creator facet
|
|
252
|
-
* @template {object} [CT=any] Custom terms
|
|
253
|
-
* @template {object} [PA=any] Private args
|
|
254
|
-
* @callback ContractStartFn
|
|
255
|
-
* @param {ZCF<CT>} zcf
|
|
256
|
-
* @param {PA} privateArgs
|
|
257
|
-
* @param {MapStore} [baggage]
|
|
258
|
-
* @returns {ContractStartFnResult<PF, CF>}
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* @template PF Public facet
|
|
263
|
-
* @template CF Creator facet
|
|
264
|
-
* @typedef {object} ContractStartFnResult
|
|
265
|
-
* @property {PF} publicFacet
|
|
266
|
-
* @property {CF} creatorFacet
|
|
267
|
-
* @property {Promise<Invitation>} [creatorInvitation]
|
|
268
|
-
*/
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* @template S
|
|
272
|
-
* @typedef {import('../zoeService/utils').ContractOf<S>} ContractOf
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* @typedef {import('../zoeService/utils').AdminFacet} AdminFacet
|
|
277
|
-
*/
|