lemdaddy commited on
Commit
3a5ee58
·
1 Parent(s): 25d025b

Add getAllEVMSmartWalletsAddressBalances rpc method

Browse files
src/tools/crypto_evm_wallet_toolkit.py CHANGED
@@ -12,6 +12,7 @@ class CryptoEVMWalletTools(Toolkit):
12
  self.register(self.get_evm_smart_wallet_address)
13
  self.register(self.get_evm_smart_wallet_balances)
14
  self.register(self.get_all_evm_smart_wallet_address)
 
15
 
16
  # Fetch the list of supported EVM chains
17
  self.chains = self.get_supported_evm_chains()
@@ -83,8 +84,7 @@ class CryptoEVMWalletTools(Toolkit):
83
 
84
  Args:
85
  user_email (str): The email of the user whose wallet addresses are to be fetched.
86
- testnet (bool, optional): A flag indicating whether to fetch addresses from the testnet.
87
- Defaults to True.
88
 
89
  Returns:
90
  str: The response from the RPC call containing the wallet addresses.
@@ -133,3 +133,31 @@ class CryptoEVMWalletTools(Toolkit):
133
  }
134
  response = asyncio.run(rpc_call(method_name="getEVMSmartWalletAddressBalances", params=params))
135
  return f"{response}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  self.register(self.get_evm_smart_wallet_address)
13
  self.register(self.get_evm_smart_wallet_balances)
14
  self.register(self.get_all_evm_smart_wallet_address)
15
+ self.register(self.get_all_evm_smart_wallet_balances)
16
 
17
  # Fetch the list of supported EVM chains
18
  self.chains = self.get_supported_evm_chains()
 
84
 
85
  Args:
86
  user_email (str): The email of the user whose wallet addresses are to be fetched.
87
+ testnet (bool, optional): A flag indicating whether to fetch addresses from the testnet. Defaults to True.
 
88
 
89
  Returns:
90
  str: The response from the RPC call containing the wallet addresses.
 
133
  }
134
  response = asyncio.run(rpc_call(method_name="getEVMSmartWalletAddressBalances", params=params))
135
  return f"{response}"
136
+
137
+ def get_all_evm_smart_wallet_balances(
138
+ self,
139
+ user_email: str,
140
+ testnet: bool = True
141
+ ) -> str:
142
+ """
143
+ Fetches the balances of all smart EVM wallet addresses for the given user email.
144
+
145
+ This method takes a user's email and an optional testnet flag, constructs the
146
+ necessary parameters, and makes a remote procedure call (RPC) to fetch all EVM
147
+ smart wallet addresses associated with the user.
148
+
149
+ Args:
150
+ user_email (str): The email of the user whose wallet addresses are to be fetched.
151
+ testnet (bool, optional): A flag indicating whether to fetch addresses from the testnet. Defaults to True.
152
+
153
+ Returns:
154
+ str: The response from the RPC call containing the wallet addresses.
155
+ """
156
+ logger.info(f"Fetching crypto wallet account for {user_email}")
157
+
158
+ params = {
159
+ 'testnet': testnet,
160
+ 'userEmail': user_email,
161
+ }
162
+ response = asyncio.run(rpc_call(method_name="getAllEVMSmartWalletsAddressBalances", params=params))
163
+ return f"{response}"