@rango-dev/widget-embedded 0.1.10-next.69 → 0.1.10-next.71
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/package.json +25 -8
- package/src/App.tsx +1 -1
- package/src/index.tsx +3 -1
- package/src/lib.tsx +64 -0
- package/src/pages/ConfirmWalletsPage.tsx +1 -1
- package/src/pages/HistoryPage.tsx +122 -79
- package/src/pages/Home.tsx +2 -2
- package/src/pages/SelectTokenPage.tsx +1 -1
- package/src/store/meta.ts +1 -1
- package/src/store/wallets.ts +1 -2
- package/src/swapBox.tsx +64 -0
- package/src/utils/wallets.ts +7 -1
- package/CHANGELOG.md +0 -12
- package/public/index.html +0 -11
package/package.json
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.1.10-next.
|
|
3
|
+
"version": "0.1.10-next.71",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
6
11
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
7
12
|
"scripts": {
|
|
8
|
-
"dev": "parcel
|
|
9
|
-
"build": "parcel build"
|
|
13
|
+
"dev": "parcel public/index.html -p 3000",
|
|
14
|
+
"build": "parcel build",
|
|
15
|
+
"build:lib": "tsdx build --entry ./src/lib.tsx"
|
|
16
|
+
},
|
|
17
|
+
"husky": {
|
|
18
|
+
"hooks": {
|
|
19
|
+
"pre-commit": "tsdx lint"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"prettier": {
|
|
23
|
+
"printWidth": 80,
|
|
24
|
+
"semi": true,
|
|
25
|
+
"singleQuote": true,
|
|
26
|
+
"trailingComma": "es5"
|
|
10
27
|
},
|
|
11
28
|
"dependencies": {
|
|
12
|
-
"@rango-dev/provider-all": "^0.1.11-next.
|
|
13
|
-
"@rango-dev/ui": "^0.1.10-next.
|
|
14
|
-
"@rango-dev/wallets-core": "^0.1.11-next.
|
|
29
|
+
"@rango-dev/provider-all": "^0.1.11-next.71",
|
|
30
|
+
"@rango-dev/ui": "^0.1.10-next.71",
|
|
31
|
+
"@rango-dev/wallets-core": "^0.1.11-next.71",
|
|
15
32
|
"bignumber.js": "^9.1.1",
|
|
16
33
|
"immer": "^9.0.19",
|
|
17
34
|
"mitt": "^3.0.0",
|
|
@@ -25,5 +42,5 @@
|
|
|
25
42
|
"publishConfig": {
|
|
26
43
|
"access": "public"
|
|
27
44
|
},
|
|
28
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a06369ceaa20017adb7b949401111552987a53ee"
|
|
29
46
|
}
|
package/src/App.tsx
CHANGED
package/src/index.tsx
CHANGED
package/src/lib.tsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SwapContainer } from '@rango-dev/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AppRouter } from './components/AppRouter';
|
|
4
|
+
import { useMetaStore } from './store/meta';
|
|
5
|
+
import { Events, Provider } from '@rango-dev/wallets-core';
|
|
6
|
+
import { allProviders } from '@rango-dev/provider-all';
|
|
7
|
+
import { EventHandler } from '@rango-dev/wallets-core/dist/wallet';
|
|
8
|
+
import { isEvmBlockchain, Network } from '@rango-dev/wallets-shared';
|
|
9
|
+
import {
|
|
10
|
+
prepareAccountsForWalletStore,
|
|
11
|
+
walletAndSupportedChainsNames,
|
|
12
|
+
} from './utils/wallets';
|
|
13
|
+
import { useWalletsStore } from './store/wallets';
|
|
14
|
+
import { Layout } from './components/Layout';
|
|
15
|
+
import { globalStyles } from './globalStyles';
|
|
16
|
+
import { useTheme } from './hooks/useTheme';
|
|
17
|
+
|
|
18
|
+
const providers = allProviders();
|
|
19
|
+
|
|
20
|
+
export const SwapBox: React.FC = () => {
|
|
21
|
+
globalStyles();
|
|
22
|
+
const { activeTheme } = useTheme();
|
|
23
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
24
|
+
const disconnectWallet = useWalletsStore.use.disconnectWallet();
|
|
25
|
+
const connectWallet = useWalletsStore.use.connectWallet();
|
|
26
|
+
const evmBasedChainNames = blockchains
|
|
27
|
+
.filter(isEvmBlockchain)
|
|
28
|
+
.map((chain) => chain.name);
|
|
29
|
+
|
|
30
|
+
const onUpdateState: EventHandler = (type, event, value, supportedChains) => {
|
|
31
|
+
if (event === Events.ACCOUNTS) {
|
|
32
|
+
if (value) {
|
|
33
|
+
const supportedChainNames: Network[] | null =
|
|
34
|
+
//@ts-ignore
|
|
35
|
+
walletAndSupportedChainsNames(supportedChains);
|
|
36
|
+
const data = prepareAccountsForWalletStore(
|
|
37
|
+
type,
|
|
38
|
+
value,
|
|
39
|
+
evmBasedChainNames,
|
|
40
|
+
supportedChainNames
|
|
41
|
+
);
|
|
42
|
+
connectWallet(data);
|
|
43
|
+
} else {
|
|
44
|
+
disconnectWallet(type);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Provider
|
|
51
|
+
allBlockChains={blockchains}
|
|
52
|
+
providers={providers}
|
|
53
|
+
onUpdateState={onUpdateState}
|
|
54
|
+
>
|
|
55
|
+
<div id="pageContainer" className={activeTheme}>
|
|
56
|
+
<SwapContainer>
|
|
57
|
+
<AppRouter>
|
|
58
|
+
<Layout />
|
|
59
|
+
</AppRouter>
|
|
60
|
+
</SwapContainer>
|
|
61
|
+
</div>
|
|
62
|
+
</Provider>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { History } from '@rango-dev/ui';
|
|
2
2
|
import { PendingSwap } from '@rango-dev/ui/dist/containers/History/types';
|
|
3
|
+
import { TransactionType } from 'rango-sdk';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { useNavigate } from 'react-router-dom';
|
|
5
6
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
@@ -37,13 +38,15 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
37
38
|
swapperId: 'Osmosis',
|
|
38
39
|
swapperType: 'DEX',
|
|
39
40
|
swapperLogo: '',
|
|
41
|
+
// @ts-ignore
|
|
40
42
|
result: null,
|
|
41
43
|
from: {
|
|
42
44
|
symbol: 'JUNO',
|
|
43
45
|
logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
44
|
-
address:
|
|
46
|
+
address:
|
|
47
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
45
48
|
blockchain: 'OSMOSIS',
|
|
46
|
-
|
|
49
|
+
blockchainLogo: '',
|
|
47
50
|
decimals: 6,
|
|
48
51
|
usdPrice: 1.1091996179668873,
|
|
49
52
|
},
|
|
@@ -53,17 +56,17 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
53
56
|
address: null,
|
|
54
57
|
blockchain: 'OSMOSIS',
|
|
55
58
|
decimals: 6,
|
|
56
|
-
|
|
59
|
+
blockchainLogo: '',
|
|
57
60
|
usdPrice: 0.7192435454440882,
|
|
58
61
|
},
|
|
59
62
|
fromAmount: '1.000000',
|
|
60
63
|
fromAmountPrecision: null,
|
|
61
64
|
fromAmountMinValue: null,
|
|
62
65
|
fromAmountMaxValue: null,
|
|
63
|
-
fromAmountRestrictionType: null,
|
|
64
66
|
toAmount: '1.540670',
|
|
65
67
|
fee: [
|
|
66
68
|
{
|
|
69
|
+
name: '',
|
|
67
70
|
asset: {
|
|
68
71
|
blockchain: 'OSMOSIS',
|
|
69
72
|
symbol: 'OSMO',
|
|
@@ -93,7 +96,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
93
96
|
fromBlockchain: 'OSMOSIS',
|
|
94
97
|
to: 'ATOM',
|
|
95
98
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
96
|
-
toAddress:
|
|
99
|
+
toAddress:
|
|
100
|
+
'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
|
|
97
101
|
toBlockchain: 'OSMOSIS',
|
|
98
102
|
},
|
|
99
103
|
{
|
|
@@ -111,7 +115,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
111
115
|
fromBlockchain: 'OSMOSIS',
|
|
112
116
|
to: 'IRIS',
|
|
113
117
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
|
|
114
|
-
toAddress:
|
|
118
|
+
toAddress:
|
|
119
|
+
'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
|
|
115
120
|
toBlockchain: 'OSMOSIS',
|
|
116
121
|
},
|
|
117
122
|
{
|
|
@@ -151,10 +156,13 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
151
156
|
id: 1,
|
|
152
157
|
fromBlockchain: 'OSMOSIS',
|
|
153
158
|
fromSymbol: 'JUNO',
|
|
154
|
-
fromSymbolAddress:
|
|
159
|
+
fromSymbolAddress:
|
|
160
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
155
161
|
fromDecimals: 6,
|
|
156
162
|
fromAmountPrecision: null,
|
|
157
163
|
fromAmountMinValue: null,
|
|
164
|
+
swapperLogo: '',
|
|
165
|
+
swapperType: '',
|
|
158
166
|
fromAmountMaxValue: null,
|
|
159
167
|
toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
160
168
|
fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
@@ -170,7 +178,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
170
178
|
outputAmount: '1.540658',
|
|
171
179
|
status: 'running',
|
|
172
180
|
networkStatus: null,
|
|
173
|
-
executedTransactionId:
|
|
181
|
+
executedTransactionId:
|
|
182
|
+
'0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
174
183
|
explorerUrl: [
|
|
175
184
|
{
|
|
176
185
|
url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
@@ -178,7 +187,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
178
187
|
},
|
|
179
188
|
],
|
|
180
189
|
cosmosTransaction: {
|
|
181
|
-
type:
|
|
190
|
+
type: TransactionType.COSMOS,
|
|
182
191
|
fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
183
192
|
blockChain: 'OSMOSIS',
|
|
184
193
|
data: {
|
|
@@ -208,7 +217,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
208
217
|
},
|
|
209
218
|
],
|
|
210
219
|
token_in: {
|
|
211
|
-
denom:
|
|
220
|
+
denom:
|
|
221
|
+
'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
|
|
212
222
|
amount: '1000000',
|
|
213
223
|
},
|
|
214
224
|
token_out_min_amount: '1525264',
|
|
@@ -219,21 +229,26 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
219
229
|
{
|
|
220
230
|
type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
|
|
221
231
|
value: [
|
|
222
|
-
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
223
|
-
102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
233
|
+
121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
234
|
+
51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53,
|
|
235
|
+
116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105,
|
|
236
|
+
98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50,
|
|
237
|
+
69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54,
|
|
238
|
+
69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68,
|
|
239
|
+
65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70,
|
|
240
|
+
52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99,
|
|
241
|
+
47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55,
|
|
242
|
+
53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57,
|
|
243
|
+
67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53,
|
|
244
|
+
66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55,
|
|
245
|
+
48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109,
|
|
246
|
+
111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56,
|
|
247
|
+
57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68,
|
|
248
|
+
52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55,
|
|
249
|
+
67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52,
|
|
250
|
+
57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49,
|
|
251
|
+
48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52,
|
|
237
252
|
],
|
|
238
253
|
},
|
|
239
254
|
],
|
|
@@ -249,7 +264,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
249
264
|
],
|
|
250
265
|
},
|
|
251
266
|
signType: 'AMINO',
|
|
252
|
-
rpcUrl:
|
|
267
|
+
rpcUrl: '',
|
|
253
268
|
},
|
|
254
269
|
rawTransfer: null,
|
|
255
270
|
},
|
|
@@ -293,14 +308,16 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
293
308
|
{
|
|
294
309
|
swapperId: 'Osmosis',
|
|
295
310
|
swapperLogo: '',
|
|
311
|
+
// @ts-ignore
|
|
296
312
|
result: null,
|
|
297
313
|
swapperType: 'DEX',
|
|
298
314
|
from: {
|
|
299
315
|
symbol: 'JUNO',
|
|
300
316
|
logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
301
|
-
address:
|
|
317
|
+
address:
|
|
318
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
302
319
|
blockchain: 'OSMOSIS',
|
|
303
|
-
|
|
320
|
+
blockchainLogo: '',
|
|
304
321
|
decimals: 6,
|
|
305
322
|
usdPrice: 1.1091996179668873,
|
|
306
323
|
},
|
|
@@ -310,17 +327,17 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
310
327
|
address: null,
|
|
311
328
|
blockchain: 'OSMOSIS',
|
|
312
329
|
decimals: 6,
|
|
313
|
-
|
|
330
|
+
blockchainLogo: '',
|
|
314
331
|
usdPrice: 0.7192435454440882,
|
|
315
332
|
},
|
|
316
333
|
fromAmount: '1.000000',
|
|
317
334
|
fromAmountPrecision: null,
|
|
318
335
|
fromAmountMinValue: null,
|
|
319
336
|
fromAmountMaxValue: null,
|
|
320
|
-
fromAmountRestrictionType: null,
|
|
321
337
|
toAmount: '1.540670',
|
|
322
338
|
fee: [
|
|
323
339
|
{
|
|
340
|
+
name: '',
|
|
324
341
|
asset: {
|
|
325
342
|
blockchain: 'OSMOSIS',
|
|
326
343
|
symbol: 'OSMO',
|
|
@@ -350,7 +367,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
350
367
|
fromBlockchain: 'OSMOSIS',
|
|
351
368
|
to: 'ATOM',
|
|
352
369
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
353
|
-
toAddress:
|
|
370
|
+
toAddress:
|
|
371
|
+
'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
|
|
354
372
|
toBlockchain: 'OSMOSIS',
|
|
355
373
|
},
|
|
356
374
|
{
|
|
@@ -368,7 +386,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
368
386
|
fromBlockchain: 'OSMOSIS',
|
|
369
387
|
to: 'IRIS',
|
|
370
388
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
|
|
371
|
-
toAddress:
|
|
389
|
+
toAddress:
|
|
390
|
+
'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
|
|
372
391
|
toBlockchain: 'OSMOSIS',
|
|
373
392
|
},
|
|
374
393
|
{
|
|
@@ -408,7 +427,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
408
427
|
id: 1,
|
|
409
428
|
fromBlockchain: 'OSMOSIS',
|
|
410
429
|
fromSymbol: 'JUNO',
|
|
411
|
-
fromSymbolAddress:
|
|
430
|
+
fromSymbolAddress:
|
|
431
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
412
432
|
fromDecimals: 6,
|
|
413
433
|
fromAmountPrecision: null,
|
|
414
434
|
fromAmountMinValue: null,
|
|
@@ -416,6 +436,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
416
436
|
toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
417
437
|
fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
418
438
|
toBlockchain: 'OSMOSIS',
|
|
439
|
+
swapperLogo: '',
|
|
440
|
+
swapperType: '',
|
|
419
441
|
fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
420
442
|
toSymbol: 'OSMO',
|
|
421
443
|
toSymbolAddress: null,
|
|
@@ -427,7 +449,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
427
449
|
outputAmount: '1.540658',
|
|
428
450
|
status: 'failed',
|
|
429
451
|
networkStatus: null,
|
|
430
|
-
executedTransactionId:
|
|
452
|
+
executedTransactionId:
|
|
453
|
+
'0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
431
454
|
explorerUrl: [
|
|
432
455
|
{
|
|
433
456
|
url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
@@ -435,7 +458,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
435
458
|
},
|
|
436
459
|
],
|
|
437
460
|
cosmosTransaction: {
|
|
438
|
-
type:
|
|
461
|
+
type: TransactionType.COSMOS,
|
|
439
462
|
fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
440
463
|
blockChain: 'OSMOSIS',
|
|
441
464
|
data: {
|
|
@@ -465,7 +488,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
465
488
|
},
|
|
466
489
|
],
|
|
467
490
|
token_in: {
|
|
468
|
-
denom:
|
|
491
|
+
denom:
|
|
492
|
+
'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
|
|
469
493
|
amount: '1000000',
|
|
470
494
|
},
|
|
471
495
|
token_out_min_amount: '1525264',
|
|
@@ -476,21 +500,26 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
476
500
|
{
|
|
477
501
|
type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
|
|
478
502
|
value: [
|
|
479
|
-
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
480
|
-
102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
503
|
+
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
504
|
+
121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
505
|
+
51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53,
|
|
506
|
+
116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105,
|
|
507
|
+
98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50,
|
|
508
|
+
69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54,
|
|
509
|
+
69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68,
|
|
510
|
+
65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70,
|
|
511
|
+
52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99,
|
|
512
|
+
47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55,
|
|
513
|
+
53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57,
|
|
514
|
+
67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53,
|
|
515
|
+
66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55,
|
|
516
|
+
48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109,
|
|
517
|
+
111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56,
|
|
518
|
+
57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68,
|
|
519
|
+
52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55,
|
|
520
|
+
67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52,
|
|
521
|
+
57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49,
|
|
522
|
+
48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52,
|
|
494
523
|
],
|
|
495
524
|
},
|
|
496
525
|
],
|
|
@@ -506,7 +535,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
506
535
|
],
|
|
507
536
|
},
|
|
508
537
|
signType: 'AMINO',
|
|
509
|
-
rpcUrl:
|
|
538
|
+
rpcUrl: '',
|
|
510
539
|
},
|
|
511
540
|
rawTransfer: null,
|
|
512
541
|
},
|
|
@@ -548,7 +577,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
548
577
|
outputAmount: '1.540670',
|
|
549
578
|
swaps: [
|
|
550
579
|
{
|
|
551
|
-
|
|
580
|
+
// @ts-ignore
|
|
581
|
+
result: [],
|
|
552
582
|
swapperId: 'Osmosis',
|
|
553
583
|
swapperType: 'DEX',
|
|
554
584
|
swapperLogo: '',
|
|
@@ -556,9 +586,10 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
556
586
|
from: {
|
|
557
587
|
symbol: 'JUNO',
|
|
558
588
|
logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
559
|
-
address:
|
|
589
|
+
address:
|
|
590
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
560
591
|
blockchain: 'OSMOSIS',
|
|
561
|
-
|
|
592
|
+
blockchainLogo: '',
|
|
562
593
|
decimals: 6,
|
|
563
594
|
usdPrice: 1.1091996179668873,
|
|
564
595
|
},
|
|
@@ -568,17 +599,17 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
568
599
|
address: null,
|
|
569
600
|
blockchain: 'OSMOSIS',
|
|
570
601
|
decimals: 6,
|
|
571
|
-
|
|
602
|
+
blockchainLogo: '',
|
|
572
603
|
usdPrice: 0.7192435454440882,
|
|
573
604
|
},
|
|
574
605
|
fromAmount: '1.000000',
|
|
575
606
|
fromAmountPrecision: null,
|
|
576
607
|
fromAmountMinValue: null,
|
|
577
608
|
fromAmountMaxValue: null,
|
|
578
|
-
fromAmountRestrictionType: null,
|
|
579
609
|
toAmount: '1.540670',
|
|
580
610
|
fee: [
|
|
581
611
|
{
|
|
612
|
+
name: '',
|
|
582
613
|
asset: {
|
|
583
614
|
blockchain: 'OSMOSIS',
|
|
584
615
|
symbol: 'OSMO',
|
|
@@ -608,7 +639,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
608
639
|
fromBlockchain: 'OSMOSIS',
|
|
609
640
|
to: 'ATOM',
|
|
610
641
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
611
|
-
toAddress:
|
|
642
|
+
toAddress:
|
|
643
|
+
'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
|
|
612
644
|
toBlockchain: 'OSMOSIS',
|
|
613
645
|
},
|
|
614
646
|
{
|
|
@@ -626,7 +658,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
626
658
|
fromBlockchain: 'OSMOSIS',
|
|
627
659
|
to: 'IRIS',
|
|
628
660
|
toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
|
|
629
|
-
toAddress:
|
|
661
|
+
toAddress:
|
|
662
|
+
'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
|
|
630
663
|
toBlockchain: 'OSMOSIS',
|
|
631
664
|
},
|
|
632
665
|
{
|
|
@@ -666,10 +699,13 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
666
699
|
id: 1,
|
|
667
700
|
fromBlockchain: 'OSMOSIS',
|
|
668
701
|
fromSymbol: 'JUNO',
|
|
669
|
-
fromSymbolAddress:
|
|
702
|
+
fromSymbolAddress:
|
|
703
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
670
704
|
fromDecimals: 6,
|
|
671
705
|
fromAmountPrecision: null,
|
|
672
706
|
fromAmountMinValue: null,
|
|
707
|
+
swapperLogo: '',
|
|
708
|
+
swapperType: '',
|
|
673
709
|
fromAmountMaxValue: null,
|
|
674
710
|
toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
675
711
|
fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
@@ -685,7 +721,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
685
721
|
outputAmount: '1.540658',
|
|
686
722
|
status: 'success',
|
|
687
723
|
networkStatus: null,
|
|
688
|
-
executedTransactionId:
|
|
724
|
+
executedTransactionId:
|
|
725
|
+
'0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
689
726
|
explorerUrl: [
|
|
690
727
|
{
|
|
691
728
|
url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
@@ -693,7 +730,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
693
730
|
},
|
|
694
731
|
],
|
|
695
732
|
cosmosTransaction: {
|
|
696
|
-
type:
|
|
733
|
+
type: TransactionType.COSMOS,
|
|
697
734
|
fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
698
735
|
blockChain: 'OSMOSIS',
|
|
699
736
|
data: {
|
|
@@ -723,7 +760,8 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
723
760
|
},
|
|
724
761
|
],
|
|
725
762
|
token_in: {
|
|
726
|
-
denom:
|
|
763
|
+
denom:
|
|
764
|
+
'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
|
|
727
765
|
amount: '1000000',
|
|
728
766
|
},
|
|
729
767
|
token_out_min_amount: '1525264',
|
|
@@ -734,21 +772,26 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
734
772
|
{
|
|
735
773
|
type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
|
|
736
774
|
value: [
|
|
737
|
-
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
738
|
-
102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
775
|
+
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99,
|
|
776
|
+
121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54,
|
|
777
|
+
51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53,
|
|
778
|
+
116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105,
|
|
779
|
+
98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50,
|
|
780
|
+
69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54,
|
|
781
|
+
69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68,
|
|
782
|
+
65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70,
|
|
783
|
+
52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99,
|
|
784
|
+
47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55,
|
|
785
|
+
53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57,
|
|
786
|
+
67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53,
|
|
787
|
+
66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55,
|
|
788
|
+
48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109,
|
|
789
|
+
111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56,
|
|
790
|
+
57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68,
|
|
791
|
+
52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55,
|
|
792
|
+
67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52,
|
|
793
|
+
57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49,
|
|
794
|
+
48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52,
|
|
752
795
|
],
|
|
753
796
|
},
|
|
754
797
|
],
|
|
@@ -764,7 +807,7 @@ export const pendingSwap: PendingSwap[] = [
|
|
|
764
807
|
],
|
|
765
808
|
},
|
|
766
809
|
signType: 'AMINO',
|
|
767
|
-
rpcUrl:
|
|
810
|
+
rpcUrl: '',
|
|
768
811
|
},
|
|
769
812
|
rawTransfer: null,
|
|
770
813
|
},
|
package/src/pages/Home.tsx
CHANGED
|
@@ -45,7 +45,7 @@ const Alerts = styled('div', {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
export function Home() {
|
|
48
|
-
const
|
|
48
|
+
const waningMessage = '';
|
|
49
49
|
const isRouterInContext = useInRouterContext();
|
|
50
50
|
const navigate = useNavigate();
|
|
51
51
|
const [count, setCount] = useState(0);
|
|
@@ -173,4 +173,4 @@ export function Home() {
|
|
|
173
173
|
</Footer>
|
|
174
174
|
</Container>
|
|
175
175
|
);
|
|
176
|
-
}
|
|
176
|
+
}
|
package/src/store/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { removeDuplicateFrom } from '../utils/common';
|
|
|
6
6
|
|
|
7
7
|
export type LoadingStatus = 'loading' | 'success' | 'failed';
|
|
8
8
|
|
|
9
|
-
interface MetaState {
|
|
9
|
+
export interface MetaState {
|
|
10
10
|
meta: MetaResponse;
|
|
11
11
|
loadingStatus: LoadingStatus;
|
|
12
12
|
fetchMeta: () => Promise<void>;
|
package/src/store/wallets.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
-
import { Token } from 'rango-sdk';
|
|
3
2
|
import { create } from 'zustand';
|
|
4
3
|
import { SelectableWallet } from '../pages/ConfirmWalletsPage';
|
|
5
4
|
import { httpService } from '../services/httpService';
|
|
@@ -53,7 +52,7 @@ interface WalletsStore {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
export const useWalletsStore = createSelectors(
|
|
56
|
-
create<WalletsStore>()((set
|
|
55
|
+
create<WalletsStore>()((set) => ({
|
|
57
56
|
accounts: [],
|
|
58
57
|
balances: [],
|
|
59
58
|
selectedWallets: [],
|
package/src/swapBox.tsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SwapContainer } from '@rangodev/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AppRouter } from './components/AppRouter';
|
|
4
|
+
import { useMetaStore } from './store/meta';
|
|
5
|
+
import { Events, Provider } from '@rangodev/wallets-core';
|
|
6
|
+
import { allProviders } from '@rangodev/provider-all';
|
|
7
|
+
import { EventHandler } from '@rangodev/wallets-core/dist/wallet';
|
|
8
|
+
import { isEvmBlockchain, Network } from '@rangodev/wallets-shared';
|
|
9
|
+
import {
|
|
10
|
+
prepareAccountsForWalletStore,
|
|
11
|
+
walletAndSupportedChainsNames,
|
|
12
|
+
} from './utils/wallets';
|
|
13
|
+
import { useWalletsStore } from './store/wallets';
|
|
14
|
+
import { Layout } from './components/Layout';
|
|
15
|
+
import { globalStyles } from './globalStyles';
|
|
16
|
+
import { useTheme } from './hooks/useTheme';
|
|
17
|
+
|
|
18
|
+
const providers = allProviders();
|
|
19
|
+
|
|
20
|
+
export const SwapBox: React.FC = () => {
|
|
21
|
+
globalStyles();
|
|
22
|
+
const { activeTheme } = useTheme();
|
|
23
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
24
|
+
const disconnectWallet = useWalletsStore.use.disconnectWallet();
|
|
25
|
+
const connectWallet = useWalletsStore.use.connectWallet();
|
|
26
|
+
const evmBasedChainNames = blockchains
|
|
27
|
+
.filter(isEvmBlockchain)
|
|
28
|
+
.map((chain) => chain.name);
|
|
29
|
+
|
|
30
|
+
const onUpdateState: EventHandler = (type, event, value, supportedChains) => {
|
|
31
|
+
if (event === Events.ACCOUNTS) {
|
|
32
|
+
if (value) {
|
|
33
|
+
const supportedChainNames: Network[] | null =
|
|
34
|
+
//@ts-ignore
|
|
35
|
+
walletAndSupportedChainsNames(supportedChains);
|
|
36
|
+
const data = prepareAccountsForWalletStore(
|
|
37
|
+
type,
|
|
38
|
+
value,
|
|
39
|
+
evmBasedChainNames,
|
|
40
|
+
supportedChainNames
|
|
41
|
+
);
|
|
42
|
+
connectWallet(data);
|
|
43
|
+
} else {
|
|
44
|
+
disconnectWallet(type);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Provider
|
|
51
|
+
allBlockChains={blockchains}
|
|
52
|
+
providers={providers}
|
|
53
|
+
onUpdateState={onUpdateState}
|
|
54
|
+
>
|
|
55
|
+
<div id="pageContainer" className={activeTheme}>
|
|
56
|
+
<SwapContainer>
|
|
57
|
+
<AppRouter>
|
|
58
|
+
<Layout />
|
|
59
|
+
</AppRouter>
|
|
60
|
+
</SwapContainer>
|
|
61
|
+
</div>
|
|
62
|
+
</Provider>
|
|
63
|
+
);
|
|
64
|
+
};
|
package/src/utils/wallets.ts
CHANGED
|
@@ -29,6 +29,12 @@ export function getStateWallet(state: WalletState): WalletStatus {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export const excludedWallets = [
|
|
33
|
+
WalletType.UNKNOWN,
|
|
34
|
+
WalletType.TERRA_STATION,
|
|
35
|
+
WalletType.LEAP,
|
|
36
|
+
];
|
|
37
|
+
|
|
32
38
|
export function getlistWallet(
|
|
33
39
|
getState: (type: WalletType) => WalletState,
|
|
34
40
|
getWalletInfo: (type: WalletType) => WalletInfo,
|
|
@@ -342,4 +348,4 @@ export const getUsdPrice = (
|
|
|
342
348
|
t.address === address,
|
|
343
349
|
);
|
|
344
350
|
return token?.usdPrice || null;
|
|
345
|
-
};
|
|
351
|
+
};
|
package/CHANGELOG.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## 0.1.10-next.1 (2023-01-11)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @rango-dev/widget-embedded
|
|
9
|
-
|
|
10
|
-
## 0.1.10-next.0 (2023-01-10)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @rango-dev/widget-embedded
|
package/public/index.html
DELETED