@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.
Files changed (46) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/dist/index.d.mts +39 -8
  4. package/dist/index.d.ts +39 -8
  5. package/dist/index.global.js +827 -440
  6. package/dist/index.js +9 -9
  7. package/dist/index.mjs +9 -9
  8. package/package.json +12 -1
  9. package/src/components/AllWalletsConfig/index.tsx +40 -0
  10. package/src/components/Swap/HistoryView/index.tsx +28 -5
  11. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +73 -47
  12. package/src/components/Swap/SwapView/SwapButton/index.tsx +45 -10
  13. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +123 -4
  14. package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +71 -0
  15. package/src/components/Swap/SwapView/SwapPanel/index.tsx +4 -0
  16. package/src/components/Swap/SwapView/WalletPicker/index.tsx +63 -28
  17. package/src/components/Swap/index.tsx +2 -2
  18. package/src/components/TxConfigForm/index.tsx +9 -34
  19. package/src/components/TxDataCard/TxDataCardUI/index.tsx +16 -10
  20. package/src/components/TxDataCard/index.tsx +1 -0
  21. package/src/components/index.ts +1 -0
  22. package/src/config/wagmiConfig.ts +1 -6
  23. package/src/constants/index.ts +14 -0
  24. package/src/context/HistoryProvider.tsx +121 -25
  25. package/src/context/SwapProvider.tsx +104 -48
  26. package/src/context/TransactionProvider.tsx +60 -1
  27. package/src/context/TxUIWrapper.tsx +187 -71
  28. package/src/context/WalletProvider.tsx +108 -0
  29. package/src/contracts/addresses.ts +4 -0
  30. package/src/contracts/idl/jupiter.ts +2879 -0
  31. package/src/models/Ecosystem.ts +1 -0
  32. package/src/models/Route.ts +14 -3
  33. package/src/models/SolanaTransaction.ts +38 -0
  34. package/src/models/SolanaWeb3Network.ts +5 -0
  35. package/src/models/TxUIWrapper.ts +8 -4
  36. package/src/models/index.ts +1 -0
  37. package/src/models/payloads/GetBalancesPayload.ts +2 -1
  38. package/src/models/payloads/GetSolanaRoutePayload.ts +8 -0
  39. package/src/models/payloads/index.ts +1 -0
  40. package/src/services/api.ts +21 -3
  41. package/src/services/solana/jupiter/extract-swap-data.ts +183 -0
  42. package/src/services/solana/jupiter/get-events.ts +37 -0
  43. package/src/services/solana/jupiter/instruction-parser.ts +217 -0
  44. package/src/services/solana/jupiter/utils.ts +37 -0
  45. package/src/utils/strings.ts +16 -0
  46. 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
- <WagmiProvider config={wagmiConfig}>
72
- <QueryClientProvider client={queryClient}>
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
- </QueryClientProvider>
82
- </WagmiProvider>
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);