@@ -64,88 +64,3 @@ export const infuraRpcUrls: RPC_URLS_MAP = {
6464 'eip155:44787' : 'https://celo-alfajores.infura.io/v3/' ,
6565} ;
6666
67- /**
68- * Standard RPC method names used in the MetaMask ecosystem.
69- *
70- * This constant provides a centralized registry of all supported
71- * RPC methods, making it easier to reference them consistently
72- * throughout the codebase.
73- */
74- export const RPC_METHODS = {
75- /** Get the current provider state */
76- METAMASK_GETPROVIDERSTATE : 'metamask_getProviderState' ,
77- /** Connect and sign in a single operation */
78- METAMASK_CONNECTSIGN : 'metamask_connectSign' ,
79- /** Connect with specific parameters */
80- METAMASK_CONNECTWITH : 'metamask_connectWith' ,
81- /** Open MetaMask interface */
82- METAMASK_OPEN : 'metamask_open' ,
83- /** Execute multiple operations in a batch */
84- METAMASK_BATCH : 'metamask_batch' ,
85- /** Sign a message with personal_sign */
86- PERSONAL_SIGN : 'personal_sign' ,
87- /** Request wallet permissions */
88- WALLET_REQUESTPERMISSIONS : 'wallet_requestPermissions' ,
89- /** Revoke wallet permissions */
90- WALLET_REVOKEPERMISSIONS : 'wallet_revokePermissions' ,
91- /** Get current wallet permissions */
92- WALLET_GETPERMISSIONS : 'wallet_getPermissions' ,
93- /** Watch/add a token to the wallet */
94- WALLET_WATCHASSET : 'wallet_watchAsset' ,
95- /** Add a new Ethereum chain */
96- WALLET_ADDETHEREUMCHAIN : 'wallet_addEthereumChain' ,
97- /** Switch to a different Ethereum chain */
98- WALLET_SWITCHETHEREUMCHAIN : 'wallet_switchEthereumChain' ,
99- /** Request account access */
100- ETH_REQUESTACCOUNTS : 'eth_requestAccounts' ,
101- /** Get available accounts */
102- ETH_ACCOUNTS : 'eth_accounts' ,
103- /** Get current chain ID */
104- ETH_CHAINID : 'eth_chainId' ,
105- /** Send a transaction */
106- ETH_SENDTRANSACTION : 'eth_sendTransaction' ,
107- /** Sign typed data */
108- ETH_SIGNTYPEDDATA : 'eth_signTypedData' ,
109- /** Sign typed data v3 */
110- ETH_SIGNTYPEDDATA_V3 : 'eth_signTypedData_v3' ,
111- /** Sign typed data v4 */
112- ETH_SIGNTYPEDDATA_V4 : 'eth_signTypedData_v4' ,
113- /** Sign a transaction */
114- ETH_SIGNTRANSACTION : 'eth_signTransaction' ,
115- /** Sign arbitrary data */
116- ETH_SIGN : 'eth_sign' ,
117- /** Recover address from signature */
118- PERSONAL_EC_RECOVER : 'personal_ecRecover' ,
119- } ;
120-
121- /**
122- * Configuration mapping for RPC methods that should be redirected to the wallet.
123- *
124- * This constant defines which RPC methods require user interaction through
125- * the wallet interface (true) versus those that can be handled locally (false).
126- * Methods marked as true will redirect to the wallet for user approval.
127- */
128- export const METHODS_TO_REDIRECT : { [ method : string ] : boolean } = {
129- [ RPC_METHODS . ETH_REQUESTACCOUNTS ] : true ,
130- [ RPC_METHODS . ETH_SENDTRANSACTION ] : true ,
131- [ RPC_METHODS . ETH_SIGNTRANSACTION ] : true ,
132- [ RPC_METHODS . ETH_SIGN ] : true ,
133- [ RPC_METHODS . PERSONAL_SIGN ] : true ,
134- // stop redirecting these as we are caching values in the provider
135- [ RPC_METHODS . ETH_ACCOUNTS ] : false ,
136- [ RPC_METHODS . ETH_CHAINID ] : false ,
137- //
138- [ RPC_METHODS . ETH_SIGNTYPEDDATA ] : true ,
139- [ RPC_METHODS . ETH_SIGNTYPEDDATA_V3 ] : true ,
140- [ RPC_METHODS . ETH_SIGNTYPEDDATA_V4 ] : true ,
141- [ RPC_METHODS . WALLET_REQUESTPERMISSIONS ] : true ,
142- [ RPC_METHODS . WALLET_GETPERMISSIONS ] : true ,
143- [ RPC_METHODS . WALLET_WATCHASSET ] : true ,
144- [ RPC_METHODS . WALLET_ADDETHEREUMCHAIN ] : true ,
145- [ RPC_METHODS . WALLET_SWITCHETHEREUMCHAIN ] : true ,
146- [ RPC_METHODS . METAMASK_CONNECTSIGN ] : true ,
147- [ RPC_METHODS . METAMASK_CONNECTWITH ] : true ,
148- [ RPC_METHODS . PERSONAL_EC_RECOVER ] : true ,
149- [ RPC_METHODS . METAMASK_BATCH ] : true ,
150- [ RPC_METHODS . METAMASK_OPEN ] : true ,
151- } ;
0 commit comments