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

Bumped x402 packages and fix missing readContract interface
6 changes: 3 additions & 3 deletions typescript/agentkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@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.4.0",
"@x402/fetch": "^2.4.0",
"@x402/svm": "^2.4.0",
"@zerodev/ecdsa-validator": "^5.4.5",
"@zerodev/intent": "^0.0.24",
"@zerodev/sdk": "^5.4.28",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as utils from "./utils";

// Mock external modules
jest.mock("@x402/fetch");
jest.mock("@x402/evm");
jest.mock("@x402/evm/exact/client");
jest.mock("@x402/svm/exact/client");
jest.mock("./utils");
Expand Down Expand Up @@ -76,6 +77,7 @@ global.fetch = mockFetch;
const makeMockWalletProvider = (networkId: string) => {
const mockProvider = Object.create(EvmWalletProvider.prototype);
mockProvider.toSigner = jest.fn().mockReturnValue("mock-signer");
mockProvider.getPublicClient = jest.fn().mockReturnValue("mock-public-client");
mockProvider.getNetwork = jest.fn().mockReturnValue({ protocolFamily: "evm", networkId });
return mockProvider as EvmWalletProvider;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "./schemas";
import { EvmWalletProvider, WalletProvider, SvmWalletProvider } from "../../wallet-providers";
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { toClientEvmSigner } from "@x402/evm";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
import {
Expand Down Expand Up @@ -88,8 +89,6 @@ export class X402ActionProvider extends ActionProvider<WalletProvider> {
args: z.infer<typeof ListX402ServicesSchema>,
): Promise<string> {
try {
console.log("args", args);

// Validate facilitator is allowed (known name or registered name)
const { isAllowed, resolvedUrl } = validateFacilitator(
args.facilitator,
Expand Down Expand Up @@ -382,8 +381,6 @@ DO NOT use this action directly without first trying make_http_request!`,
args: z.infer<typeof RetryWithX402Schema>,
): Promise<string> {
try {
console.log("args", args);

// Check if service is registered
if (!isUrlAllowed(args.url, this.registeredServices)) {
return JSON.stringify(
Expand Down Expand Up @@ -849,7 +846,7 @@ These are the only services that can be called using make_http_request or make_h
const client = new x402Client();

if (walletProvider instanceof EvmWalletProvider) {
const signer = walletProvider.toSigner();
const signer = toClientEvmSigner(walletProvider.toSigner(), walletProvider.getPublicClient());
registerExactEvmScheme(client, { signer });
} else if (walletProvider instanceof SvmWalletProvider) {
const signer = await walletProvider.toSigner();
Expand Down
4 changes: 1 addition & 3 deletions typescript/examples/langchain-cdp-chatbot/chatbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ async function initializeAgent() {
registeredServices: networkId === "base-sepolia" ? ["https://www.x402.org/protected"] : [], // add approved x402 services
allowDynamicServiceRegistration: false, // set to true to allow registering services discovered through facilitators bazaar
maxPaymentUsdc: 1.0, // maximum payment per request in USDC
registeredFacilitators: {
"my-custom-facilitator": "https://my-custom-facilitator.example.com",
}, // add custom facilitators for discovery (CDP and PayAI are pre-registered), format: { "name": "https://url" }
registeredFacilitators: {}, // add custom facilitators for discovery (CDP and PayAI are pre-registered), format: { "name": "https://url" }
};

// action providers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ async function initializeAgent() {
networkId === "base-sepolia" ? ["https://www.x402.org/protected"] : [], // add approved x402 services
allowDynamicServiceRegistration: false, // set to true to allow registering services discovered through facilitators bazaar
maxPaymentUsdc: 1.0, // maximum payment per request in USDC
registeredFacilitators: {
"my-custom-facilitator": "https://my-custom-facilitator.example.com",
}, // add custom facilitators for discovery (CDP and PayAI are pre-registered), format: { "name": "https://url" }
registeredFacilitators: {}, // add custom facilitators for discovery (CDP and PayAI are pre-registered), format: { "name": "https://url" }
}),
],
});
Expand Down
Loading
Loading