@optimex-xyz/market-maker-sdk 0.4.8 → 0.4.10
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/README.md +156 -30
- package/dist/index.d.mts +46 -13
- package/dist/index.d.ts +46 -13
- package/dist/index.js +17 -7
- package/dist/index.mjs +17 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,13 +127,12 @@ Provides an indicative quote for the given token pair and trade amount. The quot
|
|
|
127
127
|
- **Query Parameters**:
|
|
128
128
|
- `from_token_id` (string): The ID of the source token.
|
|
129
129
|
- `to_token_id` (string): The ID of the destination token.
|
|
130
|
-
- `amount` (string): The amount of the source token to be traded, represented as a string in base 10 to accommodate large numbers.
|
|
131
|
-
- `session_id` (string, optional): A unique identifier for the session.
|
|
130
|
+
- `amount` (string): The amount of the source token to be traded, represented as a string in base 10 to accommodate large numbers. This should be treated as a BigInt in your implementation.
|
|
132
131
|
|
|
133
132
|
#### Example Request
|
|
134
133
|
|
|
135
134
|
```
|
|
136
|
-
GET /indicative-quote?from_token_id=ETH&to_token_id=BTC&amount=1000000000000000000
|
|
135
|
+
GET /indicative-quote?from_token_id=ETH&to_token_id=BTC&amount=1000000000000000000
|
|
137
136
|
```
|
|
138
137
|
|
|
139
138
|
#### Expected Response
|
|
@@ -152,7 +151,7 @@ GET /indicative-quote?from_token_id=ETH&to_token_id=BTC&amount=10000000000000000
|
|
|
152
151
|
|
|
153
152
|
- `session_id` (string): The session ID associated with the request.
|
|
154
153
|
- `pmm_receiving_address` (string): The receiving address where the user will send the `from_token`.
|
|
155
|
-
- `indicative_quote` (string): The indicative quote value, represented as a string.
|
|
154
|
+
- `indicative_quote` (string): The indicative quote value, represented as a string. Should be treated as a BigInt in your implementation.
|
|
156
155
|
- `error` (string): Error message, if any (empty if no error).
|
|
157
156
|
|
|
158
157
|
#### Example Implementation
|
|
@@ -183,7 +182,9 @@ async function getIndicativeQuote(req, res) {
|
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
// Calculate the quote (implementation specific to your PMM)
|
|
186
|
-
|
|
185
|
+
// Note: Treat amount as BigInt
|
|
186
|
+
const amountBigInt = BigInt(amount);
|
|
187
|
+
const quote = calculateQuote(fromToken, toToken, amountBigInt);
|
|
187
188
|
|
|
188
189
|
// Get the receiving address for this token pair
|
|
189
190
|
const pmmReceivingAddress = getPMMReceivingAddress(fromToken.network_id);
|
|
@@ -191,7 +192,7 @@ async function getIndicativeQuote(req, res) {
|
|
|
191
192
|
return res.status(200).json({
|
|
192
193
|
session_id: sessionId,
|
|
193
194
|
pmm_receiving_address: pmmReceivingAddress,
|
|
194
|
-
indicative_quote: quote,
|
|
195
|
+
indicative_quote: quote.toString(),
|
|
195
196
|
error: ''
|
|
196
197
|
});
|
|
197
198
|
} catch (error) {
|
|
@@ -216,21 +217,21 @@ Provides a commitment quote for a specific trade, representing a firm commitment
|
|
|
216
217
|
- **HTTP Method**: `GET`
|
|
217
218
|
- **Query Parameters**:
|
|
218
219
|
- `session_id` (string): A unique identifier for the session.
|
|
219
|
-
- `trade_id` (string): The unique identifier for the trade.
|
|
220
|
+
- `trade_id` (string): The unique identifier for the trade. Example format: `0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328`.
|
|
220
221
|
- `from_token_id` (string): The ID of the source token.
|
|
221
222
|
- `to_token_id` (string): The ID of the destination token.
|
|
222
|
-
- `amount` (string): The amount of the source token to be traded, in base 10.
|
|
223
|
+
- `amount` (string): The amount of the source token to be traded, in base 10. This should be treated as a BigInt in your implementation.
|
|
223
224
|
- `from_user_address` (string): The address of the user initiating the trade.
|
|
224
225
|
- `to_user_address` (string): The address where the user will receive the `to_token`.
|
|
225
226
|
- `user_deposit_tx` (string): The transaction hash where the user deposited their funds.
|
|
226
227
|
- `user_deposit_vault` (string): The vault where the user's deposit is kept.
|
|
227
|
-
- `trade_deadline` (string): The UNIX timestamp (in seconds) by which the user expects to receive payment.
|
|
228
|
-
- `script_deadline` (string): The UNIX timestamp (in seconds) after which the user can withdraw their deposit if not paid.
|
|
228
|
+
- `trade_deadline` (string): The UNIX timestamp (in seconds) by which the user expects to receive payment. Should be treated as a BigInt in your implementation.
|
|
229
|
+
- `script_deadline` (string): The UNIX timestamp (in seconds) after which the user can withdraw their deposit if not paid. Should be treated as a BigInt in your implementation.
|
|
229
230
|
|
|
230
231
|
#### Example Request
|
|
231
232
|
|
|
232
233
|
```
|
|
233
|
-
GET /commitment-quote?session_id=12345&trade_id=
|
|
234
|
+
GET /commitment-quote?session_id=12345&trade_id=0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328&from_token_id=ETH&to_token_id=BTC&amount=1000000000000000000&from_user_address=0xUserAddress&to_user_address=0xReceivingAddress&user_deposit_tx=0xDepositTxHash&user_deposit_vault=VaultData&trade_deadline=1696012800&script_deadline=1696016400
|
|
234
235
|
```
|
|
235
236
|
|
|
236
237
|
#### Expected Response
|
|
@@ -240,14 +241,14 @@ GET /commitment-quote?session_id=12345&trade_id=abcd1234&from_token_id=ETH&to_to
|
|
|
240
241
|
|
|
241
242
|
```json
|
|
242
243
|
{
|
|
243
|
-
"trade_id": "
|
|
244
|
+
"trade_id": "0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328",
|
|
244
245
|
"commitment_quote": "987654321000000000",
|
|
245
246
|
"error": "" // Empty if no error
|
|
246
247
|
}
|
|
247
248
|
```
|
|
248
249
|
|
|
249
250
|
- `trade_id` (string): The trade ID associated with the request.
|
|
250
|
-
- `commitment_quote` (string): The committed quote value, represented as a string.
|
|
251
|
+
- `commitment_quote` (string): The committed quote value, represented as a string. Should be treated as a BigInt in your implementation.
|
|
251
252
|
- `error` (string): Error message, if any (empty if no error).
|
|
252
253
|
|
|
253
254
|
#### Example Implementation
|
|
@@ -296,7 +297,9 @@ async function getCommitmentQuote(req, res) {
|
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
// Calculate the final quote (implementation specific to your PMM)
|
|
299
|
-
|
|
300
|
+
// Note: Treat numeric values as BigInt
|
|
301
|
+
const amountBigInt = BigInt(amount);
|
|
302
|
+
const quote = calculateFinalQuote(fromToken, toToken, amountBigInt, trade_deadline);
|
|
300
303
|
|
|
301
304
|
// Store the trade in the database
|
|
302
305
|
await tradeRepository.create({
|
|
@@ -304,19 +307,19 @@ async function getCommitmentQuote(req, res) {
|
|
|
304
307
|
sessionId: session_id,
|
|
305
308
|
fromTokenId: from_token_id,
|
|
306
309
|
toTokenId: to_token_id,
|
|
307
|
-
amount,
|
|
310
|
+
amount: amountBigInt.toString(),
|
|
308
311
|
fromUserAddress: from_user_address,
|
|
309
312
|
toUserAddress: to_user_address,
|
|
310
313
|
userDepositTx: user_deposit_tx,
|
|
311
314
|
userDepositVault: user_deposit_vault,
|
|
312
315
|
tradeDeadline: trade_deadline,
|
|
313
316
|
scriptDeadline: script_deadline,
|
|
314
|
-
commitmentQuote: quote
|
|
317
|
+
commitmentQuote: quote.toString()
|
|
315
318
|
});
|
|
316
319
|
|
|
317
320
|
return res.status(200).json({
|
|
318
321
|
trade_id,
|
|
319
|
-
commitment_quote: quote,
|
|
322
|
+
commitment_quote: quote.toString(),
|
|
320
323
|
error: ''
|
|
321
324
|
});
|
|
322
325
|
} catch (error) {
|
|
@@ -339,15 +342,16 @@ Returns a signature from the PMM to confirm the settlement quote, required to fi
|
|
|
339
342
|
|
|
340
343
|
- **HTTP Method**: `GET`
|
|
341
344
|
- **Query Parameters**:
|
|
342
|
-
- `trade_id` (string): The unique identifier for the trade.
|
|
343
|
-
- `committed_quote` (string): The committed quote value in base 10.
|
|
345
|
+
- `trade_id` (string): The unique identifier for the trade. Example format: `0x3d09b8eb94466bffa126aeda68c8c0f330633a7d0058f57269d795530415498a`.
|
|
346
|
+
- `committed_quote` (string): The committed quote value in base 10. This should be treated as a BigInt in your implementation.
|
|
344
347
|
- `trade_deadline` (string): The UNIX timestamp (in seconds) by which the user expects to receive payment.
|
|
345
348
|
- `script_deadline` (string): The UNIX timestamp (in seconds) after which the user can withdraw their deposit if not paid.
|
|
346
349
|
|
|
350
|
+
|
|
347
351
|
#### Example Request
|
|
348
352
|
|
|
349
353
|
```
|
|
350
|
-
GET /settlement-signature?trade_id=
|
|
354
|
+
GET /settlement-signature?trade_id=0x3d09b8eb94466bffa126aeda68c8c0f330633a7d0058f57269d795530415498a&committed_quote=987654321000000000&trade_deadline=1696012800&script_deadline=1696016400
|
|
351
355
|
```
|
|
352
356
|
|
|
353
357
|
#### Expected Response
|
|
@@ -357,7 +361,7 @@ GET /settlement-signature?trade_id=abcd1234&committed_quote=987654321000000000&t
|
|
|
357
361
|
|
|
358
362
|
```json
|
|
359
363
|
{
|
|
360
|
-
"trade_id": "
|
|
364
|
+
"trade_id": "0x3d09b8eb94466bffa126aeda68c8c0f330633a7d0058f57269d795530415498a",
|
|
361
365
|
"signature": "0xSignatureData",
|
|
362
366
|
"deadline": 1696012800,
|
|
363
367
|
"error": "" // Empty if no error
|
|
@@ -401,12 +405,14 @@ async function getSettlementSignature(req, res) {
|
|
|
401
405
|
const { from_token, to_token } = tradeDetails.data;
|
|
402
406
|
|
|
403
407
|
// Create a commitment info hash
|
|
408
|
+
// Note: Treat numeric values as BigInt
|
|
409
|
+
const committedQuoteBigInt = BigInt(committed_quote);
|
|
404
410
|
const commitInfoHash = createCommitInfoHash(
|
|
405
411
|
pmmId,
|
|
406
412
|
trade.pmmReceivingAddress,
|
|
407
413
|
to_token.chain,
|
|
408
414
|
to_token.address,
|
|
409
|
-
|
|
415
|
+
committedQuoteBigInt,
|
|
410
416
|
deadline
|
|
411
417
|
);
|
|
412
418
|
|
|
@@ -441,7 +447,7 @@ Used by the solver to acknowledge to the PMM about a successful settlement, indi
|
|
|
441
447
|
|
|
442
448
|
- **HTTP Method**: `POST`
|
|
443
449
|
- **Form Parameters**:
|
|
444
|
-
- `trade_id` (string): The unique identifier for the trade.
|
|
450
|
+
- `trade_id` (string): The unique identifier for the trade. Example format: `0x024be4dae899989e0c3d9b4459e5811613bcd04016dc56529f16a19d2a7724c0`.
|
|
445
451
|
- `trade_deadline` (string): The UNIX timestamp (in seconds) by which the user expects to receive payment.
|
|
446
452
|
- `script_deadline` (string): The UNIX timestamp (in seconds) after which the user can withdraw their deposit if not paid.
|
|
447
453
|
- `chosen` (string): `"true"` if the PMM is selected, `"false"` otherwise.
|
|
@@ -452,7 +458,7 @@ Used by the solver to acknowledge to the PMM about a successful settlement, indi
|
|
|
452
458
|
POST /ack-settlement
|
|
453
459
|
Content-Type: application/x-www-form-urlencoded
|
|
454
460
|
|
|
455
|
-
trade_id=
|
|
461
|
+
trade_id=0x024be4dae899989e0c3d9b4459e5811613bcd04016dc56529f16a19d2a7724c0&trade_deadline=1696012800&script_deadline=1696016400&chosen=true
|
|
456
462
|
```
|
|
457
463
|
|
|
458
464
|
#### Expected Response
|
|
@@ -462,7 +468,7 @@ trade_id=abcd1234&trade_deadline=1696012800&script_deadline=1696016400&chosen=tr
|
|
|
462
468
|
|
|
463
469
|
```json
|
|
464
470
|
{
|
|
465
|
-
"trade_id": "
|
|
471
|
+
"trade_id": "0x024be4dae899989e0c3d9b4459e5811613bcd04016dc56529f16a19d2a7724c0",
|
|
466
472
|
"status": "acknowledged",
|
|
467
473
|
"error": "" // Empty if no error
|
|
468
474
|
}
|
|
@@ -521,10 +527,10 @@ Used by the solver to signal the chosen PMM to start submitting their payment.
|
|
|
521
527
|
|
|
522
528
|
- **HTTP Method**: `POST`
|
|
523
529
|
- **Form Parameters**:
|
|
524
|
-
- `trade_id` (string): The unique identifier for the trade.
|
|
525
|
-
- `total_fee_amount` (string): The amount of total fee the PMM has to submit, in base 10.
|
|
530
|
+
- `trade_id` (string): The unique identifier for the trade. Example format: `0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328`.
|
|
526
531
|
- `trade_deadline` (string): The UNIX timestamp (in seconds) by which the user expects to receive payment.
|
|
527
532
|
- `script_deadline` (string): The UNIX timestamp (in seconds) after which the user can withdraw their deposit if not paid.
|
|
533
|
+
- `total_fee_amount` (string): The amount of total fee the PMM has to submit, in base 10. This should be treated as a BigInt in your implementation.
|
|
528
534
|
|
|
529
535
|
#### Example Request
|
|
530
536
|
|
|
@@ -532,7 +538,7 @@ Used by the solver to signal the chosen PMM to start submitting their payment.
|
|
|
532
538
|
POST /signal-payment
|
|
533
539
|
Content-Type: application/x-www-form-urlencoded
|
|
534
540
|
|
|
535
|
-
trade_id=
|
|
541
|
+
trade_id=0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328&total_fee_amount=1000000000000000&trade_deadline=1696012800&script_deadline=1696016400
|
|
536
542
|
```
|
|
537
543
|
|
|
538
544
|
#### Expected Response
|
|
@@ -542,7 +548,7 @@ trade_id=abcd1234&total_fee_amount=1000000000000000&trade_deadline=1696012800&sc
|
|
|
542
548
|
|
|
543
549
|
```json
|
|
544
550
|
{
|
|
545
|
-
"trade_id": "
|
|
551
|
+
"trade_id": "0x3bfe2fc4889a98a39b31b348e7b212ea3f2bea63fd1ea2e0c8ba326433677328",
|
|
546
552
|
"status": "acknowledged",
|
|
547
553
|
"error": "" // Empty if no error
|
|
548
554
|
}
|
|
@@ -721,7 +727,7 @@ Allows the PMM to submit the settlement transaction hash for one or more trades.
|
|
|
721
727
|
|
|
722
728
|
- `trade_ids` (array of strings): An array of trade IDs associated with the settlement transaction.
|
|
723
729
|
- `pmm_id` (string): The PMM's ID, which must match the one committed for the trade(s).
|
|
724
|
-
- `settlement_tx` (string): The
|
|
730
|
+
- `settlement_tx` (string): The txHash of the settlement.
|
|
725
731
|
- `signature` (string): The PMM's signature on the settlement transaction.
|
|
726
732
|
- `start_index` (integer): The index indicating the starting point for settlement processing (used for batch settlements).
|
|
727
733
|
- `signed_at` (integer): The UNIX timestamp (in seconds) when the PMM signed the settlement transaction.
|
|
@@ -849,3 +855,123 @@ In case the target chain is Bitcoin, the transaction should have at least N + 1
|
|
|
849
855
|
Example implementation:
|
|
850
856
|
|
|
851
857
|
```js
|
|
858
|
+
import * as bitcoin from 'bitcoinjs-lib'
|
|
859
|
+
import { ECPairFactory } from 'ecpair'
|
|
860
|
+
import * as ecc from 'tiny-secp256k1'
|
|
861
|
+
import axios from 'axios'
|
|
862
|
+
import { getTradeIdsHash } from '@optimex-xyz/market-maker-sdk'
|
|
863
|
+
|
|
864
|
+
async function makeBitcoinPayment(params) {
|
|
865
|
+
const { toAddress, amount, token, tradeId } = params
|
|
866
|
+
const ECPair = ECPairFactory(ecc)
|
|
867
|
+
|
|
868
|
+
// Set up Bitcoin library
|
|
869
|
+
bitcoin.initEccLib(ecc)
|
|
870
|
+
|
|
871
|
+
// Get network configuration
|
|
872
|
+
const network = getNetwork(token.networkId)
|
|
873
|
+
const rpcUrl = getRpcUrl(token.networkId)
|
|
874
|
+
|
|
875
|
+
// Create keypair from private key
|
|
876
|
+
const keyPair = ECPair.fromWIF(process.env.PMM_BTC_PRIVATE_KEY, network)
|
|
877
|
+
const payment = bitcoin.payments.p2tr({
|
|
878
|
+
internalPubkey: Buffer.from(keyPair.publicKey.slice(1, 33)),
|
|
879
|
+
network,
|
|
880
|
+
})
|
|
881
|
+
|
|
882
|
+
if (!payment.address) {
|
|
883
|
+
throw new Error('Could not generate address')
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Get UTXOs for the address
|
|
887
|
+
const utxos = await getUTXOs(payment.address, rpcUrl)
|
|
888
|
+
if (utxos.length === 0) {
|
|
889
|
+
throw new Error(`No UTXOs found in ${token.networkSymbol} wallet`)
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// Create and sign transaction
|
|
893
|
+
const psbt = new bitcoin.Psbt({ network })
|
|
894
|
+
let totalInput = 0n
|
|
895
|
+
|
|
896
|
+
// Add inputs
|
|
897
|
+
for (const utxo of utxos) {
|
|
898
|
+
if (!payment.output) {
|
|
899
|
+
throw new Error('Could not generate output script')
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
const internalKey = Buffer.from(keyPair.publicKey.slice(1, 33))
|
|
903
|
+
|
|
904
|
+
psbt.addInput({
|
|
905
|
+
hash: utxo.txid,
|
|
906
|
+
index: utxo.vout,
|
|
907
|
+
witnessUtxo: {
|
|
908
|
+
script: payment.output,
|
|
909
|
+
value: BigInt(utxo.value),
|
|
910
|
+
},
|
|
911
|
+
tapInternalKey: internalKey,
|
|
912
|
+
})
|
|
913
|
+
|
|
914
|
+
totalInput += BigInt(utxo.value)
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Check if we have enough balance
|
|
918
|
+
if (totalInput < amount) {
|
|
919
|
+
throw new Error(
|
|
920
|
+
`Insufficient balance. Need ${amount} satoshis, but only have ${totalInput} satoshis`
|
|
921
|
+
)
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// Get fee rate
|
|
925
|
+
const feeRate = await getFeeRate(rpcUrl)
|
|
926
|
+
const fee = BigInt(Math.ceil(200 * feeRate))
|
|
927
|
+
const changeAmount = totalInput - amount - fee
|
|
928
|
+
|
|
929
|
+
// Add recipient output
|
|
930
|
+
psbt.addOutput({
|
|
931
|
+
address: toAddress,
|
|
932
|
+
value: amount,
|
|
933
|
+
})
|
|
934
|
+
|
|
935
|
+
// Add change output if needed
|
|
936
|
+
if (changeAmount > 546n) {
|
|
937
|
+
psbt.addOutput({
|
|
938
|
+
address: payment.address,
|
|
939
|
+
value: changeAmount,
|
|
940
|
+
})
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// Add OP_RETURN output with trade ID hash
|
|
944
|
+
const tradeIdsHash = getTradeIdsHash([tradeId])
|
|
945
|
+
psbt.addOutput({
|
|
946
|
+
script: bitcoin.script.compile([
|
|
947
|
+
bitcoin.opcodes.OP_RETURN,
|
|
948
|
+
Buffer.from(tradeIdsHash.slice(2), 'hex')
|
|
949
|
+
]),
|
|
950
|
+
value: 0n,
|
|
951
|
+
})
|
|
952
|
+
|
|
953
|
+
// Sign inputs
|
|
954
|
+
const toXOnly = (pubKey) => (pubKey.length === 32 ? pubKey : pubKey.slice(1, 33))
|
|
955
|
+
const tweakedSigner = keyPair.tweak(bitcoin.crypto.taggedHash('TapTweak', toXOnly(keyPair.publicKey)))
|
|
956
|
+
|
|
957
|
+
for (let i = 0; i < psbt.data.inputs.length; i++) {
|
|
958
|
+
psbt.signInput(i, tweakedSigner, [bitcoin.Transaction.SIGHASH_DEFAULT])
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
psbt.finalizeAllInputs()
|
|
962
|
+
|
|
963
|
+
// Extract transaction
|
|
964
|
+
const tx = psbt.extractTransaction()
|
|
965
|
+
const rawTx = tx.toHex()
|
|
966
|
+
|
|
967
|
+
// Broadcast transaction
|
|
968
|
+
const response = await axios.post(`${rpcUrl}/api/tx`, rawTx, {
|
|
969
|
+
headers: {
|
|
970
|
+
'Content-Type': 'text/plain',
|
|
971
|
+
},
|
|
972
|
+
})
|
|
973
|
+
|
|
974
|
+
return response.data // Transaction ID
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
```
|
package/dist/index.d.mts
CHANGED
|
@@ -4666,11 +4666,24 @@ declare const SubmitSettlementRequestSchema: z.ZodObject<{
|
|
|
4666
4666
|
startIndex: number;
|
|
4667
4667
|
}>;
|
|
4668
4668
|
declare const SubmitSettlementResponseSchema: z.ZodObject<{
|
|
4669
|
-
|
|
4669
|
+
data: z.ZodObject<{
|
|
4670
|
+
message: z.ZodString;
|
|
4671
|
+
}, "strip", z.ZodTypeAny, {
|
|
4672
|
+
message: string;
|
|
4673
|
+
}, {
|
|
4674
|
+
message: string;
|
|
4675
|
+
}>;
|
|
4676
|
+
traceId: z.ZodString;
|
|
4670
4677
|
}, "strip", z.ZodTypeAny, {
|
|
4671
|
-
|
|
4678
|
+
data: {
|
|
4679
|
+
message: string;
|
|
4680
|
+
};
|
|
4681
|
+
traceId: string;
|
|
4672
4682
|
}, {
|
|
4673
|
-
|
|
4683
|
+
data: {
|
|
4684
|
+
message: string;
|
|
4685
|
+
};
|
|
4686
|
+
traceId: string;
|
|
4674
4687
|
}>;
|
|
4675
4688
|
declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
4676
4689
|
data: z.ZodObject<{
|
|
@@ -4719,7 +4732,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4719
4732
|
amountAfterFees: z.ZodString;
|
|
4720
4733
|
fromUserAddress: z.ZodString;
|
|
4721
4734
|
userReceivingAddress: z.ZodString;
|
|
4722
|
-
deadline: z.ZodNumber;
|
|
4723
4735
|
protocolFeeInBps: z.ZodString;
|
|
4724
4736
|
protocolMpcPubkey: z.ZodString;
|
|
4725
4737
|
protocolMpcAddress: z.ZodString;
|
|
@@ -4745,7 +4757,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4745
4757
|
pmmFailureStats: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
4746
4758
|
commitedSignature: z.ZodString;
|
|
4747
4759
|
minAmountOut: z.ZodNull;
|
|
4748
|
-
sessionDeadline: z.ZodNumber;
|
|
4749
4760
|
userDepositTx: z.ZodString;
|
|
4750
4761
|
depositVault: z.ZodString;
|
|
4751
4762
|
paymentBundle: z.ZodObject<{
|
|
@@ -4777,12 +4788,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4777
4788
|
state: z.ZodString;
|
|
4778
4789
|
lastUpdateMsg: z.ZodString;
|
|
4779
4790
|
version: z.ZodNumber;
|
|
4791
|
+
scriptTimeout: z.ZodNumber;
|
|
4792
|
+
affiliateFeeInBps: z.ZodString;
|
|
4793
|
+
totalFee: z.ZodString;
|
|
4794
|
+
protocolFee: z.ZodString;
|
|
4795
|
+
affiliateFee: z.ZodString;
|
|
4796
|
+
tradeTimeout: z.ZodNumber;
|
|
4780
4797
|
}, "strip", z.ZodTypeAny, {
|
|
4781
4798
|
version: number;
|
|
4782
|
-
deadline: number;
|
|
4783
4799
|
tradeId: string;
|
|
4800
|
+
totalFee: string;
|
|
4784
4801
|
minAmountOut: null;
|
|
4802
|
+
tradeTimeout: number;
|
|
4785
4803
|
sessionId: string;
|
|
4804
|
+
scriptTimeout: number;
|
|
4786
4805
|
solverAddress: string;
|
|
4787
4806
|
fromToken: {
|
|
4788
4807
|
address: string;
|
|
@@ -4820,7 +4839,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4820
4839
|
commitmentRetries: number;
|
|
4821
4840
|
pmmFailureStats: Record<string, number>;
|
|
4822
4841
|
commitedSignature: string;
|
|
4823
|
-
sessionDeadline: number;
|
|
4824
4842
|
userDepositTx: string;
|
|
4825
4843
|
depositVault: string;
|
|
4826
4844
|
paymentBundle: {
|
|
@@ -4837,12 +4855,17 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4837
4855
|
tradeMakePaymentTx: string;
|
|
4838
4856
|
state: string;
|
|
4839
4857
|
lastUpdateMsg: string;
|
|
4858
|
+
affiliateFeeInBps: string;
|
|
4859
|
+
protocolFee: string;
|
|
4860
|
+
affiliateFee: string;
|
|
4840
4861
|
}, {
|
|
4841
4862
|
version: number;
|
|
4842
|
-
deadline: number;
|
|
4843
4863
|
tradeId: string;
|
|
4864
|
+
totalFee: string;
|
|
4844
4865
|
minAmountOut: null;
|
|
4866
|
+
tradeTimeout: number;
|
|
4845
4867
|
sessionId: string;
|
|
4868
|
+
scriptTimeout: number;
|
|
4846
4869
|
solverAddress: string;
|
|
4847
4870
|
fromToken: {
|
|
4848
4871
|
address: string;
|
|
@@ -4880,7 +4903,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4880
4903
|
commitmentRetries: number;
|
|
4881
4904
|
pmmFailureStats: Record<string, number>;
|
|
4882
4905
|
commitedSignature: string;
|
|
4883
|
-
sessionDeadline: number;
|
|
4884
4906
|
userDepositTx: string;
|
|
4885
4907
|
depositVault: string;
|
|
4886
4908
|
paymentBundle: {
|
|
@@ -4897,15 +4919,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4897
4919
|
tradeMakePaymentTx: string;
|
|
4898
4920
|
state: string;
|
|
4899
4921
|
lastUpdateMsg: string;
|
|
4922
|
+
affiliateFeeInBps: string;
|
|
4923
|
+
protocolFee: string;
|
|
4924
|
+
affiliateFee: string;
|
|
4900
4925
|
}>;
|
|
4901
4926
|
traceId: z.ZodString;
|
|
4902
4927
|
}, "strip", z.ZodTypeAny, {
|
|
4903
4928
|
data: {
|
|
4904
4929
|
version: number;
|
|
4905
|
-
deadline: number;
|
|
4906
4930
|
tradeId: string;
|
|
4931
|
+
totalFee: string;
|
|
4907
4932
|
minAmountOut: null;
|
|
4933
|
+
tradeTimeout: number;
|
|
4908
4934
|
sessionId: string;
|
|
4935
|
+
scriptTimeout: number;
|
|
4909
4936
|
solverAddress: string;
|
|
4910
4937
|
fromToken: {
|
|
4911
4938
|
address: string;
|
|
@@ -4943,7 +4970,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4943
4970
|
commitmentRetries: number;
|
|
4944
4971
|
pmmFailureStats: Record<string, number>;
|
|
4945
4972
|
commitedSignature: string;
|
|
4946
|
-
sessionDeadline: number;
|
|
4947
4973
|
userDepositTx: string;
|
|
4948
4974
|
depositVault: string;
|
|
4949
4975
|
paymentBundle: {
|
|
@@ -4960,15 +4986,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4960
4986
|
tradeMakePaymentTx: string;
|
|
4961
4987
|
state: string;
|
|
4962
4988
|
lastUpdateMsg: string;
|
|
4989
|
+
affiliateFeeInBps: string;
|
|
4990
|
+
protocolFee: string;
|
|
4991
|
+
affiliateFee: string;
|
|
4963
4992
|
};
|
|
4964
4993
|
traceId: string;
|
|
4965
4994
|
}, {
|
|
4966
4995
|
data: {
|
|
4967
4996
|
version: number;
|
|
4968
|
-
deadline: number;
|
|
4969
4997
|
tradeId: string;
|
|
4998
|
+
totalFee: string;
|
|
4970
4999
|
minAmountOut: null;
|
|
5000
|
+
tradeTimeout: number;
|
|
4971
5001
|
sessionId: string;
|
|
5002
|
+
scriptTimeout: number;
|
|
4972
5003
|
solverAddress: string;
|
|
4973
5004
|
fromToken: {
|
|
4974
5005
|
address: string;
|
|
@@ -5006,7 +5037,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
5006
5037
|
commitmentRetries: number;
|
|
5007
5038
|
pmmFailureStats: Record<string, number>;
|
|
5008
5039
|
commitedSignature: string;
|
|
5009
|
-
sessionDeadline: number;
|
|
5010
5040
|
userDepositTx: string;
|
|
5011
5041
|
depositVault: string;
|
|
5012
5042
|
paymentBundle: {
|
|
@@ -5023,6 +5053,9 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
5023
5053
|
tradeMakePaymentTx: string;
|
|
5024
5054
|
state: string;
|
|
5025
5055
|
lastUpdateMsg: string;
|
|
5056
|
+
affiliateFeeInBps: string;
|
|
5057
|
+
protocolFee: string;
|
|
5058
|
+
affiliateFee: string;
|
|
5026
5059
|
};
|
|
5027
5060
|
traceId: string;
|
|
5028
5061
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4666,11 +4666,24 @@ declare const SubmitSettlementRequestSchema: z.ZodObject<{
|
|
|
4666
4666
|
startIndex: number;
|
|
4667
4667
|
}>;
|
|
4668
4668
|
declare const SubmitSettlementResponseSchema: z.ZodObject<{
|
|
4669
|
-
|
|
4669
|
+
data: z.ZodObject<{
|
|
4670
|
+
message: z.ZodString;
|
|
4671
|
+
}, "strip", z.ZodTypeAny, {
|
|
4672
|
+
message: string;
|
|
4673
|
+
}, {
|
|
4674
|
+
message: string;
|
|
4675
|
+
}>;
|
|
4676
|
+
traceId: z.ZodString;
|
|
4670
4677
|
}, "strip", z.ZodTypeAny, {
|
|
4671
|
-
|
|
4678
|
+
data: {
|
|
4679
|
+
message: string;
|
|
4680
|
+
};
|
|
4681
|
+
traceId: string;
|
|
4672
4682
|
}, {
|
|
4673
|
-
|
|
4683
|
+
data: {
|
|
4684
|
+
message: string;
|
|
4685
|
+
};
|
|
4686
|
+
traceId: string;
|
|
4674
4687
|
}>;
|
|
4675
4688
|
declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
4676
4689
|
data: z.ZodObject<{
|
|
@@ -4719,7 +4732,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4719
4732
|
amountAfterFees: z.ZodString;
|
|
4720
4733
|
fromUserAddress: z.ZodString;
|
|
4721
4734
|
userReceivingAddress: z.ZodString;
|
|
4722
|
-
deadline: z.ZodNumber;
|
|
4723
4735
|
protocolFeeInBps: z.ZodString;
|
|
4724
4736
|
protocolMpcPubkey: z.ZodString;
|
|
4725
4737
|
protocolMpcAddress: z.ZodString;
|
|
@@ -4745,7 +4757,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4745
4757
|
pmmFailureStats: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
4746
4758
|
commitedSignature: z.ZodString;
|
|
4747
4759
|
minAmountOut: z.ZodNull;
|
|
4748
|
-
sessionDeadline: z.ZodNumber;
|
|
4749
4760
|
userDepositTx: z.ZodString;
|
|
4750
4761
|
depositVault: z.ZodString;
|
|
4751
4762
|
paymentBundle: z.ZodObject<{
|
|
@@ -4777,12 +4788,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4777
4788
|
state: z.ZodString;
|
|
4778
4789
|
lastUpdateMsg: z.ZodString;
|
|
4779
4790
|
version: z.ZodNumber;
|
|
4791
|
+
scriptTimeout: z.ZodNumber;
|
|
4792
|
+
affiliateFeeInBps: z.ZodString;
|
|
4793
|
+
totalFee: z.ZodString;
|
|
4794
|
+
protocolFee: z.ZodString;
|
|
4795
|
+
affiliateFee: z.ZodString;
|
|
4796
|
+
tradeTimeout: z.ZodNumber;
|
|
4780
4797
|
}, "strip", z.ZodTypeAny, {
|
|
4781
4798
|
version: number;
|
|
4782
|
-
deadline: number;
|
|
4783
4799
|
tradeId: string;
|
|
4800
|
+
totalFee: string;
|
|
4784
4801
|
minAmountOut: null;
|
|
4802
|
+
tradeTimeout: number;
|
|
4785
4803
|
sessionId: string;
|
|
4804
|
+
scriptTimeout: number;
|
|
4786
4805
|
solverAddress: string;
|
|
4787
4806
|
fromToken: {
|
|
4788
4807
|
address: string;
|
|
@@ -4820,7 +4839,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4820
4839
|
commitmentRetries: number;
|
|
4821
4840
|
pmmFailureStats: Record<string, number>;
|
|
4822
4841
|
commitedSignature: string;
|
|
4823
|
-
sessionDeadline: number;
|
|
4824
4842
|
userDepositTx: string;
|
|
4825
4843
|
depositVault: string;
|
|
4826
4844
|
paymentBundle: {
|
|
@@ -4837,12 +4855,17 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4837
4855
|
tradeMakePaymentTx: string;
|
|
4838
4856
|
state: string;
|
|
4839
4857
|
lastUpdateMsg: string;
|
|
4858
|
+
affiliateFeeInBps: string;
|
|
4859
|
+
protocolFee: string;
|
|
4860
|
+
affiliateFee: string;
|
|
4840
4861
|
}, {
|
|
4841
4862
|
version: number;
|
|
4842
|
-
deadline: number;
|
|
4843
4863
|
tradeId: string;
|
|
4864
|
+
totalFee: string;
|
|
4844
4865
|
minAmountOut: null;
|
|
4866
|
+
tradeTimeout: number;
|
|
4845
4867
|
sessionId: string;
|
|
4868
|
+
scriptTimeout: number;
|
|
4846
4869
|
solverAddress: string;
|
|
4847
4870
|
fromToken: {
|
|
4848
4871
|
address: string;
|
|
@@ -4880,7 +4903,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4880
4903
|
commitmentRetries: number;
|
|
4881
4904
|
pmmFailureStats: Record<string, number>;
|
|
4882
4905
|
commitedSignature: string;
|
|
4883
|
-
sessionDeadline: number;
|
|
4884
4906
|
userDepositTx: string;
|
|
4885
4907
|
depositVault: string;
|
|
4886
4908
|
paymentBundle: {
|
|
@@ -4897,15 +4919,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4897
4919
|
tradeMakePaymentTx: string;
|
|
4898
4920
|
state: string;
|
|
4899
4921
|
lastUpdateMsg: string;
|
|
4922
|
+
affiliateFeeInBps: string;
|
|
4923
|
+
protocolFee: string;
|
|
4924
|
+
affiliateFee: string;
|
|
4900
4925
|
}>;
|
|
4901
4926
|
traceId: z.ZodString;
|
|
4902
4927
|
}, "strip", z.ZodTypeAny, {
|
|
4903
4928
|
data: {
|
|
4904
4929
|
version: number;
|
|
4905
|
-
deadline: number;
|
|
4906
4930
|
tradeId: string;
|
|
4931
|
+
totalFee: string;
|
|
4907
4932
|
minAmountOut: null;
|
|
4933
|
+
tradeTimeout: number;
|
|
4908
4934
|
sessionId: string;
|
|
4935
|
+
scriptTimeout: number;
|
|
4909
4936
|
solverAddress: string;
|
|
4910
4937
|
fromToken: {
|
|
4911
4938
|
address: string;
|
|
@@ -4943,7 +4970,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4943
4970
|
commitmentRetries: number;
|
|
4944
4971
|
pmmFailureStats: Record<string, number>;
|
|
4945
4972
|
commitedSignature: string;
|
|
4946
|
-
sessionDeadline: number;
|
|
4947
4973
|
userDepositTx: string;
|
|
4948
4974
|
depositVault: string;
|
|
4949
4975
|
paymentBundle: {
|
|
@@ -4960,15 +4986,20 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
4960
4986
|
tradeMakePaymentTx: string;
|
|
4961
4987
|
state: string;
|
|
4962
4988
|
lastUpdateMsg: string;
|
|
4989
|
+
affiliateFeeInBps: string;
|
|
4990
|
+
protocolFee: string;
|
|
4991
|
+
affiliateFee: string;
|
|
4963
4992
|
};
|
|
4964
4993
|
traceId: string;
|
|
4965
4994
|
}, {
|
|
4966
4995
|
data: {
|
|
4967
4996
|
version: number;
|
|
4968
|
-
deadline: number;
|
|
4969
4997
|
tradeId: string;
|
|
4998
|
+
totalFee: string;
|
|
4970
4999
|
minAmountOut: null;
|
|
5000
|
+
tradeTimeout: number;
|
|
4971
5001
|
sessionId: string;
|
|
5002
|
+
scriptTimeout: number;
|
|
4972
5003
|
solverAddress: string;
|
|
4973
5004
|
fromToken: {
|
|
4974
5005
|
address: string;
|
|
@@ -5006,7 +5037,6 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
5006
5037
|
commitmentRetries: number;
|
|
5007
5038
|
pmmFailureStats: Record<string, number>;
|
|
5008
5039
|
commitedSignature: string;
|
|
5009
|
-
sessionDeadline: number;
|
|
5010
5040
|
userDepositTx: string;
|
|
5011
5041
|
depositVault: string;
|
|
5012
5042
|
paymentBundle: {
|
|
@@ -5023,6 +5053,9 @@ declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
|
5023
5053
|
tradeMakePaymentTx: string;
|
|
5024
5054
|
state: string;
|
|
5025
5055
|
lastUpdateMsg: string;
|
|
5056
|
+
affiliateFeeInBps: string;
|
|
5057
|
+
protocolFee: string;
|
|
5058
|
+
affiliateFee: string;
|
|
5026
5059
|
};
|
|
5027
5060
|
traceId: string;
|
|
5028
5061
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -3671,7 +3671,10 @@ var SubmitSettlementRequestSchema = import_zod.z.object({
|
|
|
3671
3671
|
signedAt: import_zod.z.number()
|
|
3672
3672
|
});
|
|
3673
3673
|
var SubmitSettlementResponseSchema = import_zod.z.object({
|
|
3674
|
-
|
|
3674
|
+
data: import_zod.z.object({
|
|
3675
|
+
message: import_zod.z.string()
|
|
3676
|
+
}),
|
|
3677
|
+
traceId: import_zod.z.string()
|
|
3675
3678
|
});
|
|
3676
3679
|
var TokenInfoSchema = import_zod.z.object({
|
|
3677
3680
|
tokenId: import_zod.z.string(),
|
|
@@ -3703,7 +3706,6 @@ var TradeDetailResponseSchema = import_zod.z.object({
|
|
|
3703
3706
|
amountAfterFees: import_zod.z.string(),
|
|
3704
3707
|
fromUserAddress: import_zod.z.string(),
|
|
3705
3708
|
userReceivingAddress: import_zod.z.string(),
|
|
3706
|
-
deadline: import_zod.z.number(),
|
|
3707
3709
|
protocolFeeInBps: import_zod.z.string(),
|
|
3708
3710
|
protocolMpcPubkey: import_zod.z.string(),
|
|
3709
3711
|
protocolMpcAddress: import_zod.z.string(),
|
|
@@ -3720,7 +3722,6 @@ var TradeDetailResponseSchema = import_zod.z.object({
|
|
|
3720
3722
|
pmmFailureStats: import_zod.z.record(import_zod.z.number()),
|
|
3721
3723
|
commitedSignature: import_zod.z.string(),
|
|
3722
3724
|
minAmountOut: import_zod.z.null(),
|
|
3723
|
-
sessionDeadline: import_zod.z.number(),
|
|
3724
3725
|
userDepositTx: import_zod.z.string(),
|
|
3725
3726
|
depositVault: import_zod.z.string(),
|
|
3726
3727
|
paymentBundle: PaymentBundleSchema,
|
|
@@ -3730,7 +3731,13 @@ var TradeDetailResponseSchema = import_zod.z.object({
|
|
|
3730
3731
|
tradeMakePaymentTx: import_zod.z.string(),
|
|
3731
3732
|
state: import_zod.z.string(),
|
|
3732
3733
|
lastUpdateMsg: import_zod.z.string(),
|
|
3733
|
-
version: import_zod.z.number()
|
|
3734
|
+
version: import_zod.z.number(),
|
|
3735
|
+
scriptTimeout: import_zod.z.number(),
|
|
3736
|
+
affiliateFeeInBps: import_zod.z.string(),
|
|
3737
|
+
totalFee: import_zod.z.string(),
|
|
3738
|
+
protocolFee: import_zod.z.string(),
|
|
3739
|
+
affiliateFee: import_zod.z.string(),
|
|
3740
|
+
tradeTimeout: import_zod.z.number()
|
|
3734
3741
|
}),
|
|
3735
3742
|
traceId: import_zod.z.string()
|
|
3736
3743
|
});
|
|
@@ -3769,7 +3776,8 @@ var SolverService = class {
|
|
|
3769
3776
|
return SubmitSettlementResponseSchema.parse(response.data);
|
|
3770
3777
|
} catch (error) {
|
|
3771
3778
|
if (import_axios.default.isAxiosError(error)) {
|
|
3772
|
-
|
|
3779
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3780
|
+
throw new Error(errorMessage);
|
|
3773
3781
|
}
|
|
3774
3782
|
if (error instanceof import_zod.z.ZodError) {
|
|
3775
3783
|
throw new Error(`Invalid data: ${error.message}`);
|
|
@@ -3795,7 +3803,8 @@ var SolverService = class {
|
|
|
3795
3803
|
return TradeDetailResponseSchema.parse(camelCaseData);
|
|
3796
3804
|
} catch (error) {
|
|
3797
3805
|
if (import_axios.default.isAxiosError(error)) {
|
|
3798
|
-
|
|
3806
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3807
|
+
throw new Error(errorMessage);
|
|
3799
3808
|
}
|
|
3800
3809
|
if (error instanceof import_zod.z.ZodError) {
|
|
3801
3810
|
throw new Error(`Invalid data: ${error.message}`);
|
|
@@ -3862,7 +3871,8 @@ var TokenService = class {
|
|
|
3862
3871
|
return validatedResponse.data.tokens;
|
|
3863
3872
|
} catch (error) {
|
|
3864
3873
|
if (import_axios2.default.isAxiosError(error)) {
|
|
3865
|
-
|
|
3874
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3875
|
+
throw new Error(errorMessage);
|
|
3866
3876
|
}
|
|
3867
3877
|
if (error instanceof import_zod3.z.ZodError) {
|
|
3868
3878
|
throw new Error(`Invalid token data received: ${error.message}`);
|
package/dist/index.mjs
CHANGED
|
@@ -3606,7 +3606,10 @@ var SubmitSettlementRequestSchema = z.object({
|
|
|
3606
3606
|
signedAt: z.number()
|
|
3607
3607
|
});
|
|
3608
3608
|
var SubmitSettlementResponseSchema = z.object({
|
|
3609
|
-
|
|
3609
|
+
data: z.object({
|
|
3610
|
+
message: z.string()
|
|
3611
|
+
}),
|
|
3612
|
+
traceId: z.string()
|
|
3610
3613
|
});
|
|
3611
3614
|
var TokenInfoSchema = z.object({
|
|
3612
3615
|
tokenId: z.string(),
|
|
@@ -3638,7 +3641,6 @@ var TradeDetailResponseSchema = z.object({
|
|
|
3638
3641
|
amountAfterFees: z.string(),
|
|
3639
3642
|
fromUserAddress: z.string(),
|
|
3640
3643
|
userReceivingAddress: z.string(),
|
|
3641
|
-
deadline: z.number(),
|
|
3642
3644
|
protocolFeeInBps: z.string(),
|
|
3643
3645
|
protocolMpcPubkey: z.string(),
|
|
3644
3646
|
protocolMpcAddress: z.string(),
|
|
@@ -3655,7 +3657,6 @@ var TradeDetailResponseSchema = z.object({
|
|
|
3655
3657
|
pmmFailureStats: z.record(z.number()),
|
|
3656
3658
|
commitedSignature: z.string(),
|
|
3657
3659
|
minAmountOut: z.null(),
|
|
3658
|
-
sessionDeadline: z.number(),
|
|
3659
3660
|
userDepositTx: z.string(),
|
|
3660
3661
|
depositVault: z.string(),
|
|
3661
3662
|
paymentBundle: PaymentBundleSchema,
|
|
@@ -3665,7 +3666,13 @@ var TradeDetailResponseSchema = z.object({
|
|
|
3665
3666
|
tradeMakePaymentTx: z.string(),
|
|
3666
3667
|
state: z.string(),
|
|
3667
3668
|
lastUpdateMsg: z.string(),
|
|
3668
|
-
version: z.number()
|
|
3669
|
+
version: z.number(),
|
|
3670
|
+
scriptTimeout: z.number(),
|
|
3671
|
+
affiliateFeeInBps: z.string(),
|
|
3672
|
+
totalFee: z.string(),
|
|
3673
|
+
protocolFee: z.string(),
|
|
3674
|
+
affiliateFee: z.string(),
|
|
3675
|
+
tradeTimeout: z.number()
|
|
3669
3676
|
}),
|
|
3670
3677
|
traceId: z.string()
|
|
3671
3678
|
});
|
|
@@ -3704,7 +3711,8 @@ var SolverService = class {
|
|
|
3704
3711
|
return SubmitSettlementResponseSchema.parse(response.data);
|
|
3705
3712
|
} catch (error) {
|
|
3706
3713
|
if (axios.isAxiosError(error)) {
|
|
3707
|
-
|
|
3714
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3715
|
+
throw new Error(errorMessage);
|
|
3708
3716
|
}
|
|
3709
3717
|
if (error instanceof z.ZodError) {
|
|
3710
3718
|
throw new Error(`Invalid data: ${error.message}`);
|
|
@@ -3730,7 +3738,8 @@ var SolverService = class {
|
|
|
3730
3738
|
return TradeDetailResponseSchema.parse(camelCaseData);
|
|
3731
3739
|
} catch (error) {
|
|
3732
3740
|
if (axios.isAxiosError(error)) {
|
|
3733
|
-
|
|
3741
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3742
|
+
throw new Error(errorMessage);
|
|
3734
3743
|
}
|
|
3735
3744
|
if (error instanceof z.ZodError) {
|
|
3736
3745
|
throw new Error(`Invalid data: ${error.message}`);
|
|
@@ -3797,7 +3806,8 @@ var TokenService = class {
|
|
|
3797
3806
|
return validatedResponse.data.tokens;
|
|
3798
3807
|
} catch (error) {
|
|
3799
3808
|
if (axios2.isAxiosError(error)) {
|
|
3800
|
-
|
|
3809
|
+
const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
3810
|
+
throw new Error(errorMessage);
|
|
3801
3811
|
}
|
|
3802
3812
|
if (error instanceof z3.ZodError) {
|
|
3803
3813
|
throw new Error(`Invalid token data received: ${error.message}`);
|