Skip to content
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

chore: bump twitter-langchain deps #88

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cdp-agentkit-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## [0.0.7] - 2025-01-08

### Added

- Bump `cdp-sdk` dependency to `0.13.0`.

## [0.0.6] - 2024-12-06

### Added
Expand Down
1,201 changes: 603 additions & 598 deletions cdp-agentkit-core/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cdp-agentkit-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cdp-agentkit-core"
version = "0.0.6"
version = "0.0.7"
description = "CDP Agentkit core primitives"
authors = ["John Peterson <john.peterson@coinbase.com>"]
readme = "README.md"
Expand All @@ -10,7 +10,7 @@ packages = [{ include = "cdp_agentkit_core" }]

[tool.poetry.dependencies]
python = "^3.10"
cdp-sdk = "^0.12.0"
cdp-sdk = "^0.13.0"
pydantic = "^2.0"
web3 = "^7.6.0"

Expand Down
10 changes: 9 additions & 1 deletion cdp-langchain/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

## Unreleased

## [0.0.9] - 2025-01-08

### Added

- Bump dependency `cdp-agentkit-core` to version `0.0.7`.
- Bump dependency `cdp-sdk` to version `0.13.0`.
- Wallet mnemonic phrase import
- Wallet mnemonic phrase import example

## [0.0.8] - 2024-12-06

### Added

- Bump dependency `cdp-agentkit-core` to version `0.0.6`.
- Bump dependency `cdp-sdk` to version `0.12.0`.


## [0.0.7] - 2024-11-16

### Added
Expand Down
7 changes: 6 additions & 1 deletion cdp-langchain/cdp_langchain/utils/cdp_agentkit_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langchain_core.utils import get_from_dict_or_env
from pydantic import BaseModel, model_validator

from cdp import Wallet
from cdp import MnemonicSeedPhrase, Wallet
from cdp_langchain import __version__
from cdp_langchain.constants import CDP_LANGCHAIN_DEFAULT_SOURCE

Expand All @@ -29,6 +29,7 @@ def validate_environment(cls, values: dict) -> Any:
cdp_api_key_private_key = get_from_dict_or_env(
values, "cdp_api_key_private_key", "CDP_API_KEY_PRIVATE_KEY"
).replace("\\n", "\n")
mnemonic_phrase = get_from_dict_or_env(values, "mnemonic_phrase", "MNEMONIC_PHRASE", "")
network_id = get_from_dict_or_env(values, "network_id", "NETWORK_ID", "base-sepolia")
wallet_data_json = values.get("cdp_wallet_data")

Expand All @@ -49,12 +50,16 @@ def validate_environment(cls, values: dict) -> Any:
if wallet_data_json:
wallet_data = WalletData.from_dict(json.loads(wallet_data_json))
wallet = Wallet.import_data(wallet_data)
elif mnemonic_phrase:
phrase = MnemonicSeedPhrase(mnemonic_phrase)
wallet = Wallet.import_wallet(phrase)
else:
wallet = Wallet.create(network_id=network_id)

values["wallet"] = wallet
values["cdp_api_key_name"] = cdp_api_key_name
values["cdp_api_key_private_key"] = cdp_api_key_private_key
values["mnemonic_phrase"] = mnemonic_phrase
values["network_id"] = network_id

return values
Expand Down
10 changes: 10 additions & 0 deletions cdp-langchain/examples/wallet/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ifneq (,$(wildcard ./.env))
include .env
endif

export

.PHONY: run
run:
poetry install --with dev && \
poetry run python wallet.py
47 changes: 47 additions & 0 deletions cdp-langchain/examples/wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# CDP AgentKit Langchain Extension Examples - Mnemomic Phrase Wallet Import

This example demonstrates agentkit setup with an imported wallet from a mnemomic phrase through the ENV. An example of a mnemomic phrase could be:

```bash
eternal phone creek robot disorder climb thought eternal noodle flat cage bubble liquid sting can
```

## Requirements

- Python 3.10+
- [CDP API Key](https://portal.cdp.coinbase.com/access/api)

### Checking Python Version

Before using the example, ensure that you have the correct version of Python installed. The example requires Python 3.10 or higher. You can check your Python version by running the following code:

```bash
python --version
pip --version
```

## Installation

```bash
pip install cdp-langchain
```

## Run the example

### Set ENV Vars

Ensure the following vars are set in .env:

- "CDP_API_KEY_NAME"
- "CDP_API_KEY_PRIVATE_KEY"
- "MNEMONIC_PHRASE"

The mnemomic phrase example above can be used to validate wallet import functionality.

```bash
make run
```

## License

Apache-2.0
Empty file.
42 changes: 42 additions & 0 deletions cdp-langchain/examples/wallet/wallet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import json
import sys

# Import CDP Agentkit Langchain Extension.
from cdp_langchain.utils import CdpAgentkitWrapper


def initialize_agentkit():
"""Initialize the CDP Agentkit.

Returns:
tuple: Agentkit and its config.

"""
config = {}
agentkit = CdpAgentkitWrapper(**config)

return agentkit, config


def main():
"""Import wallet and display its details."""
print("initializing agentkit...")
agentkit, config = initialize_agentkit()

wallet_data = agentkit.export_wallet()

print("ensuring wallet...")
wallet = json.loads(wallet_data)

print("wallet Id:", wallet["wallet_id"])
print("wallet address:", wallet["default_address_id"])
print("wallet network:", wallet["network_id"])
print("wallet seed:", wallet["seed"])


if __name__ == "__main__":
try:
main()
except Exception as error:
print("Fatal error:", str(error))
sys.exit(1)
Loading
Loading