coinbase / coinbase/agentkit

Failed to initialize wallet: APIError{}

Open
#727 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
815
Avg merge
13h 31m
Merged PRs (30d)
2

Description

### Language Affected

- [ ] Python
- [x] TypeScript

### 🐛 Describe the bug

static async configureWithWallet(config = {}) {
const agentkit = new CdpAgentkit(config);
const mnemonicPhrase = config.mnemonicPhrase || process.env.MNEMONIC_PHRASE;
const networkId = config.networkId || process.env.NETWORK_ID || coinbase_sdk_1.Coinbase.networks.BaseSepolia;
try {
if (config.cdpWalletData) {
const walletData = JSON.parse(config.cdpWalletData);
agentkit.wallet = await coinbase_sdk_1.Wallet.import(walletData);
}
else if (mnemonicPhrase) {
agentkit.wallet = await coinbase_sdk_1.Wallet.import({ mnemonicPhrase: mnemonicPhrase });
}
else {
agentkit.wallet = await coinbase_sdk_1.Wallet.create({ networkId: networkId });
}
}
catch (error) {
**throw new Error(`Failed to initialize wallet: ${error}`);**
}
return agentkit;
}

my run commond:
npm run start:mentions,error info
npm run test,its ok!

I’ve confirmed that all the parameters are correct. I referred to YouTube and code examples — the test runs fine, but there’s an issue when executing the agent. It throws an exception saying the wallet failed to initialize!

### Versions

I’ve confirmed that all the parameters are correct. I referred to YouTube and code examples — the test runs fine, but there’s an issue when executing the agent. It throws an exception saying the wallet failed to initialize!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.