Skip to content
Draft
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
5 changes: 5 additions & 0 deletions typescript/.changeset/upset-parrots-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@coinbase/agentkit": patch
---

Added erc8004 action providers
7 changes: 4 additions & 3 deletions typescript/agentkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@
"@solana/spl-token": "^0.4.12",
"@solana/web3.js": "^1.98.1",
"@vaultsfyi/sdk": "^2.1.9",
"@x402/evm": "^2.2.0",
"@x402/fetch": "^2.2.0",
"@x402/svm": "^2.2.0",
"@x402/evm": "2.2.0",
"@x402/fetch": "2.2.0",
"@x402/svm": "2.2.0",
"@zerodev/ecdsa-validator": "^5.4.5",
"@zerodev/intent": "^0.0.24",
"@zerodev/sdk": "^5.4.28",
"@zoralabs/coins-sdk": "0.2.8",
"@zoralabs/protocol-deployments": "0.6.1",
"agent0-sdk": "^1.5.3",
"bs58": "^4.0.1",
"canonicalize": "^2.1.0",
"clanker-sdk": "^4.1.18",
Expand Down
47 changes: 47 additions & 0 deletions typescript/agentkit/src/action-providers/erc8004/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { NETWORK_ID_TO_CHAIN_ID, Network } from "../../network";

// Supported network IDs for ERC-8004 - must match agent0 SDK (contracts.ts DEFAULT_REGISTRIES)
export const SUPPORTED_NETWORK_IDS = [
"ethereum-mainnet", // 1
"ethereum-sepolia", // 11155111
"base-mainnet", // 8453
"base-sepolia", // 84532
"polygon-mainnet", // 137
] as const;

export type SupportedNetworkId = (typeof SUPPORTED_NETWORK_IDS)[number];

/**
* Gets the chain ID from a network object
*
* @param network - The network object
* @returns The chain ID as a number
* @throws Error if network is not supported
*/
export function getChainIdFromNetwork(network: Network): number {
const networkId = network.networkId;
if (!networkId) {
throw new Error("Network ID is not defined");
}

const chainIdStr = NETWORK_ID_TO_CHAIN_ID[networkId];
if (!chainIdStr) {
throw new Error(
`Network ${networkId} is not supported. Supported networks: ${SUPPORTED_NETWORK_IDS.join(", ")}`,
);
}

return parseInt(chainIdStr, 10);
}

/**
* Checks if a network is supported for ERC-8004
*
* @param network - The network to check
* @returns True if the network is supported
*/
export function isNetworkSupported(network: Network): boolean {
const networkId = network.networkId;
if (!networkId) return false;
return SUPPORTED_NETWORK_IDS.includes(networkId as SupportedNetworkId);
}
Loading
Loading