Skip to content
Open
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
4 changes: 2 additions & 2 deletions ts/.dependency-cruiser-known-violations.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{
"type": "dependency",
"from": "src/adapters/outbound/x402/gasfree-errors.test.ts",
"to": "node_modules/@bankofai/x402-fetch/dist/cjs/index.js",
"unresolvedTo": "@bankofai/x402-fetch",
"to": "node_modules/@x402/fetch/dist/cjs/index.js",
"unresolvedTo": "@x402/fetch",
"dependencyTypes": ["npm-dev", "import"],
"rule": {
"severity": "error",
Expand Down
14 changes: 7 additions & 7 deletions ts/.dependency-cruiser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { readdirSync } = require("node:fs");

const SDK_PACKAGES = "(tronweb|ethers)(/|$)|@(sun-protocol|bankofai|ledgerhq)/";
const SDK_PACKAGES = "(tronweb|ethers)(/|$)|@(sun-protocol|bankofai|ledgerhq|x402)/";
const HTTP_CLIENT_PACKAGES = "(axios|undici|node-fetch|got|ky)(/|$)";

// Only a missing directory means "no integrations"; any other error would silently drop rules.
Expand Down Expand Up @@ -40,8 +40,8 @@ const LEDGER_SIGNING_MODULES = {
"hw-app-eth": ["Eth", "modules/EIP712"],
};
const X402_PAYMENT_MODULES = {
"x402-core": ["client", "facilitator"],
"x402-evm": [
"@x402/core": ["client", "facilitator"],
"@x402/evm": [
"exact/client",
"exact/facilitator",
"exact/v1/client",
Expand All @@ -52,9 +52,8 @@ const X402_PAYMENT_MODULES = {
"batch-settlement/server",
"batch-settlement/facilitator",
"auth-capture/client",
"adapters/agent-wallet",
],
"x402-tron": [
"@bankofai/x402-tron": [
"exact",
"exact/client",
"exact/facilitator",
Expand All @@ -72,7 +71,8 @@ const LEDGER_SIGNING_PATTERN = Object.entries(LEDGER_SIGNING_MODULES)
.map(([app, modules]) => `${app}($|/(lib/|lib-es/|)(${modules.join("|")})(/index|)(\\.js|)$)`)
.join("|");
const X402_PAYMENT_PATTERN = [
"x402-fetch($|/dist/(esm|cjs)/index\\.(mjs|js)$)",
"@bankofai/x402-tron-extensions(/|$)",
"@x402/fetch($|/dist/(esm|cjs)/index\\.(mjs|js)$)",
...Object.entries(X402_PAYMENT_MODULES).map(
([pkg, modules]) => `${pkg}/(dist/(esm|cjs)/|)(${modules.join("|")})(/index|)(\\.(mjs|js)|)$`,
),
Expand Down Expand Up @@ -231,7 +231,7 @@ module.exports = {
comment:
"the x402 modules that sign, send, or settle payments; only the payment client imports them",
from: { path: "^src/", pathNot: "^src/adapters/outbound/x402/payment-client\\.ts$" },
to: { path: `(^|node_modules/)@bankofai/(${X402_PAYMENT_PATTERN})` },
to: { path: `(^|node_modules/)(${X402_PAYMENT_PATTERN})` },
},
],
options: {
Expand Down
155 changes: 105 additions & 50 deletions ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@
"axios": "^1.18.1",
"ws": "8.21.1",
"esbuild": "^0.28.1",
"@bankofai/x402-core": "$@bankofai/x402-core",
"nanoid": "^3.3.18"
},
"devDependencies": {
"@bankofai/x402-core": "1.1.1",
"@bankofai/x402-evm": "1.1.1",
"@bankofai/x402-fetch": "1.1.0",
"@bankofai/x402-tron": "2.0.0",
"@bankofai/x402-tron": "2.1.2",
"@bankofai/x402-tron-extensions": "2.1.2",
"@eslint/js": "^10.0.1",
"@types/node": "^25.9.3",
"@types/qrcode": "^1.5.6",
"@types/ws": "^8.18.1",
"@types/yargs": "^17.0.35",
"@x402/core": "2.29.0",
"@x402/evm": "2.29.0",
"@x402/fetch": "2.29.0",
"bun": "1.3.14",
"dependency-cruiser": "^17.4.3",
"eslint": "^10.8.1",
Expand Down
2 changes: 1 addition & 1 deletion ts/src/adapters/outbound/x402/facilitator-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
decodePaymentSignatureHeader,
encodePaymentRequiredHeader,
encodePaymentResponseHeader,
} from "@bankofai/x402-core/http";
} from "@x402/core/http";
import type { NetworkDescriptor } from "../../../domain/types/index.js";
import type { X402Scheme } from "../../../domain/x402/families.js";
import type {
Expand Down
2 changes: 1 addition & 1 deletion ts/src/adapters/outbound/x402/gasfree-errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { X402Service } from "../../../application/use-cases/x402-service.js";
import { expect, it, vi } from "vitest";
import { x402Client, wrapFetchWithPayment } from "@bankofai/x402-fetch";
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { ExactGasFreeTronScheme } from "@bankofai/x402-tron/gasfree/client";
import { X402PaymentClient } from "./payment-client.js";
import { CommandDeadline } from "../../../application/services/command-deadline.js";
Expand Down
5 changes: 4 additions & 1 deletion ts/src/adapters/outbound/x402/nile-compatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ it.each(["tron:3448148188", "tron:0xcd8690dc"])(
.toLowerCase(),
).toBe(`0x${TronWeb.address.toHex(address).slice(2)}`.toLowerCase());
expect(fetcher).toHaveBeenCalledTimes(2);
expect((fetcher.mock.calls[1]![0] as Request).headers.has("payment-signature")).toBe(true);
const signature = (fetcher.mock.calls[1]![0] as Request).headers.get("payment-signature");
expect(signature).not.toBeNull();
const payment = JSON.parse(Buffer.from(signature!, "base64").toString("utf8"));
expect(payment.accepted.network).toBe(wireNetwork);
},
);

Expand Down
2 changes: 1 addition & 1 deletion ts/src/adapters/outbound/x402/nile-settlement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Interface, Wallet } from "ethers";
import { TronWeb, providers, utils as tronUtils } from "tronweb";
import { ExactTronScheme } from "@bankofai/x402-tron/exact/facilitator";
import type { FacilitatorTronSigner } from "@bankofai/x402-tron";
import type { PaymentPayload, PaymentRequirements } from "@bankofai/x402-core/types";
import type { PaymentPayload, PaymentRequirements } from "@x402/core/types";
import { X402PaymentClient } from "./payment-client.js";
import { tronSignStrategy } from "../chain/tron/signing-strategy.js";
import type { TypedDataPayload } from "../../../domain/types/index.js";
Expand Down
Loading