@rango-dev/widget-embedded 0.1.10-next.91 → 0.1.10-next.92
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/dist/App.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +0 -5
- package/src/utils/numbers.ts +1 -0
- package/dist/swapBox.d.ts +0 -3
- package/dist/swapBox.d.ts.map +0 -1
- package/src/swapBox.tsx +0 -65
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -78,11 +78,6 @@ export function App({ configs }: WidgetProps) {
|
|
|
78
78
|
<SwapContainer>
|
|
79
79
|
<AppRouter
|
|
80
80
|
title={configs?.title}
|
|
81
|
-
fromChain={configs?.fromChain}
|
|
82
|
-
fromToken={configs?.fromToken}
|
|
83
|
-
toChain={configs?.toChain}
|
|
84
|
-
toToken={configs?.toToken}
|
|
85
|
-
fromAmount={configs?.fromAmount}
|
|
86
81
|
titleSize={configs?.titleSize}
|
|
87
82
|
titleWeight={configs?.titleWeight}
|
|
88
83
|
>
|
package/src/utils/numbers.ts
CHANGED
|
@@ -68,6 +68,7 @@ export const convertBigNumberToHex = (value: BigNumber, decimals: number): strin
|
|
|
68
68
|
|
|
69
69
|
export const uint8ArrayToHex = (buffer: Uint8Array): string => {
|
|
70
70
|
// buffer is an ArrayBuffer
|
|
71
|
+
// @ts-ignore
|
|
71
72
|
return [...buffer].map((x) => x.toString(16).padStart(2, '0')).join('');
|
|
72
73
|
};
|
|
73
74
|
|
package/dist/swapBox.d.ts
DELETED
package/dist/swapBox.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"swapBox.d.ts","sourceRoot":"","sources":["src/swapBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EA4C3B,CAAC"}
|
package/src/swapBox.tsx
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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 { 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
|
-
import { isEvmBlockchain } from 'rango-sdk';
|
|
18
|
-
|
|
19
|
-
const providers = allProviders();
|
|
20
|
-
|
|
21
|
-
export const SwapBox: React.FC = () => {
|
|
22
|
-
globalStyles();
|
|
23
|
-
const { activeTheme } = useTheme();
|
|
24
|
-
const { blockchains } = useMetaStore.use.meta();
|
|
25
|
-
const disconnectWallet = useWalletsStore.use.disconnectWallet();
|
|
26
|
-
const connectWallet = useWalletsStore.use.connectWallet();
|
|
27
|
-
const evmBasedChainNames = blockchains
|
|
28
|
-
.filter(isEvmBlockchain)
|
|
29
|
-
.map((chain) => chain.name);
|
|
30
|
-
|
|
31
|
-
const onUpdateState: EventHandler = (type, event, value, supportedChains) => {
|
|
32
|
-
if (event === Events.ACCOUNTS) {
|
|
33
|
-
if (value) {
|
|
34
|
-
const supportedChainNames: Network[] | null =
|
|
35
|
-
//@ts-ignore
|
|
36
|
-
walletAndSupportedChainsNames(supportedChains);
|
|
37
|
-
const data = prepareAccountsForWalletStore(
|
|
38
|
-
type,
|
|
39
|
-
value,
|
|
40
|
-
evmBasedChainNames,
|
|
41
|
-
supportedChainNames
|
|
42
|
-
);
|
|
43
|
-
connectWallet(data);
|
|
44
|
-
} else {
|
|
45
|
-
disconnectWallet(type);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Provider
|
|
52
|
-
allBlockChains={blockchains}
|
|
53
|
-
providers={providers}
|
|
54
|
-
onUpdateState={onUpdateState}
|
|
55
|
-
>
|
|
56
|
-
<div id="pageContainer" className={activeTheme}>
|
|
57
|
-
<SwapContainer>
|
|
58
|
-
<AppRouter>
|
|
59
|
-
<Layout />
|
|
60
|
-
</AppRouter>
|
|
61
|
-
</SwapContainer>
|
|
62
|
-
</div>
|
|
63
|
-
</Provider>
|
|
64
|
-
);
|
|
65
|
-
};
|