@sip-protocol/sdk 0.2.4 → 0.2.6
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/browser.js +22 -1
- package/dist/browser.mjs +1 -1
- package/dist/chunk-6WOV2YNG.mjs +10179 -0
- package/dist/chunk-MR7HRCRS.mjs +10165 -0
- package/dist/index.js +22 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/adapters/oneclick-client.ts +33 -1
- package/src/sip.ts +10 -0
package/dist/browser.js
CHANGED
|
@@ -2121,7 +2121,21 @@ var OneClickClient = class {
|
|
|
2121
2121
|
*/
|
|
2122
2122
|
async quote(request) {
|
|
2123
2123
|
this.validateQuoteRequest(request);
|
|
2124
|
-
|
|
2124
|
+
const rawResponse = await this.post("/v0/quote", request);
|
|
2125
|
+
return {
|
|
2126
|
+
quoteId: rawResponse.timestamp,
|
|
2127
|
+
// Use timestamp as quoteId since API doesn't provide one
|
|
2128
|
+
depositAddress: rawResponse.quote.depositAddress,
|
|
2129
|
+
amountIn: rawResponse.quote.amountIn,
|
|
2130
|
+
amountInFormatted: rawResponse.quote.amountInFormatted,
|
|
2131
|
+
amountOut: rawResponse.quote.amountOut,
|
|
2132
|
+
amountOutFormatted: rawResponse.quote.amountOutFormatted,
|
|
2133
|
+
amountOutUsd: rawResponse.quote.amountOutUsd,
|
|
2134
|
+
deadline: rawResponse.quote.deadline,
|
|
2135
|
+
timeEstimate: rawResponse.quote.timeEstimate,
|
|
2136
|
+
signature: rawResponse.signature,
|
|
2137
|
+
request: rawResponse.quoteRequest
|
|
2138
|
+
};
|
|
2125
2139
|
}
|
|
2126
2140
|
/**
|
|
2127
2141
|
* Request a dry quote (preview without deposit address)
|
|
@@ -2966,6 +2980,13 @@ var SIP = class {
|
|
|
2966
2980
|
senderAddress ?? this.wallet?.address
|
|
2967
2981
|
);
|
|
2968
2982
|
const rawQuote = await this.intentsAdapter.getQuote(prepared);
|
|
2983
|
+
if (!rawQuote.amountOut || !rawQuote.amountIn) {
|
|
2984
|
+
throw new ValidationError(
|
|
2985
|
+
`Invalid quote response from 1Click API: missing ${!rawQuote.amountOut ? "amountOut" : "amountIn"}. This may indicate the trading pair is not supported or the amount is too small.`,
|
|
2986
|
+
"quote",
|
|
2987
|
+
{ rawQuote }
|
|
2988
|
+
);
|
|
2989
|
+
}
|
|
2969
2990
|
this.pendingSwaps.set(requestId, {
|
|
2970
2991
|
depositAddress: rawQuote.depositAddress,
|
|
2971
2992
|
quote: rawQuote
|