Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: correct escaped backticks in autonomous-registry bridge-status entry; wire offer-receipt mocks in x402-spec tests

nirholas682d7fb976b9
diff --git a/api/_lib/x402/autonomous-registry.js b/api/_lib/x402/autonomous-registry.js
index 23a3de369..a4cacde59 100644
--- a/api/_lib/x402/autonomous-registry.js
+++ b/api/_lib/x402/autonomous-registry.js
@@ -1760,13 +1760,13 @@ const SELF_ENDPOINTS = [
{ ex: BRIDGE_ALERT_TTL_SECONDS },
);
console.warn(
- \`[x402/bridge-status] ALERT: \${v.down_count} bridge(s) down — \${downBridges.join(', ')}\`,
+ `[x402/bridge-status] ALERT: \${v.down_count} bridge(s) down — \${downBridges.join(', ')}`,
);
} else if (typeof v.down_count === 'number') {
await redis.del(BRIDGE_ALERT_KEY);
}
} catch (err) {
- console.warn(\`[x402/bridge-status] alert write failed: \${err?.message || err}\`);
+ console.warn(`[x402/bridge-status] alert write failed: \${err?.message || err}`);
}
},
},
diff --git a/tests/api/x402-spec.test.js b/tests/api/x402-spec.test.js
index 1d97a1636..68240036d 100644
--- a/tests/api/x402-spec.test.js
+++ b/tests/api/x402-spec.test.js
@@ -31,6 +31,7 @@ vi.mock('@coinbase/x402', () => ({
vi.mock('@x402/extensions', () => ({
EIP2612_GAS_SPONSORING: { key: 'eip2612GasSponsoring' },
ERC20_APPROVAL_GAS_SPONSORING: { key: 'erc20ApprovalGasSponsoring' },
+ OFFER_RECEIPT: 'offer-receipt',
declareEip2612GasSponsoringExtension: () => ({
eip2612GasSponsoring: {
info: { description: 'EIP-2612 gas sponsoring', version: '1' },
@@ -54,6 +55,12 @@ vi.mock('../../api/_lib/x402-builder-code.js', () => ({
declareBuilderCodeExtension: () => ({ builderCode: { code: 'three.ws' } }),
verifyClientEcho: vi.fn(() => true),
}));
+vi.mock('../../api/_lib/x402/offer-receipt-server.js', () => ({
+ buildOffersExtension: vi.fn(async () => null),
+}));
+vi.mock('../../api/_lib/x402-offer-receipt.js', () => ({
+ offerReceiptDeclaration: vi.fn(() => null),
+}));
vi.setConfig({ testTimeout: 10_000, hookTimeout: 60_000 });
@@ -298,7 +305,7 @@ describe('build402Body extensions', () => {
it('emits only the bazaar extension when no accept opts into Permit2', async () => {
const { build402Body } = await loadSpec();
- const body = build402Body({
+ const body = await build402Body({
resourceUrl: 'https://three.ws/api/x402/foo',
accepts: [baseAccept],
});
@@ -308,7 +315,7 @@ describe('build402Body extensions', () => {
it('auto-declares eip2612GasSponsoring + erc20ApprovalGasSponsoring when a Permit2 accept is present', async () => {
const { build402Body, EIP2612_EXTENSION_KEY, ERC20_APPROVAL_EXTENSION_KEY } =
await loadSpec();
- const body = build402Body({
+ const body = await build402Body({
resourceUrl: 'https://three.ws/api/x402/foo',
accepts: [baseAccept, permit2Accept],
});
@@ -319,7 +326,7 @@ describe('build402Body extensions', () => {
it('passes caller-supplied extensions through (last-write-wins)', async () => {
const { build402Body } = await loadSpec();
- const body = build402Body({
+ const body = await build402Body({
resourceUrl: 'https://three.ws/api/x402/foo',
accepts: [baseAccept],
extensions: { customSentinel: { hello: 'world' } },
@@ -330,7 +337,7 @@ describe('build402Body extensions', () => {
it('emits the v2 envelope shape required by the spec', async () => {
const { build402Body, X402_VERSION } = await loadSpec();
- const body = build402Body({
+ const body = await build402Body({
resourceUrl: 'https://three.ws/api/x402/foo',
accepts: [baseAccept],
description: 'demo',
@@ -479,7 +486,7 @@ describe('send402 PAYMENT-REQUIRED header', () => {
const { send402, paymentRequirements, EIP2612_EXTENSION_KEY } = await loadSpec();
const res = makeRes();
const accepts = paymentRequirements('https://three.ws/api/x402/foo');
- send402(res, {
+ await send402(res, {
resourceUrl: 'https://three.ws/api/x402/foo',
accepts,
description: 'demo',