@rango-dev/widget-embedded 0.1.10-next.69
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/CHANGELOG.md +12 -0
- package/package.json +29 -0
- package/public/index.html +11 -0
- package/readme.md +2 -0
- package/src/App.tsx +78 -0
- package/src/app.css +28 -0
- package/src/components/AppRouter.tsx +15 -0
- package/src/components/AppRoutes.tsx +32 -0
- package/src/components/BottomLogo.tsx +44 -0
- package/src/components/Footer.tsx +8 -0
- package/src/components/Header.tsx +25 -0
- package/src/components/HeaderButtons.tsx +34 -0
- package/src/components/Layout.tsx +55 -0
- package/src/components/SwitchFromAndTo.tsx +30 -0
- package/src/components/TokenInfo.tsx +218 -0
- package/src/components/UpdateUrl.tsx +85 -0
- package/src/constants/errors.ts +3 -0
- package/src/constants/navigationRoutes.ts +14 -0
- package/src/constants/numbers.ts +3 -0
- package/src/constants/searchParams.ts +7 -0
- package/src/globalStyles.ts +16 -0
- package/src/hooks/useBestRoute.ts +70 -0
- package/src/hooks/useConfirmSwap.ts +234 -0
- package/src/hooks/useTheme.ts +37 -0
- package/src/index.tsx +12 -0
- package/src/mockData/pendingSwap.ts +607 -0
- package/src/pages/ConfirmSwapPage.tsx +24 -0
- package/src/pages/ConfirmWalletsPage.tsx +51 -0
- package/src/pages/HistoryPage.tsx +793 -0
- package/src/pages/Home.tsx +176 -0
- package/src/pages/LiquiditySourcesPage.tsx +49 -0
- package/src/pages/SelectChainPage.tsx +62 -0
- package/src/pages/SelectTokenPage.tsx +84 -0
- package/src/pages/SettingsPage.tsx +60 -0
- package/src/pages/SwapDetailsPage.tsx +9 -0
- package/src/pages/WalletsPage.tsx +61 -0
- package/src/services/httpService.ts +3 -0
- package/src/store/bestRoute.ts +82 -0
- package/src/store/meta.ts +35 -0
- package/src/store/selectors.ts +19 -0
- package/src/store/settings.ts +72 -0
- package/src/store/wallets.ts +144 -0
- package/src/utils/common.ts +3 -0
- package/src/utils/numbers.ts +94 -0
- package/src/utils/routing.ts +108 -0
- package/src/utils/swap.ts +155 -0
- package/src/utils/wallets.ts +345 -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,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfirmSwap } from '@rango-dev/ui';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
5
|
+
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
6
|
+
|
|
7
|
+
export function ConfirmSwapPage() {
|
|
8
|
+
const navigate = useNavigate();
|
|
9
|
+
|
|
10
|
+
const bestRoute = useBestRouteStore.use.bestRoute();
|
|
11
|
+
|
|
12
|
+
const { error, loading, warning, swap } = useConfirmSwap();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ConfirmSwap
|
|
16
|
+
onConfirm={swap.bind(null)}
|
|
17
|
+
onBack={navigate.bind(null, -1)}
|
|
18
|
+
bestRoute={bestRoute}
|
|
19
|
+
loading={loading}
|
|
20
|
+
error={error}
|
|
21
|
+
warning={warning}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { ConfirmWallets } from '@rango-dev/ui';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
5
|
+
import { useWalletsStore } from '../store/wallets';
|
|
6
|
+
import { useWallets } from '@rango-dev/wallets-core';
|
|
7
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
8
|
+
import { getRequiredChains, getSelectableWallets, SelectedWallet } from '../utils/wallets';
|
|
9
|
+
import { requiredWallets } from '../utils/swap';
|
|
10
|
+
|
|
11
|
+
export interface SelectableWallet extends SelectedWallet {
|
|
12
|
+
image: string;
|
|
13
|
+
selected: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function ConfirmWalletsPage() {
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
|
|
19
|
+
const bestRoute = useBestRouteStore.use.bestRoute();
|
|
20
|
+
|
|
21
|
+
const accounts = useWalletsStore.use.accounts();
|
|
22
|
+
const selectedWallets = useWalletsStore.use.selectedWallets();
|
|
23
|
+
const initSelectedWallets = useWalletsStore.use.initSelectedWallets();
|
|
24
|
+
const setSelectedWallet = useWalletsStore.use.setSelectedWallet();
|
|
25
|
+
|
|
26
|
+
const { getWalletInfo } = useWallets();
|
|
27
|
+
const confirmDisabled = !requiredWallets(bestRoute).every((chain) =>
|
|
28
|
+
selectedWallets.map((wallet) => wallet.chain).includes(chain),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
initSelectedWallets();
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ConfirmWallets
|
|
37
|
+
requiredWallets={getRequiredChains(bestRoute)}
|
|
38
|
+
selectableWallets={getSelectableWallets(
|
|
39
|
+
accounts,
|
|
40
|
+
selectedWallets,
|
|
41
|
+
getWalletInfo,
|
|
42
|
+
getRequiredChains(bestRoute),
|
|
43
|
+
)}
|
|
44
|
+
onBack={() => navigate(-1)}
|
|
45
|
+
swap={bestRoute!}
|
|
46
|
+
onConfirm={() => navigate(navigationRoutes.confirmSwap)}
|
|
47
|
+
onChange={(wallet) => setSelectedWallet(wallet)}
|
|
48
|
+
confirmDisabled={confirmDisabled}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|