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
1 change: 0 additions & 1 deletion packages/atxp-base/src/baseAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export class BaseAccount implements Account {
const httpClient = new x402HTTPClient(client);

// Build PaymentRequired envelope from the enriched requirements
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const paymentRequired = {
x402Version,
accepts: [reqs],
Expand Down
2 changes: 1 addition & 1 deletion packages/atxp-client/src/atxpAccountHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('ATXPAccountHandler', () => {
expect(authorize).toHaveBeenCalledTimes(1);
expect(authorize).toHaveBeenCalledWith(
expect.objectContaining({
protocols: ['atxp', 'x402', 'mpp'],
protocols: ['atxp'],
amount: expect.anything(),
}),
);
Expand Down
12 changes: 10 additions & 2 deletions packages/atxp-client/src/atxpAccountHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,19 @@ export class ATXPAccountHandler implements ProtocolHandler {
}

// Delegate to account.authorize() → accounts /authorize/auto
logger.info('ATXPAccountHandler: delegating to account.authorize()');
// Only advertise protocols the server actually provided data for.
// Always include 'atxp' (needs only amount + destination).
// Include 'x402' only if the challenge contained x402 accepts.
// Include 'mpp' only if the challenge contained mpp challenges.
const protocols: Array<'atxp' | 'x402' | 'mpp'> = ['atxp'];
if (authorizeParams.paymentRequirements) protocols.push('x402');
if (authorizeParams.challenges) protocols.push('mpp');

logger.info(`ATXPAccountHandler: delegating to account.authorize() with protocols=[${protocols.join(',')}]`);
let result;
try {
result = await account.authorize({
protocols: ['atxp', 'x402', 'mpp'],
protocols,
amount: authorizeParams.amount ? new BigNumber(String(authorizeParams.amount)) : undefined,
destination: authorizeParams.destination as string | undefined,
paymentRequirements: authorizeParams.paymentRequirements,
Expand Down
2 changes: 1 addition & 1 deletion packages/atxp-server/src/node/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function parseMcpRequests(config: ATXPConfig, requestUrl: URL, req:
return requests;
}

export async function parseBody(req: IncomingMessage, logger: Logger): Promise<unknown> {
export async function parseBody(req: IncomingMessage, _logger: Logger): Promise<unknown> {
try {
const ct = req.headers["content-type"];

Expand Down
1 change: 0 additions & 1 deletion packages/atxp-x402/src/x402Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export const wrapWithX402: FetchWrapper = (config: ClientArgs): FetchLike => {
x402ClientInstance.register(network as `${string}:${string}`, scheme);
const httpClient = new x402HTTPClient(x402ClientInstance);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const paymentRequired = {
x402Version: paymentChallenge.x402Version,
accepts: [selectedPaymentRequirements],
Expand Down
Loading