@shogun-sdk/intents-sdk 1.4.0 → 1.4.2
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.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chains.ts +18 -0
- package/src/core/orders/api/index.ts +5 -3
- package/src/utils/quote/paraswap.ts +7 -0
package/package.json
CHANGED
package/src/chains.ts
CHANGED
|
@@ -85,3 +85,21 @@ export const chainIdToChainTypeMap = {
|
|
|
85
85
|
[ChainID.BSC]: ChainType.EVM,
|
|
86
86
|
[ChainID.MONAD]: ChainType.EVM,
|
|
87
87
|
} as const;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Maps a chain id to the network name accepted by the auctioneer's `ChainId` parser.
|
|
91
|
+
*
|
|
92
|
+
* The auctioneer accepts a name for every chain but only some numeric ids (Solana's id is
|
|
93
|
+
* not accepted numerically), so the SDK always sends the canonical name to keep the
|
|
94
|
+
* `?network=` filter working uniformly across chains.
|
|
95
|
+
*/
|
|
96
|
+
export const chainIdToNetworkName: Record<SupportedChain, string> = {
|
|
97
|
+
[ChainID.Arbitrum]: 'ArbitrumOne',
|
|
98
|
+
[ChainID.Optimism]: 'Optimism',
|
|
99
|
+
[ChainID.Base]: 'Base',
|
|
100
|
+
[ChainID.Hyperliquid]: 'HyperEVM',
|
|
101
|
+
[ChainID.Solana]: 'Solana',
|
|
102
|
+
[ChainID.Sui]: 'Sui',
|
|
103
|
+
[ChainID.BSC]: 'Bsc',
|
|
104
|
+
[ChainID.MONAD]: 'Monad',
|
|
105
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AUCTIONEER_URL } from '../../../constants.js';
|
|
2
|
-
import type
|
|
2
|
+
import { chainIdToNetworkName, type SupportedChain } from '../../../chains.js';
|
|
3
3
|
import type { ApiResponse, ApiUserOrders } from '../../../types/api.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -12,7 +12,7 @@ import type { ApiResponse, ApiUserOrders } from '../../../types/api.js';
|
|
|
12
12
|
export interface GetUserOrdersParams {
|
|
13
13
|
/** Wallet address to query. Combined with any wallet(s) carried by the JWT claims. */
|
|
14
14
|
wallet?: string;
|
|
15
|
-
/** Restrict results to a single chain. Serialized as
|
|
15
|
+
/** Restrict results to a single chain. Serialized as the auctioneer's network name (e.g. Base). */
|
|
16
16
|
network?: SupportedChain;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -33,7 +33,9 @@ export class AuctioneerAPI {
|
|
|
33
33
|
query.set('wallet', params.wallet);
|
|
34
34
|
}
|
|
35
35
|
if (params.network !== undefined) {
|
|
36
|
-
|
|
36
|
+
// Send the auctioneer's network name: it accepts a name for every chain, but not
|
|
37
|
+
// every numeric id (e.g. Solana's id is rejected numerically).
|
|
38
|
+
query.set('network', chainIdToNetworkName[params.network]);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
const queryString = query.toString();
|
|
@@ -50,6 +50,13 @@ export class ParaswapQuoteProvider {
|
|
|
50
50
|
|
|
51
51
|
private async getQuote(paraswapParams: ParaswapQuoteRequestParams): Promise<OptimalRate> {
|
|
52
52
|
const params = { ...paraswapParams };
|
|
53
|
+
// Native sentinels (0xEee…/0x0…) aren't real contracts, so `decimals()` reverts.
|
|
54
|
+
// Normalize both sides to wrapped native before quoting — mirrors how the swap layer
|
|
55
|
+
// normalizes tokenIn, and covers internal callers (e.g. gas-expense quotes) that pass
|
|
56
|
+
// the native sentinel as srcToken.
|
|
57
|
+
if (isNativeEvmToken(params.srcToken)) {
|
|
58
|
+
params.srcToken = WRAPPED_ETH_ADDRESSES[this.chainId];
|
|
59
|
+
}
|
|
53
60
|
if (isNativeEvmToken(params.destToken)) {
|
|
54
61
|
params.destToken = WRAPPED_ETH_ADDRESSES[this.chainId];
|
|
55
62
|
}
|