@@ -2,7 +2,6 @@ import type {
2
2
CanEagerConnect ,
3
3
CanSwitchNetwork ,
4
4
Connect ,
5
- ProviderConnectResult ,
6
5
Subscribe ,
7
6
SwitchNetwork ,
8
7
WalletInfo ,
@@ -17,11 +16,10 @@ import {
17
16
switchNetworkForEvm ,
18
17
WalletTypes ,
19
18
} from '@rango-dev/wallets-shared' ;
20
- import { cosmosBlockchains , evmBlockchains } from 'rango-types' ;
19
+ import { evmBlockchains } from 'rango-types' ;
21
20
22
21
import { metamask as metamask_instance } from './helpers' ;
23
22
import signer from './signer' ;
24
- import { getAddresses , installCosmosSnap , isCosmosSnapInstalled } from './snap' ;
25
23
26
24
const WALLET = WalletTypes . META_MASK ;
27
25
@@ -31,29 +29,18 @@ export const config = {
31
29
32
30
export const getInstance = metamask_instance ;
33
31
export const connect : Connect = async ( { instance } ) => {
34
- /*
35
- * cosmos snap (It's optional)
36
- * If the user approves to install Snap, we take the Cosmos addresses and add them to the accounts.
37
- */
38
- await installCosmosSnap ( instance ) ;
39
- const installed = await isCosmosSnapInstalled ( instance ) ;
40
- let accounts : ProviderConnectResult [ ] = [ ] ;
41
- if ( installed ) {
42
- const addresses = await getAddresses ( instance ) ;
43
- accounts = addresses . map ( ( item ) => ( {
44
- accounts : [ item . address ] ,
45
- chainId : item . chain_id ,
46
- } ) ) ;
47
- }
48
32
/*
49
33
* Note: We need to get `chainId` here, because for the first time
50
34
* after opening the browser, wallet is locked, and don't give us accounts and chainId
51
35
* on `check` phase, so `network` will be null. For this case we need to get chainId
52
36
* whenever we are requesting accounts.
53
37
*/
54
- const evm = await getEvmAccounts ( instance ) ;
55
- accounts = [ ...accounts , evm ] ;
56
- return accounts ;
38
+ const { accounts, chainId } = await getEvmAccounts ( instance ) ;
39
+
40
+ return {
41
+ accounts,
42
+ chainId,
43
+ } ;
57
44
} ;
58
45
59
46
export const subscribe : Subscribe = subscribeToEvm ;
@@ -70,8 +57,6 @@ export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
70
57
allBlockChains
71
58
) => {
72
59
const evms = evmBlockchains ( allBlockChains ) ;
73
- const cosmos = cosmosBlockchains ( allBlockChains ) ;
74
-
75
60
return {
76
61
name : 'MetaMask' ,
77
62
img : 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/metamask/icon.svg' ,
@@ -86,6 +71,6 @@ export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
86
71
DEFAULT : 'https://metamask.io/download/' ,
87
72
} ,
88
73
color : '#dac7ae' ,
89
- supportedChains : [ ... evms , ... cosmos ] ,
74
+ supportedChains : evms ,
90
75
} ;
91
76
} ;
0 commit comments