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: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@missionsquad/agentindex-api",
"version": "1.5.4",
"version": "1.5.5",
"description": "AgentIndex blockchain scanner API",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -27,7 +27,8 @@
},
"dependencies": {
"@helia/verified-fetch": "^7.0.0",
"@missionsquad/x402-proxy": "^0.1.0",
"@missionsquad/x402-proxy": "^0.1.1",
"@x402/paywall": "2.4.0",
"cors": "^2.8.5",
"dotenv": "^16.4.7",
"evmdecoder": "^0.0.71",
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import express from 'express'
import cors from 'cors'
import { createX402ProxySdk } from '@missionsquad/x402-proxy'
import { createPaywall, evmPaywall } from '@x402/paywall'
import { WebSocketServer, WebSocket } from 'ws'
import { env } from './env'
import { log } from './utils/logger'
Expand Down Expand Up @@ -141,6 +142,12 @@ if (x402App) {
},
syncFacilitatorOnStart: env.X402_SYNC_FACILITATOR_ON_START,
endpoints: buildSearchX402Endpoints(env.X402_UPSTREAM_ORIGIN),
// Full wallet-connect payment UI for browsers hitting protected endpoints
// (connect wallet, pay in USDC, auto-retry with the payment header). Without
// a provider, @x402/core serves its bare "Payment Required" fallback page.
// testnet mode is derived from defaultNetwork by x402-proxy.
paywall: createPaywall().withNetwork(evmPaywall).build(),
paywallConfig: { appName: 'AgentIndex' },
})

x402.install(x402App)
Expand Down
38 changes: 38 additions & 0 deletions src/types/x402-paywall.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Minimal ambient types for @x402/paywall (pinned to 2.4.0).
*
* The package publishes its type declarations only through the package.json
* `exports` map, which this project's `moduleResolution: "node"` cannot read.
* Node itself resolves the runtime require() through `exports` without issue,
* so only the compiler needs this shim. Keep in sync with the pinned version's
* public API (createPaywall builder + network handlers).
*/
declare module '@x402/paywall' {
/** Network-specific paywall handler (opaque — pass to withNetwork). */
export interface PaywallNetworkHandler {
[key: string]: unknown
}

export interface PaywallConfig {
appName?: string
appLogo?: string
currentUrl?: string
testnet?: boolean
}

/** Matches @x402/core's PaywallProvider structurally. */
export interface PaywallProvider {
generateHtml(paymentRequired: unknown, config?: unknown): string
}

export class PaywallBuilder {
withNetwork(handler: PaywallNetworkHandler): this
withConfig(config: PaywallConfig): this
build(): PaywallProvider
}

export function createPaywall(): PaywallBuilder

export const evmPaywall: PaywallNetworkHandler
export const svmPaywall: PaywallNetworkHandler
}
Loading
Loading