@sip-protocol/sdk 0.2.5 → 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 +15 -1
- package/dist/browser.mjs +1 -1
- package/dist/chunk-6WOV2YNG.mjs +10179 -0
- package/dist/index.js +15 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/adapters/oneclick-client.ts +33 -1
package/dist/index.js
CHANGED
|
@@ -2120,7 +2120,21 @@ var OneClickClient = class {
|
|
|
2120
2120
|
*/
|
|
2121
2121
|
async quote(request) {
|
|
2122
2122
|
this.validateQuoteRequest(request);
|
|
2123
|
-
|
|
2123
|
+
const rawResponse = await this.post("/v0/quote", request);
|
|
2124
|
+
return {
|
|
2125
|
+
quoteId: rawResponse.timestamp,
|
|
2126
|
+
// Use timestamp as quoteId since API doesn't provide one
|
|
2127
|
+
depositAddress: rawResponse.quote.depositAddress,
|
|
2128
|
+
amountIn: rawResponse.quote.amountIn,
|
|
2129
|
+
amountInFormatted: rawResponse.quote.amountInFormatted,
|
|
2130
|
+
amountOut: rawResponse.quote.amountOut,
|
|
2131
|
+
amountOutFormatted: rawResponse.quote.amountOutFormatted,
|
|
2132
|
+
amountOutUsd: rawResponse.quote.amountOutUsd,
|
|
2133
|
+
deadline: rawResponse.quote.deadline,
|
|
2134
|
+
timeEstimate: rawResponse.quote.timeEstimate,
|
|
2135
|
+
signature: rawResponse.signature,
|
|
2136
|
+
request: rawResponse.quoteRequest
|
|
2137
|
+
};
|
|
2124
2138
|
}
|
|
2125
2139
|
/**
|
|
2126
2140
|
* Request a dry quote (preview without deposit address)
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sip-protocol/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Core SDK for Shielded Intents Protocol - Privacy layer for cross-chain transactions",
|
|
5
5
|
"author": "SIP Protocol <hello@sip-protocol.org>",
|
|
6
6
|
"homepage": "https://sip-protocol.org",
|
|
@@ -91,7 +91,39 @@ export class OneClickClient {
|
|
|
91
91
|
*/
|
|
92
92
|
async quote(request: OneClickQuoteRequest): Promise<OneClickQuoteResponse> {
|
|
93
93
|
this.validateQuoteRequest(request)
|
|
94
|
-
|
|
94
|
+
// The 1Click API returns a nested structure: { quote: {...}, signature, timestamp }
|
|
95
|
+
// We flatten it to match our OneClickQuoteResponse type
|
|
96
|
+
const rawResponse = await this.post<{
|
|
97
|
+
quote: {
|
|
98
|
+
amountIn: string
|
|
99
|
+
amountInFormatted: string
|
|
100
|
+
amountInUsd?: string
|
|
101
|
+
amountOut: string
|
|
102
|
+
amountOutFormatted: string
|
|
103
|
+
amountOutUsd?: string
|
|
104
|
+
depositAddress: string
|
|
105
|
+
deadline: string
|
|
106
|
+
timeEstimate: number
|
|
107
|
+
}
|
|
108
|
+
quoteRequest: OneClickQuoteRequest
|
|
109
|
+
signature: string
|
|
110
|
+
timestamp: string
|
|
111
|
+
}>('/v0/quote', request)
|
|
112
|
+
|
|
113
|
+
// Flatten the response
|
|
114
|
+
return {
|
|
115
|
+
quoteId: rawResponse.timestamp, // Use timestamp as quoteId since API doesn't provide one
|
|
116
|
+
depositAddress: rawResponse.quote.depositAddress,
|
|
117
|
+
amountIn: rawResponse.quote.amountIn,
|
|
118
|
+
amountInFormatted: rawResponse.quote.amountInFormatted,
|
|
119
|
+
amountOut: rawResponse.quote.amountOut,
|
|
120
|
+
amountOutFormatted: rawResponse.quote.amountOutFormatted,
|
|
121
|
+
amountOutUsd: rawResponse.quote.amountOutUsd,
|
|
122
|
+
deadline: rawResponse.quote.deadline,
|
|
123
|
+
timeEstimate: rawResponse.quote.timeEstimate,
|
|
124
|
+
signature: rawResponse.signature,
|
|
125
|
+
request: rawResponse.quoteRequest,
|
|
126
|
+
}
|
|
95
127
|
}
|
|
96
128
|
|
|
97
129
|
/**
|