@shogun-sdk/swap 0.0.2-test
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 +274 -0
- package/dist/core.cjs +619 -0
- package/dist/core.d.cts +137 -0
- package/dist/core.d.ts +137 -0
- package/dist/core.js +590 -0
- package/dist/execute-FaLLPp1i.d.cts +147 -0
- package/dist/execute-HX1fQ7wG.d.ts +147 -0
- package/dist/index.cjs +2477 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2458 -0
- package/dist/react.cjs +2364 -0
- package/dist/react.d.cts +158 -0
- package/dist/react.d.ts +158 -0
- package/dist/react.js +2355 -0
- package/dist/wallet-MmUIz8GE.d.cts +29 -0
- package/dist/wallet-MmUIz8GE.d.ts +29 -0
- package/dist/wallet-adapter.cjs +175 -0
- package/dist/wallet-adapter.d.cts +34 -0
- package/dist/wallet-adapter.d.ts +34 -0
- package/dist/wallet-adapter.js +150 -0
- package/package.json +68 -0
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { TokenSearchParams, TokenSearchResponse, ChainID } from '@shogun-sdk/intents-sdk';
|
|
2
|
+
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
+
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-FaLLPp1i.cjs';
|
|
4
|
+
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-FaLLPp1i.cjs';
|
|
5
|
+
import { WalletClient } from 'viem';
|
|
6
|
+
import { A as AdaptedWallet } from './wallet-MmUIz8GE.cjs';
|
|
7
|
+
import '@mysten/sui/transactions';
|
|
8
|
+
import '@solana/web3.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a list of verified tokens available for swapping.
|
|
12
|
+
*
|
|
13
|
+
* This is a Shogun SDK function that supports searching
|
|
14
|
+
* by name, symbol, or address — across multiple networks.
|
|
15
|
+
*
|
|
16
|
+
* - Supports pagination (`page`, `limit`)
|
|
17
|
+
* - Supports cancellation via `AbortController`
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { getTokenList } from "@shogun-sdk/swap"
|
|
22
|
+
*
|
|
23
|
+
* const res = await getTokenList({ q: "usdc", networkId: 8453 })
|
|
24
|
+
* console.log(res.results)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function getTokenList(params: TokenSearchParams): Promise<TokenSearchResponse>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ⚡ getQuote — Fetch a real-time cross-chain swap quote via Shogun Intents SDK.
|
|
31
|
+
*
|
|
32
|
+
* Retrieves a quote, applies slippage tolerance, and returns a normalized response
|
|
33
|
+
* suitable for swap execution or intent fulfillment.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const quote = await getQuote({
|
|
38
|
+
* tokenIn,
|
|
39
|
+
* tokenOut,
|
|
40
|
+
* sourceChainId: 8453,
|
|
41
|
+
* destChainId: 7565164,
|
|
42
|
+
* amount: parseUnits("100", 6),
|
|
43
|
+
* slippage: 10, // 10% (always pass as percentage number)
|
|
44
|
+
* })
|
|
45
|
+
*
|
|
46
|
+
* if (quote.warning) console.warn(quote.warning)
|
|
47
|
+
* console.log("Reduced Out:", quote.internal.estimatedAmountOutReduced)
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function getQuote(params: SwapQuoteParams): Promise<SwapQuoteResponse & {
|
|
51
|
+
warning?: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* buildQuoteParams — Converts user-friendly input into normalized `SwapQuoteParams`.
|
|
55
|
+
*
|
|
56
|
+
* Converts human-readable token amount (like "100") into base units via `parseUnits`.
|
|
57
|
+
* Slippage should be passed as a percentage number (e.g., 1 = 1%, 10 = 10%).
|
|
58
|
+
*/
|
|
59
|
+
declare function buildQuoteParams({ tokenIn, tokenOut, sourceChainId, destChainId, amount, slippage, }: {
|
|
60
|
+
tokenIn: QuoteTokenInfo;
|
|
61
|
+
tokenOut: QuoteTokenInfo;
|
|
62
|
+
sourceChainId: ChainID;
|
|
63
|
+
destChainId: ChainID;
|
|
64
|
+
amount: string | number;
|
|
65
|
+
slippage?: number;
|
|
66
|
+
}): SwapQuoteParams;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Fetch token balances for a user's EVM and/or SVM wallets.
|
|
70
|
+
*/
|
|
71
|
+
declare function getBalances(params: BalanceRequestParams, options?: {
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
}): Promise<BalanceResponse>;
|
|
74
|
+
|
|
75
|
+
declare const SOLANA_CHAIN_ID = ChainID.Solana;
|
|
76
|
+
declare const SupportedChains: readonly [{
|
|
77
|
+
readonly id: ChainID.Arbitrum;
|
|
78
|
+
readonly name: "Arbitrum";
|
|
79
|
+
readonly isEVM: true;
|
|
80
|
+
readonly wrapped: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
|
|
81
|
+
readonly symbol: "ETH";
|
|
82
|
+
readonly decimals: 18;
|
|
83
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
84
|
+
}, {
|
|
85
|
+
readonly id: ChainID.Optimism;
|
|
86
|
+
readonly name: "Optimism";
|
|
87
|
+
readonly isEVM: true;
|
|
88
|
+
readonly wrapped: "0x4200000000000000000000000000000000000006";
|
|
89
|
+
readonly symbol: "ETH";
|
|
90
|
+
readonly decimals: 18;
|
|
91
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
92
|
+
}, {
|
|
93
|
+
readonly id: ChainID.Base;
|
|
94
|
+
readonly name: "Base";
|
|
95
|
+
readonly isEVM: true;
|
|
96
|
+
readonly wrapped: "0x4200000000000000000000000000000000000006";
|
|
97
|
+
readonly symbol: "ETH";
|
|
98
|
+
readonly decimals: 18;
|
|
99
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: ChainID.Hyperliquid;
|
|
102
|
+
readonly name: "Hyperliquid";
|
|
103
|
+
readonly isEVM: true;
|
|
104
|
+
readonly wrapped: "0x5555555555555555555555555555555555555555";
|
|
105
|
+
readonly symbol: "ETH";
|
|
106
|
+
readonly decimals: 18;
|
|
107
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
108
|
+
}, {
|
|
109
|
+
readonly id: ChainID.BSC;
|
|
110
|
+
readonly name: "BSC";
|
|
111
|
+
readonly isEVM: true;
|
|
112
|
+
readonly wrapped: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
|
|
113
|
+
readonly symbol: "BNB";
|
|
114
|
+
readonly decimals: 18;
|
|
115
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
116
|
+
}, {
|
|
117
|
+
readonly id: ChainID.Solana;
|
|
118
|
+
readonly name: "Solana";
|
|
119
|
+
readonly isEVM: false;
|
|
120
|
+
readonly wrapped: "So11111111111111111111111111111111111111112";
|
|
121
|
+
readonly symbol: "SOL";
|
|
122
|
+
readonly decimals: 9;
|
|
123
|
+
readonly tokenAddress: "So11111111111111111111111111111111111111111";
|
|
124
|
+
}];
|
|
125
|
+
|
|
126
|
+
declare const NATIVE_TOKEN: {
|
|
127
|
+
readonly ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
128
|
+
readonly SOL: "So11111111111111111111111111111111111111111";
|
|
129
|
+
readonly SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
|
|
130
|
+
};
|
|
131
|
+
declare const isNativeAddress: (tokenAddress: string) => boolean;
|
|
132
|
+
|
|
133
|
+
declare function isViemWalletClient(wallet: WalletClient | AdaptedWallet): wallet is WalletClient;
|
|
134
|
+
|
|
135
|
+
declare function serializeBigIntsToStrings<T>(obj: T): T;
|
|
136
|
+
|
|
137
|
+
export { BalanceRequestParams, BalanceResponse, NATIVE_TOKEN, QuoteTokenInfo, SOLANA_CHAIN_ID, SupportedChains, SwapQuoteParams, SwapQuoteResponse, buildQuoteParams, getBalances, getQuote, getTokenList, isNativeAddress, isViemWalletClient, serializeBigIntsToStrings };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { TokenSearchParams, TokenSearchResponse, ChainID } from '@shogun-sdk/intents-sdk';
|
|
2
|
+
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
+
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-HX1fQ7wG.js';
|
|
4
|
+
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-HX1fQ7wG.js';
|
|
5
|
+
import { WalletClient } from 'viem';
|
|
6
|
+
import { A as AdaptedWallet } from './wallet-MmUIz8GE.js';
|
|
7
|
+
import '@mysten/sui/transactions';
|
|
8
|
+
import '@solana/web3.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a list of verified tokens available for swapping.
|
|
12
|
+
*
|
|
13
|
+
* This is a Shogun SDK function that supports searching
|
|
14
|
+
* by name, symbol, or address — across multiple networks.
|
|
15
|
+
*
|
|
16
|
+
* - Supports pagination (`page`, `limit`)
|
|
17
|
+
* - Supports cancellation via `AbortController`
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { getTokenList } from "@shogun-sdk/swap"
|
|
22
|
+
*
|
|
23
|
+
* const res = await getTokenList({ q: "usdc", networkId: 8453 })
|
|
24
|
+
* console.log(res.results)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function getTokenList(params: TokenSearchParams): Promise<TokenSearchResponse>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ⚡ getQuote — Fetch a real-time cross-chain swap quote via Shogun Intents SDK.
|
|
31
|
+
*
|
|
32
|
+
* Retrieves a quote, applies slippage tolerance, and returns a normalized response
|
|
33
|
+
* suitable for swap execution or intent fulfillment.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const quote = await getQuote({
|
|
38
|
+
* tokenIn,
|
|
39
|
+
* tokenOut,
|
|
40
|
+
* sourceChainId: 8453,
|
|
41
|
+
* destChainId: 7565164,
|
|
42
|
+
* amount: parseUnits("100", 6),
|
|
43
|
+
* slippage: 10, // 10% (always pass as percentage number)
|
|
44
|
+
* })
|
|
45
|
+
*
|
|
46
|
+
* if (quote.warning) console.warn(quote.warning)
|
|
47
|
+
* console.log("Reduced Out:", quote.internal.estimatedAmountOutReduced)
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function getQuote(params: SwapQuoteParams): Promise<SwapQuoteResponse & {
|
|
51
|
+
warning?: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* buildQuoteParams — Converts user-friendly input into normalized `SwapQuoteParams`.
|
|
55
|
+
*
|
|
56
|
+
* Converts human-readable token amount (like "100") into base units via `parseUnits`.
|
|
57
|
+
* Slippage should be passed as a percentage number (e.g., 1 = 1%, 10 = 10%).
|
|
58
|
+
*/
|
|
59
|
+
declare function buildQuoteParams({ tokenIn, tokenOut, sourceChainId, destChainId, amount, slippage, }: {
|
|
60
|
+
tokenIn: QuoteTokenInfo;
|
|
61
|
+
tokenOut: QuoteTokenInfo;
|
|
62
|
+
sourceChainId: ChainID;
|
|
63
|
+
destChainId: ChainID;
|
|
64
|
+
amount: string | number;
|
|
65
|
+
slippage?: number;
|
|
66
|
+
}): SwapQuoteParams;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Fetch token balances for a user's EVM and/or SVM wallets.
|
|
70
|
+
*/
|
|
71
|
+
declare function getBalances(params: BalanceRequestParams, options?: {
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
}): Promise<BalanceResponse>;
|
|
74
|
+
|
|
75
|
+
declare const SOLANA_CHAIN_ID = ChainID.Solana;
|
|
76
|
+
declare const SupportedChains: readonly [{
|
|
77
|
+
readonly id: ChainID.Arbitrum;
|
|
78
|
+
readonly name: "Arbitrum";
|
|
79
|
+
readonly isEVM: true;
|
|
80
|
+
readonly wrapped: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
|
|
81
|
+
readonly symbol: "ETH";
|
|
82
|
+
readonly decimals: 18;
|
|
83
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
84
|
+
}, {
|
|
85
|
+
readonly id: ChainID.Optimism;
|
|
86
|
+
readonly name: "Optimism";
|
|
87
|
+
readonly isEVM: true;
|
|
88
|
+
readonly wrapped: "0x4200000000000000000000000000000000000006";
|
|
89
|
+
readonly symbol: "ETH";
|
|
90
|
+
readonly decimals: 18;
|
|
91
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
92
|
+
}, {
|
|
93
|
+
readonly id: ChainID.Base;
|
|
94
|
+
readonly name: "Base";
|
|
95
|
+
readonly isEVM: true;
|
|
96
|
+
readonly wrapped: "0x4200000000000000000000000000000000000006";
|
|
97
|
+
readonly symbol: "ETH";
|
|
98
|
+
readonly decimals: 18;
|
|
99
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: ChainID.Hyperliquid;
|
|
102
|
+
readonly name: "Hyperliquid";
|
|
103
|
+
readonly isEVM: true;
|
|
104
|
+
readonly wrapped: "0x5555555555555555555555555555555555555555";
|
|
105
|
+
readonly symbol: "ETH";
|
|
106
|
+
readonly decimals: 18;
|
|
107
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
108
|
+
}, {
|
|
109
|
+
readonly id: ChainID.BSC;
|
|
110
|
+
readonly name: "BSC";
|
|
111
|
+
readonly isEVM: true;
|
|
112
|
+
readonly wrapped: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
|
|
113
|
+
readonly symbol: "BNB";
|
|
114
|
+
readonly decimals: 18;
|
|
115
|
+
readonly tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
116
|
+
}, {
|
|
117
|
+
readonly id: ChainID.Solana;
|
|
118
|
+
readonly name: "Solana";
|
|
119
|
+
readonly isEVM: false;
|
|
120
|
+
readonly wrapped: "So11111111111111111111111111111111111111112";
|
|
121
|
+
readonly symbol: "SOL";
|
|
122
|
+
readonly decimals: 9;
|
|
123
|
+
readonly tokenAddress: "So11111111111111111111111111111111111111111";
|
|
124
|
+
}];
|
|
125
|
+
|
|
126
|
+
declare const NATIVE_TOKEN: {
|
|
127
|
+
readonly ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
128
|
+
readonly SOL: "So11111111111111111111111111111111111111111";
|
|
129
|
+
readonly SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
|
|
130
|
+
};
|
|
131
|
+
declare const isNativeAddress: (tokenAddress: string) => boolean;
|
|
132
|
+
|
|
133
|
+
declare function isViemWalletClient(wallet: WalletClient | AdaptedWallet): wallet is WalletClient;
|
|
134
|
+
|
|
135
|
+
declare function serializeBigIntsToStrings<T>(obj: T): T;
|
|
136
|
+
|
|
137
|
+
export { BalanceRequestParams, BalanceResponse, NATIVE_TOKEN, QuoteTokenInfo, SOLANA_CHAIN_ID, SupportedChains, SwapQuoteParams, SwapQuoteResponse, buildQuoteParams, getBalances, getQuote, getTokenList, isNativeAddress, isViemWalletClient, serializeBigIntsToStrings };
|