-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Balance for Other Wallets Fixes #291 #293
base: master
Are you sure you want to change the base?
Get Balance for Other Wallets Fixes #291 #293
Conversation
🟡 Heimdall Review Status
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @arnavmehta7! Please see my comments
from pydantic import BaseModel, Field | ||
|
||
from cdp_agentkit_core.actions import CdpAction | ||
|
||
GET_BALANCE_PROMPT = """ | ||
This tool will get the balance of all the addresses in the wallet for a given asset. | ||
This tool will get the balance of address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see suggestion
This tool will get the balance of address. | |
This tool will get the balance of all the addresses in the wallet for a given asset, or for a user-specified address if provided. |
@@ -18,10 +19,14 @@ class GetBalanceInput(BaseModel): | |||
..., | |||
description="The asset ID to get the balance for, e.g. `eth`, `0x036CbD53842c5426634e7929541eC2318f3dCF7e`", | |||
) | |||
address_to_fund: Optional[str] = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename to just address
@@ -18,10 +19,14 @@ class GetBalanceInput(BaseModel): | |||
..., | |||
description="The asset ID to get the balance for, e.g. `eth`, `0x036CbD53842c5426634e7929541eC2318f3dCF7e`", | |||
) | |||
address_to_fund: Optional[str] = Field( | |||
None, | |||
description="The address to fund. If not provided, the default address of the wallet will be used.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see suggestion
description="The address to fund. If not provided, the default address of the wallet will be used.", | |
description="The address to get the balance for. If not provided, addresses of the wallet will be used.", |
|
||
|
||
def get_balance(wallet: Wallet, asset_id: str) -> str: | ||
"""Get balance for all addresses in the wallet for a given asset. | ||
def get_balance(wallet: Wallet, asset_id: str, address_to_fund: Optional[str]) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename to just address
Review Error for 0xRAG @ 2025-02-11 15:41:15 UTC |
Fixes #291
Added ability to fetch other wallet's balances if some specific address is supplied in prompt
Pros:
Example SS:
![image](https://private-user-images.githubusercontent.com/65492948/411096972-36f817ee-61f8-4557-ad9a-8bbef9bdd5c8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzg5NzUsIm5iZiI6MTczOTM3ODY3NSwicGF0aCI6Ii82NTQ5Mjk0OC80MTEwOTY5NzItMzZmODE3ZWUtNjFmOC00NTU3LWFkOWEtOGJiZWY5YmRkNWM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE2NDQzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3NGZmMDJhNjA1NGMxMTA1Y2IxYmMwOTEyZjk5OGE0YzY3NGMzZjhmZmM0N2U0MmIxNTYxZjQzNzc3YTdhOWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zUfJJFFm1vAGKMnFvZm2mVwyu6RiH-JBE0Q5XaU9eAo)