Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat: add type definitions for x402 and x402-express modules

Ademílson Tonato1cf70edd6a68
diff --git a/apps/api/src/types/x402.d.ts b/apps/api/src/types/x402.d.ts
new file mode 100644
index 000000000..06fd1df95
--- /dev/null
+++ b/apps/api/src/types/x402.d.ts
@@ -0,0 +1,34 @@
+declare module 'x402' {
+ export * from 'x402/dist/cjs/types/index';
+}
+
+declare module 'x402/dist/cjs/types/index' {
+ // Type definitions
+ export interface ChainConfig {
+ [key: string]: any;
+ }
+
+ export interface ConnectedClient {
+ [key: string]: any;
+ }
+
+ export interface SignerWallet {
+ [key: string]: any;
+ }
+
+ // Value exports (constants)
+ export const index_ChainConfig: any;
+ export const index_ConnectedClient: any;
+ export const index_SignerWallet: any;
+
+ // Re-export everything else that might be in the module
+ const _default: any;
+ export default _default;
+}
+
+declare module 'x402-express' {
+ export function paymentMiddleware(...args: any[]): any;
+
+ // Export any other functions or types that might be used
+ export * from 'x402-express';
+}
\ No newline at end of file
diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json
index e220e2132..0bdf4200c 100644
--- a/apps/api/tsconfig.json
+++ b/apps/api/tsconfig.json
@@ -14,7 +14,14 @@
"baseUrl": ".",
"strictNullChecks": true,
- "inlineSources": true
+ "inlineSources": true,
+
+ "typeRoots": ["./src/types", "./node_modules/@types"],
+ "paths": {
+ "x402": ["./src/types/x402"],
+ "x402/*": ["./src/types/x402"],
+ "x402-express": ["./src/types/x402"]
+ }
},
"include": [
"src/",
@@ -23,6 +30,7 @@
"utils/utils.ts",
"services/db/supabaseEmbeddings.ts",
"utils/EventEmmitter.ts",
- "src/services/queue-service.ts"
+ "src/services/queue-service.ts",
+ "src/types/x402.d.ts"
]
}