@agoric/zoe 0.26.3-upgrade-18a-dev-4ee0508.0 → 0.26.3-upgrade-20-dev-086463b.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 (191) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +288 -288
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +30 -30
  4. package/src/cleanProposal.d.ts +2 -0
  5. package/src/cleanProposal.d.ts.map +1 -1
  6. package/src/cleanProposal.js +4 -2
  7. package/src/contractFacet/exit.d.ts +1 -1
  8. package/src/contractFacet/exit.d.ts.map +1 -1
  9. package/src/contractFacet/offerHandlerStorage.d.ts +1 -1
  10. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
  11. package/src/contractFacet/offerHandlerStorage.js +5 -0
  12. package/src/contractFacet/reallocate.d.ts.map +1 -1
  13. package/src/contractFacet/reallocate.js +4 -0
  14. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  15. package/src/contractFacet/rightsConservation.js +0 -1
  16. package/src/contractFacet/types.d.ts +184 -0
  17. package/src/contractFacet/types.d.ts.map +1 -0
  18. package/src/contractFacet/{types-ambient.d.ts → types.ts} +66 -91
  19. package/src/contractFacet/vatRoot.d.ts +8 -2
  20. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  21. package/src/contractFacet/vatRoot.js +5 -4
  22. package/src/contractFacet/zcfMint.d.ts +4 -3
  23. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  24. package/src/contractFacet/zcfMint.js +9 -21
  25. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  26. package/src/contractFacet/zcfSeat.js +12 -188
  27. package/src/contractFacet/zcfZygote.d.ts +9 -1
  28. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  29. package/src/contractFacet/zcfZygote.js +27 -9
  30. package/src/contractSupport/atomicTransfer.d.ts +6 -0
  31. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  32. package/src/contractSupport/atomicTransfer.js +4 -0
  33. package/src/contractSupport/bondingCurves.js +1 -1
  34. package/src/contractSupport/durability.d.ts +1 -0
  35. package/src/contractSupport/durability.d.ts.map +1 -1
  36. package/src/contractSupport/durability.js +4 -0
  37. package/src/contractSupport/index.d.ts +2 -2
  38. package/src/contractSupport/index.js +2 -19
  39. package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
  40. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  41. package/src/contractSupport/priceAuthorityInitial.js +3 -1
  42. package/src/contractSupport/priceQuote.d.ts +1 -0
  43. package/src/contractSupport/priceQuote.d.ts.map +1 -1
  44. package/src/contractSupport/priceQuote.js +6 -1
  45. package/src/contractSupport/recorder.d.ts +8 -24
  46. package/src/contractSupport/recorder.d.ts.map +1 -1
  47. package/src/contractSupport/recorder.js +6 -0
  48. package/src/contractSupport/types-ambient.d.ts.map +1 -1
  49. package/src/contractSupport/types-ambient.js +1 -0
  50. package/src/contractSupport/zoeHelpers.d.ts +11 -2
  51. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  52. package/src/contractSupport/zoeHelpers.js +7 -2
  53. package/src/contracts/atomicSwap.d.ts +1 -1
  54. package/src/contracts/auction/index.d.ts +3 -3
  55. package/src/contracts/automaticRefund.d.ts +3 -3
  56. package/src/contracts/autoswap.d.ts +4 -0
  57. package/src/contracts/autoswap.d.ts.map +1 -1
  58. package/src/contracts/autoswap.js +4 -0
  59. package/src/contracts/barterExchange.d.ts +2 -2
  60. package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
  61. package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
  62. package/src/contracts/coveredCall-durable.d.ts +1 -1
  63. package/src/contracts/coveredCall.d.ts +1 -1
  64. package/src/contracts/coveredCall.d.ts.map +1 -1
  65. package/src/contracts/coveredCall.js +1 -6
  66. package/src/contracts/loan/index.d.ts +1 -1
  67. package/src/contracts/loan/types-ambient.d.ts +13 -13
  68. package/src/contracts/loan/types-ambient.d.ts.map +1 -1
  69. package/src/contracts/loan/types-ambient.js +17 -17
  70. package/src/contracts/mintPayments.d.ts +2 -2
  71. package/src/contracts/oracle.d.ts +3 -0
  72. package/src/contracts/oracle.d.ts.map +1 -1
  73. package/src/contracts/oracle.js +1 -0
  74. package/src/contracts/priceAggregator.d.ts +2 -0
  75. package/src/contracts/priceAggregator.d.ts.map +1 -1
  76. package/src/contracts/priceAggregator.js +14 -11
  77. package/src/contracts/scaledPriceAuthority.d.ts +1 -0
  78. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  79. package/src/contracts/scaledPriceAuthority.js +1 -0
  80. package/src/contracts/sellItems.d.ts +1 -1
  81. package/src/contracts/simpleExchange.d.ts +5 -0
  82. package/src/contracts/simpleExchange.d.ts.map +1 -1
  83. package/src/contracts/simpleExchange.js +4 -0
  84. package/src/contracts/types-ambient.d.ts +7 -7
  85. package/src/contracts/types-ambient.d.ts.map +1 -1
  86. package/src/contracts/types-ambient.js +7 -7
  87. package/src/contracts/valueVow.contract.d.ts +5 -2
  88. package/src/contracts/valueVow.contract.d.ts.map +1 -1
  89. package/src/contracts/valueVow.contract.js +1 -0
  90. package/src/instanceRecordStorage.d.ts.map +1 -1
  91. package/src/instanceRecordStorage.js +3 -1
  92. package/src/internal-types.d.ts +15 -6
  93. package/src/internal-types.d.ts.map +1 -1
  94. package/src/internal-types.js +9 -5
  95. package/src/issuerRecord.d.ts +3 -2
  96. package/src/issuerRecord.d.ts.map +1 -1
  97. package/src/issuerRecord.js +6 -2
  98. package/src/issuerStorage.d.ts +3 -2
  99. package/src/issuerStorage.d.ts.map +1 -1
  100. package/src/issuerStorage.js +10 -5
  101. package/src/typeGuards.d.ts +10 -5
  102. package/src/typeGuards.d.ts.map +1 -1
  103. package/src/typeGuards.js +9 -6
  104. package/src/types-ambient.d.ts +0 -40
  105. package/src/types-ambient.d.ts.map +1 -1
  106. package/src/types-ambient.js +4 -42
  107. package/src/types-index.d.ts +4 -0
  108. package/src/types-index.js +2 -0
  109. package/src/types.d.ts +29 -0
  110. package/src/types.d.ts.map +1 -0
  111. package/src/types.ts +44 -0
  112. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  113. package/src/zoeService/escrowStorage.js +4 -0
  114. package/src/zoeService/feeMint.d.ts +1 -0
  115. package/src/zoeService/feeMint.d.ts.map +1 -1
  116. package/src/zoeService/feeMint.js +4 -0
  117. package/src/zoeService/installationStorage.d.ts +4 -5
  118. package/src/zoeService/installationStorage.d.ts.map +1 -1
  119. package/src/zoeService/installationStorage.js +8 -8
  120. package/src/zoeService/instanceAdminStorage.d.ts +1 -0
  121. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  122. package/src/zoeService/instanceAdminStorage.js +4 -0
  123. package/src/zoeService/internal-types.d.ts +12 -5
  124. package/src/zoeService/internal-types.d.ts.map +1 -1
  125. package/src/zoeService/internal-types.js +10 -10
  126. package/src/zoeService/invitationQueries.d.ts +3 -3
  127. package/src/zoeService/invitationQueries.js +3 -3
  128. package/src/zoeService/makeInvitation.d.ts +1 -0
  129. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  130. package/src/zoeService/makeInvitation.js +3 -1
  131. package/src/zoeService/offer/burnInvitation.d.ts +1 -1
  132. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
  133. package/src/zoeService/offer/burnInvitation.js +3 -2
  134. package/src/zoeService/offer/offer.d.ts +1 -0
  135. package/src/zoeService/offer/offer.d.ts.map +1 -1
  136. package/src/zoeService/offer/offer.js +3 -1
  137. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  138. package/src/zoeService/originalZoeSeat.js +6 -4
  139. package/src/zoeService/startInstance.d.ts +1 -1
  140. package/src/zoeService/startInstance.d.ts.map +1 -1
  141. package/src/zoeService/startInstance.js +5 -4
  142. package/src/zoeService/types-ambient.d.ts +0 -220
  143. package/src/zoeService/types-ambient.d.ts.map +1 -1
  144. package/src/zoeService/types-ambient.js +4 -323
  145. package/src/zoeService/types.d.ts +238 -0
  146. package/src/zoeService/types.d.ts.map +1 -0
  147. package/src/zoeService/types.ts +307 -0
  148. package/src/zoeService/utils.d.ts +18 -10
  149. package/src/zoeService/utils.test-d.ts +1 -0
  150. package/src/zoeService/zoe.d.ts +11 -1
  151. package/src/zoeService/zoe.d.ts.map +1 -1
  152. package/src/zoeService/zoe.js +8 -1
  153. package/src/zoeService/zoeSeat.d.ts +1 -4
  154. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  155. package/src/zoeService/zoeSeat.js +6 -4
  156. package/src/zoeService/zoeStorageManager.d.ts +5 -5
  157. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  158. package/src/zoeService/zoeStorageManager.js +4 -3
  159. package/tools/fakePriceAuthority.d.ts +3 -2
  160. package/tools/fakePriceAuthority.d.ts.map +1 -1
  161. package/tools/fakePriceAuthority.js +9 -6
  162. package/tools/fakeVatAdmin.d.ts +10 -4
  163. package/tools/fakeVatAdmin.d.ts.map +1 -1
  164. package/tools/fakeVatAdmin.js +21 -10
  165. package/tools/manualPriceAuthority.d.ts +6 -2
  166. package/tools/manualPriceAuthority.d.ts.map +1 -1
  167. package/tools/manualPriceAuthority.js +8 -6
  168. package/tools/scriptedOracle.d.ts +7 -3
  169. package/tools/scriptedOracle.d.ts.map +1 -1
  170. package/tools/scriptedOracle.js +4 -0
  171. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  172. package/tools/scriptedPriceAuthority.js +6 -5
  173. package/tools/setup-zoe.d.ts +12 -6
  174. package/tools/setup-zoe.d.ts.map +1 -1
  175. package/tools/setup-zoe.js +38 -5
  176. package/tools/test-utils.d.ts +10 -6
  177. package/tools/test-utils.d.ts.map +1 -1
  178. package/tools/test-utils.js +6 -2
  179. package/tools/types.d.ts +5 -0
  180. package/tools/types.d.ts.map +1 -1
  181. package/tools/types.js +5 -0
  182. package/src/contractFacet/internal-types.d.ts +0 -8
  183. package/src/contractFacet/internal-types.d.ts.map +0 -1
  184. package/src/contractFacet/internal-types.js +0 -15
  185. package/src/contractFacet/types-ambient.js +0 -1
  186. package/src/contractSupport/ratio.d.ts +0 -37
  187. package/src/contractSupport/ratio.d.ts.map +0 -1
  188. package/src/contractSupport/ratio.js +0 -419
  189. package/src/contractSupport/safeMath.d.ts +0 -11
  190. package/src/contractSupport/safeMath.d.ts.map +0 -1
  191. package/src/contractSupport/safeMath.js +0 -49
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/zoe",
3
- "version": "0.26.3-upgrade-18a-dev-4ee0508.0+4ee0508",
3
+ "version": "0.26.3-upgrade-20-dev-086463b.0+086463b",
4
4
  "description": "Zoe: the Smart Contract Framework for Offer Enforcement",
5
5
  "type": "module",
6
6
  "main": "./src/zoeService/zoe.js",
@@ -43,38 +43,38 @@
43
43
  },
44
44
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
45
45
  "dependencies": {
46
- "@agoric/base-zone": "0.1.1-upgrade-18a-dev-4ee0508.0+4ee0508",
47
- "@agoric/ertp": "0.16.3-upgrade-18a-dev-4ee0508.0+4ee0508",
48
- "@agoric/internal": "0.4.0-upgrade-18a-dev-4ee0508.0+4ee0508",
49
- "@agoric/notifier": "0.7.0-upgrade-18a-dev-4ee0508.0+4ee0508",
50
- "@agoric/store": "0.9.3-upgrade-18a-dev-4ee0508.0+4ee0508",
51
- "@agoric/swingset-liveslots": "0.10.3-upgrade-18a-dev-4ee0508.0+4ee0508",
52
- "@agoric/swingset-vat": "0.33.0-upgrade-18a-dev-4ee0508.0+4ee0508",
53
- "@agoric/time": "0.3.3-upgrade-18a-dev-4ee0508.0+4ee0508",
54
- "@agoric/vat-data": "0.5.3-upgrade-18a-dev-4ee0508.0+4ee0508",
55
- "@agoric/vow": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
56
- "@agoric/zone": "0.3.0-upgrade-18a-dev-4ee0508.0+4ee0508",
57
- "@endo/bundle-source": "^3.5.0",
58
- "@endo/captp": "^4.4.3",
59
- "@endo/common": "^1.2.8",
60
- "@endo/errors": "^1.2.8",
61
- "@endo/eventual-send": "^1.2.8",
62
- "@endo/exo": "^1.5.7",
63
- "@endo/far": "^1.1.9",
64
- "@endo/import-bundle": "^1.3.2",
65
- "@endo/marshal": "^1.6.2",
66
- "@endo/nat": "^5.0.13",
67
- "@endo/pass-style": "^1.4.7",
68
- "@endo/patterns": "^1.4.7",
69
- "@endo/promise-kit": "^1.1.8",
46
+ "@agoric/base-zone": "0.1.1-upgrade-20-dev-086463b.0+086463b",
47
+ "@agoric/ertp": "0.16.3-upgrade-20-dev-086463b.0+086463b",
48
+ "@agoric/internal": "0.3.3-upgrade-20-dev-086463b.0+086463b",
49
+ "@agoric/notifier": "0.6.3-upgrade-20-dev-086463b.0+086463b",
50
+ "@agoric/store": "0.9.3-upgrade-20-dev-086463b.0+086463b",
51
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-20-dev-086463b.0+086463b",
52
+ "@agoric/swingset-vat": "0.32.3-upgrade-20-dev-086463b.0+086463b",
53
+ "@agoric/time": "0.3.3-upgrade-20-dev-086463b.0+086463b",
54
+ "@agoric/vat-data": "0.5.3-upgrade-20-dev-086463b.0+086463b",
55
+ "@agoric/vow": "0.1.1-upgrade-20-dev-086463b.0+086463b",
56
+ "@agoric/zone": "0.2.3-upgrade-20-dev-086463b.0+086463b",
57
+ "@endo/bundle-source": "^4.0.0",
58
+ "@endo/captp": "^4.4.5",
59
+ "@endo/common": "^1.2.10",
60
+ "@endo/errors": "^1.2.10",
61
+ "@endo/eventual-send": "^1.3.1",
62
+ "@endo/exo": "^1.5.9",
63
+ "@endo/far": "^1.1.11",
64
+ "@endo/import-bundle": "^1.4.0",
65
+ "@endo/marshal": "^1.6.4",
66
+ "@endo/nat": "^5.1.0",
67
+ "@endo/pass-style": "^1.5.0",
68
+ "@endo/patterns": "^1.5.0",
69
+ "@endo/promise-kit": "^1.1.10",
70
70
  "yargs-parser": "^21.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@agoric/kmarshal": "0.1.1-upgrade-18a-dev-4ee0508.0+4ee0508",
74
- "@endo/init": "^1.1.7",
73
+ "@agoric/kmarshal": "0.1.1-upgrade-20-dev-086463b.0+086463b",
74
+ "@endo/init": "^1.1.9",
75
75
  "ava": "^5.3.0",
76
76
  "c8": "^10.1.2",
77
- "import-meta-resolve": "^2.2.1",
77
+ "import-meta-resolve": "^4.1.0",
78
78
  "tsd": "^0.31.1"
79
79
  },
80
80
  "files": [
@@ -98,7 +98,7 @@
98
98
  "access": "public"
99
99
  },
100
100
  "typeCoverage": {
101
- "atLeast": 85.06
101
+ "atLeast": 85.15
102
102
  },
103
- "gitHead": "4ee05088e5ada989a866a11ff65838d395505ce6"
103
+ "gitHead": "086463b1a157a30d0382d7dadc56e751f4479028"
104
104
  }
@@ -6,4 +6,6 @@ export function cleanKeywords(uncleanKeywordRecord: {
6
6
  export function coerceAmountPatternKeywordRecord(allegedAmountKeywordRecord: any, getAssetKindByBrand: any): Record<string | number | symbol, any>;
7
7
  export function coerceAmountKeywordRecord(allegedAmountKeywordRecord: unknown, getAssetKindByBrand: any): AmountKeywordRecord;
8
8
  export function cleanProposal(proposal: Proposal, getAssetKindByBrand: GetAssetKindByBrand): ProposalRecord;
9
+ import type { Proposal } from '@agoric/zoe';
10
+ import type { ProposalRecord } from '@agoric/zoe';
9
11
  //# sourceMappingURL=cleanProposal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,iCAAkC,GAAG,CAAC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAcpB;AAEM,mJAsBN;AAQM,sEAJI,OAAO,uBACP,GAAC,GACC,mBAAmB,CAa/B;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B"}
1
+ {"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AASA,iCAAkC,GAAG,CAAC;AAiB/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAcpB;AAEM,mJAsBN;AAQM,sEAJI,OAAO,uBACP,GAAC,GACC,mBAAmB,CAa/B;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B;8BA9JoD,aAAa;oCAAb,aAAa"}
@@ -5,12 +5,14 @@ import { assertRecord } from '@endo/marshal';
5
5
  import { assertKey, assertPattern, mustMatch, isKey } from '@agoric/store';
6
6
  import { FullProposalShape } from './typeGuards.js';
7
7
 
8
- import './internal-types.js';
9
-
10
8
  const { ownKeys } = Reflect;
11
9
 
12
10
  export const MAX_KEYWORD_LENGTH = 100;
13
11
 
12
+ /**
13
+ * @import {ExitRule, Proposal, ProposalRecord} from '@agoric/zoe';
14
+ */
15
+
14
16
  const firstCapASCII = /^[A-Z][a-zA-Z0-9_$]*$/;
15
17
 
16
18
  // We adopt simple requirements on keywords so that they do not accidentally
@@ -1,2 +1,2 @@
1
- export function makeMakeExiter(baggage: any): (proposal: ProposalRecord, zcfSeat: ZCFSeat) => ExitObj;
1
+ export function makeMakeExiter(baggage: any): (proposal: globalThis.ProposalRecord, zcfSeat: globalThis.ZCFSeat) => ExitObj;
2
2
  //# sourceMappingURL=exit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["exit.js"],"names":[],"mappings":"AAwBO,sGAwGN"}
1
+ {"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["exit.js"],"names":[],"mappings":"AAwBO,4HAwGN"}
@@ -1,5 +1,5 @@
1
1
  export function makeOfferHandlerStorage(zcfBaggage: any): {
2
- storeOfferHandler: (offerHandler: any) => Handle<"Invitation">;
2
+ storeOfferHandler: (offerHandler: any) => globalThis.Handle<"Invitation">;
3
3
  takeOfferHandler: (invitationHandle: InvitationHandle, details?: Details) => OfferHandler;
4
4
  };
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AA6BO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;;;sBAlEY,MAAM,GAAG,EAAE;mCASX,2BAAiB,eAAe,GAAG,YAAY;oCAL3B,qBAAqB;qCACpB,kBAAkB"}
1
+ {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AAkCO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;;;sBAlEY,MAAM,GAAG,EAAE;mCASX,2BAAiB,eAAe,GAAG,YAAY;oCAL3B,qBAAqB;qCACpB,kBAAkB"}
@@ -6,6 +6,11 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data';
6
6
 
7
7
  import { defineDurableHandle } from '../makeHandle.js';
8
8
 
9
+ /**
10
+ * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
11
+ * @import {MapStore} from '@agoric/swingset-liveslots';
12
+ */
13
+
9
14
  /**
10
15
  * The following should work. But for some reason, @endo/errors does
11
16
  * not export the type `Details`.
@@ -1 +1 @@
1
- {"version":3,"file":"reallocate.d.ts","sourceRoot":"","sources":["reallocate.js"],"names":[],"mappings":"AAgBO,6CAHI,KAAK,CAAC,YAAY,CAAC,GACjB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CA8E5C;8BAtFa,KAAK,CAAC,mBAAmB,CAAC"}
1
+ {"version":3,"file":"reallocate.d.ts","sourceRoot":"","sources":["reallocate.js"],"names":[],"mappings":"AAoBO,6CAHI,KAAK,CAAC,YAAY,CAAC,GACjB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CA8E5C;8BAtFa,KAAK,CAAC,mBAAmB,CAAC"}
@@ -4,6 +4,10 @@ import { makeScalarMapStore } from '@agoric/vat-data';
4
4
  import { assertRightsConserved } from './rightsConservation.js';
5
5
  import { addToAllocation, subtractFromAllocation } from './allocationMath.js';
6
6
 
7
+ /**
8
+ * @import {MapStore} from '@agoric/swingset-liveslots';
9
+ */
10
+
7
11
  /** @typedef {Array<AmountKeywordRecord>} TransactionList */
8
12
 
9
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"rightsConservation.d.ts","sourceRoot":"","sources":["rightsConservation.js"],"names":[],"mappings":"AAqFA;;;;;;;;;GASG;AACH,uDANW,MAAM,EAAE,cAER,MAAM,EAAE,GAEN,IAAI,CAMhB"}
1
+ {"version":3,"file":"rightsConservation.d.ts","sourceRoot":"","sources":["rightsConservation.js"],"names":[],"mappings":"AAoFA;;;;;;;;;GASG;AACH,uDANW,MAAM,EAAE,cAER,MAAM,EAAE,GAEN,IAAI,CAMhB"}
@@ -2,7 +2,6 @@ import { assert, Fail } from '@endo/errors';
2
2
  import { makeScalarMapStore } from '@agoric/store';
3
3
  import { AmountMath } from '@agoric/ertp';
4
4
 
5
- import '../internal-types.js';
6
5
  /**
7
6
  * @import {MapStore} from '@agoric/store';
8
7
  */
@@ -0,0 +1,184 @@
1
+ import type { AdditionalDisplayInfo, Amount, AnyAmount, AssetKind, Brand, DisplayInfo, Issuer, Payment } from '@agoric/ertp';
2
+ import type { Subscriber } from '@agoric/notifier';
3
+ import type { ERef } from '@endo/far';
4
+ import type { Passable } from '@endo/pass-style';
5
+ import type { Key, Pattern } from '@endo/patterns';
6
+ import type { AmountKeywordRecord, ExitRule, FeeMintAccess, Instance, InvitationDetails, Keyword, ProposalRecord, StandardTerms, UserSeat, ZoeService } from '../types-index.js';
7
+ import type { ContractStartFunction } from '../zoeService/utils.js';
8
+ /**
9
+ * Any passable non-thenable. Often an explanatory string.
10
+ */
11
+ export type Completion = Passable;
12
+ export type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
13
+ export type InvitationAmount = Amount<'set', InvitationDetails>;
14
+ export type ZoeIssuerRecord<K extends AssetKind = AssetKind, M extends Key = Key> = {
15
+ brand: Brand<K>;
16
+ issuer: Issuer<K, M>;
17
+ assetKind: K;
18
+ displayInfo?: DisplayInfo<K>;
19
+ };
20
+ export type Allocation = Record<Keyword, AnyAmount>;
21
+ /**
22
+ * 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
+ export type ZCF<CT = Record<string, unknown>> = {
31
+ /**
32
+ * - atomically reallocate amounts among seats.
33
+ */
34
+ atomicRearrange: (transfers: TransferPart[]) => void;
35
+ /**
36
+ * - check
37
+ * whether a keyword is valid and unique and could be added in
38
+ * `saveIssuer`
39
+ */
40
+ assertUniqueKeyword: (keyword: Keyword) => void;
41
+ /**
42
+ * Informs Zoe about an issuer and returns a promise for acknowledging
43
+ * when the issuer is added and ready.
44
+ *
45
+ * @returns the AmountMath and brand synchronously accessible after
46
+ * saving
47
+ */
48
+ saveIssuer: <I extends Issuer>(issuerP: ERef<I>, keyword: Keyword) => Promise<I extends Issuer<infer K, infer M> ? ZoeIssuerRecord<K, M> : never>;
49
+ /**
50
+ * Make a credible Zoe invitation for a particular smart contract
51
+ * indicated by the `instance` in the details of the invitation. Zoe
52
+ * also puts the `installation` and a unique `handle` in the details
53
+ * of the invitation. The contract must provide a `description` for
54
+ * the invitation and should include whatever information is necessary
55
+ * for a potential buyer of the invitation to know what they are
56
+ * getting in the `customDetails`. `customDetails` will be
57
+ * placed in the details of the invitation.
58
+ */
59
+ makeInvitation: <R, A = undefined>(offerHandler: OfferHandler<ERef<R>, A>, description: string, customDetails?: object, proposalShape?: Pattern) => Promise<Invitation<R, A>>;
60
+ shutdown: (completion: Completion) => void;
61
+ shutdownWithFailure: import('@agoric/swingset-vat').ShutdownWithFailure;
62
+ getZoeService: () => ERef<ZoeService>;
63
+ getInvitationIssuer: () => Issuer<'set'>;
64
+ getTerms: () => StandardTerms & CT;
65
+ getBrandForIssuer: <K extends AssetKind>(issuer: Issuer<K>) => Brand<K>;
66
+ getIssuerForBrand: <K_1 extends AssetKind>(brand: Brand<K_1>) => Issuer<K_1>;
67
+ getAssetKind: (brand: Brand) => AssetKind;
68
+ makeZCFMint: <K_2 extends AssetKind = 'nat'>(keyword: Keyword, assetKind?: K_2 | undefined, displayInfo?: AdditionalDisplayInfo, options?: import('@agoric/ertp').IssuerOptionsRecord) => Promise<ZCFMint<K_2>>;
69
+ registerFeeMint: ZCFRegisterFeeMint;
70
+ makeEmptySeatKit: ZCFMakeEmptySeatKit;
71
+ setTestJig: SetTestJig;
72
+ stopAcceptingOffers: () => Promise<void>;
73
+ setOfferFilter: (strings: Array<string>) => Promise<void>;
74
+ getOfferFilter: () => Promise<Array<string>>;
75
+ getInstance: () => Instance;
76
+ };
77
+ export type TransferPart = [
78
+ fromSeat?: ZCFSeat,
79
+ toSeat?: ZCFSeat,
80
+ fromAmounts?: AmountKeywordRecord,
81
+ toAmounts?: AmountKeywordRecord
82
+ ];
83
+ export type ZCFRegisterFeeMint = (keyword: Keyword, allegedFeeMintAccess: FeeMintAccess) => Promise<ZCFMint<'nat'>>;
84
+ /**
85
+ * Provide a jig object for testing purposes only.
86
+ *
87
+ * The contract code provides a callback whose return result will
88
+ * be made available to the test that started this contract. The
89
+ * supplied callback will only be called in a testing context,
90
+ * never in production; i.e., it is only called if `testJigSetter`
91
+ * was supplied.
92
+ *
93
+ * If no `testFn` is supplied, then an empty jig will be used.
94
+ * An additional `zcf` property set to the current ContractFacet
95
+ * will be appended to the returned jig object (overriding any
96
+ * provided by the `testFn`).
97
+ */
98
+ export type SetTestJig = (testFn?: () => Record<string, unknown>) => void;
99
+ export type ZCFMint<K extends AssetKind = AssetKind> = {
100
+ getIssuerRecord: () => ZoeIssuerRecord<K>;
101
+ /**
102
+ * All the amounts in gains must be of this ZCFMint's brand.
103
+ * The gains' keywords are in the namespace of that seat.
104
+ * Add the gains to that seat's allocation.
105
+ * The resulting state must be offer safe. (Currently, increasing assets can
106
+ * never violate offer safety anyway.)
107
+ *
108
+ * Mint that amount of assets into the pooled purse.
109
+ * If a seat is provided, it is returned. Otherwise a new seat is
110
+ * returned.
111
+ */
112
+ mintGains: (gains: AmountKeywordRecord, zcfSeat?: ZCFSeat) => ZCFSeat;
113
+ /**
114
+ * All the amounts in losses must be of this ZCFMint's brand.
115
+ * The losses' keywords are in the namespace of that seat.
116
+ * Subtract losses from that seat's allocation.
117
+ * The resulting state must be offer safe.
118
+ *
119
+ * Burn that amount of assets from the pooled purse.
120
+ */
121
+ burnLosses: (losses: AmountKeywordRecord, zcfSeat: ZCFSeat) => void;
122
+ };
123
+ /**
124
+ * fail called with the reason for this failure, where reason is
125
+ * normally an instanceof Error.
126
+ */
127
+ export type ZCFSeatFail = (reason: unknown) => Error;
128
+ export type ZCFSeat = import('@endo/pass-style').RemotableObject & {
129
+ exit: (completion?: Completion) => void;
130
+ fail: ZCFSeatFail;
131
+ getSubscriber: () => Promise<Subscriber<Allocation>>;
132
+ hasExited: () => boolean;
133
+ getProposal: () => ProposalRecord;
134
+ /**
135
+ * @param brand used for filling in an empty amount if the `keyword`
136
+ * is not present in the allocation
137
+ */
138
+ getAmountAllocated: <B extends Brand<any>>(keyword: Keyword, brand?: B) => B extends Brand<infer K> ? Amount<K> : Amount;
139
+ getCurrentAllocation: () => Allocation;
140
+ isOfferSafe: (newAllocation: Allocation) => boolean;
141
+ };
142
+ export type ZcfSeatKit = {
143
+ zcfSeat: ZCFSeat;
144
+ userSeat: Promise<UserSeat>;
145
+ };
146
+ export type HandleOffer<OR, OA> = (seat: ZCFSeat, offerArgs: OA) => OR;
147
+ export type OfferHandler<OR = unknown, OA = never> = HandleOffer<OR, OA> | {
148
+ handle: HandleOffer<OR, OA>;
149
+ };
150
+ export type ContractMeta<SF extends ContractStartFunction = ContractStartFunction> = {
151
+ customTermsShape?: Record<Parameters<SF>[0] extends ZCF<infer CT> ? keyof CT : never, Pattern>;
152
+ privateArgsShape?: {
153
+ [K in keyof Parameters<SF>[1]]: Pattern;
154
+ };
155
+ /**
156
+ * - `none` means that the contract is not upgradable.
157
+ * - `canUpgrade` means this code can perform an upgrade
158
+ * - `canBeUpgraded` means that the contract stores kinds durably such that the next version can upgrade
159
+ */
160
+ upgradability?: 'none' | 'canBeUpgraded' | 'canUpgrade' | undefined;
161
+ };
162
+ /**
163
+ * API for a contract start function.
164
+ *
165
+ * CAVEAT: assumes synchronous
166
+ */
167
+ export type ContractStartFn<PF = any, CF = any, CT = any, PA = any> = (zcf: ZCF<CT>, privateArgs: PA, baggage: import('@agoric/vat-data').Baggage) => ContractStartFnResult<PF, CF>;
168
+ export type ContractStartFnResult<PF, CF> = {
169
+ publicFacet?: PF;
170
+ creatorFacet?: CF;
171
+ creatorInvitation?: Promise<Invitation<any, any>> | undefined;
172
+ };
173
+ /**
174
+ * @deprecated use the parameterized version
175
+ */
176
+ export type AdminFacet = import('../zoeService/utils.js').AdminFacet<any>;
177
+ declare const OfferReturn: unique symbol;
178
+ declare const OfferArgs: unique symbol;
179
+ export type Invitation<R = unknown, A = undefined> = Payment<'set', InvitationDetails> & {
180
+ [OfferReturn]?: R;
181
+ [OfferArgs]?: A;
182
+ };
183
+ export {};
184
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,SAAS,EACT,SAAS,EACT,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACR,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,E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M,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,SAAS,IAAI,OAAO,CAC1D,KAAK,EACL,iBAAiB,CAClB,GAAG;IAEF,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;CACjB,CAAC"}
@@ -1,14 +1,49 @@
1
- /// <reference types="@agoric/ertp/exported" />
2
- /// <reference types="@endo/pass-style" />
3
- /// <reference path="../zoeService/utils.d.ts" />
1
+ import type {
2
+ AdditionalDisplayInfo,
3
+ Amount,
4
+ AnyAmount,
5
+ AssetKind,
6
+ Brand,
7
+ DisplayInfo,
8
+ Issuer,
9
+ Payment,
10
+ } from '@agoric/ertp';
11
+ import type { Subscriber } from '@agoric/notifier';
12
+ import type { ERef } from '@endo/far';
13
+ import type { Passable } from '@endo/pass-style';
14
+ import type { Key, Pattern } from '@endo/patterns';
15
+ import type {
16
+ AmountKeywordRecord,
17
+ ExitRule,
18
+ FeeMintAccess,
19
+ Instance,
20
+ InvitationDetails,
21
+ Keyword,
22
+ ProposalRecord,
23
+ StandardTerms,
24
+ UserSeat,
25
+ ZoeService,
26
+ } from '../types-index.js';
27
+ import type { ContractStartFunction } from '../zoeService/utils.js';
4
28
 
5
29
  /**
6
30
  * Any passable non-thenable. Often an explanatory string.
7
31
  */
8
- type Completion = import('@endo/pass-style').Passable;
9
- type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
32
+ export type Completion = Passable;
33
+ export type ZCFMakeEmptySeatKit = (exit?: ExitRule | undefined) => ZcfSeatKit;
10
34
 
11
- type InvitationAmount = Amount<'set', InvitationDetails>;
35
+ export type InvitationAmount = Amount<'set', InvitationDetails>;
36
+
37
+ export type ZoeIssuerRecord<
38
+ K extends AssetKind = AssetKind,
39
+ M extends Key = Key,
40
+ > = {
41
+ brand: Brand<K>;
42
+ issuer: Issuer<K, M>;
43
+ assetKind: K;
44
+ displayInfo?: DisplayInfo<K>;
45
+ };
46
+ export type Allocation = Record<Keyword, AnyAmount>;
12
47
 
13
48
  /**
14
49
  * Zoe Contract Facet
@@ -19,16 +54,11 @@ type InvitationAmount = Amount<'set', InvitationDetails>;
19
54
  * synchronously from within the contract, and usually is referred to
20
55
  * in code as zcf.
21
56
  */
22
- type ZCF<CT extends unknown = Record<string, unknown>> = {
57
+ export type ZCF<CT = Record<string, unknown>> = {
23
58
  /**
24
59
  * - atomically reallocate amounts among seats.
25
60
  */
26
61
  atomicRearrange: (transfers: TransferPart[]) => void;
27
- /**
28
- * - reallocate amounts among seats.
29
- * @deprecated Use atomicRearrange instead.
30
- */
31
- reallocate: Reallocate;
32
62
  /**
33
63
  * - check
34
64
  * whether a keyword is valid and unique and could be added in
@@ -45,7 +75,9 @@ type ZCF<CT extends unknown = Record<string, unknown>> = {
45
75
  saveIssuer: <I extends Issuer>(
46
76
  issuerP: ERef<I>,
47
77
  keyword: Keyword,
48
- ) => Promise<I extends Issuer<infer K, infer M> ? IssuerRecord<K, M> : never>;
78
+ ) => Promise<
79
+ I extends Issuer<infer K, infer M> ? ZoeIssuerRecord<K, M> : never
80
+ >;
49
81
 
50
82
  /**
51
83
  * Make a credible Zoe invitation for a particular smart contract
@@ -70,7 +102,7 @@ type ZCF<CT extends unknown = Record<string, unknown>> = {
70
102
  getTerms: () => StandardTerms & CT;
71
103
  getBrandForIssuer: <K extends AssetKind>(issuer: Issuer<K>) => Brand<K>;
72
104
  getIssuerForBrand: <K_1 extends AssetKind>(brand: Brand<K_1>) => Issuer<K_1>;
73
- getAssetKind: GetAssetKindByBrand;
105
+ getAssetKind: (brand: Brand) => AssetKind;
74
106
  makeZCFMint: <K_2 extends AssetKind = 'nat'>(
75
107
  keyword: Keyword,
76
108
  assetKind?: K_2 | undefined,
@@ -86,42 +118,14 @@ type ZCF<CT extends unknown = Record<string, unknown>> = {
86
118
  getInstance: () => Instance;
87
119
  };
88
120
 
89
- /**
90
- * @deprecated Use atomicRearrange instead
91
- *
92
- * The contract can reallocate over seats, which commits the staged
93
- * allocation for each seat. On commit, the staged allocation becomes
94
- * the current allocation and the staged allocation is deleted.
95
- *
96
- * The reallocation will only succeed if the reallocation 1) conserves
97
- * rights (the amounts specified have the same total value as the
98
- * current total amount), and 2) is 'offer-safe' for all parties
99
- * involved. All seats that have staged allocations must be included
100
- * as arguments to `reallocate`, or an error is thrown. Additionally,
101
- * an error is thrown if any seats included in `reallocate` do not
102
- * have a staged allocation.
103
- *
104
- * The reallocation is partial, meaning that it applies only to the
105
- * seats passed in as arguments. By induction, if rights conservation
106
- * and offer safety hold before, they will hold after a safe
107
- * reallocation, even though we only re-validate for the seats whose
108
- * allocations will change. Since rights are conserved for the change,
109
- * overall rights will be unchanged, and a reallocation can only
110
- * effect offer safety for seats whose allocations change.
111
- */
112
- type Reallocate = (
113
- seat1: ZCFSeat,
114
- seat2: ZCFSeat,
115
- ...seatRest: Array<ZCFSeat>
116
- ) => void;
117
- type TransferPart = [
121
+ export type TransferPart = [
118
122
  fromSeat?: ZCFSeat,
119
123
  toSeat?: ZCFSeat,
120
124
  fromAmounts?: AmountKeywordRecord,
121
125
  toAmounts?: AmountKeywordRecord,
122
126
  ];
123
127
 
124
- type ZCFRegisterFeeMint = (
128
+ export type ZCFRegisterFeeMint = (
125
129
  keyword: Keyword,
126
130
  allegedFeeMintAccess: FeeMintAccess,
127
131
  ) => Promise<ZCFMint<'nat'>>;
@@ -139,9 +143,9 @@ type ZCFRegisterFeeMint = (
139
143
  * will be appended to the returned jig object (overriding any
140
144
  * provided by the `testFn`).
141
145
  */
142
- type SetTestJig = (testFn?: () => Record<string, unknown>) => void;
143
- type ZCFMint<K extends AssetKind = AssetKind> = {
144
- getIssuerRecord: () => IssuerRecord<K>;
146
+ export type SetTestJig = (testFn?: () => Record<string, unknown>) => void;
147
+ export type ZCFMint<K extends AssetKind = AssetKind> = {
148
+ getIssuerRecord: () => ZoeIssuerRecord<K>;
145
149
  /**
146
150
  * All the amounts in gains must be of this ZCFMint's brand.
147
151
  * The gains' keywords are in the namespace of that seat.
@@ -168,8 +172,8 @@ type ZCFMint<K extends AssetKind = AssetKind> = {
168
172
  * fail called with the reason for this failure, where reason is
169
173
  * normally an instanceof Error.
170
174
  */
171
- type ZCFSeatFail = (reason: unknown) => Error;
172
- type ZCFSeat = import('@endo/pass-style').RemotableObject & {
175
+ export type ZCFSeatFail = (reason: unknown) => Error;
176
+ export type ZCFSeat = import('@endo/pass-style').RemotableObject & {
173
177
  exit: (completion?: Completion) => void;
174
178
  fail: ZCFSeatFail;
175
179
  getSubscriber: () => Promise<Subscriber<Allocation>>;
@@ -179,50 +183,26 @@ type ZCFSeat = import('@endo/pass-style').RemotableObject & {
179
183
  * @param brand used for filling in an empty amount if the `keyword`
180
184
  * is not present in the allocation
181
185
  */
182
- getAmountAllocated: <B extends Brand>(
186
+ getAmountAllocated: <B extends Brand<any>>(
183
187
  keyword: Keyword,
184
188
  brand?: B,
185
189
  ) => B extends Brand<infer K> ? Amount<K> : Amount;
186
190
  getCurrentAllocation: () => Allocation;
187
- /**
188
- * @deprecated Use atomicRearrange instead
189
- */
190
- getStagedAllocation: () => Allocation;
191
- /**
192
- * @deprecated Use atomicRearrange instead
193
- */
194
- hasStagedAllocation: () => boolean;
195
191
  isOfferSafe: (newAllocation: Allocation) => boolean;
196
- /**
197
- * @deprecated Use atomicRearrange instead
198
- */
199
- incrementBy: (
200
- amountKeywordRecord: AmountKeywordRecord,
201
- ) => AmountKeywordRecord;
202
- /**
203
- * @deprecated Use atomicRearrange instead
204
- */
205
- decrementBy: (
206
- amountKeywordRecord: AmountKeywordRecord,
207
- ) => AmountKeywordRecord;
208
- /**
209
- * @deprecated Use atomicRearrange instead
210
- */
211
- clear: () => void;
212
192
  };
213
- type ZcfSeatKit = {
193
+ export type ZcfSeatKit = {
214
194
  zcfSeat: ZCFSeat;
215
195
  userSeat: Promise<UserSeat>;
216
196
  };
217
- type HandleOffer<OR extends unknown, OA> = (seat: ZCFSeat, offerArgs: OA) => OR;
218
- type OfferHandler<OR extends unknown = unknown, OA = never> =
197
+ export type HandleOffer<OR, OA> = (seat: ZCFSeat, offerArgs: OA) => OR;
198
+ export type OfferHandler<OR = unknown, OA = never> =
219
199
  | HandleOffer<OR, OA>
220
200
  | {
221
201
  handle: HandleOffer<OR, OA>;
222
202
  };
223
- type ContractMeta<
203
+ export type ContractMeta<
224
204
  SF extends // import inline to maintain ambient mode
225
- import('../zoeService/utils').ContractStartFunction = import('../zoeService/utils').ContractStartFunction,
205
+ ContractStartFunction = ContractStartFunction,
226
206
  > = {
227
207
  customTermsShape?: Record<
228
208
  Parameters<SF>[0] extends ZCF<infer CT> ? keyof CT : never,
@@ -241,30 +221,25 @@ type ContractMeta<
241
221
  *
242
222
  * CAVEAT: assumes synchronous
243
223
  */
244
- type ContractStartFn<
245
- PF extends unknown = any,
246
- CF extends unknown = any,
247
- CT extends unknown = any,
248
- PA extends unknown = any,
249
- > = (
224
+ export type ContractStartFn<PF = any, CF = any, CT = any, PA = any> = (
250
225
  zcf: ZCF<CT>,
251
226
  privateArgs: PA,
252
227
  baggage: import('@agoric/vat-data').Baggage,
253
228
  ) => ContractStartFnResult<PF, CF>;
254
- type ContractStartFnResult<PF, CF> = {
229
+ export type ContractStartFnResult<PF, CF> = {
255
230
  publicFacet?: PF;
256
231
  creatorFacet?: CF;
257
232
  creatorInvitation?: Promise<Invitation<any, any>> | undefined;
258
233
  };
259
234
 
260
- // XXX redef, losing documentation
261
- type ContractOf<S extends (...args: any) => any> =
262
- import('../zoeService/utils').ContractOf<S>;
263
- type AdminFacet = import('../zoeService/utils').AdminFacet<any>;
235
+ /**
236
+ * @deprecated use the parameterized version
237
+ */
238
+ export type AdminFacet = import('../zoeService/utils.js').AdminFacet<any>;
264
239
 
265
240
  declare const OfferReturn: unique symbol;
266
241
  declare const OfferArgs: unique symbol;
267
- type Invitation<R = unknown, A = undefined> = Payment<
242
+ export type Invitation<R = unknown, A = undefined> = Payment<
268
243
  'set',
269
244
  InvitationDetails
270
245
  > & {