@shogun-sdk/swap 0.0.2-test.1 → 0.0.2-test.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/dist/core.cjs +153 -45
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +145 -38
- package/dist/{execute-FaLLPp1i.d.cts → execute-DEFbp1WZ.d.cts} +13 -5
- package/dist/{execute-HX1fQ7wG.d.ts → execute-St0oo8GR.d.ts} +13 -5
- package/dist/index.cjs +190 -1557
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +216 -1597
- package/dist/react.cjs +197 -1564
- package/dist/react.d.cts +6 -40
- package/dist/react.d.ts +6 -40
- package/dist/react.js +218 -1599
- package/package.json +7 -4
package/dist/react.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenSearchParams, TokenSearchResponse } from '@shogun-sdk/intents-sdk';
|
|
2
2
|
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
-
import { a as SwapQuoteResponse, e as executeOrder, b as Stage, S as SwapQuoteParams, B as BalanceRequestParams, c as BalanceResponse } from './execute-
|
|
4
|
-
export { P as PlaceOrderResult, Q as QuoteTokenInfo, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse } from './execute-
|
|
3
|
+
import { a as SwapQuoteResponse, e as executeOrder, b as Stage, g as PollResult, S as SwapQuoteParams, B as BalanceRequestParams, c as BalanceResponse } from './execute-DEFbp1WZ.cjs';
|
|
4
|
+
export { P as PlaceOrderResult, Q as QuoteTokenInfo, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse } from './execute-DEFbp1WZ.cjs';
|
|
5
5
|
import { A as AdaptedWallet } from './wallet-MmUIz8GE.cjs';
|
|
6
6
|
import { WalletClient } from 'viem';
|
|
7
7
|
import '@mysten/sui/transactions';
|
|
@@ -29,13 +29,6 @@ type ExecuteOrderResult = Awaited<ReturnType<typeof executeOrder>>;
|
|
|
29
29
|
* built-in stage tracking, loading states, and error handling.
|
|
30
30
|
*
|
|
31
31
|
* ---
|
|
32
|
-
* ## Features
|
|
33
|
-
* - Live stage updates (processing, approving, signing, submitting, etc.)
|
|
34
|
-
* - Built-in 20-min deadline by default (current timestamp + 1200s)
|
|
35
|
-
* - Safe state handling with unmount guards
|
|
36
|
-
* - Works for both EVM and Solana wallets
|
|
37
|
-
*
|
|
38
|
-
* ---
|
|
39
32
|
* ## Example
|
|
40
33
|
* ```tsx
|
|
41
34
|
* import { useExecuteOrder } from "@shogun-sdk/swap/react"
|
|
@@ -79,9 +72,10 @@ declare function useExecuteOrder(): {
|
|
|
79
72
|
/** Raw SDK response data. */
|
|
80
73
|
data: {
|
|
81
74
|
status: boolean;
|
|
82
|
-
|
|
75
|
+
orderId: string;
|
|
83
76
|
chainId: number;
|
|
84
|
-
|
|
77
|
+
finalStatus: PollResult;
|
|
78
|
+
stage: Stage;
|
|
85
79
|
} | {
|
|
86
80
|
status: boolean;
|
|
87
81
|
message: string;
|
|
@@ -92,44 +86,16 @@ declare function useExecuteOrder(): {
|
|
|
92
86
|
};
|
|
93
87
|
|
|
94
88
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* import { useQuote } from "@shogun-sdk/swap/react"
|
|
100
|
-
*
|
|
101
|
-
* export function SwapQuote({ params }) {
|
|
102
|
-
* const { data, loading, error, warning, refetch } = useQuote(params, { debounceMs: 300 })
|
|
103
|
-
*
|
|
104
|
-
* if (loading) return <p>Fetching quote...</p>
|
|
105
|
-
* if (error) return <p style={{ color: "red" }}>{error.message}</p>
|
|
106
|
-
* if (warning) return <p style={{ color: "orange" }}>{warning}</p>
|
|
107
|
-
*
|
|
108
|
-
* return (
|
|
109
|
-
* <div>
|
|
110
|
-
* <p>Output: {data?.amountOut.toString()}</p>
|
|
111
|
-
* <p>Reduced (after slippage): {data?.internal?.estimatedAmountOutReduced?.toString()}</p>
|
|
112
|
-
* <button onClick={refetch}>Refresh</button>
|
|
113
|
-
* </div>
|
|
114
|
-
* )
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
89
|
+
* useQuote — React hook for fetching live swap quotes.
|
|
117
90
|
*/
|
|
118
91
|
declare function useQuote(params: SwapQuoteParams | null, options?: {
|
|
119
|
-
/** Debounce duration (ms) for reactive fetches. Default: 250 */
|
|
120
92
|
debounceMs?: number;
|
|
121
|
-
/** Optional polling interval (ms) for auto refresh */
|
|
122
93
|
autoRefreshMs?: number;
|
|
123
94
|
}): {
|
|
124
|
-
/** Latest quote data */
|
|
125
95
|
data: SwapQuoteResponse | null;
|
|
126
|
-
/** Whether a fetch is ongoing */
|
|
127
96
|
loading: boolean;
|
|
128
|
-
/** Error (if any) */
|
|
129
97
|
error: Error | null;
|
|
130
|
-
/** Warning (e.g. high slippage alert) */
|
|
131
98
|
warning: string | null;
|
|
132
|
-
/** Manual refetch */
|
|
133
99
|
refetch: () => Promise<void>;
|
|
134
100
|
};
|
|
135
101
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenSearchParams, TokenSearchResponse } from '@shogun-sdk/intents-sdk';
|
|
2
2
|
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
-
import { a as SwapQuoteResponse, e as executeOrder, b as Stage, S as SwapQuoteParams, B as BalanceRequestParams, c as BalanceResponse } from './execute-
|
|
4
|
-
export { P as PlaceOrderResult, Q as QuoteTokenInfo, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse } from './execute-
|
|
3
|
+
import { a as SwapQuoteResponse, e as executeOrder, b as Stage, g as PollResult, S as SwapQuoteParams, B as BalanceRequestParams, c as BalanceResponse } from './execute-St0oo8GR.js';
|
|
4
|
+
export { P as PlaceOrderResult, Q as QuoteTokenInfo, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse } from './execute-St0oo8GR.js';
|
|
5
5
|
import { A as AdaptedWallet } from './wallet-MmUIz8GE.js';
|
|
6
6
|
import { WalletClient } from 'viem';
|
|
7
7
|
import '@mysten/sui/transactions';
|
|
@@ -29,13 +29,6 @@ type ExecuteOrderResult = Awaited<ReturnType<typeof executeOrder>>;
|
|
|
29
29
|
* built-in stage tracking, loading states, and error handling.
|
|
30
30
|
*
|
|
31
31
|
* ---
|
|
32
|
-
* ## Features
|
|
33
|
-
* - Live stage updates (processing, approving, signing, submitting, etc.)
|
|
34
|
-
* - Built-in 20-min deadline by default (current timestamp + 1200s)
|
|
35
|
-
* - Safe state handling with unmount guards
|
|
36
|
-
* - Works for both EVM and Solana wallets
|
|
37
|
-
*
|
|
38
|
-
* ---
|
|
39
32
|
* ## Example
|
|
40
33
|
* ```tsx
|
|
41
34
|
* import { useExecuteOrder } from "@shogun-sdk/swap/react"
|
|
@@ -79,9 +72,10 @@ declare function useExecuteOrder(): {
|
|
|
79
72
|
/** Raw SDK response data. */
|
|
80
73
|
data: {
|
|
81
74
|
status: boolean;
|
|
82
|
-
|
|
75
|
+
orderId: string;
|
|
83
76
|
chainId: number;
|
|
84
|
-
|
|
77
|
+
finalStatus: PollResult;
|
|
78
|
+
stage: Stage;
|
|
85
79
|
} | {
|
|
86
80
|
status: boolean;
|
|
87
81
|
message: string;
|
|
@@ -92,44 +86,16 @@ declare function useExecuteOrder(): {
|
|
|
92
86
|
};
|
|
93
87
|
|
|
94
88
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* import { useQuote } from "@shogun-sdk/swap/react"
|
|
100
|
-
*
|
|
101
|
-
* export function SwapQuote({ params }) {
|
|
102
|
-
* const { data, loading, error, warning, refetch } = useQuote(params, { debounceMs: 300 })
|
|
103
|
-
*
|
|
104
|
-
* if (loading) return <p>Fetching quote...</p>
|
|
105
|
-
* if (error) return <p style={{ color: "red" }}>{error.message}</p>
|
|
106
|
-
* if (warning) return <p style={{ color: "orange" }}>{warning}</p>
|
|
107
|
-
*
|
|
108
|
-
* return (
|
|
109
|
-
* <div>
|
|
110
|
-
* <p>Output: {data?.amountOut.toString()}</p>
|
|
111
|
-
* <p>Reduced (after slippage): {data?.internal?.estimatedAmountOutReduced?.toString()}</p>
|
|
112
|
-
* <button onClick={refetch}>Refresh</button>
|
|
113
|
-
* </div>
|
|
114
|
-
* )
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
89
|
+
* useQuote — React hook for fetching live swap quotes.
|
|
117
90
|
*/
|
|
118
91
|
declare function useQuote(params: SwapQuoteParams | null, options?: {
|
|
119
|
-
/** Debounce duration (ms) for reactive fetches. Default: 250 */
|
|
120
92
|
debounceMs?: number;
|
|
121
|
-
/** Optional polling interval (ms) for auto refresh */
|
|
122
93
|
autoRefreshMs?: number;
|
|
123
94
|
}): {
|
|
124
|
-
/** Latest quote data */
|
|
125
95
|
data: SwapQuoteResponse | null;
|
|
126
|
-
/** Whether a fetch is ongoing */
|
|
127
96
|
loading: boolean;
|
|
128
|
-
/** Error (if any) */
|
|
129
97
|
error: Error | null;
|
|
130
|
-
/** Warning (e.g. high slippage alert) */
|
|
131
98
|
warning: string | null;
|
|
132
|
-
/** Manual refetch */
|
|
133
99
|
refetch: () => Promise<void>;
|
|
134
100
|
};
|
|
135
101
|
|