@reown/appkit-react-native 0.0.0-feat-multichain-20250519172433 → 0.0.0-feat-multichain-20250604171123
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/lib/commonjs/AppKit.js +92 -43
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/client.js +0 -4
- package/lib/commonjs/client.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useAccount.js +2 -2
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useProvider.js +14 -4
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/networks/solana.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +2 -3
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +15 -16
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-details/index.js +1 -1
- package/lib/commonjs/partials/w3m-swap-details/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/index.js +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +22 -19
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/UiUtil.js +5 -4
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +14 -17
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +1 -0
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-preview-view/index.js +3 -3
- package/lib/commonjs/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +7 -2
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/AppKit.js +93 -43
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/client.js +0 -4
- package/lib/module/client.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useAccount.js +2 -2
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useProvider.js +14 -4
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/networks/solana.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +3 -4
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +16 -17
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-details/index.js +2 -2
- package/lib/module/partials/w3m-swap-details/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/index.js +1 -1
- package/lib/module/utils/NetworkUtil.js +22 -19
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/UiUtil.js +5 -4
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +14 -17
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +1 -0
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-preview-view/index.js +3 -3
- package/lib/module/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +8 -3
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +10 -6
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +1 -1
- package/lib/typescript/client.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +2 -5
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useProvider.d.ts +7 -2
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/networks/solana.d.ts +1 -23
- package/lib/typescript/networks/solana.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-wallet-features/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-details/index.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +3 -2
- package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
- package/lib/typescript/utils/UiUtil.d.ts +1 -2
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +117 -48
- package/src/client.ts +0 -5
- package/src/connectors/WalletConnectConnector.ts +3 -3
- package/src/hooks/useAccount.ts +2 -2
- package/src/hooks/useProvider.ts +16 -6
- package/src/networks/solana.ts +1 -1
- package/src/partials/w3m-account-activity/index.tsx +5 -2
- package/src/partials/w3m-account-wallet-features/index.tsx +17 -20
- package/src/partials/w3m-send-input-token/index.tsx +1 -1
- package/src/partials/w3m-swap-details/index.tsx +6 -2
- package/src/partials/w3m-swap-input/index.tsx +1 -1
- package/src/utils/NetworkUtil.ts +25 -25
- package/src/utils/UiUtil.ts +5 -11
- package/src/views/w3m-account-default-view/index.tsx +22 -20
- package/src/views/w3m-connect-view/index.tsx +1 -0
- package/src/views/w3m-swap-preview-view/index.tsx +6 -3
- package/src/views/w3m-swap-view/index.tsx +9 -5
package/src/hooks/useAccount.ts
CHANGED
|
@@ -11,11 +11,11 @@ export function useAccount() {
|
|
|
11
11
|
connections
|
|
12
12
|
} = useSnapshot(ConnectionsController.state);
|
|
13
13
|
|
|
14
|
-
const connection = connections
|
|
14
|
+
const connection = activeNamespace ? connections.get(activeNamespace) : undefined;
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
address: address?.split(':')[2],
|
|
18
18
|
isConnected: !!address,
|
|
19
|
-
chainId: connection?.
|
|
19
|
+
chainId: connection?.caipNetwork
|
|
20
20
|
};
|
|
21
21
|
}
|
package/src/hooks/useProvider.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
|
-
import type { Provider } from '@reown/appkit-common-react-native';
|
|
3
|
+
import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface ProviderResult {
|
|
6
|
+
provider?: Provider;
|
|
7
|
+
providerType?: ChainNamespace;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function useProvider(namespace?: ChainNamespace): ProviderResult {
|
|
6
11
|
const { connections, activeNamespace } = useSnapshot(ConnectionsController.state);
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
const targetNamespace = namespace ?? activeNamespace;
|
|
14
|
+
|
|
15
|
+
if (!targetNamespace) return { provider: undefined, providerType: undefined };
|
|
9
16
|
|
|
10
|
-
const connection = connections
|
|
17
|
+
const connection = connections.get(targetNamespace);
|
|
11
18
|
|
|
12
|
-
if (!connection) return undefined;
|
|
19
|
+
if (!connection) return { provider: undefined, providerType: undefined };
|
|
13
20
|
|
|
14
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
provider: connection.adapter.connector?.getProvider(),
|
|
23
|
+
providerType: connection.adapter.getSupportedNamespace()
|
|
24
|
+
};
|
|
15
25
|
}
|
package/src/networks/solana.ts
CHANGED
|
@@ -30,7 +30,7 @@ export const solanaDevnet: AppKitNetwork = {
|
|
|
30
30
|
testnet: true
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export const solanaTestnet = {
|
|
33
|
+
export const solanaTestnet: AppKitNetwork = {
|
|
34
34
|
id: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
35
35
|
name: 'Solana Testnet',
|
|
36
36
|
nativeCurrency: { name: 'Solana', symbol: 'SOL', decimals: 9 },
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
AccountController,
|
|
16
16
|
AssetUtil,
|
|
17
17
|
ConnectionsController,
|
|
18
|
+
ConstantsUtil,
|
|
18
19
|
EventsController,
|
|
19
20
|
OptionsController,
|
|
20
21
|
TransactionsController
|
|
@@ -32,9 +33,11 @@ export function AccountActivity({ style }: Props) {
|
|
|
32
33
|
const [refreshing, setRefreshing] = useState(false);
|
|
33
34
|
const [initialLoad, setInitialLoad] = useState(true);
|
|
34
35
|
const { loading, transactions, next } = useSnapshot(TransactionsController.state);
|
|
35
|
-
const { activeNetwork
|
|
36
|
+
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
36
37
|
const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
|
|
37
|
-
const isSupported =
|
|
38
|
+
const isSupported =
|
|
39
|
+
activeNetwork?.caipNetworkId &&
|
|
40
|
+
ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
|
|
38
41
|
|
|
39
42
|
const handleLoadMore = () => {
|
|
40
43
|
const address = ConnectionsController.state.activeAddress?.split(':')[2];
|
|
@@ -3,10 +3,10 @@ import { useSnapshot } from 'valtio';
|
|
|
3
3
|
import { Balance, FlexView, IconLink, Tabs } from '@reown/appkit-ui-react-native';
|
|
4
4
|
import {
|
|
5
5
|
AccountController,
|
|
6
|
+
ConnectionsController,
|
|
6
7
|
ConstantsUtil,
|
|
7
8
|
CoreHelperUtil,
|
|
8
9
|
EventsController,
|
|
9
|
-
NetworkController,
|
|
10
10
|
OnRampController,
|
|
11
11
|
OptionsController,
|
|
12
12
|
RouterController,
|
|
@@ -25,8 +25,12 @@ export function AccountWalletFeatures() {
|
|
|
25
25
|
const [activeTab, setActiveTab] = useState(0);
|
|
26
26
|
const { tokenBalance } = useSnapshot(AccountController.state);
|
|
27
27
|
const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
|
|
28
|
+
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
28
29
|
const balance = CoreHelperUtil.calculateAndFormatBalance(tokenBalance as BalanceType[]);
|
|
29
|
-
const isSwapsEnabled =
|
|
30
|
+
const isSwapsEnabled =
|
|
31
|
+
features?.swaps &&
|
|
32
|
+
activeNetwork?.caipNetworkId &&
|
|
33
|
+
ConstantsUtil.SWAP_SUPPORTED_NETWORKS.includes(activeNetwork.caipNetworkId);
|
|
30
34
|
|
|
31
35
|
const onTabChange = (index: number) => {
|
|
32
36
|
setActiveTab(index);
|
|
@@ -46,23 +50,16 @@ export function AccountWalletFeatures() {
|
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
const onSwapPress = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
properties: {
|
|
60
|
-
network: NetworkController.state.caipNetwork?.id || '',
|
|
61
|
-
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
RouterController.push('Swap');
|
|
65
|
-
}
|
|
53
|
+
SwapController.resetState();
|
|
54
|
+
EventsController.sendEvent({
|
|
55
|
+
type: 'track',
|
|
56
|
+
event: 'OPEN_SWAP',
|
|
57
|
+
properties: {
|
|
58
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
59
|
+
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
RouterController.push('Swap');
|
|
66
63
|
};
|
|
67
64
|
|
|
68
65
|
const onSendPress = () => {
|
|
@@ -70,7 +67,7 @@ export function AccountWalletFeatures() {
|
|
|
70
67
|
type: 'track',
|
|
71
68
|
event: 'OPEN_SEND',
|
|
72
69
|
properties: {
|
|
73
|
-
network:
|
|
70
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
74
71
|
isSmartAccount: AccountController.state.preferredAccountType === 'smartAccount'
|
|
75
72
|
}
|
|
76
73
|
});
|
|
@@ -43,7 +43,7 @@ export function SendInputToken({
|
|
|
43
43
|
const isNetworkToken =
|
|
44
44
|
token.address === undefined ||
|
|
45
45
|
Object.values(ConstantsUtil.NATIVE_TOKEN_ADDRESS).some(
|
|
46
|
-
nativeAddress => token?.address === nativeAddress
|
|
46
|
+
nativeAddress => token?.address?.split(':')[2] === nativeAddress
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const numericGas = NumberUtil.bigNumber(gasPrice).shiftedBy(-token.quantity.decimals);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ConnectionsController,
|
|
5
|
+
ConstantsUtil,
|
|
6
|
+
SwapController
|
|
7
|
+
} from '@reown/appkit-core-react-native';
|
|
4
8
|
import {
|
|
5
9
|
FlexView,
|
|
6
10
|
Text,
|
|
@@ -80,7 +84,7 @@ export function SwapDetails({ initialOpen, canClose }: SwapDetailsProps) {
|
|
|
80
84
|
setModalData(
|
|
81
85
|
getModalData('networkCost', {
|
|
82
86
|
networkSymbol: SwapController.state.networkTokenSymbol,
|
|
83
|
-
networkName:
|
|
87
|
+
networkName: ConnectionsController.state.activeNetwork?.name
|
|
84
88
|
})
|
|
85
89
|
);
|
|
86
90
|
};
|
|
@@ -128,7 +128,7 @@ export function SwapInput({
|
|
|
128
128
|
>
|
|
129
129
|
<Text variant="small-400" color="fg-200" numberOfLines={1}>
|
|
130
130
|
{isMarketValueGreaterThanZero
|
|
131
|
-
? `~$${UiUtil.formatNumberToLocalString(marketValue,
|
|
131
|
+
? `~$${UiUtil.formatNumberToLocalString(marketValue, 6)}`
|
|
132
132
|
: ''}
|
|
133
133
|
</Text>
|
|
134
134
|
{showMax && (
|
package/src/utils/NetworkUtil.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { ConstantsUtil } from '@reown/appkit-common-react-native';
|
|
2
|
-
import type { AppKitNetwork, CaipNetworkId } from '@reown/appkit-common-react-native';
|
|
2
|
+
import type { AppKitNetwork, CaipNetworkId, Network } from '@reown/appkit-common-react-native';
|
|
3
3
|
|
|
4
4
|
export const NetworkUtil = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
projectId
|
|
22
|
-
)
|
|
23
|
-
]
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return formattedNetwork;
|
|
5
|
+
formatNetwork(network: Network, projectId: string): AppKitNetwork {
|
|
6
|
+
const formattedNetwork = {
|
|
7
|
+
...network,
|
|
8
|
+
rpcUrls: { ...network.rpcUrls },
|
|
9
|
+
chainNamespace: network.chainNamespace ?? 'eip155',
|
|
10
|
+
caipNetworkId: network.caipNetworkId ?? `${network.chainNamespace ?? 'eip155'}:${network.id}`
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
Object.keys(formattedNetwork.rpcUrls).forEach(key => {
|
|
14
|
+
const rpcConfig = formattedNetwork.rpcUrls[key];
|
|
15
|
+
if (rpcConfig?.http?.some(url => url.includes(ConstantsUtil.BLOCKCHAIN_API_RPC_URL))) {
|
|
16
|
+
formattedNetwork.rpcUrls[key] = {
|
|
17
|
+
...rpcConfig,
|
|
18
|
+
http: [this.getBlockchainApiRpcUrl(formattedNetwork.caipNetworkId, projectId)]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
29
21
|
});
|
|
22
|
+
|
|
23
|
+
return formattedNetwork;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
formatNetworks(networks: Network[], projectId: string): AppKitNetwork[] {
|
|
27
|
+
const formattedNetworks = networks.map(network => this.formatNetwork(network, projectId));
|
|
28
|
+
|
|
29
|
+
return formattedNetworks;
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
getBlockchainApiRpcUrl(caipNetworkId: CaipNetworkId, projectId: string) {
|
package/src/utils/UiUtil.ts
CHANGED
|
@@ -4,24 +4,18 @@ import {
|
|
|
4
4
|
StorageUtil,
|
|
5
5
|
type WcWallet
|
|
6
6
|
} from '@reown/appkit-core-react-native';
|
|
7
|
-
import {
|
|
8
|
-
LayoutAnimation,
|
|
9
|
-
type LayoutAnimationProperty,
|
|
10
|
-
type LayoutAnimationType
|
|
11
|
-
} from 'react-native';
|
|
12
7
|
|
|
13
8
|
export const UiUtil = {
|
|
14
9
|
TOTAL_VISIBLE_WALLETS: 4,
|
|
15
10
|
|
|
16
11
|
createViewTransition: () => {
|
|
17
|
-
|
|
12
|
+
//TODO: replace this with reanimated
|
|
13
|
+
// LayoutAnimation.configureNext(LayoutAnimation.create(200, 'easeInEaseOut', 'opacity'));
|
|
18
14
|
},
|
|
19
15
|
|
|
20
|
-
animateChange: (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) => {
|
|
24
|
-
LayoutAnimation.configureNext(LayoutAnimation.create(150, type, creationProp));
|
|
16
|
+
animateChange: () => {
|
|
17
|
+
//TODO: replace this with reanimated
|
|
18
|
+
// LayoutAnimation.configureNext(LayoutAnimation.create(150, type, creationProp));
|
|
25
19
|
},
|
|
26
20
|
|
|
27
21
|
storeConnectedWallet: async (
|
|
@@ -59,7 +59,16 @@ export function AccountDefaultView() {
|
|
|
59
59
|
const showExplorer = Object.keys(activeNetwork?.blockExplorers ?? {}).length > 0 && !isAuth;
|
|
60
60
|
const showBack = history.length > 1;
|
|
61
61
|
const showSwitchAccountType = isAuth && NetworkController.checkIfSmartAccountEnabled();
|
|
62
|
-
const showActivity =
|
|
62
|
+
const showActivity =
|
|
63
|
+
!isAuth &&
|
|
64
|
+
activeNamespace &&
|
|
65
|
+
activeNetwork?.caipNetworkId &&
|
|
66
|
+
ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
|
|
67
|
+
const showSwaps =
|
|
68
|
+
!isAuth &&
|
|
69
|
+
features?.swaps &&
|
|
70
|
+
activeNetwork?.caipNetworkId &&
|
|
71
|
+
ConstantsUtil.SWAP_SUPPORTED_NETWORKS.includes(activeNetwork.caipNetworkId);
|
|
63
72
|
const { padding } = useCustomDimensions();
|
|
64
73
|
const { disconnect } = useAppKit();
|
|
65
74
|
|
|
@@ -82,7 +91,7 @@ export function AccountDefaultView() {
|
|
|
82
91
|
event: 'SET_PREFERRED_ACCOUNT_TYPE',
|
|
83
92
|
properties: {
|
|
84
93
|
accountType,
|
|
85
|
-
network:
|
|
94
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId || ''
|
|
86
95
|
}
|
|
87
96
|
});
|
|
88
97
|
}
|
|
@@ -124,23 +133,16 @@ export function AccountDefaultView() {
|
|
|
124
133
|
};
|
|
125
134
|
|
|
126
135
|
const onSwapPress = () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
properties: {
|
|
138
|
-
network: NetworkController.state.caipNetwork?.id || '',
|
|
139
|
-
isSmartAccount: false
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
RouterController.push('Swap');
|
|
143
|
-
}
|
|
136
|
+
SwapController.resetState();
|
|
137
|
+
EventsController.sendEvent({
|
|
138
|
+
type: 'track',
|
|
139
|
+
event: 'OPEN_SWAP',
|
|
140
|
+
properties: {
|
|
141
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
142
|
+
isSmartAccount: false
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
RouterController.push('Swap');
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
const onBuyPress = () => {
|
|
@@ -276,7 +278,7 @@ export function AccountDefaultView() {
|
|
|
276
278
|
<Text color="fg-100">Buy crypto</Text>
|
|
277
279
|
</ListItem>
|
|
278
280
|
)}
|
|
279
|
-
{
|
|
281
|
+
{showSwaps && (
|
|
280
282
|
<ListItem
|
|
281
283
|
chevron
|
|
282
284
|
icon="recycleHorizontal"
|
|
@@ -31,6 +31,7 @@ export function ConnectView() {
|
|
|
31
31
|
const { padding } = useCustomDimensions();
|
|
32
32
|
const { keyboardShown, keyboardHeight } = useKeyboard();
|
|
33
33
|
|
|
34
|
+
//TODO: check this
|
|
34
35
|
// const isWalletConnectEnabled = connectors.some(c => c.type === 'WALLET_CONNECT');
|
|
35
36
|
const isWalletConnectEnabled = true;
|
|
36
37
|
const isAuthEnabled = connectors.some(c => c.type === 'AUTH');
|
|
@@ -86,11 +86,14 @@ export function SwapPreviewView() {
|
|
|
86
86
|
Send
|
|
87
87
|
</Text>
|
|
88
88
|
<Text variant="paragraph-400" color="fg-100">
|
|
89
|
-
${UiUtil.formatNumberToLocalString(sourceTokenMarketValue,
|
|
89
|
+
${UiUtil.formatNumberToLocalString(sourceTokenMarketValue, 6)}
|
|
90
90
|
</Text>
|
|
91
91
|
</FlexView>
|
|
92
92
|
<TokenButton
|
|
93
|
-
text={` ${
|
|
93
|
+
text={` ${UiUtil.formatNumberToLocalString(
|
|
94
|
+
sourceTokenAmount,
|
|
95
|
+
8
|
|
96
|
+
)} ${sourceToken?.symbol}`}
|
|
94
97
|
imageUrl={sourceToken?.logoUri}
|
|
95
98
|
inverse
|
|
96
99
|
disabled
|
|
@@ -103,7 +106,7 @@ export function SwapPreviewView() {
|
|
|
103
106
|
Receive
|
|
104
107
|
</Text>
|
|
105
108
|
<Text variant="paragraph-400" color="fg-100">
|
|
106
|
-
${UiUtil.formatNumberToLocalString(toTokenMarketValue,
|
|
109
|
+
${UiUtil.formatNumberToLocalString(toTokenMarketValue, 6)}
|
|
107
110
|
</Text>
|
|
108
111
|
</FlexView>
|
|
109
112
|
<TokenButton
|
|
@@ -3,8 +3,9 @@ import { useCallback, useEffect } from 'react';
|
|
|
3
3
|
import { Platform, ScrollView } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
AccountController,
|
|
6
|
+
ConnectionsController,
|
|
7
|
+
ConstantsUtil,
|
|
6
8
|
EventsController,
|
|
7
|
-
NetworkController,
|
|
8
9
|
RouterController,
|
|
9
10
|
SwapController
|
|
10
11
|
} from '@reown/appkit-core-react-native';
|
|
@@ -91,7 +92,7 @@ export function SwapView() {
|
|
|
91
92
|
type: 'track',
|
|
92
93
|
event: 'INITIATE_SWAP',
|
|
93
94
|
properties: {
|
|
94
|
-
network:
|
|
95
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId || '',
|
|
95
96
|
swapFromToken: SwapController.state.sourceToken?.symbol || '',
|
|
96
97
|
swapToToken: SwapController.state.toToken?.symbol || '',
|
|
97
98
|
swapFromAmount: SwapController.state.sourceTokenAmount || '',
|
|
@@ -103,9 +104,12 @@ export function SwapView() {
|
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const onSourceMaxPress = () => {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
const { activeNamespace, activeCaipNetworkId } = ConnectionsController.state;
|
|
108
|
+
const networkTokenAddress = activeNamespace
|
|
109
|
+
? `${activeCaipNetworkId}:${ConstantsUtil.NATIVE_TOKEN_ADDRESS[activeNamespace]}`
|
|
110
|
+
: undefined;
|
|
111
|
+
|
|
112
|
+
const isNetworkToken = SwapController.state.sourceToken?.address === networkTokenAddress;
|
|
109
113
|
|
|
110
114
|
const _gasPriceInUSD = SwapController.state.gasPriceInUSD;
|
|
111
115
|
const _sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
|