@optimex-xyz/market-maker-sdk 0.4.5 → 0.4.7
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/dist/index.d.mts +362 -0
- package/dist/index.d.ts +362 -0
- package/dist/index.js +88 -1
- package/dist/index.mjs +88 -1
- package/package.json +12 -11
package/dist/index.d.mts
CHANGED
|
@@ -4672,8 +4672,363 @@ declare const SubmitSettlementResponseSchema: z.ZodObject<{
|
|
|
4672
4672
|
}, {
|
|
4673
4673
|
message: string;
|
|
4674
4674
|
}>;
|
|
4675
|
+
declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
4676
|
+
data: z.ZodObject<{
|
|
4677
|
+
tradeId: z.ZodString;
|
|
4678
|
+
sessionId: z.ZodString;
|
|
4679
|
+
solverAddress: z.ZodString;
|
|
4680
|
+
fromToken: z.ZodObject<{
|
|
4681
|
+
tokenId: z.ZodString;
|
|
4682
|
+
chain: z.ZodString;
|
|
4683
|
+
address: z.ZodString;
|
|
4684
|
+
feeIn: z.ZodBoolean;
|
|
4685
|
+
feeOut: z.ZodBoolean;
|
|
4686
|
+
}, "strip", z.ZodTypeAny, {
|
|
4687
|
+
address: string;
|
|
4688
|
+
tokenId: string;
|
|
4689
|
+
chain: string;
|
|
4690
|
+
feeIn: boolean;
|
|
4691
|
+
feeOut: boolean;
|
|
4692
|
+
}, {
|
|
4693
|
+
address: string;
|
|
4694
|
+
tokenId: string;
|
|
4695
|
+
chain: string;
|
|
4696
|
+
feeIn: boolean;
|
|
4697
|
+
feeOut: boolean;
|
|
4698
|
+
}>;
|
|
4699
|
+
toToken: z.ZodObject<{
|
|
4700
|
+
tokenId: z.ZodString;
|
|
4701
|
+
chain: z.ZodString;
|
|
4702
|
+
address: z.ZodString;
|
|
4703
|
+
feeIn: z.ZodBoolean;
|
|
4704
|
+
feeOut: z.ZodBoolean;
|
|
4705
|
+
}, "strip", z.ZodTypeAny, {
|
|
4706
|
+
address: string;
|
|
4707
|
+
tokenId: string;
|
|
4708
|
+
chain: string;
|
|
4709
|
+
feeIn: boolean;
|
|
4710
|
+
feeOut: boolean;
|
|
4711
|
+
}, {
|
|
4712
|
+
address: string;
|
|
4713
|
+
tokenId: string;
|
|
4714
|
+
chain: string;
|
|
4715
|
+
feeIn: boolean;
|
|
4716
|
+
feeOut: boolean;
|
|
4717
|
+
}>;
|
|
4718
|
+
amountBeforeFees: z.ZodString;
|
|
4719
|
+
amountAfterFees: z.ZodString;
|
|
4720
|
+
fromUserAddress: z.ZodString;
|
|
4721
|
+
userReceivingAddress: z.ZodString;
|
|
4722
|
+
deadline: z.ZodNumber;
|
|
4723
|
+
protocolFeeInBps: z.ZodString;
|
|
4724
|
+
protocolMpcPubkey: z.ZodString;
|
|
4725
|
+
protocolMpcAddress: z.ZodString;
|
|
4726
|
+
bestIndicativeQuote: z.ZodString;
|
|
4727
|
+
displayIndicativeQuote: z.ZodString;
|
|
4728
|
+
pmmFinalists: z.ZodArray<z.ZodObject<{
|
|
4729
|
+
pmmId: z.ZodString;
|
|
4730
|
+
pmmReceivingAddress: z.ZodString;
|
|
4731
|
+
}, "strip", z.ZodTypeAny, {
|
|
4732
|
+
pmmId: string;
|
|
4733
|
+
pmmReceivingAddress: string;
|
|
4734
|
+
}, {
|
|
4735
|
+
pmmId: string;
|
|
4736
|
+
pmmReceivingAddress: string;
|
|
4737
|
+
}>, "many">;
|
|
4738
|
+
settlementQuote: z.ZodString;
|
|
4739
|
+
receivingAmount: z.ZodString;
|
|
4740
|
+
selectedPmm: z.ZodString;
|
|
4741
|
+
selectedPmmReceivingAddress: z.ZodString;
|
|
4742
|
+
selectedPmmOperator: z.ZodString;
|
|
4743
|
+
selectedPmmSigDeadline: z.ZodNumber;
|
|
4744
|
+
commitmentRetries: z.ZodNumber;
|
|
4745
|
+
pmmFailureStats: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
4746
|
+
commitedSignature: z.ZodString;
|
|
4747
|
+
minAmountOut: z.ZodNull;
|
|
4748
|
+
sessionDeadline: z.ZodNumber;
|
|
4749
|
+
userDepositTx: z.ZodString;
|
|
4750
|
+
depositVault: z.ZodString;
|
|
4751
|
+
paymentBundle: z.ZodObject<{
|
|
4752
|
+
tradeIds: z.ZodArray<z.ZodString, "many">;
|
|
4753
|
+
settlementTx: z.ZodString;
|
|
4754
|
+
signature: z.ZodString;
|
|
4755
|
+
startIndex: z.ZodNumber;
|
|
4756
|
+
pmmId: z.ZodString;
|
|
4757
|
+
signedAt: z.ZodNumber;
|
|
4758
|
+
}, "strip", z.ZodTypeAny, {
|
|
4759
|
+
signature: string;
|
|
4760
|
+
tradeIds: string[];
|
|
4761
|
+
signedAt: number;
|
|
4762
|
+
pmmId: string;
|
|
4763
|
+
settlementTx: string;
|
|
4764
|
+
startIndex: number;
|
|
4765
|
+
}, {
|
|
4766
|
+
signature: string;
|
|
4767
|
+
tradeIds: string[];
|
|
4768
|
+
signedAt: number;
|
|
4769
|
+
pmmId: string;
|
|
4770
|
+
settlementTx: string;
|
|
4771
|
+
startIndex: number;
|
|
4772
|
+
}>;
|
|
4773
|
+
userSignature: z.ZodString;
|
|
4774
|
+
tradeSubmissionTx: z.ZodString;
|
|
4775
|
+
tradeSelectPmmTx: z.ZodString;
|
|
4776
|
+
tradeMakePaymentTx: z.ZodString;
|
|
4777
|
+
state: z.ZodString;
|
|
4778
|
+
lastUpdateMsg: z.ZodString;
|
|
4779
|
+
version: z.ZodNumber;
|
|
4780
|
+
}, "strip", z.ZodTypeAny, {
|
|
4781
|
+
version: number;
|
|
4782
|
+
deadline: number;
|
|
4783
|
+
tradeId: string;
|
|
4784
|
+
minAmountOut: null;
|
|
4785
|
+
sessionId: string;
|
|
4786
|
+
solverAddress: string;
|
|
4787
|
+
fromToken: {
|
|
4788
|
+
address: string;
|
|
4789
|
+
tokenId: string;
|
|
4790
|
+
chain: string;
|
|
4791
|
+
feeIn: boolean;
|
|
4792
|
+
feeOut: boolean;
|
|
4793
|
+
};
|
|
4794
|
+
toToken: {
|
|
4795
|
+
address: string;
|
|
4796
|
+
tokenId: string;
|
|
4797
|
+
chain: string;
|
|
4798
|
+
feeIn: boolean;
|
|
4799
|
+
feeOut: boolean;
|
|
4800
|
+
};
|
|
4801
|
+
amountBeforeFees: string;
|
|
4802
|
+
amountAfterFees: string;
|
|
4803
|
+
fromUserAddress: string;
|
|
4804
|
+
userReceivingAddress: string;
|
|
4805
|
+
protocolFeeInBps: string;
|
|
4806
|
+
protocolMpcPubkey: string;
|
|
4807
|
+
protocolMpcAddress: string;
|
|
4808
|
+
bestIndicativeQuote: string;
|
|
4809
|
+
displayIndicativeQuote: string;
|
|
4810
|
+
pmmFinalists: {
|
|
4811
|
+
pmmId: string;
|
|
4812
|
+
pmmReceivingAddress: string;
|
|
4813
|
+
}[];
|
|
4814
|
+
settlementQuote: string;
|
|
4815
|
+
receivingAmount: string;
|
|
4816
|
+
selectedPmm: string;
|
|
4817
|
+
selectedPmmReceivingAddress: string;
|
|
4818
|
+
selectedPmmOperator: string;
|
|
4819
|
+
selectedPmmSigDeadline: number;
|
|
4820
|
+
commitmentRetries: number;
|
|
4821
|
+
pmmFailureStats: Record<string, number>;
|
|
4822
|
+
commitedSignature: string;
|
|
4823
|
+
sessionDeadline: number;
|
|
4824
|
+
userDepositTx: string;
|
|
4825
|
+
depositVault: string;
|
|
4826
|
+
paymentBundle: {
|
|
4827
|
+
signature: string;
|
|
4828
|
+
tradeIds: string[];
|
|
4829
|
+
signedAt: number;
|
|
4830
|
+
pmmId: string;
|
|
4831
|
+
settlementTx: string;
|
|
4832
|
+
startIndex: number;
|
|
4833
|
+
};
|
|
4834
|
+
userSignature: string;
|
|
4835
|
+
tradeSubmissionTx: string;
|
|
4836
|
+
tradeSelectPmmTx: string;
|
|
4837
|
+
tradeMakePaymentTx: string;
|
|
4838
|
+
state: string;
|
|
4839
|
+
lastUpdateMsg: string;
|
|
4840
|
+
}, {
|
|
4841
|
+
version: number;
|
|
4842
|
+
deadline: number;
|
|
4843
|
+
tradeId: string;
|
|
4844
|
+
minAmountOut: null;
|
|
4845
|
+
sessionId: string;
|
|
4846
|
+
solverAddress: string;
|
|
4847
|
+
fromToken: {
|
|
4848
|
+
address: string;
|
|
4849
|
+
tokenId: string;
|
|
4850
|
+
chain: string;
|
|
4851
|
+
feeIn: boolean;
|
|
4852
|
+
feeOut: boolean;
|
|
4853
|
+
};
|
|
4854
|
+
toToken: {
|
|
4855
|
+
address: string;
|
|
4856
|
+
tokenId: string;
|
|
4857
|
+
chain: string;
|
|
4858
|
+
feeIn: boolean;
|
|
4859
|
+
feeOut: boolean;
|
|
4860
|
+
};
|
|
4861
|
+
amountBeforeFees: string;
|
|
4862
|
+
amountAfterFees: string;
|
|
4863
|
+
fromUserAddress: string;
|
|
4864
|
+
userReceivingAddress: string;
|
|
4865
|
+
protocolFeeInBps: string;
|
|
4866
|
+
protocolMpcPubkey: string;
|
|
4867
|
+
protocolMpcAddress: string;
|
|
4868
|
+
bestIndicativeQuote: string;
|
|
4869
|
+
displayIndicativeQuote: string;
|
|
4870
|
+
pmmFinalists: {
|
|
4871
|
+
pmmId: string;
|
|
4872
|
+
pmmReceivingAddress: string;
|
|
4873
|
+
}[];
|
|
4874
|
+
settlementQuote: string;
|
|
4875
|
+
receivingAmount: string;
|
|
4876
|
+
selectedPmm: string;
|
|
4877
|
+
selectedPmmReceivingAddress: string;
|
|
4878
|
+
selectedPmmOperator: string;
|
|
4879
|
+
selectedPmmSigDeadline: number;
|
|
4880
|
+
commitmentRetries: number;
|
|
4881
|
+
pmmFailureStats: Record<string, number>;
|
|
4882
|
+
commitedSignature: string;
|
|
4883
|
+
sessionDeadline: number;
|
|
4884
|
+
userDepositTx: string;
|
|
4885
|
+
depositVault: string;
|
|
4886
|
+
paymentBundle: {
|
|
4887
|
+
signature: string;
|
|
4888
|
+
tradeIds: string[];
|
|
4889
|
+
signedAt: number;
|
|
4890
|
+
pmmId: string;
|
|
4891
|
+
settlementTx: string;
|
|
4892
|
+
startIndex: number;
|
|
4893
|
+
};
|
|
4894
|
+
userSignature: string;
|
|
4895
|
+
tradeSubmissionTx: string;
|
|
4896
|
+
tradeSelectPmmTx: string;
|
|
4897
|
+
tradeMakePaymentTx: string;
|
|
4898
|
+
state: string;
|
|
4899
|
+
lastUpdateMsg: string;
|
|
4900
|
+
}>;
|
|
4901
|
+
traceId: z.ZodString;
|
|
4902
|
+
}, "strip", z.ZodTypeAny, {
|
|
4903
|
+
data: {
|
|
4904
|
+
version: number;
|
|
4905
|
+
deadline: number;
|
|
4906
|
+
tradeId: string;
|
|
4907
|
+
minAmountOut: null;
|
|
4908
|
+
sessionId: string;
|
|
4909
|
+
solverAddress: string;
|
|
4910
|
+
fromToken: {
|
|
4911
|
+
address: string;
|
|
4912
|
+
tokenId: string;
|
|
4913
|
+
chain: string;
|
|
4914
|
+
feeIn: boolean;
|
|
4915
|
+
feeOut: boolean;
|
|
4916
|
+
};
|
|
4917
|
+
toToken: {
|
|
4918
|
+
address: string;
|
|
4919
|
+
tokenId: string;
|
|
4920
|
+
chain: string;
|
|
4921
|
+
feeIn: boolean;
|
|
4922
|
+
feeOut: boolean;
|
|
4923
|
+
};
|
|
4924
|
+
amountBeforeFees: string;
|
|
4925
|
+
amountAfterFees: string;
|
|
4926
|
+
fromUserAddress: string;
|
|
4927
|
+
userReceivingAddress: string;
|
|
4928
|
+
protocolFeeInBps: string;
|
|
4929
|
+
protocolMpcPubkey: string;
|
|
4930
|
+
protocolMpcAddress: string;
|
|
4931
|
+
bestIndicativeQuote: string;
|
|
4932
|
+
displayIndicativeQuote: string;
|
|
4933
|
+
pmmFinalists: {
|
|
4934
|
+
pmmId: string;
|
|
4935
|
+
pmmReceivingAddress: string;
|
|
4936
|
+
}[];
|
|
4937
|
+
settlementQuote: string;
|
|
4938
|
+
receivingAmount: string;
|
|
4939
|
+
selectedPmm: string;
|
|
4940
|
+
selectedPmmReceivingAddress: string;
|
|
4941
|
+
selectedPmmOperator: string;
|
|
4942
|
+
selectedPmmSigDeadline: number;
|
|
4943
|
+
commitmentRetries: number;
|
|
4944
|
+
pmmFailureStats: Record<string, number>;
|
|
4945
|
+
commitedSignature: string;
|
|
4946
|
+
sessionDeadline: number;
|
|
4947
|
+
userDepositTx: string;
|
|
4948
|
+
depositVault: string;
|
|
4949
|
+
paymentBundle: {
|
|
4950
|
+
signature: string;
|
|
4951
|
+
tradeIds: string[];
|
|
4952
|
+
signedAt: number;
|
|
4953
|
+
pmmId: string;
|
|
4954
|
+
settlementTx: string;
|
|
4955
|
+
startIndex: number;
|
|
4956
|
+
};
|
|
4957
|
+
userSignature: string;
|
|
4958
|
+
tradeSubmissionTx: string;
|
|
4959
|
+
tradeSelectPmmTx: string;
|
|
4960
|
+
tradeMakePaymentTx: string;
|
|
4961
|
+
state: string;
|
|
4962
|
+
lastUpdateMsg: string;
|
|
4963
|
+
};
|
|
4964
|
+
traceId: string;
|
|
4965
|
+
}, {
|
|
4966
|
+
data: {
|
|
4967
|
+
version: number;
|
|
4968
|
+
deadline: number;
|
|
4969
|
+
tradeId: string;
|
|
4970
|
+
minAmountOut: null;
|
|
4971
|
+
sessionId: string;
|
|
4972
|
+
solverAddress: string;
|
|
4973
|
+
fromToken: {
|
|
4974
|
+
address: string;
|
|
4975
|
+
tokenId: string;
|
|
4976
|
+
chain: string;
|
|
4977
|
+
feeIn: boolean;
|
|
4978
|
+
feeOut: boolean;
|
|
4979
|
+
};
|
|
4980
|
+
toToken: {
|
|
4981
|
+
address: string;
|
|
4982
|
+
tokenId: string;
|
|
4983
|
+
chain: string;
|
|
4984
|
+
feeIn: boolean;
|
|
4985
|
+
feeOut: boolean;
|
|
4986
|
+
};
|
|
4987
|
+
amountBeforeFees: string;
|
|
4988
|
+
amountAfterFees: string;
|
|
4989
|
+
fromUserAddress: string;
|
|
4990
|
+
userReceivingAddress: string;
|
|
4991
|
+
protocolFeeInBps: string;
|
|
4992
|
+
protocolMpcPubkey: string;
|
|
4993
|
+
protocolMpcAddress: string;
|
|
4994
|
+
bestIndicativeQuote: string;
|
|
4995
|
+
displayIndicativeQuote: string;
|
|
4996
|
+
pmmFinalists: {
|
|
4997
|
+
pmmId: string;
|
|
4998
|
+
pmmReceivingAddress: string;
|
|
4999
|
+
}[];
|
|
5000
|
+
settlementQuote: string;
|
|
5001
|
+
receivingAmount: string;
|
|
5002
|
+
selectedPmm: string;
|
|
5003
|
+
selectedPmmReceivingAddress: string;
|
|
5004
|
+
selectedPmmOperator: string;
|
|
5005
|
+
selectedPmmSigDeadline: number;
|
|
5006
|
+
commitmentRetries: number;
|
|
5007
|
+
pmmFailureStats: Record<string, number>;
|
|
5008
|
+
commitedSignature: string;
|
|
5009
|
+
sessionDeadline: number;
|
|
5010
|
+
userDepositTx: string;
|
|
5011
|
+
depositVault: string;
|
|
5012
|
+
paymentBundle: {
|
|
5013
|
+
signature: string;
|
|
5014
|
+
tradeIds: string[];
|
|
5015
|
+
signedAt: number;
|
|
5016
|
+
pmmId: string;
|
|
5017
|
+
settlementTx: string;
|
|
5018
|
+
startIndex: number;
|
|
5019
|
+
};
|
|
5020
|
+
userSignature: string;
|
|
5021
|
+
tradeSubmissionTx: string;
|
|
5022
|
+
tradeSelectPmmTx: string;
|
|
5023
|
+
tradeMakePaymentTx: string;
|
|
5024
|
+
state: string;
|
|
5025
|
+
lastUpdateMsg: string;
|
|
5026
|
+
};
|
|
5027
|
+
traceId: string;
|
|
5028
|
+
}>;
|
|
4675
5029
|
type SubmitSettlementRequest = z.infer<typeof SubmitSettlementRequestSchema>;
|
|
4676
5030
|
type SubmitSettlementResponse = z.infer<typeof SubmitSettlementResponseSchema>;
|
|
5031
|
+
type TradeDetailResponse = z.infer<typeof TradeDetailResponseSchema>;
|
|
4677
5032
|
declare class SolverService implements ConfigObserver {
|
|
4678
5033
|
private baseURL;
|
|
4679
5034
|
constructor();
|
|
@@ -4689,6 +5044,13 @@ declare class SolverService implements ConfigObserver {
|
|
|
4689
5044
|
* @throws Error if the request fails or validation fails
|
|
4690
5045
|
*/
|
|
4691
5046
|
submitSettlementTx(params: SubmitSettlementRequest): Promise<SubmitSettlementResponse>;
|
|
5047
|
+
/**
|
|
5048
|
+
* Get trade details
|
|
5049
|
+
* @param tradeId ID of the trade to query
|
|
5050
|
+
* @returns Promise with trade details in camelCase format
|
|
5051
|
+
* @throws Error if request fails or validation fails
|
|
5052
|
+
*/
|
|
5053
|
+
getTradeDetail(tradeId: string): Promise<TradeDetailResponse>;
|
|
4692
5054
|
}
|
|
4693
5055
|
declare const solverService: SolverService;
|
|
4694
5056
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4672,8 +4672,363 @@ declare const SubmitSettlementResponseSchema: z.ZodObject<{
|
|
|
4672
4672
|
}, {
|
|
4673
4673
|
message: string;
|
|
4674
4674
|
}>;
|
|
4675
|
+
declare const TradeDetailResponseSchema: z.ZodObject<{
|
|
4676
|
+
data: z.ZodObject<{
|
|
4677
|
+
tradeId: z.ZodString;
|
|
4678
|
+
sessionId: z.ZodString;
|
|
4679
|
+
solverAddress: z.ZodString;
|
|
4680
|
+
fromToken: z.ZodObject<{
|
|
4681
|
+
tokenId: z.ZodString;
|
|
4682
|
+
chain: z.ZodString;
|
|
4683
|
+
address: z.ZodString;
|
|
4684
|
+
feeIn: z.ZodBoolean;
|
|
4685
|
+
feeOut: z.ZodBoolean;
|
|
4686
|
+
}, "strip", z.ZodTypeAny, {
|
|
4687
|
+
address: string;
|
|
4688
|
+
tokenId: string;
|
|
4689
|
+
chain: string;
|
|
4690
|
+
feeIn: boolean;
|
|
4691
|
+
feeOut: boolean;
|
|
4692
|
+
}, {
|
|
4693
|
+
address: string;
|
|
4694
|
+
tokenId: string;
|
|
4695
|
+
chain: string;
|
|
4696
|
+
feeIn: boolean;
|
|
4697
|
+
feeOut: boolean;
|
|
4698
|
+
}>;
|
|
4699
|
+
toToken: z.ZodObject<{
|
|
4700
|
+
tokenId: z.ZodString;
|
|
4701
|
+
chain: z.ZodString;
|
|
4702
|
+
address: z.ZodString;
|
|
4703
|
+
feeIn: z.ZodBoolean;
|
|
4704
|
+
feeOut: z.ZodBoolean;
|
|
4705
|
+
}, "strip", z.ZodTypeAny, {
|
|
4706
|
+
address: string;
|
|
4707
|
+
tokenId: string;
|
|
4708
|
+
chain: string;
|
|
4709
|
+
feeIn: boolean;
|
|
4710
|
+
feeOut: boolean;
|
|
4711
|
+
}, {
|
|
4712
|
+
address: string;
|
|
4713
|
+
tokenId: string;
|
|
4714
|
+
chain: string;
|
|
4715
|
+
feeIn: boolean;
|
|
4716
|
+
feeOut: boolean;
|
|
4717
|
+
}>;
|
|
4718
|
+
amountBeforeFees: z.ZodString;
|
|
4719
|
+
amountAfterFees: z.ZodString;
|
|
4720
|
+
fromUserAddress: z.ZodString;
|
|
4721
|
+
userReceivingAddress: z.ZodString;
|
|
4722
|
+
deadline: z.ZodNumber;
|
|
4723
|
+
protocolFeeInBps: z.ZodString;
|
|
4724
|
+
protocolMpcPubkey: z.ZodString;
|
|
4725
|
+
protocolMpcAddress: z.ZodString;
|
|
4726
|
+
bestIndicativeQuote: z.ZodString;
|
|
4727
|
+
displayIndicativeQuote: z.ZodString;
|
|
4728
|
+
pmmFinalists: z.ZodArray<z.ZodObject<{
|
|
4729
|
+
pmmId: z.ZodString;
|
|
4730
|
+
pmmReceivingAddress: z.ZodString;
|
|
4731
|
+
}, "strip", z.ZodTypeAny, {
|
|
4732
|
+
pmmId: string;
|
|
4733
|
+
pmmReceivingAddress: string;
|
|
4734
|
+
}, {
|
|
4735
|
+
pmmId: string;
|
|
4736
|
+
pmmReceivingAddress: string;
|
|
4737
|
+
}>, "many">;
|
|
4738
|
+
settlementQuote: z.ZodString;
|
|
4739
|
+
receivingAmount: z.ZodString;
|
|
4740
|
+
selectedPmm: z.ZodString;
|
|
4741
|
+
selectedPmmReceivingAddress: z.ZodString;
|
|
4742
|
+
selectedPmmOperator: z.ZodString;
|
|
4743
|
+
selectedPmmSigDeadline: z.ZodNumber;
|
|
4744
|
+
commitmentRetries: z.ZodNumber;
|
|
4745
|
+
pmmFailureStats: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
4746
|
+
commitedSignature: z.ZodString;
|
|
4747
|
+
minAmountOut: z.ZodNull;
|
|
4748
|
+
sessionDeadline: z.ZodNumber;
|
|
4749
|
+
userDepositTx: z.ZodString;
|
|
4750
|
+
depositVault: z.ZodString;
|
|
4751
|
+
paymentBundle: z.ZodObject<{
|
|
4752
|
+
tradeIds: z.ZodArray<z.ZodString, "many">;
|
|
4753
|
+
settlementTx: z.ZodString;
|
|
4754
|
+
signature: z.ZodString;
|
|
4755
|
+
startIndex: z.ZodNumber;
|
|
4756
|
+
pmmId: z.ZodString;
|
|
4757
|
+
signedAt: z.ZodNumber;
|
|
4758
|
+
}, "strip", z.ZodTypeAny, {
|
|
4759
|
+
signature: string;
|
|
4760
|
+
tradeIds: string[];
|
|
4761
|
+
signedAt: number;
|
|
4762
|
+
pmmId: string;
|
|
4763
|
+
settlementTx: string;
|
|
4764
|
+
startIndex: number;
|
|
4765
|
+
}, {
|
|
4766
|
+
signature: string;
|
|
4767
|
+
tradeIds: string[];
|
|
4768
|
+
signedAt: number;
|
|
4769
|
+
pmmId: string;
|
|
4770
|
+
settlementTx: string;
|
|
4771
|
+
startIndex: number;
|
|
4772
|
+
}>;
|
|
4773
|
+
userSignature: z.ZodString;
|
|
4774
|
+
tradeSubmissionTx: z.ZodString;
|
|
4775
|
+
tradeSelectPmmTx: z.ZodString;
|
|
4776
|
+
tradeMakePaymentTx: z.ZodString;
|
|
4777
|
+
state: z.ZodString;
|
|
4778
|
+
lastUpdateMsg: z.ZodString;
|
|
4779
|
+
version: z.ZodNumber;
|
|
4780
|
+
}, "strip", z.ZodTypeAny, {
|
|
4781
|
+
version: number;
|
|
4782
|
+
deadline: number;
|
|
4783
|
+
tradeId: string;
|
|
4784
|
+
minAmountOut: null;
|
|
4785
|
+
sessionId: string;
|
|
4786
|
+
solverAddress: string;
|
|
4787
|
+
fromToken: {
|
|
4788
|
+
address: string;
|
|
4789
|
+
tokenId: string;
|
|
4790
|
+
chain: string;
|
|
4791
|
+
feeIn: boolean;
|
|
4792
|
+
feeOut: boolean;
|
|
4793
|
+
};
|
|
4794
|
+
toToken: {
|
|
4795
|
+
address: string;
|
|
4796
|
+
tokenId: string;
|
|
4797
|
+
chain: string;
|
|
4798
|
+
feeIn: boolean;
|
|
4799
|
+
feeOut: boolean;
|
|
4800
|
+
};
|
|
4801
|
+
amountBeforeFees: string;
|
|
4802
|
+
amountAfterFees: string;
|
|
4803
|
+
fromUserAddress: string;
|
|
4804
|
+
userReceivingAddress: string;
|
|
4805
|
+
protocolFeeInBps: string;
|
|
4806
|
+
protocolMpcPubkey: string;
|
|
4807
|
+
protocolMpcAddress: string;
|
|
4808
|
+
bestIndicativeQuote: string;
|
|
4809
|
+
displayIndicativeQuote: string;
|
|
4810
|
+
pmmFinalists: {
|
|
4811
|
+
pmmId: string;
|
|
4812
|
+
pmmReceivingAddress: string;
|
|
4813
|
+
}[];
|
|
4814
|
+
settlementQuote: string;
|
|
4815
|
+
receivingAmount: string;
|
|
4816
|
+
selectedPmm: string;
|
|
4817
|
+
selectedPmmReceivingAddress: string;
|
|
4818
|
+
selectedPmmOperator: string;
|
|
4819
|
+
selectedPmmSigDeadline: number;
|
|
4820
|
+
commitmentRetries: number;
|
|
4821
|
+
pmmFailureStats: Record<string, number>;
|
|
4822
|
+
commitedSignature: string;
|
|
4823
|
+
sessionDeadline: number;
|
|
4824
|
+
userDepositTx: string;
|
|
4825
|
+
depositVault: string;
|
|
4826
|
+
paymentBundle: {
|
|
4827
|
+
signature: string;
|
|
4828
|
+
tradeIds: string[];
|
|
4829
|
+
signedAt: number;
|
|
4830
|
+
pmmId: string;
|
|
4831
|
+
settlementTx: string;
|
|
4832
|
+
startIndex: number;
|
|
4833
|
+
};
|
|
4834
|
+
userSignature: string;
|
|
4835
|
+
tradeSubmissionTx: string;
|
|
4836
|
+
tradeSelectPmmTx: string;
|
|
4837
|
+
tradeMakePaymentTx: string;
|
|
4838
|
+
state: string;
|
|
4839
|
+
lastUpdateMsg: string;
|
|
4840
|
+
}, {
|
|
4841
|
+
version: number;
|
|
4842
|
+
deadline: number;
|
|
4843
|
+
tradeId: string;
|
|
4844
|
+
minAmountOut: null;
|
|
4845
|
+
sessionId: string;
|
|
4846
|
+
solverAddress: string;
|
|
4847
|
+
fromToken: {
|
|
4848
|
+
address: string;
|
|
4849
|
+
tokenId: string;
|
|
4850
|
+
chain: string;
|
|
4851
|
+
feeIn: boolean;
|
|
4852
|
+
feeOut: boolean;
|
|
4853
|
+
};
|
|
4854
|
+
toToken: {
|
|
4855
|
+
address: string;
|
|
4856
|
+
tokenId: string;
|
|
4857
|
+
chain: string;
|
|
4858
|
+
feeIn: boolean;
|
|
4859
|
+
feeOut: boolean;
|
|
4860
|
+
};
|
|
4861
|
+
amountBeforeFees: string;
|
|
4862
|
+
amountAfterFees: string;
|
|
4863
|
+
fromUserAddress: string;
|
|
4864
|
+
userReceivingAddress: string;
|
|
4865
|
+
protocolFeeInBps: string;
|
|
4866
|
+
protocolMpcPubkey: string;
|
|
4867
|
+
protocolMpcAddress: string;
|
|
4868
|
+
bestIndicativeQuote: string;
|
|
4869
|
+
displayIndicativeQuote: string;
|
|
4870
|
+
pmmFinalists: {
|
|
4871
|
+
pmmId: string;
|
|
4872
|
+
pmmReceivingAddress: string;
|
|
4873
|
+
}[];
|
|
4874
|
+
settlementQuote: string;
|
|
4875
|
+
receivingAmount: string;
|
|
4876
|
+
selectedPmm: string;
|
|
4877
|
+
selectedPmmReceivingAddress: string;
|
|
4878
|
+
selectedPmmOperator: string;
|
|
4879
|
+
selectedPmmSigDeadline: number;
|
|
4880
|
+
commitmentRetries: number;
|
|
4881
|
+
pmmFailureStats: Record<string, number>;
|
|
4882
|
+
commitedSignature: string;
|
|
4883
|
+
sessionDeadline: number;
|
|
4884
|
+
userDepositTx: string;
|
|
4885
|
+
depositVault: string;
|
|
4886
|
+
paymentBundle: {
|
|
4887
|
+
signature: string;
|
|
4888
|
+
tradeIds: string[];
|
|
4889
|
+
signedAt: number;
|
|
4890
|
+
pmmId: string;
|
|
4891
|
+
settlementTx: string;
|
|
4892
|
+
startIndex: number;
|
|
4893
|
+
};
|
|
4894
|
+
userSignature: string;
|
|
4895
|
+
tradeSubmissionTx: string;
|
|
4896
|
+
tradeSelectPmmTx: string;
|
|
4897
|
+
tradeMakePaymentTx: string;
|
|
4898
|
+
state: string;
|
|
4899
|
+
lastUpdateMsg: string;
|
|
4900
|
+
}>;
|
|
4901
|
+
traceId: z.ZodString;
|
|
4902
|
+
}, "strip", z.ZodTypeAny, {
|
|
4903
|
+
data: {
|
|
4904
|
+
version: number;
|
|
4905
|
+
deadline: number;
|
|
4906
|
+
tradeId: string;
|
|
4907
|
+
minAmountOut: null;
|
|
4908
|
+
sessionId: string;
|
|
4909
|
+
solverAddress: string;
|
|
4910
|
+
fromToken: {
|
|
4911
|
+
address: string;
|
|
4912
|
+
tokenId: string;
|
|
4913
|
+
chain: string;
|
|
4914
|
+
feeIn: boolean;
|
|
4915
|
+
feeOut: boolean;
|
|
4916
|
+
};
|
|
4917
|
+
toToken: {
|
|
4918
|
+
address: string;
|
|
4919
|
+
tokenId: string;
|
|
4920
|
+
chain: string;
|
|
4921
|
+
feeIn: boolean;
|
|
4922
|
+
feeOut: boolean;
|
|
4923
|
+
};
|
|
4924
|
+
amountBeforeFees: string;
|
|
4925
|
+
amountAfterFees: string;
|
|
4926
|
+
fromUserAddress: string;
|
|
4927
|
+
userReceivingAddress: string;
|
|
4928
|
+
protocolFeeInBps: string;
|
|
4929
|
+
protocolMpcPubkey: string;
|
|
4930
|
+
protocolMpcAddress: string;
|
|
4931
|
+
bestIndicativeQuote: string;
|
|
4932
|
+
displayIndicativeQuote: string;
|
|
4933
|
+
pmmFinalists: {
|
|
4934
|
+
pmmId: string;
|
|
4935
|
+
pmmReceivingAddress: string;
|
|
4936
|
+
}[];
|
|
4937
|
+
settlementQuote: string;
|
|
4938
|
+
receivingAmount: string;
|
|
4939
|
+
selectedPmm: string;
|
|
4940
|
+
selectedPmmReceivingAddress: string;
|
|
4941
|
+
selectedPmmOperator: string;
|
|
4942
|
+
selectedPmmSigDeadline: number;
|
|
4943
|
+
commitmentRetries: number;
|
|
4944
|
+
pmmFailureStats: Record<string, number>;
|
|
4945
|
+
commitedSignature: string;
|
|
4946
|
+
sessionDeadline: number;
|
|
4947
|
+
userDepositTx: string;
|
|
4948
|
+
depositVault: string;
|
|
4949
|
+
paymentBundle: {
|
|
4950
|
+
signature: string;
|
|
4951
|
+
tradeIds: string[];
|
|
4952
|
+
signedAt: number;
|
|
4953
|
+
pmmId: string;
|
|
4954
|
+
settlementTx: string;
|
|
4955
|
+
startIndex: number;
|
|
4956
|
+
};
|
|
4957
|
+
userSignature: string;
|
|
4958
|
+
tradeSubmissionTx: string;
|
|
4959
|
+
tradeSelectPmmTx: string;
|
|
4960
|
+
tradeMakePaymentTx: string;
|
|
4961
|
+
state: string;
|
|
4962
|
+
lastUpdateMsg: string;
|
|
4963
|
+
};
|
|
4964
|
+
traceId: string;
|
|
4965
|
+
}, {
|
|
4966
|
+
data: {
|
|
4967
|
+
version: number;
|
|
4968
|
+
deadline: number;
|
|
4969
|
+
tradeId: string;
|
|
4970
|
+
minAmountOut: null;
|
|
4971
|
+
sessionId: string;
|
|
4972
|
+
solverAddress: string;
|
|
4973
|
+
fromToken: {
|
|
4974
|
+
address: string;
|
|
4975
|
+
tokenId: string;
|
|
4976
|
+
chain: string;
|
|
4977
|
+
feeIn: boolean;
|
|
4978
|
+
feeOut: boolean;
|
|
4979
|
+
};
|
|
4980
|
+
toToken: {
|
|
4981
|
+
address: string;
|
|
4982
|
+
tokenId: string;
|
|
4983
|
+
chain: string;
|
|
4984
|
+
feeIn: boolean;
|
|
4985
|
+
feeOut: boolean;
|
|
4986
|
+
};
|
|
4987
|
+
amountBeforeFees: string;
|
|
4988
|
+
amountAfterFees: string;
|
|
4989
|
+
fromUserAddress: string;
|
|
4990
|
+
userReceivingAddress: string;
|
|
4991
|
+
protocolFeeInBps: string;
|
|
4992
|
+
protocolMpcPubkey: string;
|
|
4993
|
+
protocolMpcAddress: string;
|
|
4994
|
+
bestIndicativeQuote: string;
|
|
4995
|
+
displayIndicativeQuote: string;
|
|
4996
|
+
pmmFinalists: {
|
|
4997
|
+
pmmId: string;
|
|
4998
|
+
pmmReceivingAddress: string;
|
|
4999
|
+
}[];
|
|
5000
|
+
settlementQuote: string;
|
|
5001
|
+
receivingAmount: string;
|
|
5002
|
+
selectedPmm: string;
|
|
5003
|
+
selectedPmmReceivingAddress: string;
|
|
5004
|
+
selectedPmmOperator: string;
|
|
5005
|
+
selectedPmmSigDeadline: number;
|
|
5006
|
+
commitmentRetries: number;
|
|
5007
|
+
pmmFailureStats: Record<string, number>;
|
|
5008
|
+
commitedSignature: string;
|
|
5009
|
+
sessionDeadline: number;
|
|
5010
|
+
userDepositTx: string;
|
|
5011
|
+
depositVault: string;
|
|
5012
|
+
paymentBundle: {
|
|
5013
|
+
signature: string;
|
|
5014
|
+
tradeIds: string[];
|
|
5015
|
+
signedAt: number;
|
|
5016
|
+
pmmId: string;
|
|
5017
|
+
settlementTx: string;
|
|
5018
|
+
startIndex: number;
|
|
5019
|
+
};
|
|
5020
|
+
userSignature: string;
|
|
5021
|
+
tradeSubmissionTx: string;
|
|
5022
|
+
tradeSelectPmmTx: string;
|
|
5023
|
+
tradeMakePaymentTx: string;
|
|
5024
|
+
state: string;
|
|
5025
|
+
lastUpdateMsg: string;
|
|
5026
|
+
};
|
|
5027
|
+
traceId: string;
|
|
5028
|
+
}>;
|
|
4675
5029
|
type SubmitSettlementRequest = z.infer<typeof SubmitSettlementRequestSchema>;
|
|
4676
5030
|
type SubmitSettlementResponse = z.infer<typeof SubmitSettlementResponseSchema>;
|
|
5031
|
+
type TradeDetailResponse = z.infer<typeof TradeDetailResponseSchema>;
|
|
4677
5032
|
declare class SolverService implements ConfigObserver {
|
|
4678
5033
|
private baseURL;
|
|
4679
5034
|
constructor();
|
|
@@ -4689,6 +5044,13 @@ declare class SolverService implements ConfigObserver {
|
|
|
4689
5044
|
* @throws Error if the request fails or validation fails
|
|
4690
5045
|
*/
|
|
4691
5046
|
submitSettlementTx(params: SubmitSettlementRequest): Promise<SubmitSettlementResponse>;
|
|
5047
|
+
/**
|
|
5048
|
+
* Get trade details
|
|
5049
|
+
* @param tradeId ID of the trade to query
|
|
5050
|
+
* @returns Promise with trade details in camelCase format
|
|
5051
|
+
* @throws Error if request fails or validation fails
|
|
5052
|
+
*/
|
|
5053
|
+
getTradeDetail(tradeId: string): Promise<TradeDetailResponse>;
|
|
4692
5054
|
}
|
|
4693
5055
|
declare const solverService: SolverService;
|
|
4694
5056
|
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ var environments = {
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
production: {
|
|
83
|
-
backendUrl: "https://api.optimex.
|
|
83
|
+
backendUrl: "https://api.optimex.xyz",
|
|
84
84
|
rpcUrl: "https://bitfi-ledger-testnet.alt.technology",
|
|
85
85
|
routerAddress: "0x272599CE3602A49B580A5C4a4d3C1067E30248D2",
|
|
86
86
|
paymentAddressMap: {
|
|
@@ -3673,6 +3673,67 @@ var SubmitSettlementRequestSchema = import_zod.z.object({
|
|
|
3673
3673
|
var SubmitSettlementResponseSchema = import_zod.z.object({
|
|
3674
3674
|
message: import_zod.z.string()
|
|
3675
3675
|
});
|
|
3676
|
+
var TokenInfoSchema = import_zod.z.object({
|
|
3677
|
+
tokenId: import_zod.z.string(),
|
|
3678
|
+
chain: import_zod.z.string(),
|
|
3679
|
+
address: import_zod.z.string(),
|
|
3680
|
+
feeIn: import_zod.z.boolean(),
|
|
3681
|
+
feeOut: import_zod.z.boolean()
|
|
3682
|
+
});
|
|
3683
|
+
var PMMFinalistSchema = import_zod.z.object({
|
|
3684
|
+
pmmId: import_zod.z.string(),
|
|
3685
|
+
pmmReceivingAddress: import_zod.z.string()
|
|
3686
|
+
});
|
|
3687
|
+
var PaymentBundleSchema = import_zod.z.object({
|
|
3688
|
+
tradeIds: import_zod.z.array(import_zod.z.string()),
|
|
3689
|
+
settlementTx: import_zod.z.string(),
|
|
3690
|
+
signature: import_zod.z.string(),
|
|
3691
|
+
startIndex: import_zod.z.number(),
|
|
3692
|
+
pmmId: import_zod.z.string(),
|
|
3693
|
+
signedAt: import_zod.z.number()
|
|
3694
|
+
});
|
|
3695
|
+
var TradeDetailResponseSchema = import_zod.z.object({
|
|
3696
|
+
data: import_zod.z.object({
|
|
3697
|
+
tradeId: import_zod.z.string(),
|
|
3698
|
+
sessionId: import_zod.z.string(),
|
|
3699
|
+
solverAddress: import_zod.z.string(),
|
|
3700
|
+
fromToken: TokenInfoSchema,
|
|
3701
|
+
toToken: TokenInfoSchema,
|
|
3702
|
+
amountBeforeFees: import_zod.z.string(),
|
|
3703
|
+
amountAfterFees: import_zod.z.string(),
|
|
3704
|
+
fromUserAddress: import_zod.z.string(),
|
|
3705
|
+
userReceivingAddress: import_zod.z.string(),
|
|
3706
|
+
deadline: import_zod.z.number(),
|
|
3707
|
+
protocolFeeInBps: import_zod.z.string(),
|
|
3708
|
+
protocolMpcPubkey: import_zod.z.string(),
|
|
3709
|
+
protocolMpcAddress: import_zod.z.string(),
|
|
3710
|
+
bestIndicativeQuote: import_zod.z.string(),
|
|
3711
|
+
displayIndicativeQuote: import_zod.z.string(),
|
|
3712
|
+
pmmFinalists: import_zod.z.array(PMMFinalistSchema),
|
|
3713
|
+
settlementQuote: import_zod.z.string(),
|
|
3714
|
+
receivingAmount: import_zod.z.string(),
|
|
3715
|
+
selectedPmm: import_zod.z.string(),
|
|
3716
|
+
selectedPmmReceivingAddress: import_zod.z.string(),
|
|
3717
|
+
selectedPmmOperator: import_zod.z.string(),
|
|
3718
|
+
selectedPmmSigDeadline: import_zod.z.number(),
|
|
3719
|
+
commitmentRetries: import_zod.z.number(),
|
|
3720
|
+
pmmFailureStats: import_zod.z.record(import_zod.z.number()),
|
|
3721
|
+
commitedSignature: import_zod.z.string(),
|
|
3722
|
+
minAmountOut: import_zod.z.null(),
|
|
3723
|
+
sessionDeadline: import_zod.z.number(),
|
|
3724
|
+
userDepositTx: import_zod.z.string(),
|
|
3725
|
+
depositVault: import_zod.z.string(),
|
|
3726
|
+
paymentBundle: PaymentBundleSchema,
|
|
3727
|
+
userSignature: import_zod.z.string(),
|
|
3728
|
+
tradeSubmissionTx: import_zod.z.string(),
|
|
3729
|
+
tradeSelectPmmTx: import_zod.z.string(),
|
|
3730
|
+
tradeMakePaymentTx: import_zod.z.string(),
|
|
3731
|
+
state: import_zod.z.string(),
|
|
3732
|
+
lastUpdateMsg: import_zod.z.string(),
|
|
3733
|
+
version: import_zod.z.number()
|
|
3734
|
+
}),
|
|
3735
|
+
traceId: import_zod.z.string()
|
|
3736
|
+
});
|
|
3676
3737
|
var SolverService = class {
|
|
3677
3738
|
constructor() {
|
|
3678
3739
|
this.baseURL = config.getBackendUrl();
|
|
@@ -3716,6 +3777,32 @@ var SolverService = class {
|
|
|
3716
3777
|
throw error;
|
|
3717
3778
|
}
|
|
3718
3779
|
}
|
|
3780
|
+
/**
|
|
3781
|
+
* Get trade details
|
|
3782
|
+
* @param tradeId ID of the trade to query
|
|
3783
|
+
* @returns Promise with trade details in camelCase format
|
|
3784
|
+
* @throws Error if request fails or validation fails
|
|
3785
|
+
*/
|
|
3786
|
+
async getTradeDetail(tradeId) {
|
|
3787
|
+
try {
|
|
3788
|
+
const response = await import_axios.default.get(`${this.baseURL}/market-maker/trades/${tradeId}`, {
|
|
3789
|
+
headers: {
|
|
3790
|
+
"Content-Type": "application/json",
|
|
3791
|
+
Accept: "application/json"
|
|
3792
|
+
}
|
|
3793
|
+
});
|
|
3794
|
+
const camelCaseData = convertToCamelCase(response.data);
|
|
3795
|
+
return TradeDetailResponseSchema.parse(camelCaseData);
|
|
3796
|
+
} catch (error) {
|
|
3797
|
+
if (import_axios.default.isAxiosError(error)) {
|
|
3798
|
+
throw new Error(`Failed to fetch trade details: ${error.message}`);
|
|
3799
|
+
}
|
|
3800
|
+
if (error instanceof import_zod.z.ZodError) {
|
|
3801
|
+
throw new Error(`Invalid data: ${error.message}`);
|
|
3802
|
+
}
|
|
3803
|
+
throw error;
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3719
3806
|
};
|
|
3720
3807
|
var solverService = new SolverService();
|
|
3721
3808
|
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var environments = {
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
production: {
|
|
18
|
-
backendUrl: "https://api.optimex.
|
|
18
|
+
backendUrl: "https://api.optimex.xyz",
|
|
19
19
|
rpcUrl: "https://bitfi-ledger-testnet.alt.technology",
|
|
20
20
|
routerAddress: "0x272599CE3602A49B580A5C4a4d3C1067E30248D2",
|
|
21
21
|
paymentAddressMap: {
|
|
@@ -3608,6 +3608,67 @@ var SubmitSettlementRequestSchema = z.object({
|
|
|
3608
3608
|
var SubmitSettlementResponseSchema = z.object({
|
|
3609
3609
|
message: z.string()
|
|
3610
3610
|
});
|
|
3611
|
+
var TokenInfoSchema = z.object({
|
|
3612
|
+
tokenId: z.string(),
|
|
3613
|
+
chain: z.string(),
|
|
3614
|
+
address: z.string(),
|
|
3615
|
+
feeIn: z.boolean(),
|
|
3616
|
+
feeOut: z.boolean()
|
|
3617
|
+
});
|
|
3618
|
+
var PMMFinalistSchema = z.object({
|
|
3619
|
+
pmmId: z.string(),
|
|
3620
|
+
pmmReceivingAddress: z.string()
|
|
3621
|
+
});
|
|
3622
|
+
var PaymentBundleSchema = z.object({
|
|
3623
|
+
tradeIds: z.array(z.string()),
|
|
3624
|
+
settlementTx: z.string(),
|
|
3625
|
+
signature: z.string(),
|
|
3626
|
+
startIndex: z.number(),
|
|
3627
|
+
pmmId: z.string(),
|
|
3628
|
+
signedAt: z.number()
|
|
3629
|
+
});
|
|
3630
|
+
var TradeDetailResponseSchema = z.object({
|
|
3631
|
+
data: z.object({
|
|
3632
|
+
tradeId: z.string(),
|
|
3633
|
+
sessionId: z.string(),
|
|
3634
|
+
solverAddress: z.string(),
|
|
3635
|
+
fromToken: TokenInfoSchema,
|
|
3636
|
+
toToken: TokenInfoSchema,
|
|
3637
|
+
amountBeforeFees: z.string(),
|
|
3638
|
+
amountAfterFees: z.string(),
|
|
3639
|
+
fromUserAddress: z.string(),
|
|
3640
|
+
userReceivingAddress: z.string(),
|
|
3641
|
+
deadline: z.number(),
|
|
3642
|
+
protocolFeeInBps: z.string(),
|
|
3643
|
+
protocolMpcPubkey: z.string(),
|
|
3644
|
+
protocolMpcAddress: z.string(),
|
|
3645
|
+
bestIndicativeQuote: z.string(),
|
|
3646
|
+
displayIndicativeQuote: z.string(),
|
|
3647
|
+
pmmFinalists: z.array(PMMFinalistSchema),
|
|
3648
|
+
settlementQuote: z.string(),
|
|
3649
|
+
receivingAmount: z.string(),
|
|
3650
|
+
selectedPmm: z.string(),
|
|
3651
|
+
selectedPmmReceivingAddress: z.string(),
|
|
3652
|
+
selectedPmmOperator: z.string(),
|
|
3653
|
+
selectedPmmSigDeadline: z.number(),
|
|
3654
|
+
commitmentRetries: z.number(),
|
|
3655
|
+
pmmFailureStats: z.record(z.number()),
|
|
3656
|
+
commitedSignature: z.string(),
|
|
3657
|
+
minAmountOut: z.null(),
|
|
3658
|
+
sessionDeadline: z.number(),
|
|
3659
|
+
userDepositTx: z.string(),
|
|
3660
|
+
depositVault: z.string(),
|
|
3661
|
+
paymentBundle: PaymentBundleSchema,
|
|
3662
|
+
userSignature: z.string(),
|
|
3663
|
+
tradeSubmissionTx: z.string(),
|
|
3664
|
+
tradeSelectPmmTx: z.string(),
|
|
3665
|
+
tradeMakePaymentTx: z.string(),
|
|
3666
|
+
state: z.string(),
|
|
3667
|
+
lastUpdateMsg: z.string(),
|
|
3668
|
+
version: z.number()
|
|
3669
|
+
}),
|
|
3670
|
+
traceId: z.string()
|
|
3671
|
+
});
|
|
3611
3672
|
var SolverService = class {
|
|
3612
3673
|
constructor() {
|
|
3613
3674
|
this.baseURL = config.getBackendUrl();
|
|
@@ -3651,6 +3712,32 @@ var SolverService = class {
|
|
|
3651
3712
|
throw error;
|
|
3652
3713
|
}
|
|
3653
3714
|
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Get trade details
|
|
3717
|
+
* @param tradeId ID of the trade to query
|
|
3718
|
+
* @returns Promise with trade details in camelCase format
|
|
3719
|
+
* @throws Error if request fails or validation fails
|
|
3720
|
+
*/
|
|
3721
|
+
async getTradeDetail(tradeId) {
|
|
3722
|
+
try {
|
|
3723
|
+
const response = await axios.get(`${this.baseURL}/market-maker/trades/${tradeId}`, {
|
|
3724
|
+
headers: {
|
|
3725
|
+
"Content-Type": "application/json",
|
|
3726
|
+
Accept: "application/json"
|
|
3727
|
+
}
|
|
3728
|
+
});
|
|
3729
|
+
const camelCaseData = convertToCamelCase(response.data);
|
|
3730
|
+
return TradeDetailResponseSchema.parse(camelCaseData);
|
|
3731
|
+
} catch (error) {
|
|
3732
|
+
if (axios.isAxiosError(error)) {
|
|
3733
|
+
throw new Error(`Failed to fetch trade details: ${error.message}`);
|
|
3734
|
+
}
|
|
3735
|
+
if (error instanceof z.ZodError) {
|
|
3736
|
+
throw new Error(`Invalid data: ${error.message}`);
|
|
3737
|
+
}
|
|
3738
|
+
throw error;
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3654
3741
|
};
|
|
3655
3742
|
var solverService = new SolverService();
|
|
3656
3743
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optimex-xyz/market-maker-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"commit": "cz"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"axios": "^1.8.
|
|
45
|
+
"axios": "^1.8.3",
|
|
46
46
|
"bip174": "^3.0.0-rc.1",
|
|
47
47
|
"bitcoinjs-lib": "^7.0.0-rc.0",
|
|
48
|
-
"ecpair": "^3.0.0
|
|
49
|
-
"ethers": "^6.13.
|
|
48
|
+
"ecpair": "^3.0.0",
|
|
49
|
+
"ethers": "^6.13.5",
|
|
50
50
|
"tiny-secp256k1": "^2.2.3",
|
|
51
|
-
"zod": "^3.
|
|
51
|
+
"zod": "^3.24.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commitlint/cli": "^19.8.0",
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
"@eslint/js": "^9.22.0",
|
|
57
57
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
|
58
58
|
"@typechain/ethers-v6": "^0.5.1",
|
|
59
|
-
"@types/node": "^22.10
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.26.
|
|
61
|
-
"@typescript-eslint/parser": "^8.26.
|
|
59
|
+
"@types/node": "^22.13.10",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
61
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
62
62
|
"commitizen": "^4.3.1",
|
|
63
63
|
"eslint": "^9.22.0",
|
|
64
64
|
"eslint-config-prettier": "^10.1.1",
|
|
65
65
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
66
66
|
"globals": "^16.0.0",
|
|
67
|
-
"lint-staged": "^15.
|
|
67
|
+
"lint-staged": "^15.5.0",
|
|
68
68
|
"prettier": "^3.5.3",
|
|
69
69
|
"simple-git-hooks": "^2.11.1",
|
|
70
70
|
"tsup": "^8.4.0",
|
|
71
71
|
"typechain": "^8.3.2",
|
|
72
|
-
"typescript": "^5.
|
|
73
|
-
"typescript-eslint": "^8.26.
|
|
72
|
+
"typescript": "^5.8.2",
|
|
73
|
+
"typescript-eslint": "^8.26.1"
|
|
74
74
|
},
|
|
75
75
|
"simple-git-hooks": {
|
|
76
76
|
"pre-commit": "npx lint-staged",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"lint-staged": {
|
|
80
80
|
"src/**/*.{js,ts,tsx}": [
|
|
81
|
+
"eslint --fix",
|
|
81
82
|
"prettier --write"
|
|
82
83
|
]
|
|
83
84
|
},
|