@dimes-dot-fi/sdk 2.4.0 → 2.7.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 (44) hide show
  1. package/README.md +16 -0
  2. package/dist/{aliases-Dne14KBa.d.cts → aliases-BI1c3Yt0.d.cts} +981 -787
  3. package/dist/{aliases-Dne14KBa.d.ts → aliases-BI1c3Yt0.d.ts} +981 -787
  4. package/dist/{chunk-KNGEIWFR.cjs → chunk-ERM4WP6D.cjs} +8 -4
  5. package/dist/chunk-ERM4WP6D.cjs.map +1 -0
  6. package/dist/{chunk-LXZAXWLO.mjs → chunk-GA7ZBK6W.mjs} +8 -4
  7. package/dist/chunk-GA7ZBK6W.mjs.map +1 -0
  8. package/dist/{chunk-Q34TMZ5J.mjs → chunk-HJ5EVO5A.mjs} +11 -6
  9. package/dist/chunk-HJ5EVO5A.mjs.map +1 -0
  10. package/dist/{chunk-IZI65LZF.cjs → chunk-L273PAD4.cjs} +14 -9
  11. package/dist/chunk-L273PAD4.cjs.map +1 -0
  12. package/dist/contract/index.cjs +1487 -136
  13. package/dist/contract/index.cjs.map +1 -1
  14. package/dist/contract/index.d.cts +135 -8
  15. package/dist/contract/index.d.ts +135 -8
  16. package/dist/contract/index.mjs +1470 -119
  17. package/dist/contract/index.mjs.map +1 -1
  18. package/dist/{dimes-client-DJ1d_p31.d.ts → dimes-client-C4SsCNrZ.d.cts} +48 -3
  19. package/dist/{dimes-client-D9tohawC.d.cts → dimes-client-Ckn8yRG6.d.ts} +48 -3
  20. package/dist/{dimes-error-E9yPAZb-.d.cts → dimes-error-BRysMNV_.d.cts} +2 -2
  21. package/dist/{dimes-error-hSoOierP.d.ts → dimes-error-Ke7yuX1m.d.ts} +2 -2
  22. package/dist/index.cjs +78 -8
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +10 -9
  25. package/dist/index.d.ts +10 -9
  26. package/dist/index.mjs +74 -4
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{quote-sWguOcoJ.d.cts → quote-06n723we.d.ts} +7 -2
  29. package/dist/{quote-D4QunMtN.d.ts → quote-CcIqLwKb.d.cts} +7 -2
  30. package/dist/react/index.cjs +34 -33
  31. package/dist/react/index.cjs.map +1 -1
  32. package/dist/react/index.d.cts +12 -8
  33. package/dist/react/index.d.ts +12 -8
  34. package/dist/react/index.mjs +7 -6
  35. package/dist/react/index.mjs.map +1 -1
  36. package/dist/{types-Bvj_WDbX.d.cts → types-B881zrxm.d.cts} +1 -1
  37. package/dist/{types-BHU4Qq7e.d.ts → types-CcoiGMbT.d.ts} +1 -1
  38. package/dist/ws/index.d.cts +3 -3
  39. package/dist/ws/index.d.ts +3 -3
  40. package/package.json +1 -1
  41. package/dist/chunk-IZI65LZF.cjs.map +0 -1
  42. package/dist/chunk-KNGEIWFR.cjs.map +0 -1
  43. package/dist/chunk-LXZAXWLO.mjs.map +0 -1
  44. package/dist/chunk-Q34TMZ5J.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { Abi, Address, Hex } from 'viem';
2
2
  export { Address, Hex } from 'viem';
3
- import { Q as Quote, e as ContractInfo } from '../aliases-Dne14KBa.cjs';
4
- import { D as DimesClient } from '../dimes-client-D9tohawC.cjs';
5
- import { D as DimesContractError } from '../dimes-error-E9yPAZb-.cjs';
3
+ import { Q as Quote, f as ContractInfo } from '../aliases-BI1c3Yt0.cjs';
4
+ import { D as DimesClient } from '../dimes-client-C4SsCNrZ.cjs';
5
+ import { a as DimesContractError } from '../dimes-error-BRysMNV_.cjs';
6
6
 
7
7
  declare const vaultAbi: Abi;
8
8
  declare const erc20Abi: readonly [{
@@ -59,6 +59,73 @@ interface CreatePositionTxData {
59
59
  bigint
60
60
  ];
61
61
  }
62
+ interface CreatePositionWithMarginTxData {
63
+ address: `0x${string}`;
64
+ abi: Abi;
65
+ functionName: "createPositionWithMargin";
66
+ args: readonly [
67
+ `0x${string}`,
68
+ `0x${string}`,
69
+ bigint,
70
+ bigint,
71
+ number,
72
+ bigint,
73
+ number,
74
+ number,
75
+ number,
76
+ bigint,
77
+ bigint,
78
+ `0x${string}`,
79
+ bigint
80
+ ];
81
+ }
82
+ interface CreatePositionWithVersionTxData {
83
+ address: `0x${string}`;
84
+ abi: Abi;
85
+ functionName: "createPositionWithVersion";
86
+ args: readonly [
87
+ `0x${string}`,
88
+ `0x${string}`,
89
+ bigint,
90
+ bigint,
91
+ number,
92
+ bigint,
93
+ number,
94
+ number,
95
+ number,
96
+ bigint,
97
+ number,
98
+ `0x${string}`,
99
+ bigint
100
+ ];
101
+ }
102
+ interface CreatePositionWithMarginAndVersionTxData {
103
+ address: `0x${string}`;
104
+ abi: Abi;
105
+ functionName: "createPositionWithMarginAndVersion";
106
+ args: readonly [
107
+ `0x${string}`,
108
+ `0x${string}`,
109
+ bigint,
110
+ bigint,
111
+ number,
112
+ bigint,
113
+ number,
114
+ number,
115
+ number,
116
+ bigint,
117
+ bigint,
118
+ number,
119
+ `0x${string}`,
120
+ bigint
121
+ ];
122
+ }
123
+ /**
124
+ * What {@link buildCreatePositionTx} returns: the plain call for an adaptive quote, the
125
+ * margin-bearing call for a committed one, and their `...Version` twins for a Polymarket
126
+ * Protocol V2 quote.
127
+ */
128
+ type OpenPositionTxData = CreatePositionTxData | CreatePositionWithMarginTxData | CreatePositionWithVersionTxData | CreatePositionWithMarginAndVersionTxData;
62
129
  interface ApproveTxData {
63
130
  address: `0x${string}`;
64
131
  abi: typeof erc20Abi;
@@ -77,11 +144,53 @@ interface RequestPartialCloseTxData {
77
144
  functionName: "requestPartialClose";
78
145
  args: readonly [`0x${string}`, bigint];
79
146
  }
80
- declare function buildCreatePositionTx(quote: Quote): CreatePositionTxData;
147
+ /**
148
+ * Build the vault call that opens the position this quote was signed for.
149
+ *
150
+ * The quote names its own mode in `riskMode`: a committed-mode quote
151
+ * is signed over a different EIP-712 type and opens through `createPositionWithMargin`, which
152
+ * pulls `marginUsdcUnits` on top of collateral and fees. A Polymarket Protocol V2 quote
153
+ * (`polymarketProtocolVersion` 2) is signed over a type that also carries the version and opens
154
+ * through `createPositionWithVersion` / `createPositionWithMarginAndVersion`. Submitting one
155
+ * quote's signature to another entry point always reverts, so the call is read off the quote
156
+ * rather than left to the caller.
157
+ *
158
+ * `quote.totalUserAmountUsdcUnits` already includes the margin — approve that amount.
159
+ */
160
+ declare function buildCreatePositionTx(quote: Quote): OpenPositionTxData;
81
161
  declare function buildApproveTx(usdcAddress: `0x${string}`, spender: `0x${string}`, amount: bigint): ApproveTxData;
82
162
  declare function buildRequestCloseTx(vaultAddress: `0x${string}`, positionKey: `0x${string}`): RequestCloseTxData;
83
163
  declare function buildRequestPartialCloseTx(vaultAddress: `0x${string}`, positionKey: `0x${string}`, closeTokenUnits: bigint): RequestPartialCloseTxData;
84
164
 
165
+ /**
166
+ * Whether this quote opens in committed mode — a fixed ladder of price-triggered unwinds,
167
+ * backed by extra margin locked in the vault.
168
+ *
169
+ * Read from `riskMode`, the quote's own statement of the mode it was issued in, so a quote
170
+ * issued before committed mode existed reads as adaptive. Asking for committed mode does not
171
+ * guarantee getting it: when the market, price or leverage rules it out the request is rejected
172
+ * with `quote_committed_risk_mode_unavailable`, and a partner without the beta feature enabled
173
+ * is rejected with `beta_feature_not_enabled`.
174
+ */
175
+ declare function isCommittedQuote(quote: Quote): boolean;
176
+
177
+ /**
178
+ * The Polymarket share ledgers a quote can be issued on, numbered as the vault numbers them:
179
+ * `1` is the Conditional Tokens contract (CTF), `2` is Polymarket Protocol V2 (PositionManager).
180
+ */
181
+ declare const polymarketProtocolVersions: {
182
+ readonly ctf: 1;
183
+ readonly positionManager: 2;
184
+ };
185
+ /**
186
+ * Whether this quote is for a Polymarket Protocol V2 market.
187
+ *
188
+ * A version 2 quote is signed over a separate EIP-712 type carrying `protocolVersion`, and opens
189
+ * through the `...WithVersion` / `...WithMarginAndVersion` entry points; the create functions without
190
+ * a version reject it. A quote from an API that predates the field reads as version 1.
191
+ */
192
+ declare function isProtocolV2Quote(quote: Quote): boolean;
193
+
85
194
  /**
86
195
  * Helpers for opening and closing positions from a Polymarket **deposit wallet** (DW).
87
196
  *
@@ -92,6 +201,7 @@ declare function buildRequestPartialCloseTx(vaultAddress: `0x${string}`, positio
92
201
  * 1. `vault.reserveDeposit(totalUserAmount)` — snapshot the vault pUSD balance
93
202
  * 2. `pUSD.transfer(vault, totalUserAmount)` — push the funds directly
94
203
  * 3. `vault.createPositionPushFunded(...)` — verify the balance delta + create
204
+ * (or its `...WithMargin` / `...WithVersion` / `...WithMarginAndVersion` twin, read off the quote)
95
205
  *
96
206
  * Closing follows the same batch mechanics with a single inner call, `requestClose`.
97
207
  */
@@ -142,7 +252,14 @@ declare const depositWalletBatchTypes: {
142
252
  * Build the three inner calls for a push-funded `createPosition`.
143
253
  *
144
254
  * The relayer submits these atomically; `quote.totalUserAmountUsdcUnits` is the
145
- * contract-ready amount (collateral + fees) used for both the reservation and the transfer.
255
+ * contract-ready amount (collateral + fees + committed-mode margin) used for both the
256
+ * reservation and the transfer. The vault checks the pushed amount for exact equality, so
257
+ * a committed quote whose margin was left out of the transfer reverts the whole batch.
258
+ *
259
+ * A committed quote is opened through `createPositionPushFundedWithMargin`, and a Polymarket
260
+ * Protocol V2 quote through `createPositionPushFundedWithVersion` /
261
+ * `createPositionPushFundedWithMarginAndVersion`, all chosen from the quote itself — see
262
+ * {@link isCommittedQuote} and {@link isProtocolV2Quote}.
146
263
  *
147
264
  * @param quote - the signed quote returned by the quote endpoint
148
265
  * @param pUsdAddress - the pUSD (USDC) token address (from `GET /contract-info`)
@@ -241,6 +358,14 @@ interface BuildRelayerHeadersParams {
241
358
  */
242
359
  declare function buildRelayerAuthHeaders(params: BuildRelayerHeadersParams): Promise<Record<string, string>>;
243
360
 
361
+ /**
362
+ * Recover the address that signed this quote.
363
+ *
364
+ * A committed-mode quote is signed over `CreatePositionWithMargin`, a separate EIP-712 type
365
+ * carrying `marginUsdcUnits`, and a Polymarket Protocol V2 quote over `CreatePositionWithVersion` /
366
+ * `CreatePositionWithMarginAndVersion`, which also carry `protocolVersion`. Recovering against the
367
+ * wrong type would yield a garbage address, so the type is chosen from the quote itself.
368
+ */
244
369
  declare function recoverCreatePositionSigner(quote: Quote, userAddress: `0x${string}`): Promise<`0x${string}`>;
245
370
  declare function resolveExpectedSigner(apiSigner: string | undefined): `0x${string}` | undefined;
246
371
  /**
@@ -264,7 +389,9 @@ declare const verifyOfferSignature: typeof verifyQuoteSignature;
264
389
 
265
390
  /**
266
391
  * Verify a quote's signature against the on-chain authority (using the client's
267
- * cached `/contract-info`) and then build the `createPosition` transaction.
392
+ * cached `/contract-info`) and then build the transaction that opens the position —
393
+ * `createPosition`, `createPositionWithMargin` for a committed-mode quote, or their
394
+ * `...Version` twins for a Polymarket Protocol V2 quote.
268
395
  *
269
396
  * Prefer this over the raw {@link buildCreatePositionTx} so a tampered or stale
270
397
  * quote fails fast in the client instead of reverting on-chain. Throws
@@ -273,7 +400,7 @@ declare const verifyOfferSignature: typeof verifyQuoteSignature;
273
400
  * @param userAddress - the wallet that will submit the tx (the signed `user`,
274
401
  * bound to `msg.sender` by the contract).
275
402
  */
276
- declare function buildVerifiedCreatePositionTx(client: DimesClient, quote: Quote, userAddress: `0x${string}`): Promise<CreatePositionTxData>;
403
+ declare function buildVerifiedCreatePositionTx(client: DimesClient, quote: Quote, userAddress: `0x${string}`): Promise<OpenPositionTxData>;
277
404
  /**
278
405
  * Verify a quote's signature (see {@link buildVerifiedCreatePositionTx}) and then
279
406
  * build the push-funded deposit-wallet calls. Prefer this over the raw
@@ -290,4 +417,4 @@ declare function buildVerifiedPushFundedCreateCalls(client: DimesClient, quote:
290
417
 
291
418
  declare function formatContractError(err: unknown): DimesContractError;
292
419
 
293
- export { type ApproveTxData, type CreatePositionTxData, type DepositWalletBatch, type DepositWalletCall, type RequestCloseTxData, type RequestPartialCloseTxData, assertQuoteSigner, buildApproveTx, buildCreatePositionTx, buildDepositWalletBatch, buildPushFundedCreateCalls, buildRelayerAuthHeaders, buildRelayerSubmitPayload, buildRequestCloseCalls, buildRequestCloseTx, buildRequestPartialCloseCalls, buildRequestPartialCloseTx, buildVerifiedCreatePositionTx, buildVerifiedPushFundedCreateCalls, depositWalletBatchTypes, depositWalletFactoryAddress, erc20Abi, formatContractError, getCachedContractInfo, getDepositWalletBatchTypedData, polymarketRelayerBaseUrl, recoverCreatePositionSigner, resolveExpectedSigner, toAddress, toHex, vaultAbi, verifyOfferSignature, verifyQuoteSignature };
420
+ export { type ApproveTxData, type CreatePositionTxData, type CreatePositionWithMarginAndVersionTxData, type CreatePositionWithMarginTxData, type CreatePositionWithVersionTxData, type DepositWalletBatch, type DepositWalletCall, type OpenPositionTxData, type RequestCloseTxData, type RequestPartialCloseTxData, assertQuoteSigner, buildApproveTx, buildCreatePositionTx, buildDepositWalletBatch, buildPushFundedCreateCalls, buildRelayerAuthHeaders, buildRelayerSubmitPayload, buildRequestCloseCalls, buildRequestCloseTx, buildRequestPartialCloseCalls, buildRequestPartialCloseTx, buildVerifiedCreatePositionTx, buildVerifiedPushFundedCreateCalls, depositWalletBatchTypes, depositWalletFactoryAddress, erc20Abi, formatContractError, getCachedContractInfo, getDepositWalletBatchTypedData, isCommittedQuote, isProtocolV2Quote, polymarketProtocolVersions, polymarketRelayerBaseUrl, recoverCreatePositionSigner, resolveExpectedSigner, toAddress, toHex, vaultAbi, verifyOfferSignature, verifyQuoteSignature };
@@ -1,8 +1,8 @@
1
1
  import { Abi, Address, Hex } from 'viem';
2
2
  export { Address, Hex } from 'viem';
3
- import { Q as Quote, e as ContractInfo } from '../aliases-Dne14KBa.js';
4
- import { D as DimesClient } from '../dimes-client-DJ1d_p31.js';
5
- import { D as DimesContractError } from '../dimes-error-hSoOierP.js';
3
+ import { Q as Quote, f as ContractInfo } from '../aliases-BI1c3Yt0.js';
4
+ import { D as DimesClient } from '../dimes-client-Ckn8yRG6.js';
5
+ import { a as DimesContractError } from '../dimes-error-Ke7yuX1m.js';
6
6
 
7
7
  declare const vaultAbi: Abi;
8
8
  declare const erc20Abi: readonly [{
@@ -59,6 +59,73 @@ interface CreatePositionTxData {
59
59
  bigint
60
60
  ];
61
61
  }
62
+ interface CreatePositionWithMarginTxData {
63
+ address: `0x${string}`;
64
+ abi: Abi;
65
+ functionName: "createPositionWithMargin";
66
+ args: readonly [
67
+ `0x${string}`,
68
+ `0x${string}`,
69
+ bigint,
70
+ bigint,
71
+ number,
72
+ bigint,
73
+ number,
74
+ number,
75
+ number,
76
+ bigint,
77
+ bigint,
78
+ `0x${string}`,
79
+ bigint
80
+ ];
81
+ }
82
+ interface CreatePositionWithVersionTxData {
83
+ address: `0x${string}`;
84
+ abi: Abi;
85
+ functionName: "createPositionWithVersion";
86
+ args: readonly [
87
+ `0x${string}`,
88
+ `0x${string}`,
89
+ bigint,
90
+ bigint,
91
+ number,
92
+ bigint,
93
+ number,
94
+ number,
95
+ number,
96
+ bigint,
97
+ number,
98
+ `0x${string}`,
99
+ bigint
100
+ ];
101
+ }
102
+ interface CreatePositionWithMarginAndVersionTxData {
103
+ address: `0x${string}`;
104
+ abi: Abi;
105
+ functionName: "createPositionWithMarginAndVersion";
106
+ args: readonly [
107
+ `0x${string}`,
108
+ `0x${string}`,
109
+ bigint,
110
+ bigint,
111
+ number,
112
+ bigint,
113
+ number,
114
+ number,
115
+ number,
116
+ bigint,
117
+ bigint,
118
+ number,
119
+ `0x${string}`,
120
+ bigint
121
+ ];
122
+ }
123
+ /**
124
+ * What {@link buildCreatePositionTx} returns: the plain call for an adaptive quote, the
125
+ * margin-bearing call for a committed one, and their `...Version` twins for a Polymarket
126
+ * Protocol V2 quote.
127
+ */
128
+ type OpenPositionTxData = CreatePositionTxData | CreatePositionWithMarginTxData | CreatePositionWithVersionTxData | CreatePositionWithMarginAndVersionTxData;
62
129
  interface ApproveTxData {
63
130
  address: `0x${string}`;
64
131
  abi: typeof erc20Abi;
@@ -77,11 +144,53 @@ interface RequestPartialCloseTxData {
77
144
  functionName: "requestPartialClose";
78
145
  args: readonly [`0x${string}`, bigint];
79
146
  }
80
- declare function buildCreatePositionTx(quote: Quote): CreatePositionTxData;
147
+ /**
148
+ * Build the vault call that opens the position this quote was signed for.
149
+ *
150
+ * The quote names its own mode in `riskMode`: a committed-mode quote
151
+ * is signed over a different EIP-712 type and opens through `createPositionWithMargin`, which
152
+ * pulls `marginUsdcUnits` on top of collateral and fees. A Polymarket Protocol V2 quote
153
+ * (`polymarketProtocolVersion` 2) is signed over a type that also carries the version and opens
154
+ * through `createPositionWithVersion` / `createPositionWithMarginAndVersion`. Submitting one
155
+ * quote's signature to another entry point always reverts, so the call is read off the quote
156
+ * rather than left to the caller.
157
+ *
158
+ * `quote.totalUserAmountUsdcUnits` already includes the margin — approve that amount.
159
+ */
160
+ declare function buildCreatePositionTx(quote: Quote): OpenPositionTxData;
81
161
  declare function buildApproveTx(usdcAddress: `0x${string}`, spender: `0x${string}`, amount: bigint): ApproveTxData;
82
162
  declare function buildRequestCloseTx(vaultAddress: `0x${string}`, positionKey: `0x${string}`): RequestCloseTxData;
83
163
  declare function buildRequestPartialCloseTx(vaultAddress: `0x${string}`, positionKey: `0x${string}`, closeTokenUnits: bigint): RequestPartialCloseTxData;
84
164
 
165
+ /**
166
+ * Whether this quote opens in committed mode — a fixed ladder of price-triggered unwinds,
167
+ * backed by extra margin locked in the vault.
168
+ *
169
+ * Read from `riskMode`, the quote's own statement of the mode it was issued in, so a quote
170
+ * issued before committed mode existed reads as adaptive. Asking for committed mode does not
171
+ * guarantee getting it: when the market, price or leverage rules it out the request is rejected
172
+ * with `quote_committed_risk_mode_unavailable`, and a partner without the beta feature enabled
173
+ * is rejected with `beta_feature_not_enabled`.
174
+ */
175
+ declare function isCommittedQuote(quote: Quote): boolean;
176
+
177
+ /**
178
+ * The Polymarket share ledgers a quote can be issued on, numbered as the vault numbers them:
179
+ * `1` is the Conditional Tokens contract (CTF), `2` is Polymarket Protocol V2 (PositionManager).
180
+ */
181
+ declare const polymarketProtocolVersions: {
182
+ readonly ctf: 1;
183
+ readonly positionManager: 2;
184
+ };
185
+ /**
186
+ * Whether this quote is for a Polymarket Protocol V2 market.
187
+ *
188
+ * A version 2 quote is signed over a separate EIP-712 type carrying `protocolVersion`, and opens
189
+ * through the `...WithVersion` / `...WithMarginAndVersion` entry points; the create functions without
190
+ * a version reject it. A quote from an API that predates the field reads as version 1.
191
+ */
192
+ declare function isProtocolV2Quote(quote: Quote): boolean;
193
+
85
194
  /**
86
195
  * Helpers for opening and closing positions from a Polymarket **deposit wallet** (DW).
87
196
  *
@@ -92,6 +201,7 @@ declare function buildRequestPartialCloseTx(vaultAddress: `0x${string}`, positio
92
201
  * 1. `vault.reserveDeposit(totalUserAmount)` — snapshot the vault pUSD balance
93
202
  * 2. `pUSD.transfer(vault, totalUserAmount)` — push the funds directly
94
203
  * 3. `vault.createPositionPushFunded(...)` — verify the balance delta + create
204
+ * (or its `...WithMargin` / `...WithVersion` / `...WithMarginAndVersion` twin, read off the quote)
95
205
  *
96
206
  * Closing follows the same batch mechanics with a single inner call, `requestClose`.
97
207
  */
@@ -142,7 +252,14 @@ declare const depositWalletBatchTypes: {
142
252
  * Build the three inner calls for a push-funded `createPosition`.
143
253
  *
144
254
  * The relayer submits these atomically; `quote.totalUserAmountUsdcUnits` is the
145
- * contract-ready amount (collateral + fees) used for both the reservation and the transfer.
255
+ * contract-ready amount (collateral + fees + committed-mode margin) used for both the
256
+ * reservation and the transfer. The vault checks the pushed amount for exact equality, so
257
+ * a committed quote whose margin was left out of the transfer reverts the whole batch.
258
+ *
259
+ * A committed quote is opened through `createPositionPushFundedWithMargin`, and a Polymarket
260
+ * Protocol V2 quote through `createPositionPushFundedWithVersion` /
261
+ * `createPositionPushFundedWithMarginAndVersion`, all chosen from the quote itself — see
262
+ * {@link isCommittedQuote} and {@link isProtocolV2Quote}.
146
263
  *
147
264
  * @param quote - the signed quote returned by the quote endpoint
148
265
  * @param pUsdAddress - the pUSD (USDC) token address (from `GET /contract-info`)
@@ -241,6 +358,14 @@ interface BuildRelayerHeadersParams {
241
358
  */
242
359
  declare function buildRelayerAuthHeaders(params: BuildRelayerHeadersParams): Promise<Record<string, string>>;
243
360
 
361
+ /**
362
+ * Recover the address that signed this quote.
363
+ *
364
+ * A committed-mode quote is signed over `CreatePositionWithMargin`, a separate EIP-712 type
365
+ * carrying `marginUsdcUnits`, and a Polymarket Protocol V2 quote over `CreatePositionWithVersion` /
366
+ * `CreatePositionWithMarginAndVersion`, which also carry `protocolVersion`. Recovering against the
367
+ * wrong type would yield a garbage address, so the type is chosen from the quote itself.
368
+ */
244
369
  declare function recoverCreatePositionSigner(quote: Quote, userAddress: `0x${string}`): Promise<`0x${string}`>;
245
370
  declare function resolveExpectedSigner(apiSigner: string | undefined): `0x${string}` | undefined;
246
371
  /**
@@ -264,7 +389,9 @@ declare const verifyOfferSignature: typeof verifyQuoteSignature;
264
389
 
265
390
  /**
266
391
  * Verify a quote's signature against the on-chain authority (using the client's
267
- * cached `/contract-info`) and then build the `createPosition` transaction.
392
+ * cached `/contract-info`) and then build the transaction that opens the position —
393
+ * `createPosition`, `createPositionWithMargin` for a committed-mode quote, or their
394
+ * `...Version` twins for a Polymarket Protocol V2 quote.
268
395
  *
269
396
  * Prefer this over the raw {@link buildCreatePositionTx} so a tampered or stale
270
397
  * quote fails fast in the client instead of reverting on-chain. Throws
@@ -273,7 +400,7 @@ declare const verifyOfferSignature: typeof verifyQuoteSignature;
273
400
  * @param userAddress - the wallet that will submit the tx (the signed `user`,
274
401
  * bound to `msg.sender` by the contract).
275
402
  */
276
- declare function buildVerifiedCreatePositionTx(client: DimesClient, quote: Quote, userAddress: `0x${string}`): Promise<CreatePositionTxData>;
403
+ declare function buildVerifiedCreatePositionTx(client: DimesClient, quote: Quote, userAddress: `0x${string}`): Promise<OpenPositionTxData>;
277
404
  /**
278
405
  * Verify a quote's signature (see {@link buildVerifiedCreatePositionTx}) and then
279
406
  * build the push-funded deposit-wallet calls. Prefer this over the raw
@@ -290,4 +417,4 @@ declare function buildVerifiedPushFundedCreateCalls(client: DimesClient, quote:
290
417
 
291
418
  declare function formatContractError(err: unknown): DimesContractError;
292
419
 
293
- export { type ApproveTxData, type CreatePositionTxData, type DepositWalletBatch, type DepositWalletCall, type RequestCloseTxData, type RequestPartialCloseTxData, assertQuoteSigner, buildApproveTx, buildCreatePositionTx, buildDepositWalletBatch, buildPushFundedCreateCalls, buildRelayerAuthHeaders, buildRelayerSubmitPayload, buildRequestCloseCalls, buildRequestCloseTx, buildRequestPartialCloseCalls, buildRequestPartialCloseTx, buildVerifiedCreatePositionTx, buildVerifiedPushFundedCreateCalls, depositWalletBatchTypes, depositWalletFactoryAddress, erc20Abi, formatContractError, getCachedContractInfo, getDepositWalletBatchTypedData, polymarketRelayerBaseUrl, recoverCreatePositionSigner, resolveExpectedSigner, toAddress, toHex, vaultAbi, verifyOfferSignature, verifyQuoteSignature };
420
+ export { type ApproveTxData, type CreatePositionTxData, type CreatePositionWithMarginAndVersionTxData, type CreatePositionWithMarginTxData, type CreatePositionWithVersionTxData, type DepositWalletBatch, type DepositWalletCall, type OpenPositionTxData, type RequestCloseTxData, type RequestPartialCloseTxData, assertQuoteSigner, buildApproveTx, buildCreatePositionTx, buildDepositWalletBatch, buildPushFundedCreateCalls, buildRelayerAuthHeaders, buildRelayerSubmitPayload, buildRequestCloseCalls, buildRequestCloseTx, buildRequestPartialCloseCalls, buildRequestPartialCloseTx, buildVerifiedCreatePositionTx, buildVerifiedPushFundedCreateCalls, depositWalletBatchTypes, depositWalletFactoryAddress, erc20Abi, formatContractError, getCachedContractInfo, getDepositWalletBatchTypedData, isCommittedQuote, isProtocolV2Quote, polymarketProtocolVersions, polymarketRelayerBaseUrl, recoverCreatePositionSigner, resolveExpectedSigner, toAddress, toHex, vaultAbi, verifyOfferSignature, verifyQuoteSignature };