diff --git a/README.md b/README.md index 51bf141..e183f49 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ graph TB SDK --> Vol1 SDK --> Vol2 RPC --> |coingecko_api_key| COINGECKO - RPC --> |infura_token| EVM + RPC --> |alchemy_token| EVM ``` ## Setup diff --git a/bot/account.py b/bot/account.py index 261ad4d..8837703 100644 --- a/bot/account.py +++ b/bot/account.py @@ -3,6 +3,7 @@ import requests, datetime, re, logging, os, json, ast, shutil, eth_abi, shutil import pandas as pd from PIL import Image from PIL.JpegImagePlugin import JpegImageFile +from . import constants from .signal import Signal from .logger import Logger @@ -40,7 +41,7 @@ class Account: - `backup_folder` - where backup files will be created and stored """ # Wallet transactions - self.__etherscan_api_key = None + self.__alchemy_token = None self.__transactions: Optional[pd.DataFrame] = None # Path of the account data in the Docker container for Status Backend self.__docker_data_folder = "./data-dir" @@ -68,7 +69,7 @@ class Account: # Information for Production chains (chain id -> chain name) self.__chains = {} # Monitor if wallet is used in `login` and raise an exception if - # a RPC endpoint for `wallet` is called without `infura_token` + # a RPC endpoint for `wallet` is called without `alchemy_token` self.__is_wallet_set = False # All available tokens in Status Backend self.__available_tokens = pd.DataFrame() @@ -99,7 +100,7 @@ class Account: # In case if there is a hanging logged in session self.logout() - def login(self, password: str, key_uid: Optional[str] = None, display_name: Optional[str] = None, mnemonic: Optional[str] = None, infura_token: Optional[str] = None, coingecko_api_key: Optional[str] = None, etherscan_api_key: Optional[str] = None): + def login(self, password: str, key_uid: Optional[str] = None, display_name: Optional[str] = None, mnemonic: Optional[str] = None, alchemy_token: Optional[str] = None, coingecko_api_key: Optional[str] = None): """ Login to the given account. If it does not exist, it will be created and automatically logged in. @@ -109,9 +110,8 @@ class Account: - `key_uid` - your key unique identifier. If not provided `display_name` will be used to fetch it. This means that each `display_name` can be linked to one `key_uid` - `display_name` - your Status display name. Use `display_name` and `password` parameter combination if you have a 1 to 1 mapping (each display name has a unique `key_uid`) - `mnemonic` - the mnemonic when creating an account. Use this field with `password` and `display_name` to recover an account - - `infura_token` - https://www.infura.io/ RPC token to allow Status Backend to use a wallet + - `alchemy_token` - https://alchemy.com/ RPC token to allow Status Backend to use a wallet - `coingecko_api_key` - https://www.coingecko.com/ API key to allow Status Backend to use a wallet - - `etherscan_api_key` - https://etherscan.io/ API key to fetch wallet Transactions """ if not key_uid and not display_name: raise ValueError("Please provide either a Key Unique Identifier (key_uid) or a Display Name (display_name)...") @@ -168,18 +168,16 @@ class Account: self.logout() # Wallet usage - if infura_token: - params["infuraToken"] = infura_token + if alchemy_token: + params["infuraToken"] = alchemy_token + self.__alchemy_token = alchemy_token if coingecko_api_key: params["coingeckoApiKey"] = coingecko_api_key - if infura_token and coingecko_api_key: + if alchemy_token and coingecko_api_key: self.__is_wallet_set = True - if etherscan_api_key: - self.__etherscan_api_key = etherscan_api_key - url = self.__urls["http"][url_key] params.update({ "logEnabled": True, @@ -1075,7 +1073,7 @@ class Account: def get_transactions(self, refresh: bool = False) -> pd.DataFrame: """ - Get wallet transactions from all Status chains. To fetch wallet transactions, make sure you pass + Get wallet transactions from all Alchemy chains. To fetch wallet transactions, make sure you pass a `etherscan_api_key` when calling `def login`. Parameters: @@ -1084,80 +1082,73 @@ class Account: Output: - Wallet's transactions """ - if not self.__etherscan_api_key: - raise Exception(f"Etherscan API key is required to fetch {self.info['wallet_address']} transactions") + if not self.__is_wallet_set: + raise Exception(f"Cannot use this method without setting an `alchemy_token` and `coingecko_api_key` when calling `login`.") if not refresh and isinstance(self.__transactions, pd.DataFrame): return self.__transactions.copy() - url = "https://api.etherscan.io/v2/api" - transaction_mapping = { - "txlist": "transaction", - "txlistinternal": "internal", - "tokentx": "ERC-20" - } - data = [] - for action, trx_type in transaction_mapping.items(): - for chain_id in self.chains.keys(): - params = { - "chainid": chain_id, - "address": self.info["wallet_address"], - "apikey": self.__etherscan_api_key, - "sort": "desc", - "module": "account", - "offset": 1_000, - "page": 1, - "action": action - } - while True: - response = requests.get(url, params=params) - results: list[dict] = response.json()["result"] - if not results or isinstance(results, str): - break - data += [{**result, "chain_id": chain_id, "trx_type": trx_type} for result in results] - params["page"] += 1 + wallet_address = self.info["wallet_address"] + final = [] + for domain, chain_id in constants.ALCHEMY_CHAIN_IDS.items(): + for key in ["fromAddress", "toAddress"]: + transfers = [] + page_key = "" + url = f"https://{domain}.g.alchemy.com/v2/{self.__alchemy_token}" + while isinstance(page_key, str): + payload = { + "jsonrpc": "2.0", + "id": 1, + "method": "alchemy_getAssetTransfers", + "params": [ + { + key: wallet_address, + "maxCount": hex(1_000), + "pageKey": page_key if isinstance(page_key, str) else None, + "category": ["external", "internal", "erc20"] + } + ] + } + response = requests.post(url, json=payload) + result: dict = response.json().get("result", {}) + current_transfers = result.get("transfers", []) + transfers += current_transfers + page_key = result.get("pageKey") - data = pd.DataFrame(data) - column_mapping = { - "timeStamp": "timestamp", - "trx_type": "trx_type", + transfers = pd.DataFrame(transfers).assign(chain_id = chain_id) + final.append(transfers) + + final: pd.DataFrame = pd.concat(final, ignore_index=True) + columns = { + "blockNum": "block_number", "hash": "trx_hash", "from": "from_address", "to": "to_address", - "contractAddress": "token_address", - "tokenSymbol": "token_symbol", "value": "amount", - "gasPrice": "gas_price", - "gasUsed": "gas_used", - "isError": "is_error", - "chain_id": "chain_id", - "tokenDecimal": "decimals" + "asset": "symbol", + "category": "trx_type", } + final = final[list(columns.keys())].rename(columns=columns) - fill_nan_mapping = { - "token_address": "0x0000000000000000000000000000000000000000", - "token_symbol": "ETH", - "is_error": 0, - "decimals": 18, - "gas_price": 0 - } + block_mapping = {} + for block_number in final["block_number"].unique(): + payload = { + "jsonrpc": "2.0", + "id": 1, + "method": "eth_getBlockByNumber", + "params": [block_number, False], + } + url = f"https://eth-mainnet.g.alchemy.com/v2/{self.__alchemy_token}" + response = requests.post(url, json=payload) + block_mapping[block_number] = int(response.json()["result"]["timestamp"], 16) - final = data[list(column_mapping.keys())].rename(columns=column_mapping).copy() - for column, value in fill_nan_mapping.items(): - final[column] = final[column].fillna(value) - query = final[column].astype(str).str.len() == 0 - final.loc[query, column] = value - - - final.insert(5, "movement", (final["from_address"] == self.info["wallet_address"] ).apply(lambda match: "sent" if match else "received")) + final.insert(0, "timestamp", pd.to_datetime(final["block_number"].map(block_mapping), unit="s", utc=True)) final = final.assign( - timestamp = pd.to_datetime(final["timestamp"].astype("int64"), unit="s"), - amount = (final["amount"].astype("float64") / (10 ** final["decimals"].astype("int"))) * final["movement"].apply(lambda movement: -1 if movement == "sent" else 1), - trx_fee = final.apply(lambda row: (float(row["gas_price"]) * float(row["gas_used"])) / 10**18 if row["movement"] == "sent" else 0, axis=1), - is_error = final["is_error"].astype(int).astype(bool) - ).drop(["gas_price", "gas_used"], axis=1) + block_number = final["block_number"].apply(lambda value: int(value, 16)), + trx_type = final.apply(lambda row: "sent" if row["from_address"].lower() == wallet_address.lower() else "received", axis=1), + amount = final["amount"] * final.apply(lambda row: -1 if row["from_address"].lower() == wallet_address.lower() else 1, axis=1) + ).sort_values("block_number", ascending=False).reset_index(drop=True) - final = final.sort_values("timestamp", ascending=False).reset_index(drop=True) self.__transactions = final.copy() return self.__transactions.copy() @@ -1247,7 +1238,7 @@ class Account: raise ValueError(f"Name {name} does not exist... Available options: {list(self.__prefix_mapping.keys())}") if name == "wallet" and not self.__is_wallet_set: - raise Exception(f"Cannot use this method without setting an `infura_token` and `coingecko_api_key` when calling `login`.") + raise Exception(f"Cannot use this method without setting an `alchemy_token` and `coingecko_api_key` when calling `login`.") data = { 'jsonrpc': '2.0', diff --git a/bot/constants.py b/bot/constants.py new file mode 100644 index 0000000..7dabeca --- /dev/null +++ b/bot/constants.py @@ -0,0 +1,17 @@ +ALCHEMY_CHAIN_IDS = { + "eth-mainnet": 1, + "polygon-mainnet": 137, + "polygon-amoy": 80002, + "arb-mainnet": 42161, + "opt-mainnet": 10, + "base-mainnet": 8453, + "zksync-mainnet": 324, + "blast-mainnet": 81457, + "linea-mainnet": 59144, + "worldchain-mainnet": 480, + "mantle-mainnet": 5000, + "scroll-mainnet": 534352, + "shape-mainnet": 360, + "apechain-mainnet": 33139, + "apechain-curtis": 33111, +} diff --git a/docs/account.md b/docs/account.md index 4d633d1..4980c95 100644 --- a/docs/account.md +++ b/docs/account.md @@ -6,7 +6,7 @@ The account class allows you to easily work with a Status account. ## Display name -The **display name** is the human‑readable identifier for a Status account. It is used when creating an account, resolving an existing account during [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-infura_tokennone-coingecko_api_keynone-etherscan_api_keynone), and when updating the account name through the [`display_name`](./account.md#display_name) property. +The **display name** is the human‑readable identifier for a Status account. It is used when creating an account, resolving an existing account during [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone), and when updating the account name through the [`display_name`](./account.md#display_name) property. Display names must follow strict validation rules enforced by the library and expected by the Status application. A valid display name must satisfy all of the following conditions: @@ -50,7 +50,7 @@ Backup files (`.bkp`) can be both created in [Status App](https://our.status.im/ [Status Backend](https://github.com/status-im/status-go) backup folder is exposed in a Docker volume so users can: -- **Upload backup** - by dropping `.bkp` files in the `backups` folder locally (linked to Status Backend Docker container). Backups are automatically uploaded if a [`mnemonic` is provided during `login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-infura_tokennone-coingecko_api_keynone-etherscan_api_keynone). +- **Upload backup** - by dropping `.bkp` files in the `backups` folder locally (linked to Status Backend Docker container). Backups are automatically uploaded if a [`mnemonic` is provided during `login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone). - **Create backup** - by using [`backup()`](./account.md#backup) or creating one in [Status App](https://our.status.im/status-desktop-v2-35-local-backups-new-home-page-performance-boosts-and-more/). **Note**: Status App will not automatically backup messages. This has to be manually overridden on the app (above screenshot). When using the Python SDK, the messages are automatically stored in the `.bkp` files. @@ -95,7 +95,7 @@ Create a new `Account` instance ready to be logged in. The constructor wires the | `is_secure` | `bool` | No | When `True`, the SDK communicates over `https`; otherwise `http` is used. Defaults to `False`. | | `backup_folder` | `str` | No | Absolute path on the host machine where `.bkp` files will be stored and loaded from. If not provided, the SDK's own `backups/` folder is used. See [Backups](./account.md#backups). | -The constructor does not log into any account on its own - call [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-infura_tokennone-coingecko_api_keynone-etherscan_api_keynone) afterwards. To discover what accounts already exist in the configured data directory, use the [`available_accounts`](./account.md#available_accounts) property, which is also populated automatically during initialization. +The constructor does not log into any account on its own - call [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone) afterwards. To discover what accounts already exist in the configured data directory, use the [`available_accounts`](./account.md#available_accounts) property, which is also populated automatically during initialization. Default setup (localhost, port 8080, http): @@ -125,13 +125,13 @@ account = Account( ) ``` -**Note**: Status Backend must be running before initializing `Account`. You can launch the backend container with [`launch_docker_container`](./utils.md#launch_docker_container). If the backend is not reachable on `domain:port`, calls to [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-infura_tokennone-coingecko_api_keynone-etherscan_api_keynone) will fail. +**Note**: Status Backend must be running before initializing `Account`. You can launch the backend container with [`launch_docker_container`](./utils.md#launch_docker_container). If the backend is not reachable on `domain:port`, calls to [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone) will fail. **Note**: When `backup_folder` is set, [`backup`](./account.md#backup) moves the generated `.bkp` file out of the SDK's internal `backups/` folder into the provided path, and recovery via `mnemonic` will look in this same folder for `.bkp` files to auto-load. Make sure the folder exists and is writable. ## Methods -### `login(password, key_uid=None, display_name=None, mnemonic=None, infura_token=None, coingecko_api_key=None, etherscan_api_key=None)` +### `login(password, key_uid=None, display_name=None, mnemonic=None, alchemy_token=None, coingecko_api_key=None)` Login to an existing Status account. If the account does not exist in the initialized data directory, a new account will be created and automatically logged in. @@ -147,9 +147,8 @@ An account can also be recovered if the [`mnemonic`](https://status.app/help/pro | `key_uid` | `str` | Yes* | Unique key identifier of the account. If provided, the account will be logged in directly using this identifier. If not provided, then you must use `display_name` and `password` to login. | | `display_name` | `str` | Yes* | Display name of the account. Used to resolve the `key_uid` if it is not provided, or to create a new account if one does not already exist. This field is required if an account needs to be recovered with `mnemonic`. | | `mnemonic` | `str` | No | The [mnemonic](https://status.app/help/profile/understand-your-status-keys-and-recovery-phrase#about-your-recovery-phrase) from [`info`](./account.md#info). Use this field with `password` and `display_name` to recover the account. If you have [`.bkp`](./account.md#backup) files, in the backup Docker volume they will be automatically picked up and loaded.

**Note**: You can pass a different `display_name` but that will be internal only. When an account is recovered setting [`display_name`](./account.md#display_name) can be buggy. Ideally when recovering the account, use the original `display_name` of the account. | -| `infura_token` | `str` | No | [RPC token](https://www.infura.io/) to allow Status Backend to use a wallet. | +| `alchemy_token` | `str` | No | [API token](https://www.alchemy.com/) to allow Status Backend to use a wallet. Also used by [`get_transactions`](./account.md#get_transactionsrefreshfalse) to fetch wallet transaction history via the Alchemy REST API, so no separate key is needed for transactions. | | `coingecko_api_key` | `str` | No | [API token](https://www.coingecko.com/) to allow Status Backend to use a wallet. | -| `etherscan_api_key` | `str` | No | [API key](https://etherscan.io/) used by [`get_transactions`](./account.md#get_transactionsrefreshfalse) to fetch wallet transactions from the Etherscan v2 API. Only required if you intend to call `get_transactions`. | Returns the current `Account` instance, allowing method chaining. @@ -214,14 +213,13 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", - "coingecko_api_key": "API key from https://www.coingecko.com/", - "etherscan_api_key": "API key from https://etherscan.io/" + "alchemy_token": "token from https://www.alchemy.com/", + "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) ``` -**Note**: `infura_token`, `coingecko_api_key` and `etherscan_api_key` can be used when creating, recovering and logging in to an account. `etherscan_api_key` is only required if you plan to call [`get_transactions`](./account.md#get_transactionsrefreshfalse); the other wallet endpoints work without it. +**Note**: `alchemy_token` and `coingecko_api_key` can be used when creating, recovering and logging in to an account. `alchemy_token` covers both the wallet RPC and transaction history via [`get_transactions`](./account.md#get_transactionsrefreshfalse), so no additional key is needed. ### `logout()` @@ -493,7 +491,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -525,7 +523,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -551,7 +549,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -578,7 +576,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -609,7 +607,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -655,11 +653,11 @@ Returns `pd.DataFrame`. #### `get_transactions(refresh=False)` -Retrieve the historical transactions for the **logged-in account wallet** across all chains in [`chains`](./account.md#chains). Data is fetched from the [Etherscan v2 API](https://docs.etherscan.io/) and combines three transaction types into a single `DataFrame`: regular transactions (`transaction`), internal transactions (`internal`) and ERC-20 token transfers (`ERC-20`). +Retrieve the historical transactions for the **logged-in account wallet** across all chains in [`chains`](./account.md#chains). Data is fetched from the [Alchemy REST API](https://www.alchemy.com/) using the `alchemy_token` provided during [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone) and combines three transaction types into a single `DataFrame`: regular transactions (`transaction`), internal transactions (`internal`) and ERC-20 token transfers (`ERC-20`). | Name | Type | Required | Description | |-----|-----|-----|-------------| -| `refresh` | `bool` | No | When `True`, the full transaction history is refetched from Etherscan and the cache is replaced. When `False` (default), the cached `DataFrame` from the first call is returned. | +| `refresh` | `bool` | No | When `True`, the full transaction history is refetched from Alchemy and the cache is replaced. When `False` (default), the cached `DataFrame` from the first call is returned. | Returns `pd.DataFrame`, sorted by `timestamp` in descending order (newest first). @@ -687,9 +685,8 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", - "coingecko_api_key": "API key from https://www.coingecko.com/", - "etherscan_api_key": "API key from https://etherscan.io/" + "alchemy_token": "token from https://www.alchemy.com/", + "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -726,7 +723,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -751,7 +748,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -775,7 +772,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -800,7 +797,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -815,7 +812,7 @@ tx_hash = account.send_transaction( ) ``` -**Note**: This is a wallet method, so it requires both `infura_token` and `coingecko_api_key` to be provided in [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-infura_tokennone-coingecko_api_keynone-etherscan_api_keynone). If either is missing, an exception will be raised when this method is called. +**Note**: This is a wallet method, so it requires both `alchemy_token` and `coingecko_api_key` to be provided in [`login`](./account.md#loginpassword-key_uidnone-display_namenone-mnemonicnone-alchemy_tokennone-coingecko_api_keynone). If either is missing, an exception will be raised when this method is called. **Note**: The sender and receiver must be on the **same chain**. Cross-chain transfers are not supported by this method - set `chain_id` to the chain where the funds currently exist. @@ -1262,7 +1259,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -1291,7 +1288,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) @@ -1308,7 +1305,7 @@ account = Account() params = { "display_name": "status-app-bot", "password": "SNTPUMP", - "infura_token" : "token from https://www.infura.io/", + "alchemy_token": "token from https://www.alchemy.com/", "coingecko_api_key": "API key from https://www.coingecko.com/" } account.login(**params) diff --git a/examples/agents/env.example b/examples/agents/env.example index da6f67f..e9d04c7 100644 --- a/examples/agents/env.example +++ b/examples/agents/env.example @@ -2,7 +2,7 @@ PASSWORD = "your-password-here" DISPLAY_NAME = "status-display-name" MNEMONIC = "phrase_1 phrase_2 phrase_3 phrase_4 phrase_5 phrase_6 phrase_7 phrase_8 phrase_9 phrase_10 phrase_11 phrase_12" -INFURA_TOKEN = "your-infura-token" +ALCHEMY_TOKEN = "your-alchemy-token" COINGECKO_API_KEY = "your-coingecko-api-key" # LLM setup diff --git a/examples/agents/main.py b/examples/agents/main.py index 5f98948..892b1a9 100644 --- a/examples/agents/main.py +++ b/examples/agents/main.py @@ -13,13 +13,13 @@ from bot import Account, launch_docker_container class StatusToolKit: - def __init__(self, password: str, display_name: str, mnemonic: str, infura_token: str, coingecko_api_key: str): + def __init__(self, password: str, display_name: str, mnemonic: str, alchemy_token: str, coingecko_api_key: str): self.account = Account() self.account.login( password=password, display_name=display_name, mnemonic=mnemonic, - infura_token=infura_token, + alchemy_token=alchemy_token, coingecko_api_key=coingecko_api_key ) self.display_name = self.account.display_name @@ -60,7 +60,7 @@ if __name__ == "__main__": os.environ["PASSWORD"], os.environ["DISPLAY_NAME"], os.environ["MNEMONIC"], - os.environ["INFURA_TOKEN"], + os.environ["ALCHEMY_TOKEN"], os.environ["COINGECKO_API_KEY"] ) agent = create_agent( diff --git a/examples/agents/tools.py b/examples/agents/tools.py index d4d6551..9afa2d0 100644 --- a/examples/agents/tools.py +++ b/examples/agents/tools.py @@ -146,7 +146,7 @@ class AccountContactManagementTool(StatusBaseTool): class SearchMessagesTool(StatusBaseTool): name: str = "search_messages" - description: str = "Get chat messages for the given chad ID and specified start and end date." + description: str = "Get chat messages for the given chat ID and specified start and end date." args_schema: Type[BaseModel] = models.MessageInput def _run(self, chat_id: str, message: Optional[str], start_date: Optional[models.DateStr], end_date: Optional[models.DateStr]) -> str: @@ -164,7 +164,7 @@ class SearchMessagesTool(StatusBaseTool): class SendMessagesTool(StatusBaseTool): name: str = "send_message" - description: str = "Send a message to the specified chad IT" + description: str = "Send a message to the specified chat IT" args_schema: Type[BaseModel] = models.MessageInput def _run(self, chat_id: str, message: Optional[str], start_date: Optional[models.DateStr], end_date: Optional[models.DateStr]) -> str: