@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/exported.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- import './src/contractFacet/types.js';
3
+ import './src/contractFacet/types-ambient.js';
4
4
  import './src/zoeService/types.js';
5
5
  import './src/contractSupport/types.js';
6
6
  import './src/contracts/exported.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/zoe",
3
- "version": "0.26.3-dev-97cb715.0+97cb715",
3
+ "version": "0.26.3-dev-3da32ff.0+3da32ff",
4
4
  "description": "Zoe: the Smart Contract Framework for Offer Enforcement",
5
5
  "type": "module",
6
6
  "main": "./src/zoeService/zoe.js",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
45
45
  "dependencies": {
46
- "@agoric/assert": "0.6.1-dev-97cb715.0+97cb715",
47
- "@agoric/ertp": "0.16.3-dev-97cb715.0+97cb715",
48
- "@agoric/internal": "0.3.3-dev-97cb715.0+97cb715",
49
- "@agoric/notifier": "0.6.3-dev-97cb715.0+97cb715",
50
- "@agoric/store": "0.9.3-dev-97cb715.0+97cb715",
51
- "@agoric/swingset-liveslots": "0.10.3-dev-97cb715.0+97cb715",
52
- "@agoric/swingset-vat": "0.32.3-dev-97cb715.0+97cb715",
53
- "@agoric/time": "0.3.3-dev-97cb715.0+97cb715",
54
- "@agoric/vat-data": "0.5.3-dev-97cb715.0+97cb715",
46
+ "@agoric/assert": "0.6.1-dev-3da32ff.0+3da32ff",
47
+ "@agoric/ertp": "0.16.3-dev-3da32ff.0+3da32ff",
48
+ "@agoric/internal": "0.3.3-dev-3da32ff.0+3da32ff",
49
+ "@agoric/notifier": "0.6.3-dev-3da32ff.0+3da32ff",
50
+ "@agoric/store": "0.9.3-dev-3da32ff.0+3da32ff",
51
+ "@agoric/swingset-liveslots": "0.10.3-dev-3da32ff.0+3da32ff",
52
+ "@agoric/swingset-vat": "0.32.3-dev-3da32ff.0+3da32ff",
53
+ "@agoric/time": "0.3.3-dev-3da32ff.0+3da32ff",
54
+ "@agoric/vat-data": "0.5.3-dev-3da32ff.0+3da32ff",
55
55
  "@endo/bundle-source": "^2.7.0",
56
56
  "@endo/captp": "^3.1.4",
57
57
  "@endo/eventual-send": "^0.17.5",
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "97cb7158f1176d14b9a8d775328aa826458282ea"
136
+ "gitHead": "3da32ffbdd6b0a3d6c930bbacee21eae163a715a"
137
137
  }
@@ -0,0 +1,247 @@
1
+ /* eslint-disable no-use-before-define */
2
+
3
+ type CopyRecord<T> = import('@endo/pass-style').CopyRecord<T>;
4
+ type IssuerOptionsRecord = import('@agoric/ertp').IssuerOptionsRecord;
5
+ /**
6
+ * Any passable non-thenable. Often an explanatory string.
7
+ */
8
+ type Completion = any;
9
+ type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
10
+ /**
11
+ * Zoe Contract Facet
12
+ *
13
+ * The Zoe interface specific to a contract instance. The Zoe Contract
14
+ * Facet is an API object used by running contract instances to access
15
+ * the Zoe state for that instance. The Zoe Contract Facet is accessed
16
+ * synchronously from within the contract, and usually is referred to
17
+ * in code as zcf.
18
+ */
19
+ type ZCF<CT extends unknown = Record<string, unknown>> = {
20
+ /**
21
+ * - atomically reallocate amounts among seats.
22
+ */
23
+ atomicRearrange: (transfers: TransferPart[]) => void;
24
+ /**
25
+ * - reallocate amounts among seats.
26
+ * @deprecated Use atomicRearrange instead.
27
+ */
28
+ reallocate: Reallocate;
29
+ /**
30
+ * - check
31
+ * whether a keyword is valid and unique and could be added in
32
+ * `saveIssuer`
33
+ */
34
+ assertUniqueKeyword: (keyword: Keyword) => void;
35
+ /**
36
+ * Informs Zoe about an issuer and returns a promise for acknowledging
37
+ * when the issuer is added and ready.
38
+ *
39
+ * @returns the AmountMath and brand synchronously accessible after
40
+ * saving
41
+ */
42
+ saveIssuer: (
43
+ issuerP: ERef<Issuer>,
44
+ keyword: Keyword,
45
+ ) => Promise<IssuerRecord<any>>;
46
+
47
+ /**
48
+ * Make a credible Zoe invitation for a particular smart contract
49
+ * indicated by the `instance` in the details of the invitation. Zoe
50
+ * also puts the `installation` and a unique `handle` in the details
51
+ * of the invitation. The contract must provide a `description` for
52
+ * the invitation and should include whatever information is necessary
53
+ * for a potential buyer of the invitation to know what they are
54
+ * getting in the `customDetails`. `customDetails` will be
55
+ * placed in the details of the invitation.
56
+ */
57
+ makeInvitation: <Result>(
58
+ offerHandler: OfferHandler<Result>,
59
+ description: string,
60
+ customDetails?: object,
61
+ proposalShape?: Pattern,
62
+ ) => Promise<Invitation<R, A>>;
63
+ shutdown: (completion: Completion) => void;
64
+ shutdownWithFailure: ShutdownWithFailure;
65
+ getZoeService: () => ERef<ZoeService>;
66
+ getInvitationIssuer: () => Issuer<'set'>;
67
+ getTerms: () => StandardTerms & CT;
68
+ getBrandForIssuer: <K extends AssetKind>(issuer: Issuer<K>) => Brand<K>;
69
+ getIssuerForBrand: <K_1 extends AssetKind>(brand: Brand<K_1>) => Issuer<K_1>;
70
+ getAssetKind: GetAssetKindByBrand;
71
+ makeZCFMint: <K_2 extends AssetKind = 'nat'>(
72
+ keyword: Keyword,
73
+ assetKind?: K_2 | undefined,
74
+ displayInfo?: AdditionalDisplayInfo,
75
+ options?: IssuerOptionsRecord,
76
+ ) => Promise<ZCFMint<K_2>>;
77
+ registerFeeMint: ZCFRegisterFeeMint;
78
+ makeEmptySeatKit: ZCFMakeEmptySeatKit;
79
+ setTestJig: SetTestJig;
80
+ stopAcceptingOffers: () => Promise<void>;
81
+ setOfferFilter: (strings: Array<string>) => Promise<void>;
82
+ getOfferFilter: () => Promise<Array<string>>;
83
+ getInstance: () => Instance;
84
+ };
85
+ /**
86
+ * The contract can reallocate over seats, which commits the staged
87
+ * allocation for each seat. On commit, the staged allocation becomes
88
+ * the current allocation and the staged allocation is deleted.
89
+ *
90
+ * The reallocation will only succeed if the reallocation 1) conserves
91
+ * rights (the amounts specified have the same total value as the
92
+ * current total amount), and 2) is 'offer-safe' for all parties
93
+ * involved. All seats that have staged allocations must be included
94
+ * as arguments to `reallocate`, or an error is thrown. Additionally,
95
+ * an error is thrown if any seats included in `reallocate` do not
96
+ * have a staged allocation.
97
+ *
98
+ * The reallocation is partial, meaning that it applies only to the
99
+ * seats passed in as arguments. By induction, if rights conservation
100
+ * and offer safety hold before, they will hold after a safe
101
+ * reallocation, even though we only re-validate for the seats whose
102
+ * allocations will change. Since rights are conserved for the change,
103
+ * overall rights will be unchanged, and a reallocation can only
104
+ * effect offer safety for seats whose allocations change.
105
+ */
106
+ type Reallocate = (
107
+ seat1: ZCFSeat,
108
+ seat2: ZCFSeat,
109
+ ...seatRest: Array<ZCFSeat>
110
+ ) => void;
111
+ type TransferPart = [
112
+ fromSeat?: ZCFSeat,
113
+ toSeat?: ZCFSeat,
114
+ fromAmounts?: AmountKeywordRecord,
115
+ toAmounts?: AmountKeywordRecord,
116
+ ];
117
+
118
+ type ZCFRegisterFeeMint = (
119
+ keyword: Keyword,
120
+ allegedFeeMintAccess: FeeMintAccess,
121
+ ) => Promise<ZCFMint<'nat'>>;
122
+ /**
123
+ * Provide a jig object for testing purposes only.
124
+ *
125
+ * The contract code provides a callback whose return result will
126
+ * be made available to the test that started this contract. The
127
+ * supplied callback will only be called in a testing context,
128
+ * never in production; i.e., it is only called if `testJigSetter`
129
+ * was supplied.
130
+ *
131
+ * If no, `testFn` is supplied, then an empty jig will be used.
132
+ * An additional `zcf` property set to the current ContractFacet
133
+ * will be appended to the returned jig object (overriding any
134
+ * provided by the `testFn`).
135
+ */
136
+ type SetTestJig = (testFn: () => Record<string, unknown>) => void;
137
+ type ZCFMint<K extends AssetKind = AssetKind> = {
138
+ getIssuerRecord: () => IssuerRecord<K>;
139
+ /**
140
+ * All the amounts in gains must be of this ZCFMint's brand.
141
+ * The gains' keywords are in the namespace of that seat.
142
+ * Add the gains to that seat's allocation.
143
+ * The resulting state must be offer safe. (Currently, increasing assets can
144
+ * never violate offer safety anyway.)
145
+ *
146
+ * Mint that amount of assets into the pooled purse.
147
+ * If a seat is provided, it is returned. Otherwise a new seat is
148
+ * returned.
149
+ */
150
+ mintGains: (gains: AmountKeywordRecord, zcfSeat?: ZCFSeat) => ZCFSeat;
151
+ /**
152
+ * All the amounts in losses must be of this ZCFMint's brand.
153
+ * The losses' keywords are in the namespace of that seat.
154
+ * Subtract losses from that seat's allocation.
155
+ * The resulting state must be offer safe.
156
+ *
157
+ * Burn that amount of assets from the pooled purse.
158
+ */
159
+ burnLosses: (losses: AmountKeywordRecord, zcfSeat: ZCFSeat) => void;
160
+ };
161
+ /**
162
+ * fail called with the reason for this failure, where reason is
163
+ * normally an instanceof Error.
164
+ */
165
+ type ZCFSeatFail = (reason: unknown) => Error;
166
+ /**
167
+ * The brand is used for filling in an empty amount if the `keyword`
168
+ * is not present in the allocation
169
+ */
170
+ type ZCFGetAmountAllocated = (
171
+ keyword: Keyword,
172
+ brand?: Brand<AssetKind> | undefined,
173
+ ) => Amount<any>;
174
+ type ZCFSeat = {
175
+ exit: (completion?: Completion) => void;
176
+ fail: ZCFSeatFail;
177
+ getSubscriber: () => Promise<Subscriber<Allocation>>;
178
+ hasExited: () => boolean;
179
+ getProposal: () => ProposalRecord;
180
+ getAmountAllocated: ZCFGetAmountAllocated;
181
+ getCurrentAllocation: () => Allocation;
182
+ /**
183
+ * @deprecated Use atomicRearrange instead
184
+ */
185
+ getStagedAllocation: () => Allocation;
186
+ /**
187
+ * @deprecated Use atomicRearrange instead
188
+ */
189
+ hasStagedAllocation: () => boolean;
190
+ isOfferSafe: (newAllocation: Allocation) => boolean;
191
+ /**
192
+ * @deprecated Use atomicRearrange instead
193
+ */
194
+ incrementBy: (
195
+ amountKeywordRecord: AmountKeywordRecord,
196
+ ) => AmountKeywordRecord;
197
+ /**
198
+ * @deprecated Use atomicRearrange instead
199
+ */
200
+ decrementBy: (
201
+ amountKeywordRecord: AmountKeywordRecord,
202
+ ) => AmountKeywordRecord;
203
+ /**
204
+ * @deprecated Use atomicRearrange instead
205
+ */
206
+ clear: () => void;
207
+ };
208
+ type ZcfSeatKit = {
209
+ zcfSeat: ZCFSeat;
210
+ userSeat: ERef<UserSeat>;
211
+ };
212
+ type HandleOffer<OR extends unknown> = (
213
+ seat: ZCFSeat,
214
+ offerArgs?: object,
215
+ ) => OR;
216
+ type OfferHandler<OR extends unknown = unknown> =
217
+ | HandleOffer<OR>
218
+ | {
219
+ handle: HandleOffer<OR>;
220
+ };
221
+ type ContractMeta = {
222
+ customTermsShape?: CopyRecord<any> | undefined;
223
+ privateArgsShape?: CopyRecord<any> | undefined;
224
+ upgradability?: 'none' | 'canBeUpgraded' | 'canUpgrade' | undefined;
225
+ };
226
+ /**
227
+ * API for a contract start function.
228
+ *
229
+ * CAVEAT: assumes synchronous
230
+ */
231
+ type ContractStartFn<
232
+ PF extends unknown = any,
233
+ CF extends unknown = any,
234
+ CT extends unknown = any,
235
+ PA extends unknown = any,
236
+ > = (
237
+ zcf: ZCF<CT>,
238
+ privateArgs: PA,
239
+ baggage?: MapStore<any, any> | undefined,
240
+ ) => ContractStartFnResult<PF, CF>;
241
+ type ContractStartFnResult<PF, CF> = {
242
+ publicFacet: PF;
243
+ creatorFacet: CF;
244
+ creatorInvitation?: Promise<Invitation<R, A>> | undefined;
245
+ };
246
+ type ContractOf<S> = import('../zoeService/utils').ContractOf<S>;
247
+ type AdminFacet = import('../zoeService/utils').AdminFacet;
@@ -0,0 +1 @@
1
+ // Dummy file for .d.ts twin to declare ambients
@@ -10,7 +10,7 @@ import { addToAllocation, subtractFromAllocation } from './allocationMath.js';
10
10
  import '../internal-types.js';
11
11
  import { ZcfMintI } from '../typeGuards.js';
12
12
  import './internal-types.js';
13
- import './types.js';
13
+ import './types-ambient.js';
14
14
 
15
15
  const { Fail } = assert;
16
16
 
package/src/typeGuards.js CHANGED
@@ -224,7 +224,7 @@ export const InstanceStorageManagerIKit = harden({
224
224
  InstanceHandleShape,
225
225
  M.remotable('instanceAdmin'),
226
226
  ).returns(M.promise()),
227
- deleteInstanceAdmin: M.call(InstanceAdminI).returns(),
227
+ deleteInstanceAdmin: M.call(InstanceAdminShape).returns(),
228
228
  makeInvitation: M.call(InvitationHandleShape, M.string())
229
229
  .optional(M.record(), M.pattern())
230
230
  .returns(PaymentShape),
@@ -35,7 +35,7 @@ type ZoeInstanceStorageManager = {
35
35
  getTerms: InstanceStateGetTerms;
36
36
  getIssuers: InstanceRecordGetIssuers;
37
37
  getBrands: InstanceRecordGetBrands;
38
- saveIssuer: SaveIssuer;
38
+ saveIssuer: ZCF['saveIssuer'];
39
39
  makeZoeMint: MakeZoeMint;
40
40
  registerFeeMint: RegisterFeeMint;
41
41
  getInstanceRecord: GetInstanceRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["internal-types.js"],"names":[],"mappings":";;;4BAMW,MAAM,SACN,KAAK,KACH,KAAK,IAAI,CAAC;;;;;;;;kCAWZ,MAAM,SACN,KAAK,KACH,KAAK;;;;;;;kCAUP,cAAc,YACd,qBAAqB,KACnB,QAAQ,UAAU,CAAC;oCAKrB,QAAQ,iBACR,aAAa,KACX,IAAI;mCAKN,QAAQ,KACN,aAAa;sCAKf,QAAQ,KACN,IAAI;;;;;0CASN,KAAK,YAAY,CAAC,KAChB,KAAK;IACjB,MAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,SAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,QAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,YAAgB,EAAC,YAAY,CAAA;CAC1B,CAAC;;;cAWS,qBAAqB;gBACrB,wBAAwB;eACxB,uBAAuB;gBACvB,UAAU;iBACV,WAAW;qBACX,eAAe;uBACf,iBAAiB;sBACjB,gB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CAC1B,CAAC;;;cAWS,qBAAqB;gBACrB,wBAAwB;eACxB,uBAAuB;gBACvB,GAAG,CAAC,YAAY,CAAC;iBACjB,WAAW;qBACX,eAAe;uBACf,iBAAiB;sBACjB,gBAAgB;uBAChB,iBAAiB;yBACjB,mBAAmB;oBACnB,8BAA8B;yBAC9B,MAAM,MAAM;;;;aACZ,MAAM,MAAM;;;;kBACZ,MAAM,OAAO,sBAAsB,EAAE,aAAa;;;;;;;;4FAWrD,YAAY,eACZ,MAAM,8BACN,mBAAmB,YACnB,QAAQ,qBACR,SAAS,iBACT,MAAM,KACJ,QAAQ,yBAAyB,CAAC;8BAKpC,QAAQ,KACN,QAAQ,SAAS,CAAC;wDAKpB,gBAAgB,KACd,OAAO,GAAG,SAAS;;mCAKlB,6BAA6B;yBAC7B,mBAAmB;qBACnB,eAAe;sBACf,OAAO,KAAK,CAAC;mBACb,aAAa;qBACb,eAAe;iCACf,2BAA2B;oBAC3B,OAAO,YAAY,EAAE,cAAc;eACnC,SAAS;gBACT,UAAU;cACV,OAAO,SAAS,EAAE,QAAQ;oBAC1B,cAAc;oBACd,cAAc;gCACd,0BAA0B;sBAC1B,gBAAgB;wBAChB,kBAAkB;mCAClB,6BAA6B;;;;;;wCAQhC,SAAS,iBACT,MAAM,KACJ,QAAQ,OAAO,sBAAsB,EAAE,gBAAgB,CAAC;uCAK1D,aAAa,KACX,UAAU,KAAK,CAAC"}
@@ -79,7 +79,7 @@
79
79
  * @property {InstanceStateGetTerms} getTerms
80
80
  * @property {InstanceRecordGetIssuers} getIssuers
81
81
  * @property {InstanceRecordGetBrands} getBrands
82
- * @property {SaveIssuer} saveIssuer
82
+ * @property {ZCF['saveIssuer']} saveIssuer
83
83
  * @property {MakeZoeMint} makeZoeMint
84
84
  * @property {RegisterFeeMint} registerFeeMint
85
85
  * @property {GetInstanceRecord} getInstanceRecord
@@ -1,207 +0,0 @@
1
- type CopyRecord<T> = import('@endo/pass-style').CopyRecord<T>;
2
- type IssuerOptionsRecord = import('@agoric/ertp').IssuerOptionsRecord;
3
- /**
4
- * Any passable non-thenable. Often an explanatory string.
5
- */
6
- type Completion = any;
7
- type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
8
- /**
9
- * Zoe Contract Facet
10
- *
11
- * The Zoe interface specific to a contract instance. The Zoe Contract
12
- * Facet is an API object used by running contract instances to access
13
- * the Zoe state for that instance. The Zoe Contract Facet is accessed
14
- * synchronously from within the contract, and usually is referred to
15
- * in code as zcf.
16
- */
17
- type ZCF<CT extends unknown = Record<string, unknown>> = {
18
- /**
19
- * - atomically reallocate amounts among seats.
20
- */
21
- atomicRearrange: (transfers: TransferPart[]) => void;
22
- /**
23
- * - reallocate amounts among seats.
24
- * Deprecated: Use atomicRearrange instead.
25
- */
26
- reallocate: Reallocate;
27
- /**
28
- * - check
29
- * whether a keyword is valid and unique and could be added in
30
- * `saveIssuer`
31
- */
32
- assertUniqueKeyword: (keyword: Keyword) => void;
33
- /**
34
- * - save an issuer to ZCF and Zoe
35
- * and get the AmountMath and brand synchronously accessible after
36
- * saving
37
- */
38
- saveIssuer: SaveIssuer;
39
- makeInvitation: MakeInvitation;
40
- shutdown: (completion: Completion) => void;
41
- shutdownWithFailure: ShutdownWithFailure;
42
- getZoeService: () => ERef<ZoeService>;
43
- getInvitationIssuer: () => Issuer<'set'>;
44
- getTerms: () => StandardTerms & CT;
45
- getBrandForIssuer: <K extends AssetKind>(issuer: Issuer<K>) => Brand<K>;
46
- getIssuerForBrand: <K_1 extends AssetKind>(brand: Brand<K_1>) => Issuer<K_1>;
47
- getAssetKind: GetAssetKindByBrand;
48
- makeZCFMint: <K_2 extends AssetKind = "nat">(keyword: Keyword, assetKind?: K_2 | undefined, displayInfo?: AdditionalDisplayInfo, options?: IssuerOptionsRecord) => Promise<ZCFMint<K_2>>;
49
- registerFeeMint: ZCFRegisterFeeMint;
50
- makeEmptySeatKit: ZCFMakeEmptySeatKit;
51
- setTestJig: SetTestJig;
52
- stopAcceptingOffers: () => Promise<void>;
53
- setOfferFilter: (strings: Array<string>) => Promise<void>;
54
- getOfferFilter: () => Promise<Array<string>>;
55
- getInstance: () => Instance;
56
- };
57
- /**
58
- * The contract can reallocate over seats, which commits the staged
59
- * allocation for each seat. On commit, the staged allocation becomes
60
- * the current allocation and the staged allocation is deleted.
61
- *
62
- * The reallocation will only succeed if the reallocation 1) conserves
63
- * rights (the amounts specified have the same total value as the
64
- * current total amount), and 2) is 'offer-safe' for all parties
65
- * involved. All seats that have staged allocations must be included
66
- * as arguments to `reallocate`, or an error is thrown. Additionally,
67
- * an error is thrown if any seats included in `reallocate` do not
68
- * have a staged allocation.
69
- *
70
- * The reallocation is partial, meaning that it applies only to the
71
- * seats passed in as arguments. By induction, if rights conservation
72
- * and offer safety hold before, they will hold after a safe
73
- * reallocation, even though we only re-validate for the seats whose
74
- * allocations will change. Since rights are conserved for the change,
75
- * overall rights will be unchanged, and a reallocation can only
76
- * effect offer safety for seats whose allocations change.
77
- */
78
- type Reallocate = (seat1: ZCFSeat, seat2: ZCFSeat, ...seatRest: Array<ZCFSeat>) => void;
79
- type TransferPart = [
80
- fromSeat?: ZCFSeat,
81
- toSeat?: ZCFSeat,
82
- fromAmounts?: AmountKeywordRecord,
83
- toAmounts?: AmountKeywordRecord
84
- ];
85
- /**
86
- * Informs Zoe about an issuer and returns a promise for acknowledging
87
- * when the issuer is added and ready.
88
- */
89
- type SaveIssuer = (issuerP: ERef<Issuer>, keyword: Keyword) => Promise<IssuerRecord<any>>;
90
- /**
91
- * Make a credible Zoe invitation for a particular smart contract
92
- * indicated by the `instance` in the details of the invitation. Zoe
93
- * also puts the `installation` and a unique `handle` in the details
94
- * of the invitation. The contract must provide a `description` for
95
- * the invitation and should include whatever information is necessary
96
- * for a potential buyer of the invitation to know what they are
97
- * getting in the `customDetails`. `customDetails` will be
98
- * placed in the details of the invitation.
99
- */
100
- type MakeInvitation = <Result>(offerHandler: OfferHandler<Result>, description: string, customDetails?: object, proposalShape?: Pattern) => Promise<Invitation<R, A>>;
101
- type ZCFRegisterFeeMint = (keyword: Keyword, allegedFeeMintAccess: FeeMintAccess) => Promise<ZCFMint<'nat'>>;
102
- /**
103
- * Provide a jig object for testing purposes only.
104
- *
105
- * The contract code provides a callback whose return result will
106
- * be made available to the test that started this contract. The
107
- * supplied callback will only be called in a testing context,
108
- * never in production; i.e., it is only called if `testJigSetter`
109
- * was supplied.
110
- *
111
- * If no, `testFn` is supplied, then an empty jig will be used.
112
- * An additional `zcf` property set to the current ContractFacet
113
- * will be appended to the returned jig object (overriding any
114
- * provided by the `testFn`).
115
- */
116
- type SetTestJig = (testFn: () => Record<string, unknown>) => void;
117
- type ZCFMint<K extends AssetKind = AssetKind> = {
118
- getIssuerRecord: () => IssuerRecord<K>;
119
- /**
120
- * All the amounts in gains must be of this ZCFMint's brand.
121
- * The gains' keywords are in the namespace of that seat.
122
- * Add the gains to that seat's allocation.
123
- * The resulting state must be offer safe. (Currently, increasing assets can
124
- * never violate offer safety anyway.)
125
- *
126
- * Mint that amount of assets into the pooled purse.
127
- * If a seat is provided, it is returned. Otherwise a new seat is
128
- * returned.
129
- */
130
- mintGains: (gains: AmountKeywordRecord, zcfSeat?: ZCFSeat) => ZCFSeat;
131
- /**
132
- * All the amounts in losses must be of this ZCFMint's brand.
133
- * The losses' keywords are in the namespace of that seat.
134
- * Subtract losses from that seat's allocation.
135
- * The resulting state must be offer safe.
136
- *
137
- * Burn that amount of assets from the pooled purse.
138
- */
139
- burnLosses: (losses: AmountKeywordRecord, zcfSeat: ZCFSeat) => void;
140
- };
141
- /**
142
- * fail called with the reason for this failure, where reason is
143
- * normally an instanceof Error.
144
- */
145
- type ZCFSeatFail = (reason: unknown) => Error;
146
- /**
147
- * The brand is used for filling in an empty amount if the `keyword`
148
- * is not present in the allocation
149
- */
150
- type ZCFGetAmountAllocated = (keyword: Keyword, brand?: Brand<AssetKind> | undefined) => Amount<any>;
151
- type ZCFSeat = {
152
- exit: (completion?: Completion) => void;
153
- fail: ZCFSeatFail;
154
- getSubscriber: () => Promise<Subscriber<Allocation>>;
155
- hasExited: () => boolean;
156
- getProposal: () => ProposalRecord;
157
- getAmountAllocated: ZCFGetAmountAllocated;
158
- getCurrentAllocation: () => Allocation;
159
- /**
160
- * Deprecated: Use atomicRearrange instead
161
- */
162
- getStagedAllocation: () => Allocation;
163
- /**
164
- * Deprecated: Use atomicRearrange instead
165
- */
166
- hasStagedAllocation: () => boolean;
167
- isOfferSafe: (newAllocation: Allocation) => boolean;
168
- /**
169
- * Deprecated: Use atomicRearrange instead
170
- */
171
- incrementBy: (amountKeywordRecord: AmountKeywordRecord) => AmountKeywordRecord;
172
- /**
173
- * Deprecated: Use atomicRearrange instead
174
- */
175
- decrementBy: (amountKeywordRecord: AmountKeywordRecord) => AmountKeywordRecord;
176
- /**
177
- * Deprecated: Use atomicRearrange instead
178
- */
179
- clear: () => void;
180
- };
181
- type ZcfSeatKit = {
182
- zcfSeat: ZCFSeat;
183
- userSeat: ERef<UserSeat>;
184
- };
185
- type HandleOffer<OR extends unknown> = (seat: ZCFSeat, offerArgs?: object) => OR;
186
- type OfferHandler<OR extends unknown = unknown> = HandleOffer<OR> | {
187
- handle: HandleOffer<OR>;
188
- };
189
- type ContractMeta = {
190
- customTermsShape?: CopyRecord<any> | undefined;
191
- privateArgsShape?: CopyRecord<any> | undefined;
192
- upgradability?: "none" | "canBeUpgraded" | "canUpgrade" | undefined;
193
- };
194
- /**
195
- * API for a contract start function.
196
- *
197
- * CAVEAT: assumes synchronous
198
- */
199
- type ContractStartFn<PF extends unknown = any, CF extends unknown = any, CT extends unknown = any, PA extends unknown = any> = (zcf: ZCF<CT>, privateArgs: PA, baggage?: MapStore<any, any> | undefined) => ContractStartFnResult<PF, CF>;
200
- type ContractStartFnResult<PF, CF> = {
201
- publicFacet: PF;
202
- creatorFacet: CF;
203
- creatorInvitation?: Promise<Invitation<R, A>> | undefined;
204
- };
205
- type ContractOf<S> = import('../zoeService/utils').ContractOf<S>;
206
- type AdminFacet = import('../zoeService/utils').AdminFacet;
207
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":"qBAI0B,OAAO,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;2BACpD,OAAO,cAAc,EAAE,mBAAmB;;;;kBAI3C,GAAG;4DAOH,UAAU;;;;;;;;;;;;;;iCAaG,cAAc,KAAK,IAAI;;;;;gBACnC,UAAU;;;;;;mCAEA,OAAO,KAAK,IAAI;;;;;;gBAG1B,UAAU;oBAGV,cAAc;2BACD,UAAU,KAAK,IAAI;yBAChC,mBAAmB;mBACnB,MAAM,KAAK,UAAU,CAAC;yBACtB,MAAM,OAAO,KAAK,CAAC;cACnB,MAAM,aAAa,GAAG,EAAE;;;kBAGxB,mBAAmB;0DAEnB,OAAO,6CAEF,qBAAqB,YACzB,mBAAmB;qBAEpB,kBAAkB;sBAClB,mBAAmB;gBACnB,UAAU;yBACV,MAAM,QAAQ,IAAI,CAAC;8BACT,MAAM,MAAM,CAAC,KAAK,QAAQ,IAAI,CAAC;oBACzC,MAAM,QAAQ,MAAM,MAAM,CAAC,CAAC;iBAC5B,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;0BAMP,OAAO,SAAS,OAAO,eAC3C,MAAQ,OAAO,CAAC,KAAK,IAAI;oBAwBb;IACZ,QAAY,CAAC,EAAE,OAAO;IACtB,MAAU,CAAC,EAAE,OAAO;IACpB,WAAe,CAAC,EAAE,mBAAmB;IACrC,SAAa,CAAC,EAAE,mBAAmB;CAChC;;;;;4BASO,KAAK,MAAM,CAAC,WACZ,OAAO,KACL,QAAQ,iBAAe,CAAC;;;;;;;;;;;gFAMnB,MAAM,kBACH,MAAM,kBACN,OAAO;oCAgBjB,OAAO,wBACP,aAAa,KAEX,QAAQ,QAAQ,KAAK,CAAC,CAAC;;;;;;;;;;;;;;;2BAkBzB,MAAM,OAAO,MAAM,EAA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