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: cdpApiActionProvider usage #211

Merged
merged 1 commit into from
Jan 31, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ from another wallet and provide the user with your wallet details.`,
supportsNetwork = (_: Network) => true;
}

export const cdpApiActionProvider = () => new CdpApiActionProvider();
export const cdpApiActionProvider = (config: CdpWalletProviderConfig = {}) =>
new CdpApiActionProvider(config);
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@ Important notes:
supportsNetwork = (_: Network) => true;
}

export const cdpWalletActionProvider = () => new CdpWalletActionProvider();
export const cdpWalletActionProvider = (config: CdpWalletProviderConfig = {}) =>
new CdpWalletActionProvider(config);
9 changes: 5 additions & 4 deletions cdp-langchain/examples/chatbot-typescript/chatbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as readline from "readline";
import {
AgentKit,
ViemWalletProvider,
cdpActionProvider,
cdpApiActionProvider,
erc721ActionProvider,
pythActionProvider,
walletActionProvider,
Expand All @@ -32,14 +32,15 @@ async function initializeAgent() {
model: "gpt-4o-mini",
});

const cdp = cdpActionProvider();
const cdp = cdpApiActionProvider({
apiKeyName: process.env.CDP_API_KEY_NAME,
apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY,
});
const erc721 = erc721ActionProvider();
const pyth = pythActionProvider();
const wallet = walletActionProvider();

const agentKit = await AgentKit.from({
cdpApiKeyName: process.env.CDP_API_KEY_NAME,
cdpApiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY,
walletProvider,
actionProviders: [cdp, erc721, pyth, wallet],
});
Expand Down