@coinbase/agentkit 0.2.2 → 0.2.3-nightly.20250221.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.d.ts +1 -1
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.js +9 -9
- package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +2 -2
- package/dist/action-providers/cdp/cdpWalletActionProvider.js +2 -2
- package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +8 -0
- package/dist/action-providers/erc20/erc20ActionProvider.d.ts +2 -2
- package/dist/action-providers/erc20/erc20ActionProvider.js +2 -2
- package/dist/action-providers/erc20/erc20ActionProvider.test.js +8 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +2 -2
- package/dist/action-providers/farcaster/farcasterActionProvider.js +2 -2
- package/dist/action-providers/farcaster/farcasterActionProvider.test.js +8 -0
- package/dist/agentkit.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -588,7 +588,7 @@ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
|
|
|
588
588
|
|
|
589
589
|
Privy offers the option to use authorization keys to secure your server wallets.
|
|
590
590
|
|
|
591
|
-
You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account)
|
|
591
|
+
You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account).
|
|
592
592
|
|
|
593
593
|
When using authorization keys, you must provide the `authorizationPrivateKey` and `authorizationKeyId` parameters to the `configureWithWallet` method if you are creating a new wallet. Please note that when creating a key, if you enable "Create and modify wallets", you will be required to use that key when creating new wallets via the PrivyWalletProvider.
|
|
594
594
|
|
|
@@ -701,7 +701,7 @@ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
|
|
|
701
701
|
|
|
702
702
|
Privy offers the option to use authorization keys to secure your server wallets.
|
|
703
703
|
|
|
704
|
-
You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account)
|
|
704
|
+
You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account).
|
|
705
705
|
|
|
706
706
|
When using authorization keys, you must provide the `authorizationPrivateKey` and `authorizationKeyId` parameters to the `configureWithWallet` method if you are creating a new wallet. Please note that when creating a key, if you enable "Create and modify wallets", you will be required to use that key when creating new wallets via the PrivyWalletProvider.
|
|
707
707
|
|
|
@@ -44,7 +44,7 @@ export declare class AlchemyTokenPricesActionProvider extends ActionProvider {
|
|
|
44
44
|
*
|
|
45
45
|
* @returns Always returns true.
|
|
46
46
|
*/
|
|
47
|
-
supportsNetwork()
|
|
47
|
+
supportsNetwork: () => boolean;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Factory function to create a new AlchemyTokenPricesActionProvider instance.
|
|
@@ -27,6 +27,15 @@ class AlchemyTokenPricesActionProvider extends actionProvider_1.ActionProvider {
|
|
|
27
27
|
*/
|
|
28
28
|
constructor(config = {}) {
|
|
29
29
|
super("alchemyTokenPrices", []);
|
|
30
|
+
/**
|
|
31
|
+
* Checks if the Alchemy Prices action provider supports the given network.
|
|
32
|
+
* Since the API works with multiple networks, this always returns true.
|
|
33
|
+
*
|
|
34
|
+
* @returns Always returns true.
|
|
35
|
+
*/
|
|
36
|
+
this.supportsNetwork = () => {
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
30
39
|
config.apiKey || (config.apiKey = process.env.ALCHEMY_API_KEY);
|
|
31
40
|
if (!config.apiKey) {
|
|
32
41
|
throw new Error("ALCHEMY_API_KEY is not configured.");
|
|
@@ -91,15 +100,6 @@ class AlchemyTokenPricesActionProvider extends actionProvider_1.ActionProvider {
|
|
|
91
100
|
return `Error fetching token prices by address: ${error}`;
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Checks if the Alchemy Prices action provider supports the given network.
|
|
96
|
-
* Since the API works with multiple networks, this always returns true.
|
|
97
|
-
*
|
|
98
|
-
* @returns Always returns true.
|
|
99
|
-
*/
|
|
100
|
-
supportsNetwork() {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
103
|
}
|
|
104
104
|
exports.AlchemyTokenPricesActionProvider = AlchemyTokenPricesActionProvider;
|
|
105
105
|
__decorate([
|
|
@@ -50,9 +50,9 @@ export declare class CdpWalletActionProvider extends ActionProvider<CdpWalletPro
|
|
|
50
50
|
/**
|
|
51
51
|
* Checks if the Cdp action provider supports the given network.
|
|
52
52
|
*
|
|
53
|
-
* @param
|
|
53
|
+
* @param network - The network to check.
|
|
54
54
|
* @returns True if the Cdp action provider supports the network, false otherwise.
|
|
55
55
|
*/
|
|
56
|
-
supportsNetwork: (
|
|
56
|
+
supportsNetwork: (network: Network) => boolean;
|
|
57
57
|
}
|
|
58
58
|
export declare const cdpWalletActionProvider: (config?: CdpProviderConfig) => CdpWalletActionProvider;
|
|
@@ -33,10 +33,10 @@ class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
|
|
|
33
33
|
/**
|
|
34
34
|
* Checks if the Cdp action provider supports the given network.
|
|
35
35
|
*
|
|
36
|
-
* @param
|
|
36
|
+
* @param network - The network to check.
|
|
37
37
|
* @returns True if the Cdp action provider supports the network, false otherwise.
|
|
38
38
|
*/
|
|
39
|
-
this.supportsNetwork = (
|
|
39
|
+
this.supportsNetwork = (network) => network.protocolFamily === "evm";
|
|
40
40
|
if (config.apiKeyName && config.apiKeyPrivateKey) {
|
|
41
41
|
coinbase_sdk_1.Coinbase.configure({
|
|
42
42
|
apiKeyName: config.apiKeyName,
|
|
@@ -256,4 +256,12 @@ describe("CDP Wallet Action Provider", () => {
|
|
|
256
256
|
expect(result).toBe(`Error trading assets: ${error}`);
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
|
+
describe("supportsNetwork", () => {
|
|
260
|
+
it("should return true when protocolFamily is evm", () => {
|
|
261
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "evm" })).toBe(true);
|
|
262
|
+
});
|
|
263
|
+
it("should return false when protocolFamily is not evm", () => {
|
|
264
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "solana" })).toBe(false);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
259
267
|
});
|
|
@@ -30,9 +30,9 @@ export declare class ERC20ActionProvider extends ActionProvider<EvmWalletProvide
|
|
|
30
30
|
/**
|
|
31
31
|
* Checks if the ERC20 action provider supports the given network.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
33
|
+
* @param network - The network to check.
|
|
34
34
|
* @returns True if the ERC20 action provider supports the network, false otherwise.
|
|
35
35
|
*/
|
|
36
|
-
supportsNetwork: (
|
|
36
|
+
supportsNetwork: (network: Network) => boolean;
|
|
37
37
|
}
|
|
38
38
|
export declare const erc20ActionProvider: () => ERC20ActionProvider;
|
|
@@ -29,10 +29,10 @@ class ERC20ActionProvider extends actionProvider_1.ActionProvider {
|
|
|
29
29
|
/**
|
|
30
30
|
* Checks if the ERC20 action provider supports the given network.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
32
|
+
* @param network - The network to check.
|
|
33
33
|
* @returns True if the ERC20 action provider supports the network, false otherwise.
|
|
34
34
|
*/
|
|
35
|
-
this.supportsNetwork = (
|
|
35
|
+
this.supportsNetwork = (network) => network.protocolFamily === "evm";
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Gets the balance of an ERC20 token.
|
|
@@ -114,4 +114,12 @@ describe("Transfer Action", () => {
|
|
|
114
114
|
});
|
|
115
115
|
expect(response).toContain(`Error transferring the asset: ${error}`);
|
|
116
116
|
});
|
|
117
|
+
describe("supportsNetwork", () => {
|
|
118
|
+
it("should return true when protocolFamily is evm", () => {
|
|
119
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "evm" })).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
it("should return false when protocolFamily is not evm", () => {
|
|
122
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "solana" })).toBe(false);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
117
125
|
});
|
|
@@ -49,9 +49,9 @@ export declare class FarcasterActionProvider extends ActionProvider {
|
|
|
49
49
|
/**
|
|
50
50
|
* Checks if the Farcaster action provider supports the given network.
|
|
51
51
|
*
|
|
52
|
-
* @param
|
|
52
|
+
* @param network - The network to check.
|
|
53
53
|
* @returns True if the Farcaster action provider supports the network, false otherwise.
|
|
54
54
|
*/
|
|
55
|
-
supportsNetwork: (
|
|
55
|
+
supportsNetwork: (network: Network) => boolean;
|
|
56
56
|
}
|
|
57
57
|
export declare const farcasterActionProvider: (config?: FarcasterActionProviderConfig) => FarcasterActionProvider;
|
|
@@ -28,10 +28,10 @@ class FarcasterActionProvider extends actionProvider_1.ActionProvider {
|
|
|
28
28
|
/**
|
|
29
29
|
* Checks if the Farcaster action provider supports the given network.
|
|
30
30
|
*
|
|
31
|
-
* @param
|
|
31
|
+
* @param network - The network to check.
|
|
32
32
|
* @returns True if the Farcaster action provider supports the network, false otherwise.
|
|
33
33
|
*/
|
|
34
|
-
this.supportsNetwork = (
|
|
34
|
+
this.supportsNetwork = (network) => network.protocolFamily === "evm";
|
|
35
35
|
const neynarApiKey = config.neynarApiKey || process.env.NEYNAR_API_KEY;
|
|
36
36
|
const signerUuid = config.signerUuid || process.env.NEYNAR_MANAGER_SIGNER;
|
|
37
37
|
const agentFid = config.agentFid || process.env.AGENT_FID;
|
|
@@ -140,4 +140,12 @@ describe("Farcaster Action Provider", () => {
|
|
|
140
140
|
process.env = originalEnv;
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
|
+
describe("supportsNetwork", () => {
|
|
144
|
+
it("should return true when protocolFamily is evm", () => {
|
|
145
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "evm" })).toBe(true);
|
|
146
|
+
});
|
|
147
|
+
it("should return false when protocolFamily is not evm", () => {
|
|
148
|
+
expect(actionProvider.supportsNetwork({ protocolFamily: "solana" })).toBe(false);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
143
151
|
});
|
package/dist/agentkit.js
CHANGED
|
@@ -49,10 +49,18 @@ class AgentKit {
|
|
|
49
49
|
*/
|
|
50
50
|
getActions() {
|
|
51
51
|
const actions = [];
|
|
52
|
+
const unsupported = [];
|
|
52
53
|
for (const actionProvider of this.actionProviders) {
|
|
53
54
|
if (actionProvider.supportsNetwork(this.walletProvider.getNetwork())) {
|
|
54
55
|
actions.push(...actionProvider.getActions(this.walletProvider));
|
|
55
56
|
}
|
|
57
|
+
else {
|
|
58
|
+
unsupported.push(actionProvider.name);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (unsupported.length > 0) {
|
|
62
|
+
console.log(`Warning: The following action providers are not supported on the current network and will be unavailable: ${unsupported.join(", ")}`);
|
|
63
|
+
console.log("Current network:", this.walletProvider.getNetwork());
|
|
56
64
|
}
|
|
57
65
|
return actions;
|
|
58
66
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@coinbase/agentkit",
|
|
3
3
|
"description": "Coinbase AgentKit core primitives",
|
|
4
4
|
"repository": "https://github.com/coinbase/agentkit",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.3-nightly.20250221.0",
|
|
6
6
|
"author": "Coinbase Inc.",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "dist/index.js",
|