@xswap-link/sdk 0.10.6 → 0.10.7
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/.github/workflows/main.yml +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +39 -8
- package/dist/index.d.ts +39 -8
- package/dist/index.global.js +827 -440
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +12 -1
- package/src/components/AllWalletsConfig/index.tsx +40 -0
- package/src/components/Swap/HistoryView/index.tsx +28 -5
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +73 -47
- package/src/components/Swap/SwapView/SwapButton/index.tsx +45 -10
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +123 -4
- package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +71 -0
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +4 -0
- package/src/components/Swap/SwapView/WalletPicker/index.tsx +63 -28
- package/src/components/Swap/index.tsx +2 -2
- package/src/components/TxConfigForm/index.tsx +9 -34
- package/src/components/TxDataCard/TxDataCardUI/index.tsx +16 -10
- package/src/components/TxDataCard/index.tsx +1 -0
- package/src/components/index.ts +1 -0
- package/src/config/wagmiConfig.ts +1 -6
- package/src/constants/index.ts +14 -0
- package/src/context/HistoryProvider.tsx +121 -25
- package/src/context/SwapProvider.tsx +104 -48
- package/src/context/TransactionProvider.tsx +60 -1
- package/src/context/TxUIWrapper.tsx +187 -71
- package/src/context/WalletProvider.tsx +108 -0
- package/src/contracts/addresses.ts +4 -0
- package/src/contracts/idl/jupiter.ts +2879 -0
- package/src/models/Ecosystem.ts +1 -0
- package/src/models/Route.ts +14 -3
- package/src/models/SolanaTransaction.ts +38 -0
- package/src/models/SolanaWeb3Network.ts +5 -0
- package/src/models/TxUIWrapper.ts +8 -4
- package/src/models/index.ts +1 -0
- package/src/models/payloads/GetBalancesPayload.ts +2 -1
- package/src/models/payloads/GetSolanaRoutePayload.ts +8 -0
- package/src/models/payloads/index.ts +1 -0
- package/src/services/api.ts +21 -3
- package/src/services/solana/jupiter/extract-swap-data.ts +183 -0
- package/src/services/solana/jupiter/get-events.ts +37 -0
- package/src/services/solana/jupiter/instruction-parser.ts +217 -0
- package/src/services/solana/jupiter/utils.ts +37 -0
- package/src/utils/strings.ts +16 -0
- package/test/context/SwapProvider.test.tsx +6 -9
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
DEFAULT_DESTINATION_CHAIN_ID,
|
|
13
13
|
DEFAULT_DESTINATION_TOKEN_ADDR,
|
|
14
14
|
} from "../../src/constants";
|
|
15
|
-
import { WagmiProvider } from "wagmi";
|
|
16
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
17
15
|
import fetch from "jest-fetch-mock";
|
|
18
16
|
import { ethers } from "ethers";
|
|
17
|
+
import { WalletProvider } from "../../src/context/WalletProvider";
|
|
18
|
+
import { AllWalletsConfig } from "../../src/components/AllWalletsConfig";
|
|
19
19
|
// import { Chain, Token } from "@src/models";
|
|
20
20
|
|
|
21
21
|
const NATIVE_TOKEN_ADDR: string = "0x0000000000000000000000000000000000000000";
|
|
@@ -49,7 +49,6 @@ const INVALID_DST_BRIDGE_CHAIN_ID: string = "1088";
|
|
|
49
49
|
const INVALID_DST_BRIDGE_TOKEN_ADDR: string =
|
|
50
50
|
"0x0000000000000000000000000000000000000000";
|
|
51
51
|
|
|
52
|
-
const queryClient = new QueryClient();
|
|
53
52
|
const wagmiConfig = getWagmiConfig(supportedChains);
|
|
54
53
|
|
|
55
54
|
describe("SwapProvider", () => {
|
|
@@ -68,18 +67,17 @@ describe("SwapProvider", () => {
|
|
|
68
67
|
// create a wrapper for the SwapProvider
|
|
69
68
|
const getWrapper = (integrationConfig, supportedChains, wagmiConfig) => {
|
|
70
69
|
return ({ children }: { children: React.ReactNode }) => (
|
|
71
|
-
<
|
|
72
|
-
<
|
|
70
|
+
<AllWalletsConfig wagmiConfig={wagmiConfig}>
|
|
71
|
+
<WalletProvider>
|
|
73
72
|
<SwapProvider
|
|
74
73
|
integrationConfig={integrationConfig}
|
|
75
74
|
supportedChains={supportedChains}
|
|
76
|
-
wagmiConfig={wagmiConfig}
|
|
77
75
|
overlay={false}
|
|
78
76
|
>
|
|
79
77
|
{children}
|
|
80
78
|
</SwapProvider>
|
|
81
|
-
</
|
|
82
|
-
</
|
|
79
|
+
</WalletProvider>
|
|
80
|
+
</AllWalletsConfig>
|
|
83
81
|
);
|
|
84
82
|
};
|
|
85
83
|
|
|
@@ -112,7 +110,6 @@ describe("SwapProvider", () => {
|
|
|
112
110
|
await act(async () => {
|
|
113
111
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
114
112
|
});
|
|
115
|
-
|
|
116
113
|
expect(result.current.srcChain?.chainId).toBe(undefined);
|
|
117
114
|
expect(result.current.srcToken?.address.toLowerCase()).toBe(undefined);
|
|
118
115
|
expect(result.current.dstChain?.chainId).toBe(undefined);
|