@rango-dev/widget-embedded 0.1.10-next.100

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 (204) hide show
  1. package/dist/App.d.ts +9 -0
  2. package/dist/App.d.ts.map +1 -0
  3. package/dist/QueueManager.d.ts +4 -0
  4. package/dist/QueueManager.d.ts.map +1 -0
  5. package/dist/components/AppRouter.d.ts +9 -0
  6. package/dist/components/AppRouter.d.ts.map +1 -0
  7. package/dist/components/AppRoutes.d.ts +8 -0
  8. package/dist/components/AppRoutes.d.ts.map +1 -0
  9. package/dist/components/BottomLogo.d.ts +3 -0
  10. package/dist/components/BottomLogo.d.ts.map +1 -0
  11. package/dist/components/ChangeSlippageButton.d.ts +3 -0
  12. package/dist/components/ChangeSlippageButton.d.ts.map +1 -0
  13. package/dist/components/ConfirmSwapErrors.d.ts +4 -0
  14. package/dist/components/ConfirmSwapErrors.d.ts.map +1 -0
  15. package/dist/components/ConfirmSwapWarnings.d.ts +4 -0
  16. package/dist/components/ConfirmSwapWarnings.d.ts.map +1 -0
  17. package/dist/components/Footer.d.ts +2 -0
  18. package/dist/components/Footer.d.ts.map +1 -0
  19. package/dist/components/Header.d.ts +10 -0
  20. package/dist/components/Header.d.ts.map +1 -0
  21. package/dist/components/HeaderButtons.d.ts +4 -0
  22. package/dist/components/HeaderButtons.d.ts.map +1 -0
  23. package/dist/components/Layout.d.ts +7 -0
  24. package/dist/components/Layout.d.ts.map +1 -0
  25. package/dist/components/RoutesOverview.d.ts +10 -0
  26. package/dist/components/RoutesOverview.d.ts.map +1 -0
  27. package/dist/components/SwitchFromAndTo.d.ts +4 -0
  28. package/dist/components/SwitchFromAndTo.d.ts.map +1 -0
  29. package/dist/components/TokenInfo.d.ts +18 -0
  30. package/dist/components/TokenInfo.d.ts.map +1 -0
  31. package/dist/components/TokenPreview.d.ts +20 -0
  32. package/dist/components/TokenPreview.d.ts.map +1 -0
  33. package/dist/components/UpdateUrl.d.ts +2 -0
  34. package/dist/components/UpdateUrl.d.ts.map +1 -0
  35. package/dist/components/warnings/BalanceWarnings.d.ts +7 -0
  36. package/dist/components/warnings/BalanceWarnings.d.ts.map +1 -0
  37. package/dist/components/warnings/ConfirmSwapExtraMessages.d.ts +7 -0
  38. package/dist/components/warnings/ConfirmSwapExtraMessages.d.ts.map +1 -0
  39. package/dist/components/warnings/HighSlippageWarning.d.ts +7 -0
  40. package/dist/components/warnings/HighSlippageWarning.d.ts.map +1 -0
  41. package/dist/components/warnings/MinRequiredSlippage.d.ts +7 -0
  42. package/dist/components/warnings/MinRequiredSlippage.d.ts.map +1 -0
  43. package/dist/constants/errors.d.ts +4 -0
  44. package/dist/constants/errors.d.ts.map +1 -0
  45. package/dist/constants/navigationRoutes.d.ts +15 -0
  46. package/dist/constants/navigationRoutes.d.ts.map +1 -0
  47. package/dist/constants/numbers.d.ts +3 -0
  48. package/dist/constants/numbers.d.ts.map +1 -0
  49. package/dist/constants/searchParams.d.ts +8 -0
  50. package/dist/constants/searchParams.d.ts.map +1 -0
  51. package/dist/constants/swapSettings.d.ts +6 -0
  52. package/dist/constants/swapSettings.d.ts.map +1 -0
  53. package/dist/globalStyles.d.ts +3 -0
  54. package/dist/globalStyles.d.ts.map +1 -0
  55. package/dist/hooks/useConfirmSwap.d.ts +11 -0
  56. package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
  57. package/dist/hooks/useCopyToClipboard.d.ts +2 -0
  58. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
  59. package/dist/hooks/useNavigateBack.d.ts +4 -0
  60. package/dist/hooks/useNavigateBack.d.ts.map +1 -0
  61. package/dist/hooks/usePrevious.d.ts +2 -0
  62. package/dist/hooks/usePrevious.d.ts.map +1 -0
  63. package/dist/hooks/useSelectLanguage.d.ts +5 -0
  64. package/dist/hooks/useSelectLanguage.d.ts.map +1 -0
  65. package/dist/hooks/useTheme.d.ts +8 -0
  66. package/dist/hooks/useTheme.d.ts.map +1 -0
  67. package/dist/i18n.d.ts +3 -0
  68. package/dist/i18n.d.ts.map +1 -0
  69. package/dist/index.d.ts +2 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +8 -0
  72. package/dist/lib.d.ts +8 -0
  73. package/dist/lib.d.ts.map +1 -0
  74. package/dist/mockData/pendingSwap.d.ts +2 -0
  75. package/dist/mockData/pendingSwap.d.ts.map +1 -0
  76. package/dist/pages/ConfirmSwapPage.d.ts +3 -0
  77. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -0
  78. package/dist/pages/ConfirmWalletsPage.d.ts +3 -0
  79. package/dist/pages/ConfirmWalletsPage.d.ts.map +1 -0
  80. package/dist/pages/HistoryPage.d.ts +3 -0
  81. package/dist/pages/HistoryPage.d.ts.map +1 -0
  82. package/dist/pages/Home.d.ts +9 -0
  83. package/dist/pages/Home.d.ts.map +1 -0
  84. package/dist/pages/LiquiditySourcesPage.d.ts +8 -0
  85. package/dist/pages/LiquiditySourcesPage.d.ts.map +1 -0
  86. package/dist/pages/SelectChainPage.d.ts +9 -0
  87. package/dist/pages/SelectChainPage.d.ts.map +1 -0
  88. package/dist/pages/SelectTokenPage.d.ts +15 -0
  89. package/dist/pages/SelectTokenPage.d.ts.map +1 -0
  90. package/dist/pages/SettingsPage.d.ts +8 -0
  91. package/dist/pages/SettingsPage.d.ts.map +1 -0
  92. package/dist/pages/SwapDetailsPage.d.ts +3 -0
  93. package/dist/pages/SwapDetailsPage.d.ts.map +1 -0
  94. package/dist/pages/WalletsPage.d.ts +9 -0
  95. package/dist/pages/WalletsPage.d.ts.map +1 -0
  96. package/dist/services/httpService.d.ts +3 -0
  97. package/dist/services/httpService.d.ts.map +1 -0
  98. package/dist/store/bestRoute.d.ts +28 -0
  99. package/dist/store/bestRoute.d.ts.map +1 -0
  100. package/dist/store/meta.d.ts +9 -0
  101. package/dist/store/meta.d.ts.map +1 -0
  102. package/dist/store/selectors.d.ts +11 -0
  103. package/dist/store/selectors.d.ts.map +1 -0
  104. package/dist/store/settings.d.ts +17 -0
  105. package/dist/store/settings.d.ts.map +1 -0
  106. package/dist/store/ui.d.ts +2 -0
  107. package/dist/store/ui.d.ts.map +1 -0
  108. package/dist/store/wallets.d.ts +28 -0
  109. package/dist/store/wallets.d.ts.map +1 -0
  110. package/dist/types/config.d.ts +40 -0
  111. package/dist/types/config.d.ts.map +1 -0
  112. package/dist/types/index.d.ts +4 -0
  113. package/dist/types/index.d.ts.map +1 -0
  114. package/dist/types/routing.d.ts +45 -0
  115. package/dist/types/routing.d.ts.map +1 -0
  116. package/dist/types/swap.d.ts +11 -0
  117. package/dist/types/swap.d.ts.map +1 -0
  118. package/dist/utils/common.d.ts +4 -0
  119. package/dist/utils/common.d.ts.map +1 -0
  120. package/dist/utils/numbers.d.ts +14 -0
  121. package/dist/utils/numbers.d.ts.map +1 -0
  122. package/dist/utils/queue.d.ts +4 -0
  123. package/dist/utils/queue.d.ts.map +1 -0
  124. package/dist/utils/routing.d.ts +18 -0
  125. package/dist/utils/routing.d.ts.map +1 -0
  126. package/dist/utils/swap.d.ts +45 -0
  127. package/dist/utils/swap.d.ts.map +1 -0
  128. package/dist/utils/wallets.d.ts +29 -0
  129. package/dist/utils/wallets.d.ts.map +1 -0
  130. package/dist/widget-embedded.cjs.development.js +3101 -0
  131. package/dist/widget-embedded.cjs.development.js.map +1 -0
  132. package/dist/widget-embedded.cjs.production.min.js +3101 -0
  133. package/dist/widget-embedded.cjs.production.min.js.map +1 -0
  134. package/dist/widget-embedded.esm.js +3092 -0
  135. package/dist/widget-embedded.esm.js.map +1 -0
  136. package/package.json +55 -0
  137. package/readme.md +2 -0
  138. package/src/App.tsx +91 -0
  139. package/src/QueueManager.tsx +94 -0
  140. package/src/app.css +27 -0
  141. package/src/components/AppRouter.tsx +60 -0
  142. package/src/components/AppRoutes.tsx +105 -0
  143. package/src/components/BottomLogo.tsx +47 -0
  144. package/src/components/ChangeSlippageButton.tsx +19 -0
  145. package/src/components/ConfirmSwapErrors.tsx +38 -0
  146. package/src/components/ConfirmSwapWarnings.tsx +35 -0
  147. package/src/components/Footer.tsx +8 -0
  148. package/src/components/Header.tsx +37 -0
  149. package/src/components/HeaderButtons.tsx +47 -0
  150. package/src/components/Layout.tsx +96 -0
  151. package/src/components/RoutesOverview.tsx +60 -0
  152. package/src/components/SwitchFromAndTo.tsx +30 -0
  153. package/src/components/TokenInfo.tsx +311 -0
  154. package/src/components/TokenPreview.tsx +175 -0
  155. package/src/components/UpdateUrl.tsx +162 -0
  156. package/src/components/warnings/BalanceWarnings.tsx +39 -0
  157. package/src/components/warnings/ConfirmSwapExtraMessages.tsx +20 -0
  158. package/src/components/warnings/HighSlippageWarning.tsx +18 -0
  159. package/src/components/warnings/MinRequiredSlippage.tsx +18 -0
  160. package/src/constants/errors.ts +3 -0
  161. package/src/constants/navigationRoutes.ts +14 -0
  162. package/src/constants/numbers.ts +3 -0
  163. package/src/constants/searchParams.ts +7 -0
  164. package/src/constants/swapSettings.ts +9 -0
  165. package/src/globalStyles.ts +26 -0
  166. package/src/hooks/useConfirmSwap.ts +260 -0
  167. package/src/hooks/useCopyToClipboard.ts +23 -0
  168. package/src/hooks/useNavigateBack.ts +40 -0
  169. package/src/hooks/usePrevious.ts +13 -0
  170. package/src/hooks/useSelectLanguage.ts +15 -0
  171. package/src/hooks/useTheme.ts +127 -0
  172. package/src/i18n.js +30 -0
  173. package/src/index.tsx +14 -0
  174. package/src/languages/en.json +14 -0
  175. package/src/languages/tr.json +11 -0
  176. package/src/lib.tsx +119 -0
  177. package/src/mockData/pendingSwap.ts +607 -0
  178. package/src/pages/ConfirmSwapPage.tsx +72 -0
  179. package/src/pages/ConfirmWalletsPage.tsx +127 -0
  180. package/src/pages/HistoryPage.tsx +29 -0
  181. package/src/pages/Home.tsx +228 -0
  182. package/src/pages/LiquiditySourcesPage.tsx +64 -0
  183. package/src/pages/SelectChainPage.tsx +42 -0
  184. package/src/pages/SelectTokenPage.tsx +64 -0
  185. package/src/pages/SettingsPage.tsx +98 -0
  186. package/src/pages/SwapDetailsPage.tsx +38 -0
  187. package/src/pages/WalletsPage.tsx +119 -0
  188. package/src/services/httpService.ts +5 -0
  189. package/src/store/bestRoute.ts +245 -0
  190. package/src/store/meta.ts +35 -0
  191. package/src/store/selectors.ts +19 -0
  192. package/src/store/settings.ts +84 -0
  193. package/src/store/ui.ts +21 -0
  194. package/src/store/wallets.ts +190 -0
  195. package/src/types/config.ts +44 -0
  196. package/src/types/index.ts +3 -0
  197. package/src/types/routing.ts +60 -0
  198. package/src/types/swap.ts +13 -0
  199. package/src/utils/common.ts +35 -0
  200. package/src/utils/numbers.ts +133 -0
  201. package/src/utils/queue.ts +24 -0
  202. package/src/utils/routing.ts +150 -0
  203. package/src/utils/swap.ts +552 -0
  204. package/src/utils/wallets.ts +481 -0
@@ -0,0 +1,607 @@
1
+ //TODO: remove mock data after queue manager integration
2
+ export const pendingSwap: any = {
3
+ creationTime: '1675837879344',
4
+ finishTime: '1675842500799',
5
+ requestId: 'c40b81cd-fdac-4dad-bfef-1c7b2cff715f',
6
+ inputAmount: '2',
7
+ wallets: {
8
+ POLYGON: {
9
+ walletType: 'metamask',
10
+ address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
11
+ },
12
+ SOLANA: {
13
+ walletType: 'phantom',
14
+ address: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
15
+ },
16
+ },
17
+ status: 'success',
18
+ isPaused: false,
19
+ extraMessage: null,
20
+ extraMessageSeverity: 'info',
21
+ extraMessageDetail: '',
22
+ extraMessageErrorCode: null,
23
+ networkStatusExtraMessage: '',
24
+ networkStatusExtraMessageDetail: '',
25
+ lastNotificationTime: null,
26
+ settings: {
27
+ slippage: '13.0',
28
+ disabledSwappersIds: [
29
+ 'PancakeSwapBsc',
30
+ 'ThorChain',
31
+ 'Horizon Bridge',
32
+ 'OneInchOptimism',
33
+ 'OneInchGnosis',
34
+ 'OneInchBsc',
35
+ 'OneInchArbitrum',
36
+ 'OpenOceanFantom',
37
+ 'SushiHarmony',
38
+ 'SushiArbitrum',
39
+ 'OkcSwap',
40
+ 'CherrySwap',
41
+ 'Osmosis',
42
+ 'SolanaWrapper',
43
+ 'Jupiter',
44
+ 'stargate',
45
+ 'AnySwap',
46
+ 'Satellite',
47
+ 'Diffusion',
48
+ 'JunoSwap',
49
+ 'PangolinSwap',
50
+ 'MMFinance',
51
+ 'CronaSwap',
52
+ 'VVSFinance',
53
+ 'MDexHeco',
54
+ 'ParaSwap Polygon',
55
+ 'ParaSwap Bsc',
56
+ 'ParaSwap Avalanche',
57
+ 'AuroraSwap',
58
+ 'Across',
59
+ 'Arbitrum Bridge',
60
+ 'TrisolarisSwap',
61
+ 'Polygon Bridge',
62
+ 'SpookySwap',
63
+ 'Rainbow Bridge',
64
+ 'Lido',
65
+ 'Symbiosis',
66
+ 'Avalanche Bridge',
67
+ 'VoltageSwap',
68
+ 'Stargate Aggregator',
69
+ 'Across Aggregator',
70
+ 'THORChain Aggregator',
71
+ 'CBridge Aggregator',
72
+ 'AnySwap Aggregator',
73
+ 'Hyphen Aggregator',
74
+ 'Optimism Bridge',
75
+ 'OolongSwap',
76
+ 'QuickSwap',
77
+ 'StellaSwap',
78
+ 'Hyphen',
79
+ 'ViperSwap',
80
+ 'cBridge v2.0',
81
+ 'FinKujira',
82
+ 'Hop',
83
+ 'BeamSwap',
84
+ 'SolarbeamSwap',
85
+ 'Sifchain',
86
+ 'Wormhole',
87
+ 'EthUniSwapV2',
88
+ 'OneInchPolygon',
89
+ ],
90
+ disabledSwappersGroups: [],
91
+ },
92
+ simulationResult: {
93
+ outputAmount: '0.084249153',
94
+ swaps: [
95
+ {
96
+ swapperId: 'QuickSwap',
97
+ swapperLogo: 'https://api.rango.exchange/swappers/quick-swap.png',
98
+ swapperType: 'DEX',
99
+ from: {
100
+ symbol: 'USDC',
101
+ logo: 'https://api.rango.exchange/i/ns0AMf',
102
+ blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
103
+ address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
104
+ blockchain: 'POLYGON',
105
+ decimals: 6,
106
+ usdPrice: 0.999792,
107
+ },
108
+ to: {
109
+ symbol: 'SOL',
110
+ logo: 'https://api.rango.exchange/i/YhJ1nK',
111
+ blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
112
+ address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
113
+ blockchain: 'POLYGON',
114
+ decimals: 9,
115
+ usdPrice: 23.700913462284028,
116
+ },
117
+ fromAmount: '2.000000',
118
+ fromAmountPrecision: null,
119
+ fromAmountMinValue: null,
120
+ fromAmountMaxValue: null,
121
+ fromAmountRestrictionType: null,
122
+ toAmount: '0.084249153',
123
+ fee: [
124
+ {
125
+ asset: {
126
+ blockchain: 'POLYGON',
127
+ symbol: 'USDC',
128
+ address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
129
+ },
130
+ expenseType: 'DECREASE_FROM_OUTPUT',
131
+ amount: '0.006000000000000000124900090270330110797658562660217285156250000000',
132
+ name: 'Swapper Fee',
133
+ },
134
+ {
135
+ asset: {
136
+ blockchain: 'POLYGON',
137
+ symbol: 'MATIC',
138
+ address: null,
139
+ },
140
+ expenseType: 'FROM_SOURCE_WALLET',
141
+ amount: '0.032758180196833611',
142
+ name: 'Network Fee',
143
+ },
144
+ ],
145
+ estimatedTimeInSeconds: 60,
146
+ swapChainType: 'INTER_CHAIN',
147
+ routes: [
148
+ {
149
+ nodes: [
150
+ {
151
+ nodes: [
152
+ {
153
+ marketName: 'QuickSwap',
154
+ marketId: 'QuickSwap',
155
+ percent: 1,
156
+ },
157
+ ],
158
+ from: 'USDC',
159
+ fromLogo: '',
160
+ fromAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
161
+ fromBlockchain: 'POLYGON',
162
+
163
+ to: 'SOL',
164
+ toLogo: '',
165
+ toAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
166
+ toBlockchain: 'POLYGON',
167
+ },
168
+ ],
169
+ },
170
+ ],
171
+ recommendedSlippage: null,
172
+ warnings: [],
173
+ timeStat: {
174
+ min: 7,
175
+ avg: 59,
176
+ max: 736,
177
+ },
178
+ includesDestinationTx: false,
179
+ internalSwaps: null,
180
+ maxRequiredSign: 1,
181
+ fromAsset: {
182
+ blockchain: 'POLYGON',
183
+ symbol: 'USDC',
184
+ address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
185
+ },
186
+ toAsset: {
187
+ blockchain: 'POLYGON',
188
+ symbol: 'SOL',
189
+ address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
190
+ },
191
+ },
192
+ {
193
+ swapperId: 'Wormhole',
194
+ swapperLogo: 'https://api.rango.exchange/swappers/wormhole.png',
195
+ swapperType: 'BRIDGE',
196
+ from: {
197
+ symbol: 'SOL',
198
+ logo: 'https://api.rango.exchange/i/YhJ1nK',
199
+ blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
200
+ address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
201
+ blockchain: 'POLYGON',
202
+ decimals: 9,
203
+ usdPrice: 23.700913462284028,
204
+ },
205
+ to: {
206
+ symbol: 'SOL',
207
+ logo: 'https://api.rango.exchange/i/eLHYrb',
208
+ blockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
209
+ address: null,
210
+ blockchain: 'SOLANA',
211
+ decimals: 9,
212
+ usdPrice: 23.97093428787272,
213
+ },
214
+ fromAmount: '0.084249153',
215
+ fromAmountPrecision: null,
216
+ fromAmountMinValue: null,
217
+ fromAmountMaxValue: null,
218
+ fromAmountRestrictionType: null,
219
+ toAmount: '0.084249153',
220
+ fee: [
221
+ {
222
+ asset: {
223
+ blockchain: 'POLYGON',
224
+ symbol: 'MATIC',
225
+ address: null,
226
+ },
227
+ expenseType: 'FROM_SOURCE_WALLET',
228
+ amount: '0.042205949048288939',
229
+ name: 'Network Fee',
230
+ },
231
+ {
232
+ asset: {
233
+ blockchain: 'SOLANA',
234
+ symbol: 'SOL',
235
+ address: null,
236
+ },
237
+ expenseType: 'FROM_DESTINATION_WALLET',
238
+ amount: '0.000070000',
239
+ name: 'Swapper Fee',
240
+ },
241
+ ],
242
+ estimatedTimeInSeconds: 150,
243
+ swapChainType: 'INTRA_CHAIN',
244
+ routes: null,
245
+ recommendedSlippage: null,
246
+ warnings: [],
247
+ timeStat: {
248
+ min: 42,
249
+ avg: 146,
250
+ max: 5582,
251
+ },
252
+ includesDestinationTx: true,
253
+ internalSwaps: null,
254
+ maxRequiredSign: 6,
255
+ fromAsset: {
256
+ blockchain: 'POLYGON',
257
+ symbol: 'SOL',
258
+ address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
259
+ },
260
+ toAsset: {
261
+ blockchain: 'SOLANA',
262
+ symbol: 'SOL',
263
+ address: null,
264
+ },
265
+ },
266
+ ],
267
+ resultType: 'OK',
268
+ },
269
+ validateBalanceOrFee: true,
270
+ steps: [
271
+ {
272
+ id: 1,
273
+ fromBlockchain: 'POLYGON',
274
+ fromSymbol: 'USDC',
275
+ fromSymbolAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
276
+ fromDecimals: 6,
277
+ fromAmountPrecision: null,
278
+ fromAmountMinValue: null,
279
+ fromAmountMaxValue: null,
280
+ toBlockchain: 'POLYGON',
281
+ fromLogo: 'https://api.rango.exchange/i/ns0AMf',
282
+ fromBlockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
283
+ toBlockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
284
+ toSymbol: 'SOL',
285
+ toSymbolAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
286
+ toDecimals: 9,
287
+ toLogo: 'https://api.rango.exchange/i/YhJ1nK',
288
+ startTransactionTime: 1675837904769,
289
+ swapperId: 'QuickSwap',
290
+ swapperLogo: 'https://api.rango.exchange/swappers/quick-swap.png',
291
+ expectedOutputAmountHumanReadable: '0.084249153',
292
+ outputAmount: '0.084206923',
293
+ status: 'success',
294
+ networkStatus: 'networkChanged',
295
+ executedTransactionId: '0xb2a6b1b497b660bd58d8583d05425ea1b89fa19efc18c9b3baa501abf5f8cee9',
296
+ externalTransactionId: null,
297
+ explorerUrl: [
298
+ {
299
+ url: 'https://polygonscan.com/tx/0xb2a6b1b497b660bd58d8583d05425ea1b89fa19efc18c9b3baa501abf5f8cee9',
300
+ description: 'swap',
301
+ },
302
+ ],
303
+ trackingCode: null,
304
+ cosmosTransaction: null,
305
+ solanaTransaction: null,
306
+ evmTransaction: {
307
+ type: 'EVM',
308
+ blockChain: 'POLYGON',
309
+ isApprovalTx: false,
310
+ from: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
311
+ to: '0x38F7Aa5370439E879370E24AdD063a11Bd74610D',
312
+ spender: null,
313
+ data: '0xa60fdfb60000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000d93f7e271cb87c23aaa73edc008a79646d1f991200000000000000000000000000000000000000000000000000000000001e84800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010438ed173900000000000000000000000000000000000000000000000000000000001e848000000000000000000000000000000000000000000000000000000000045e6b7b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000038f7aa5370439e879370e24add063a11bd74610d0000000000000000000000000000000000000000000000000000000063e348d800000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000d93f7e271cb87c23aaa73edc008a79646d1f991200000000000000000000000000000000000000000000000000000000',
314
+ value: null,
315
+ gasLimit: '0x62f20',
316
+ gasPrice: '247516799843',
317
+ nonce: null,
318
+ },
319
+ evmApprovalTransaction: null,
320
+ transferTransaction: null,
321
+ diagnosisUrl: null,
322
+ internalSteps: null,
323
+ },
324
+ {
325
+ id: 2,
326
+ fromBlockchain: 'POLYGON',
327
+ fromSymbol: 'SOL',
328
+ fromSymbolAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
329
+ fromDecimals: 9,
330
+ fromAmountPrecision: null,
331
+ fromAmountMinValue: null,
332
+ fromAmountMaxValue: null,
333
+ toBlockchain: 'SOLANA',
334
+ fromLogo: 'https://api.rango.exchange/i/YhJ1nK',
335
+ fromBlockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
336
+ toBlockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
337
+ toSymbol: 'SOL',
338
+ toSymbolAddress: null,
339
+ toDecimals: 9,
340
+ toLogo: 'https://api.rango.exchange/i/eLHYrb',
341
+ startTransactionTime: 1675842459076,
342
+ swapperId: 'Wormhole',
343
+ swapperLogo: 'https://api.rango.exchange/swappers/wormhole.png',
344
+ expectedOutputAmountHumanReadable: '0.084249153',
345
+ outputAmount: '0.08420692',
346
+ status: 'failed',
347
+ networkStatus: 'networkChanged',
348
+ executedTransactionId:
349
+ '5MGhqrNRwRKkHGU11S37mgF7LscXWhAvwBeAWEdxcmV9AD6bNqig6iCCzC4mKBH41JBexKb6kj4axLfcH4XZQsT9',
350
+ externalTransactionId: null,
351
+ explorerUrl: [
352
+ {
353
+ url: 'https://solscan.io/tx/2wvqHEy5hCDfpwZM5sZhBpFxXZL7p6PRqpDdCZGpGF85deGQU9oiBC9Jgoszdo8x9hjkySktGPYzubcXP8pxW3H4',
354
+ description: 'Associate Token',
355
+ },
356
+ {
357
+ url: 'https://polygonscan.com/tx/0xcdd0c684fc203d41a0eaacfba2201ab0a48845bb6d0f0805fb4a70a0f971a599',
358
+ description: 'Transfer',
359
+ },
360
+ {
361
+ url: 'https://solscan.io/tx/5rc5EHfMrChB749RsJew1ze35yQMddafkQqy5JFqcdKPJ6j2NiggGT7UDmFDAXzP2AwHGyFj2XjaYr7RQjjc1KmH',
362
+ description: 'Verify vaa 1',
363
+ },
364
+ {
365
+ url: 'https://solscan.io/tx/5xNgHvdzu63fmF7uojrHuqcHC3NgErpdGiSg38X7KZ7EEjTyPWt8W1QUtuyUFcNcSjGkFGrGzfnkRUbe4Hj6oY2v',
366
+ description: 'Verify vaa 2',
367
+ },
368
+ {
369
+ url: 'https://solscan.io/tx/3FnXLYwwpc93o2TyjKNDfiBcRDZ9W1qJVdmCjTRw3kz4Jrwjr5zQzLSbsbbBzqFNMSxBFcUDaiQ7pP4DL5coUGq',
370
+ description: 'Post vaa',
371
+ },
372
+ {
373
+ url: 'https://solscan.io/tx/5MGhqrNRwRKkHGU11S37mgF7LscXWhAvwBeAWEdxcmV9AD6bNqig6iCCzC4mKBH41JBexKb6kj4axLfcH4XZQsT9',
374
+ description: 'Redeem',
375
+ },
376
+ ],
377
+ trackingCode: null,
378
+ cosmosTransaction: null,
379
+ solanaTransaction: {
380
+ type: 'SOLANA',
381
+ blockChain: 'SOLANA',
382
+ from: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
383
+ identifier: 'redeem',
384
+ instructions: [
385
+ {
386
+ keys: [
387
+ {
388
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
389
+ isSigner: true,
390
+ isWritable: true,
391
+ },
392
+ {
393
+ pubkey: 'DapiQYH3BGonhN8cngWcXQ6SrqSm3cwysoznoHr6Sbsx',
394
+ isSigner: false,
395
+ isWritable: false,
396
+ },
397
+ {
398
+ pubkey: 'Wf8aqunuZ9y1tprCihMateij299Pa57XL15a6EQz9qt',
399
+ isSigner: false,
400
+ isWritable: false,
401
+ },
402
+ {
403
+ pubkey: 'FTWSFuqyc6B5BbarBzuHdBofA2ks12eyRNmUfKmDiUN1',
404
+ isSigner: false,
405
+ isWritable: true,
406
+ },
407
+ {
408
+ pubkey: 'J6fNPeeJc1E2zDRUtvD9aaC9kBsEq7JaFr1oa97DAJhj',
409
+ isSigner: false,
410
+ isWritable: false,
411
+ },
412
+ {
413
+ pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
414
+ isSigner: false,
415
+ isWritable: true,
416
+ },
417
+ {
418
+ pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
419
+ isSigner: false,
420
+ isWritable: true,
421
+ },
422
+ {
423
+ pubkey: '2nQNF8F9LLWMqdjymiLK2u8HoHMvYa4orCXsp3w65fQ2',
424
+ isSigner: false,
425
+ isWritable: true,
426
+ },
427
+ {
428
+ pubkey: 'So11111111111111111111111111111111111111112',
429
+ isSigner: false,
430
+ isWritable: false,
431
+ },
432
+ {
433
+ pubkey: 'GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m',
434
+ isSigner: false,
435
+ isWritable: false,
436
+ },
437
+ {
438
+ pubkey: 'SysvarRent111111111111111111111111111111111',
439
+ isSigner: false,
440
+ isWritable: false,
441
+ },
442
+ {
443
+ pubkey: '11111111111111111111111111111111',
444
+ isSigner: false,
445
+ isWritable: false,
446
+ },
447
+ {
448
+ pubkey: 'worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth',
449
+ isSigner: false,
450
+ isWritable: false,
451
+ },
452
+ {
453
+ pubkey: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
454
+ isSigner: false,
455
+ isWritable: false,
456
+ },
457
+ ],
458
+ programId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
459
+ data: [2],
460
+ },
461
+ {
462
+ keys: [
463
+ {
464
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
465
+ isSigner: true,
466
+ isWritable: true,
467
+ },
468
+ {
469
+ pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
470
+ isSigner: true,
471
+ isWritable: true,
472
+ },
473
+ ],
474
+ programId: '11111111111111111111111111111111',
475
+ data: [
476
+ 0, 0, 0, 0, -16, 29, 31, 0, 0, 0, 0, 0, -91, 0, 0, 0, 0, 0, 0, 0, 6, -35, -10, -31,
477
+ -41, 101, -95, -109, -39, -53, -31, 70, -50, -21, 121, -84, 28, -76, -123, -19, 95,
478
+ 91, 55, -111, 58, -116, -11, -123, 126, -1, 0, -87,
479
+ ],
480
+ },
481
+ {
482
+ keys: [
483
+ {
484
+ pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
485
+ isSigner: false,
486
+ isWritable: true,
487
+ },
488
+ {
489
+ pubkey: 'So11111111111111111111111111111111111111112',
490
+ isSigner: false,
491
+ isWritable: false,
492
+ },
493
+ {
494
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
495
+ isSigner: false,
496
+ isWritable: false,
497
+ },
498
+ {
499
+ pubkey: 'SysvarRent111111111111111111111111111111111',
500
+ isSigner: false,
501
+ isWritable: false,
502
+ },
503
+ ],
504
+ programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
505
+ data: [1],
506
+ },
507
+ {
508
+ keys: [
509
+ {
510
+ pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
511
+ isSigner: false,
512
+ isWritable: true,
513
+ },
514
+ {
515
+ pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
516
+ isSigner: false,
517
+ isWritable: true,
518
+ },
519
+ {
520
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
521
+ isSigner: true,
522
+ isWritable: false,
523
+ },
524
+ ],
525
+ programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
526
+ data: [3, 72, -27, 4, 5, 0, 0, 0, 0],
527
+ },
528
+ {
529
+ keys: [
530
+ {
531
+ pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
532
+ isSigner: false,
533
+ isWritable: true,
534
+ },
535
+ {
536
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
537
+ isSigner: false,
538
+ isWritable: true,
539
+ },
540
+ {
541
+ pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
542
+ isSigner: true,
543
+ isWritable: false,
544
+ },
545
+ ],
546
+ programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
547
+ data: [9],
548
+ },
549
+ ],
550
+ recentBlockhash: '2wBCvR3jVNj6wzL8vHSuqTRtxBYiwhtoY6Gkp6WaBxSG',
551
+ signatures: [
552
+ {
553
+ publicKey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
554
+ signature: [
555
+ -116, 17, -5, 86, -122, 120, -7, -53, -29, -15, -70, -100, 16, 48, 113, -42, 8, 126,
556
+ 75, -13, 63, -31, -17, 1, 74, 85, 77, 90, 98, -15, 104, 63, 4, -74, 45, -3, -3, -117,
557
+ -24, -56, 20, -89, -40, 33, 125, -120, -44, -75, 17, 69, 20, -48, 106, 48, 16, -19,
558
+ 83, 123, -77, 93, -20, -27, -77, 7,
559
+ ],
560
+ },
561
+ ],
562
+ serializedMessage: null,
563
+ },
564
+ evmTransaction: null,
565
+ evmApprovalTransaction: null,
566
+ transferTransaction: null,
567
+ diagnosisUrl: null,
568
+ internalSteps: [
569
+ {
570
+ name: 'associate token address',
571
+ state: 'SUCCESSED',
572
+ current: false,
573
+ },
574
+ {
575
+ name: 'transfer',
576
+ state: 'SUCCESSED',
577
+ current: false,
578
+ },
579
+ {
580
+ name: 'signed vaa',
581
+ state: 'SUCCESSED',
582
+ current: false,
583
+ },
584
+ {
585
+ name: 'verify vaa#1',
586
+ state: 'SUCCESSED',
587
+ current: false,
588
+ },
589
+ {
590
+ name: 'verify vaa#2',
591
+ state: 'SUCCESSED',
592
+ current: false,
593
+ },
594
+ {
595
+ name: 'post vaa',
596
+ state: 'SUCCESSED',
597
+ current: false,
598
+ },
599
+ {
600
+ name: 'redeem',
601
+ state: 'SUCCESSED',
602
+ current: true,
603
+ },
604
+ ],
605
+ },
606
+ ],
607
+ };
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import { ConfirmSwap } from '@rango-dev/ui';
4
+ import { useBestRouteStore } from '../store/bestRoute';
5
+ import { useSettingsStore } from '../store/settings';
6
+ import { ConfirmSwapExtraMessages } from '../components/warnings/ConfirmSwapExtraMessages';
7
+ import { useNavigateBack } from '../hooks/useNavigateBack';
8
+ import { navigationRoutes } from '../constants/navigationRoutes';
9
+ import { ConfirmSwapErrors } from '../components/ConfirmSwapErrors';
10
+ import { ConfirmSwapWarnings } from '../components/ConfirmSwapWarnings';
11
+ import { useManager } from '@rango-dev/queue-manager-react';
12
+ import { useUiStore } from '../store/ui';
13
+ import { useConfirmSwap } from '../hooks/useConfirmSwap';
14
+ import { ConfirmSwapErrorTypes } from '../types';
15
+ import { useMetaStore } from '../store/meta';
16
+ import { getBestRouteWithCalculatedFees } from '../utils/routing';
17
+
18
+ export function ConfirmSwapPage() {
19
+ const setSelectedSwap = useUiStore.use.setSelectedSwap();
20
+ const { navigateBackFrom } = useNavigateBack();
21
+ const { manager } = useManager();
22
+ const navigate = useNavigate();
23
+
24
+ const bestRoute = useBestRouteStore.use.bestRoute();
25
+ const fetchingBestRoute = useBestRouteStore.use.loading();
26
+ const { tokens } = useMetaStore.use.meta();
27
+
28
+ const slippage = useSettingsStore.use.slippage();
29
+ const customSlippage = useSettingsStore.use.customSlippage();
30
+ const selectedSlippage = customSlippage || slippage;
31
+ const { loading, errors, warnings, confirmSwap } = useConfirmSwap();
32
+
33
+ const showHighSlippageWarning = !errors.find(
34
+ (error) => error.type === ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE
35
+ );
36
+
37
+ return (
38
+ <ConfirmSwap
39
+ onConfirm={() => {
40
+ confirmSwap?.().then((swap) => {
41
+ if (swap) {
42
+ manager?.create(
43
+ 'swap',
44
+ { swapDetails: swap },
45
+ { id: swap.requestId }
46
+ );
47
+ setSelectedSwap(swap.requestId);
48
+ navigate(navigationRoutes.swaps + `/${swap.requestId}`, {
49
+ replace: true,
50
+ });
51
+ }
52
+ });
53
+ }}
54
+ onBack={navigateBackFrom.bind(null, navigationRoutes.confirmSwap)}
55
+ bestRoute={getBestRouteWithCalculatedFees(bestRoute, tokens)}
56
+ loading={loading}
57
+ errors={ConfirmSwapErrors(errors)}
58
+ warnings={ConfirmSwapWarnings(warnings)}
59
+ extraMessages={
60
+ showHighSlippageWarning && (
61
+ <ConfirmSwapExtraMessages selectedSlippage={selectedSlippage} />
62
+ )
63
+ }
64
+ confirmButtonTitle={
65
+ warnings.length > 0 || errors.length > 0
66
+ ? 'Proceed anyway!'
67
+ : 'Confirm swap!'
68
+ }
69
+ confirmButtonDisabled={fetchingBestRoute}
70
+ />
71
+ );
72
+ }