Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

WalletAgent Class #14

Open
whoabuddy opened this issue Aug 6, 2024 · 0 comments
Open

WalletAgent Class #14

whoabuddy opened this issue Aug 6, 2024 · 0 comments

Comments

@whoabuddy
Copy link
Contributor

This was an idea that didn't materialize, and also didn't want it to get lost in the mix.

We could create a WalletAgent class that defines some extra fields for the normal Agent class, so that we can avoid excessive tool usage and/or make sure results are consistent.

Still a WIP 🚧

class WalletAgent(Agent):
    wallet_account_index: int = Field(..., description="Index of the wallet account")
    bitcoin_address: str = Field(..., description="Bitcoin address of the agent")
    stacks_address: str = Field(..., description="Stacks address of the agent")
    bns_name: Optional[str] = Field(
        None, description="BNS name of the agent (optional)"
    )

    class Config:
        arbitrary_types_allowed = True

    def __init__(self, **data):
        super().__init__(**data)

    @classmethod
    def from_agent(
        cls,
        agent: Agent,
        wallet_account_index: int,
        bitcoin_address: str,
        stacks_address: str,
        bns_name: Optional[str] = None,
    ):
        wallet_agent_data = agent.model_dump()
        wallet_agent_data.update(
            {
                "wallet_account_index": wallet_account_index,
                "bitcoin_address": bitcoin_address,
                "stacks_address": stacks_address,
                "bns_name": bns_name,
            }
        )
        return cls(**wallet_agent_data)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant