@hpp-io/x402-mcp-bridge 0.0.2 → 0.1.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.
Files changed (82) hide show
  1. package/README.md +146 -123
  2. package/bin/hpp-x402.js +5 -0
  3. package/dist/a2a.d.ts +2 -2
  4. package/dist/a2a.js +14 -6
  5. package/dist/a2a.js.map +1 -1
  6. package/dist/autoTopup.d.ts +4 -1
  7. package/dist/autoTopup.js +4 -0
  8. package/dist/autoTopup.js.map +1 -1
  9. package/dist/cli/channel.d.ts +1 -1
  10. package/dist/cli/channel.js +1 -8
  11. package/dist/cli/channel.js.map +1 -1
  12. package/dist/cli/hpp-x402.d.ts +2 -0
  13. package/dist/cli/hpp-x402.js +377 -0
  14. package/dist/cli/hpp-x402.js.map +1 -0
  15. package/dist/cli/install-claude-code.d.ts +24 -0
  16. package/dist/cli/install-claude-code.js +50 -0
  17. package/dist/cli/install-claude-code.js.map +1 -0
  18. package/dist/cli/install-cursor.d.ts +7 -0
  19. package/dist/cli/install-cursor.js +26 -0
  20. package/dist/cli/install-cursor.js.map +1 -0
  21. package/dist/cli/install-mcp-host.d.ts +2 -2
  22. package/dist/cli/install-mcp-host.js.map +1 -1
  23. package/dist/cli/install-windsurf.d.ts +7 -0
  24. package/dist/cli/install-windsurf.js +37 -0
  25. package/dist/cli/install-windsurf.js.map +1 -0
  26. package/dist/cli/policy.d.ts +1 -1
  27. package/dist/cli/policy.js +1 -8
  28. package/dist/cli/policy.js.map +1 -1
  29. package/dist/cli/revoke.d.ts +1 -1
  30. package/dist/cli/revoke.js +1 -5
  31. package/dist/cli/revoke.js.map +1 -1
  32. package/dist/cli/safe.d.ts +62 -62
  33. package/dist/cli/serve.d.ts +1 -0
  34. package/dist/cli/serve.js +128 -0
  35. package/dist/cli/serve.js.map +1 -0
  36. package/dist/cli/setup.d.ts +1 -1
  37. package/dist/cli/setup.js +1 -5
  38. package/dist/cli/setup.js.map +1 -1
  39. package/dist/client.d.ts +6 -2
  40. package/dist/client.js +34 -15
  41. package/dist/client.js.map +1 -1
  42. package/dist/config.d.ts +71 -15
  43. package/dist/config.js +66 -10
  44. package/dist/config.js.map +1 -1
  45. package/dist/discovery.d.ts +43 -0
  46. package/dist/discovery.js +62 -0
  47. package/dist/discovery.js.map +1 -0
  48. package/dist/discoveryTools.d.ts +75 -0
  49. package/dist/discoveryTools.js +101 -0
  50. package/dist/discoveryTools.js.map +1 -0
  51. package/dist/funds/direct-balance.d.ts +28 -0
  52. package/dist/funds/direct-balance.js +61 -0
  53. package/dist/funds/direct-balance.js.map +1 -0
  54. package/dist/funds.d.ts +32 -0
  55. package/dist/funds.js +2 -0
  56. package/dist/funds.js.map +1 -0
  57. package/dist/httpX402.d.ts +8 -2
  58. package/dist/httpX402.js +26 -13
  59. package/dist/httpX402.js.map +1 -1
  60. package/dist/index.js +66 -11
  61. package/dist/index.js.map +1 -1
  62. package/dist/sellerTools.d.ts +247 -0
  63. package/dist/sellerTools.js +202 -0
  64. package/dist/sellerTools.js.map +1 -0
  65. package/dist/server.d.ts +8 -2
  66. package/dist/server.js +165 -64
  67. package/dist/server.js.map +1 -1
  68. package/dist/spendGuard.d.ts +24 -0
  69. package/dist/spendGuard.js +124 -0
  70. package/dist/spendGuard.js.map +1 -0
  71. package/package.json +13 -12
  72. package/bin/hpp-x402-channel.js +0 -5
  73. package/bin/hpp-x402-keychain.js +0 -5
  74. package/bin/hpp-x402-policy.js +0 -5
  75. package/bin/hpp-x402-safe-revoke.js +0 -5
  76. package/bin/hpp-x402-safe-setup.js +0 -5
  77. package/dist/autoSettlePickup.d.ts +0 -69
  78. package/dist/autoSettlePickup.js +0 -150
  79. package/dist/autoSettlePickup.js.map +0 -1
  80. package/dist/cli/keychain.d.ts +0 -1
  81. package/dist/cli/keychain.js +0 -147
  82. package/dist/cli/keychain.js.map +0 -1
@@ -0,0 +1,247 @@
1
+ import type { Network } from "@x402/core/types";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ export interface SellerDeps {
4
+ /** Default network for create_requirements when the caller omits one. */
5
+ network: Network;
6
+ /** Facilitator base URL used by verify/settle. */
7
+ facilitatorUrl: string;
8
+ }
9
+ export declare const SELLER_CREATE_REQUIREMENTS_TOOL: {
10
+ readonly name: "seller_create_requirements";
11
+ readonly description: string;
12
+ readonly inputSchema: {
13
+ readonly type: "object";
14
+ readonly properties: {
15
+ readonly amount: {
16
+ readonly type: "string";
17
+ readonly description: "Price in atomic units (e.g. '10000' = 0.01 USDC.e).";
18
+ };
19
+ readonly payTo: {
20
+ readonly type: "string";
21
+ readonly description: "Your wallet address (receives payment).";
22
+ };
23
+ readonly asset: {
24
+ readonly type: "string";
25
+ readonly description: "Token address (USDC.e on HPP).";
26
+ };
27
+ readonly network: {
28
+ readonly type: "string";
29
+ readonly description: "CAIP-2 network; defaults to the bridge network.";
30
+ };
31
+ readonly scheme: {
32
+ readonly type: "string";
33
+ readonly enum: readonly ["exact", "upto", "batch-settlement"];
34
+ readonly description: "Payment scheme (default exact).";
35
+ };
36
+ readonly maxTimeoutSeconds: {
37
+ readonly type: "number";
38
+ readonly description: "Payment validity window (default 600).";
39
+ };
40
+ readonly extra: {
41
+ readonly type: "object";
42
+ readonly description: "Scheme-specific extras (EIP-712 domain, Permit2 proxy, channel info).";
43
+ };
44
+ };
45
+ readonly required: readonly ["amount", "payTo", "asset"];
46
+ readonly additionalProperties: false;
47
+ };
48
+ };
49
+ export declare const SELLER_GENERATE_402_TOOL: {
50
+ readonly name: "seller_generate_402";
51
+ readonly description: string;
52
+ readonly inputSchema: {
53
+ readonly type: "object";
54
+ readonly properties: {
55
+ readonly accepts: {
56
+ readonly type: "array";
57
+ readonly description: "PaymentRequirements[] the buyer may choose from.";
58
+ readonly items: {
59
+ readonly type: "object";
60
+ };
61
+ };
62
+ readonly resource: {
63
+ readonly type: "string";
64
+ readonly description: "The resource URL being protected.";
65
+ };
66
+ readonly error: {
67
+ readonly type: "string";
68
+ readonly description: "Optional human-readable reason.";
69
+ };
70
+ };
71
+ readonly required: readonly ["accepts"];
72
+ readonly additionalProperties: false;
73
+ };
74
+ };
75
+ export declare const SELLER_DECODE_PAYMENT_TOOL: {
76
+ readonly name: "seller_decode_payment";
77
+ readonly description: string;
78
+ readonly inputSchema: {
79
+ readonly type: "object";
80
+ readonly properties: {
81
+ readonly paymentHeader: {
82
+ readonly type: "string";
83
+ readonly description: "The base64 X-PAYMENT header value.";
84
+ };
85
+ };
86
+ readonly required: readonly ["paymentHeader"];
87
+ readonly additionalProperties: false;
88
+ };
89
+ };
90
+ export declare const SELLER_VERIFY_TOOL: {
91
+ readonly name: "seller_verify";
92
+ readonly description: string;
93
+ readonly inputSchema: {
94
+ readonly type: "object";
95
+ readonly properties: {
96
+ readonly paymentHeader: {
97
+ readonly type: "string";
98
+ readonly description: "The base64 X-PAYMENT header.";
99
+ };
100
+ readonly paymentRequirements: {
101
+ readonly type: "object";
102
+ readonly description: "The requirements you advertised for this resource.";
103
+ };
104
+ };
105
+ readonly required: readonly ["paymentHeader", "paymentRequirements"];
106
+ readonly additionalProperties: false;
107
+ };
108
+ };
109
+ export declare const SELLER_SETTLE_TOOL: {
110
+ readonly name: "seller_settle";
111
+ readonly description: string;
112
+ readonly inputSchema: {
113
+ readonly type: "object";
114
+ readonly properties: {
115
+ readonly paymentHeader: {
116
+ readonly type: "string";
117
+ readonly description: "The base64 X-PAYMENT header.";
118
+ };
119
+ readonly paymentRequirements: {
120
+ readonly type: "object";
121
+ readonly description: "The requirements you advertised for this resource.";
122
+ };
123
+ };
124
+ readonly required: readonly ["paymentHeader", "paymentRequirements"];
125
+ readonly additionalProperties: false;
126
+ };
127
+ };
128
+ export declare const SELLER_TOOLS: readonly [{
129
+ readonly name: "seller_create_requirements";
130
+ readonly description: string;
131
+ readonly inputSchema: {
132
+ readonly type: "object";
133
+ readonly properties: {
134
+ readonly amount: {
135
+ readonly type: "string";
136
+ readonly description: "Price in atomic units (e.g. '10000' = 0.01 USDC.e).";
137
+ };
138
+ readonly payTo: {
139
+ readonly type: "string";
140
+ readonly description: "Your wallet address (receives payment).";
141
+ };
142
+ readonly asset: {
143
+ readonly type: "string";
144
+ readonly description: "Token address (USDC.e on HPP).";
145
+ };
146
+ readonly network: {
147
+ readonly type: "string";
148
+ readonly description: "CAIP-2 network; defaults to the bridge network.";
149
+ };
150
+ readonly scheme: {
151
+ readonly type: "string";
152
+ readonly enum: readonly ["exact", "upto", "batch-settlement"];
153
+ readonly description: "Payment scheme (default exact).";
154
+ };
155
+ readonly maxTimeoutSeconds: {
156
+ readonly type: "number";
157
+ readonly description: "Payment validity window (default 600).";
158
+ };
159
+ readonly extra: {
160
+ readonly type: "object";
161
+ readonly description: "Scheme-specific extras (EIP-712 domain, Permit2 proxy, channel info).";
162
+ };
163
+ };
164
+ readonly required: readonly ["amount", "payTo", "asset"];
165
+ readonly additionalProperties: false;
166
+ };
167
+ }, {
168
+ readonly name: "seller_generate_402";
169
+ readonly description: string;
170
+ readonly inputSchema: {
171
+ readonly type: "object";
172
+ readonly properties: {
173
+ readonly accepts: {
174
+ readonly type: "array";
175
+ readonly description: "PaymentRequirements[] the buyer may choose from.";
176
+ readonly items: {
177
+ readonly type: "object";
178
+ };
179
+ };
180
+ readonly resource: {
181
+ readonly type: "string";
182
+ readonly description: "The resource URL being protected.";
183
+ };
184
+ readonly error: {
185
+ readonly type: "string";
186
+ readonly description: "Optional human-readable reason.";
187
+ };
188
+ };
189
+ readonly required: readonly ["accepts"];
190
+ readonly additionalProperties: false;
191
+ };
192
+ }, {
193
+ readonly name: "seller_decode_payment";
194
+ readonly description: string;
195
+ readonly inputSchema: {
196
+ readonly type: "object";
197
+ readonly properties: {
198
+ readonly paymentHeader: {
199
+ readonly type: "string";
200
+ readonly description: "The base64 X-PAYMENT header value.";
201
+ };
202
+ };
203
+ readonly required: readonly ["paymentHeader"];
204
+ readonly additionalProperties: false;
205
+ };
206
+ }, {
207
+ readonly name: "seller_verify";
208
+ readonly description: string;
209
+ readonly inputSchema: {
210
+ readonly type: "object";
211
+ readonly properties: {
212
+ readonly paymentHeader: {
213
+ readonly type: "string";
214
+ readonly description: "The base64 X-PAYMENT header.";
215
+ };
216
+ readonly paymentRequirements: {
217
+ readonly type: "object";
218
+ readonly description: "The requirements you advertised for this resource.";
219
+ };
220
+ };
221
+ readonly required: readonly ["paymentHeader", "paymentRequirements"];
222
+ readonly additionalProperties: false;
223
+ };
224
+ }, {
225
+ readonly name: "seller_settle";
226
+ readonly description: string;
227
+ readonly inputSchema: {
228
+ readonly type: "object";
229
+ readonly properties: {
230
+ readonly paymentHeader: {
231
+ readonly type: "string";
232
+ readonly description: "The base64 X-PAYMENT header.";
233
+ };
234
+ readonly paymentRequirements: {
235
+ readonly type: "object";
236
+ readonly description: "The requirements you advertised for this resource.";
237
+ };
238
+ };
239
+ readonly required: readonly ["paymentHeader", "paymentRequirements"];
240
+ readonly additionalProperties: false;
241
+ };
242
+ }];
243
+ export declare function sellerCreateRequirements(deps: SellerDeps, a: Record<string, unknown>): CallToolResult;
244
+ export declare function sellerGenerate402(a: Record<string, unknown>): CallToolResult;
245
+ export declare function sellerDecodePayment(a: Record<string, unknown>): CallToolResult;
246
+ export declare function sellerVerify(deps: SellerDeps, a: Record<string, unknown>): Promise<CallToolResult>;
247
+ export declare function sellerSettle(deps: SellerDeps, a: Record<string, unknown>): Promise<CallToolResult>;
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Seller building-block tools (A2 Phase 1) — let an agent that already receives
3
+ * requests (its own HTTP/A2A server) charge for them over x402.
4
+ *
5
+ * Five stateless tools mirroring Polygon's seller set, but covering all three
6
+ * HPP schemes (exact / upto / batch-settlement), not just exact:
7
+ * - seller_create_requirements build a PaymentRequirements (local)
8
+ * - seller_generate_402 build the HTTP 402 body from accepts[] (local)
9
+ * - seller_decode_payment decode the X-PAYMENT header + payer (local)
10
+ * - seller_verify facilitator /verify (does the buyer's sig hold?)
11
+ * - seller_settle facilitator /settle (move the funds on-chain)
12
+ *
13
+ * verify/settle are thin wrappers over the same HTTPFacilitatorClient the
14
+ * resource server uses; the tools never hold funds or keys. The agent's own
15
+ * server orchestrates: 402 → decode → verify → do the work → settle.
16
+ */
17
+ import { HTTPFacilitatorClient } from "@x402/core/server";
18
+ import { log } from "./log.js";
19
+ function decodeHeader(header) {
20
+ try {
21
+ const json = Buffer.from(header, "base64").toString("utf-8");
22
+ const parsed = JSON.parse(json);
23
+ if (!parsed || !parsed.payload)
24
+ return null;
25
+ const payer = parsed.payload.authorization?.from ??
26
+ parsed.payload.channelConfig?.payer ??
27
+ parsed.payload.permit2Authorization?.from ??
28
+ null;
29
+ return { payload: parsed, payer };
30
+ }
31
+ catch {
32
+ return null;
33
+ }
34
+ }
35
+ function ok(obj) {
36
+ return { content: [{ type: "text", text: JSON.stringify(obj) }] };
37
+ }
38
+ function err(text) {
39
+ return { content: [{ type: "text", text }], isError: true };
40
+ }
41
+ // ── tool defs ───────────────────────────────────────────────────────────
42
+ export const SELLER_CREATE_REQUIREMENTS_TOOL = {
43
+ name: "seller_create_requirements",
44
+ description: "Build an x402 PaymentRequirements object for a resource you sell. Returns " +
45
+ "the requirements to advertise in a 402 (see seller_generate_402). Scheme " +
46
+ "defaults to 'exact'; use 'upto' or 'batch-settlement' with scheme-specific " +
47
+ "fields in `extra`.",
48
+ inputSchema: {
49
+ type: "object",
50
+ properties: {
51
+ amount: { type: "string", description: "Price in atomic units (e.g. '10000' = 0.01 USDC.e)." },
52
+ payTo: { type: "string", description: "Your wallet address (receives payment)." },
53
+ asset: { type: "string", description: "Token address (USDC.e on HPP)." },
54
+ network: { type: "string", description: "CAIP-2 network; defaults to the bridge network." },
55
+ scheme: { type: "string", enum: ["exact", "upto", "batch-settlement"], description: "Payment scheme (default exact)." },
56
+ maxTimeoutSeconds: { type: "number", description: "Payment validity window (default 600)." },
57
+ extra: { type: "object", description: "Scheme-specific extras (EIP-712 domain, Permit2 proxy, channel info)." },
58
+ },
59
+ required: ["amount", "payTo", "asset"],
60
+ additionalProperties: false,
61
+ },
62
+ };
63
+ export const SELLER_GENERATE_402_TOOL = {
64
+ name: "seller_generate_402",
65
+ description: "Build the HTTP 402 Payment Required response body from one or more " +
66
+ "PaymentRequirements (from seller_create_requirements). Return this when a " +
67
+ "request arrives with no payment header.",
68
+ inputSchema: {
69
+ type: "object",
70
+ properties: {
71
+ accepts: { type: "array", description: "PaymentRequirements[] the buyer may choose from.", items: { type: "object" } },
72
+ resource: { type: "string", description: "The resource URL being protected." },
73
+ error: { type: "string", description: "Optional human-readable reason." },
74
+ },
75
+ required: ["accepts"],
76
+ additionalProperties: false,
77
+ },
78
+ };
79
+ export const SELLER_DECODE_PAYMENT_TOOL = {
80
+ name: "seller_decode_payment",
81
+ description: "Decode a buyer's base64 X-PAYMENT / Payment-Signature header locally (no " +
82
+ "facilitator call) to inspect the payload and extract the payer address. " +
83
+ "Supports exact / upto / batch-settlement.",
84
+ inputSchema: {
85
+ type: "object",
86
+ properties: { paymentHeader: { type: "string", description: "The base64 X-PAYMENT header value." } },
87
+ required: ["paymentHeader"],
88
+ additionalProperties: false,
89
+ },
90
+ };
91
+ export const SELLER_VERIFY_TOOL = {
92
+ name: "seller_verify",
93
+ description: "Verify a buyer's payment against the facilitator BEFORE doing the work. " +
94
+ "Pass the X-PAYMENT header + the PaymentRequirements you advertised. Returns " +
95
+ "{ isValid, payer, invalidReason }.",
96
+ inputSchema: {
97
+ type: "object",
98
+ properties: {
99
+ paymentHeader: { type: "string", description: "The base64 X-PAYMENT header." },
100
+ paymentRequirements: { type: "object", description: "The requirements you advertised for this resource." },
101
+ },
102
+ required: ["paymentHeader", "paymentRequirements"],
103
+ additionalProperties: false,
104
+ },
105
+ };
106
+ export const SELLER_SETTLE_TOOL = {
107
+ name: "seller_settle",
108
+ description: "Settle a verified payment on-chain AFTER the work succeeded (serve-then-" +
109
+ "settle). Pass the same X-PAYMENT header + PaymentRequirements. Returns " +
110
+ "{ success, transaction }.",
111
+ inputSchema: {
112
+ type: "object",
113
+ properties: {
114
+ paymentHeader: { type: "string", description: "The base64 X-PAYMENT header." },
115
+ paymentRequirements: { type: "object", description: "The requirements you advertised for this resource." },
116
+ },
117
+ required: ["paymentHeader", "paymentRequirements"],
118
+ additionalProperties: false,
119
+ },
120
+ };
121
+ export const SELLER_TOOLS = [
122
+ SELLER_CREATE_REQUIREMENTS_TOOL,
123
+ SELLER_GENERATE_402_TOOL,
124
+ SELLER_DECODE_PAYMENT_TOOL,
125
+ SELLER_VERIFY_TOOL,
126
+ SELLER_SETTLE_TOOL,
127
+ ];
128
+ // ── handlers ──────────────────────────────────────────────────────────────
129
+ export function sellerCreateRequirements(deps, a) {
130
+ if (!a.amount || !a.payTo || !a.asset)
131
+ return err("amount, payTo, asset are required");
132
+ const req = {
133
+ scheme: a.scheme ?? "exact",
134
+ network: (a.network ?? deps.network),
135
+ asset: a.asset,
136
+ amount: String(a.amount),
137
+ payTo: a.payTo,
138
+ maxTimeoutSeconds: a.maxTimeoutSeconds ?? 600,
139
+ extra: a.extra ?? {},
140
+ };
141
+ return ok({ requirements: req });
142
+ }
143
+ export function sellerGenerate402(a) {
144
+ const accepts = a.accepts;
145
+ if (!Array.isArray(accepts) || accepts.length === 0)
146
+ return err("accepts[] required");
147
+ const body = {
148
+ x402Version: 2,
149
+ error: a.error ?? "payment required",
150
+ ...(a.resource ? { resource: a.resource } : {}),
151
+ accepts,
152
+ };
153
+ return ok({
154
+ response: { statusCode: 402, headers: { "Content-Type": "application/json" }, body },
155
+ });
156
+ }
157
+ export function sellerDecodePayment(a) {
158
+ const header = a.paymentHeader;
159
+ if (!header || typeof header !== "string")
160
+ return err("paymentHeader required");
161
+ const decoded = decodeHeader(header);
162
+ if (!decoded)
163
+ return err("could not decode payment header (base64 JSON expected)");
164
+ return ok({ scheme: decoded.payload.scheme, payer: decoded.payer, payload: decoded.payload });
165
+ }
166
+ export async function sellerVerify(deps, a) {
167
+ const header = a.paymentHeader;
168
+ const requirements = a.paymentRequirements;
169
+ if (!header || !requirements)
170
+ return err("paymentHeader and paymentRequirements required");
171
+ const decoded = decodeHeader(header);
172
+ if (!decoded)
173
+ return err("could not decode payment header");
174
+ try {
175
+ const client = new HTTPFacilitatorClient({ url: deps.facilitatorUrl });
176
+ const res = await client.verify(decoded.payload, requirements);
177
+ log.info("seller_verify", { isValid: res.isValid, payer: res.payer });
178
+ return ok({ isValid: res.isValid, payer: res.payer, invalidReason: res.invalidReason });
179
+ }
180
+ catch (e) {
181
+ return err(`verify failed: ${e.message}`);
182
+ }
183
+ }
184
+ export async function sellerSettle(deps, a) {
185
+ const header = a.paymentHeader;
186
+ const requirements = a.paymentRequirements;
187
+ if (!header || !requirements)
188
+ return err("paymentHeader and paymentRequirements required");
189
+ const decoded = decodeHeader(header);
190
+ if (!decoded)
191
+ return err("could not decode payment header");
192
+ try {
193
+ const client = new HTTPFacilitatorClient({ url: deps.facilitatorUrl });
194
+ const res = await client.settle(decoded.payload, requirements);
195
+ log.info("seller_settle", { success: res.success, tx: res.transaction });
196
+ return ok({ success: res.success, transaction: res.transaction });
197
+ }
198
+ catch (e) {
199
+ return err(`settle failed: ${e.message}`);
200
+ }
201
+ }
202
+ //# sourceMappingURL=sellerTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sellerTools.js","sourceRoot":"","sources":["../src/sellerTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAoB/B,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC;QAClD,IAAI,CAAC,MAAM,IAAI,CAAC,MAA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AAE,CAAC,CAAC;IAC1F,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,kBAAmB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAgB,EAAE,CAA0B;IAC7E,MAAM,MAAM,GAAG,CAAC,CAAC,aAAuB,CAAC;IACzC,MAAM,YAAY,GAAG,CAAC,CAAC,mBAAsD,CAAC;IAC9E,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY;QAAE,OAAO,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC3F,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC5D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAoC,EAAE,YAAY,CAAC,CAAC;QAC5F,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,EAAG,GAAgC,CAAC,WAAW,EAAE,CAAC,CAAC;QACvG,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAG,GAAgC,CAAC,WAAW,EAAE,CAAC,CAAC;IAClG,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,kBAAmB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { UpstreamClient } from "./client.js";
2
+ import type { DiscoveryClient } from "./discovery.js";
3
+ import { type SellerDeps } from "./sellerTools.js";
2
4
  import type { RawEoaSigner } from "./signers/raw-eoa.js";
3
- import type { AutoTopup } from "./autoTopup.js";
5
+ import type { Funds } from "./funds.js";
4
6
  import type { Network } from "@x402/core/types";
5
7
  export interface BridgeServerOptions {
6
8
  /** Upstream resource server. Undefined = local-tools-only mode. */
@@ -10,7 +12,11 @@ export interface BridgeServerOptions {
10
12
  /** Delegate signer + network — used by the local `pay_a2a_agent` tool. */
11
13
  signer: RawEoaSigner;
12
14
  network: Network;
13
- autoTopup?: AutoTopup;
15
+ funds?: Funds;
16
+ /** Curated-discovery client. Present = register hpp_discover / hpp_call. */
17
+ discovery?: DiscoveryClient;
18
+ /** Seller deps. Present = register seller_* tools. */
19
+ seller?: SellerDeps;
14
20
  /**
15
21
  * Per-request timeout for the A2A JSON-RPC calls in `pay_a2a_agent`.
16
22
  * Surfaced via env `HPP_X402_A2A_RPC_TIMEOUT_MS` (set at CLI entry);