-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove Action enumeration/re-implementation in Framework Exts
- Loading branch information
1 parent
63eb7cc
commit c4aa2f2
Showing
26 changed files
with
427 additions
and
654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 34 additions & 80 deletions
114
cdp-agentkit-core/cdp_agentkit_core/actions/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,37 @@ | ||
from cdp_agentkit_core.actions.deploy_nft import ( | ||
DEPLOY_NFT_PROMPT, | ||
DeployNftInput, | ||
deploy_nft, | ||
) | ||
from cdp_agentkit_core.actions.deploy_token import ( | ||
DEPLOY_TOKEN_PROMPT, | ||
DeployTokenInput, | ||
deploy_token, | ||
) | ||
from cdp_agentkit_core.actions.get_balance import ( | ||
GET_BALANCE_PROMPT, | ||
GetBalanceInput, | ||
get_balance, | ||
) | ||
from cdp_agentkit_core.actions.get_wallet_details import ( | ||
GET_WALLET_DETAILS_PROMPT, | ||
GetWalletDetailsInput, | ||
get_wallet_details, | ||
) | ||
from cdp_agentkit_core.actions.mint_nft import ( | ||
MINT_NFT_PROMPT, | ||
MintNftInput, | ||
mint_nft, | ||
) | ||
from cdp_agentkit_core.actions.register_basename import ( | ||
REGISTER_BASENAME_PROMPT, | ||
RegisterBasenameInput, | ||
register_basename, | ||
) | ||
from cdp_agentkit_core.actions.request_faucet_funds import ( | ||
REQUEST_FAUCET_FUNDS_PROMPT, | ||
RequestFaucetFundsInput, | ||
request_faucet_funds, | ||
) | ||
from cdp_agentkit_core.actions.trade import ( | ||
TRADE_PROMPT, | ||
TradeInput, | ||
trade, | ||
) | ||
from cdp_agentkit_core.actions.transfer import ( | ||
TRANSFER_PROMPT, | ||
TransferInput, | ||
transfer, | ||
) | ||
from cdp_agentkit_core.actions.uniswap_v3.create_pool import ( | ||
UNISWAP_V3_CREATE_POOL_PROMPT, | ||
UniswapV3CreatePoolInput, | ||
uniswap_v3_create_pool, | ||
) | ||
from cdp_agentkit_core.actions.cdp_action import CdpAction | ||
from cdp_agentkit_core.actions.deploy_nft import DeployNftAction | ||
from cdp_agentkit_core.actions.deploy_token import DeployTokenAction | ||
from cdp_agentkit_core.actions.get_balance import GetBalanceAction | ||
from cdp_agentkit_core.actions.get_wallet_details import GetWalletDetailsAction | ||
from cdp_agentkit_core.actions.mint_nft import MintNftAction | ||
from cdp_agentkit_core.actions.register_basename import RegisterBasenameAction | ||
from cdp_agentkit_core.actions.request_faucet_funds import RequestFaucetFundsAction | ||
from cdp_agentkit_core.actions.trade import TradeAction | ||
from cdp_agentkit_core.actions.transfer import TransferAction | ||
from cdp_agentkit_core.actions.uniswap_v3.create_pool import UniswapV3CreatePoolAction | ||
|
||
|
||
def get_all_cdp_actions() -> list[type[CdpAction]]: | ||
"""Retrieve all subclasses of CdpAction defined in the package.""" | ||
actions = [] | ||
for action in CdpAction.__subclasses__(): | ||
actions.append(action()) | ||
return actions | ||
|
||
|
||
CDP_ACTIONS = get_all_cdp_actions() | ||
|
||
__all__ = [ | ||
"UNISWAP_V3_CREATE_POOL_PROMPT", | ||
"UniswapV3CreatePoolInput", | ||
"uniswap_v3_create_pool", | ||
"DEPLOY_NFT_PROMPT", | ||
"DeployNftInput", | ||
"deploy_nft", | ||
"DEPLOY_TOKEN_PROMPT", | ||
"DeployTokenInput", | ||
"deploy_token", | ||
"GET_BALANCE_PROMPT", | ||
"GetBalanceInput", | ||
"get_balance", | ||
"GET_WALLET_DETAILS_PROMPT", | ||
"GetWalletDetailsInput", | ||
"get_wallet_details", | ||
"MINT_NFT_PROMPT", | ||
"MintNftInput", | ||
"mint_nft", | ||
"REGISTER_BASENAME_PROMPT", | ||
"RegisterBasenameInput", | ||
"register_basename", | ||
"REQUEST_FAUCET_FUNDS_PROMPT", | ||
"RequestFaucetFundsInput", | ||
"request_faucet_funds", | ||
"TRADE_PROMPT", | ||
"TradeInput", | ||
"trade", | ||
"TRANSFER_PROMPT", | ||
"TransferInput", | ||
"transfer", | ||
"CdpAction", | ||
"GetWalletDetailsAction", | ||
"DeployNftAction", | ||
"DeployTokenAction", | ||
"GetBalanceAction", | ||
"MintNftAction", | ||
"RegisterBasenameAction", | ||
"RequestFaucetFundsAction", | ||
"TradeAction", | ||
"TransferAction", | ||
"UniswapV3CreatePoolAction", | ||
"CDP_ACTIONS", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from collections.abc import Callable | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class CdpAction(BaseModel): | ||
"""CDP Action Base Class.""" | ||
|
||
name: str | ||
description: str | ||
args_schema: type[BaseModel] | None = None | ||
func: Callable[..., str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.