Skip to content
Draft
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
2 changes: 1 addition & 1 deletion e2e/clients/axios/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";
import { config } from "dotenv";
import { Hex } from "viem";
import { withPaymentInterceptor, decodeXPaymentResponse, createSigner, MultiNetworkSigner } from "x402-axios";
import { withPaymentInterceptor, decodeXPaymentResponse, createSigner, MultiNetworkSigner } from "@space-meridian/x402-axios";

config();

Expand Down
2 changes: 1 addition & 1 deletion e2e/clients/axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"axios": "^1.7.9",
"dotenv": "^16.5.0",
"viem": "^2.21.26",
"x402-axios": "workspace:*"
"@space-meridian/x402-axios": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand Down
4 changes: 2 additions & 2 deletions e2e/clients/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"axios": "^1.7.9",
"dotenv": "^16.4.7",
"viem": "^2.21.26",
"x402-fetch": "workspace:*"
"@space-meridian/x402-fetch": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand All @@ -27,4 +27,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
6 changes: 3 additions & 3 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"express": "^4.18.0",
"tsx": "^4.20.3",
"viem": "^2.0.0",
"x402": "workspace:*",
"x402-axios": "workspace:*",
"x402-express": "workspace:*"
"@space-meridian/x402": "workspace:*",
"@space-meridian/x402-axios": "workspace:*",
"@space-meridian/x402-express": "workspace:*"
},
"devDependencies": {
"@types/express": "^4.17.0",
Expand Down
2 changes: 1 addition & 1 deletion e2e/servers/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@coinbase/x402": "workspace:*",
"dotenv": "^16.6.1",
"express": "^4.18.2",
"x402-express": "workspace:*"
"@space-meridian/x402-express": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"@langchain/openai": "^0.5.2",
"dotenv": "^16.4.7",
"viem": "^2.26.2",
"x402-fetch": "workspace:*",
"@space-meridian/x402-fetch": "workspace:*",
"zod": "^3.24.2"
},
"type": "module",
"files": [
"dist"
]
}
}
3 changes: 3 additions & 0 deletions examples/typescript/clients/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ async function main(): Promise<void> {
baseURL,
}),
signer,
undefined,
undefined,
"KYC",
);

const response = await api.get(endpointPath);
Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/clients/axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"axios": "^1.7.9",
"dotenv": "^16.5.0",
"x402-axios": "workspace:*"
"@space-meridian/x402-axios": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand All @@ -27,4 +27,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
4 changes: 2 additions & 2 deletions examples/typescript/clients/cdp-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"axios": "^1.7.9",
"dotenv": "^16.5.0",
"viem": "^2.21.26",
"x402-axios": "workspace:*"
"@space-meridian/x402-axios": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand All @@ -28,4 +28,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
2 changes: 1 addition & 1 deletion examples/typescript/clients/chainlink-vrf-nft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"viem": "^2.23.5",
"x402": "file:../../../../typescript/packages/x402",
"axios": "^1.7.9",
"x402-axios": "workspace:*"
"@space-meridian/x402-axios": "workspace:*"
},
"devDependencies": {
"tsx": "^4.19.3",
Expand Down
9 changes: 8 additions & 1 deletion examples/typescript/clients/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ if (!baseURL || !privateKey || !endpointPath) {
async function main(): Promise<void> {
// const signer = await createSigner("solana-devnet", privateKey); // uncomment for solana
const signer = await createSigner("base-sepolia", privateKey);
const fetchWithPayment = wrapFetchWithPayment(fetch, signer);
const fetchWithPayment = wrapFetchWithPayment(
fetch,
signer,
undefined,
undefined,
undefined,
"KYC",
);

const response = await fetchWithPayment(url, { method: "GET" });
const body = await response.json();
Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/clients/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"dotenv": "^16.4.7",
"x402-fetch": "workspace:*"
"@space-meridian/x402-fetch": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand All @@ -26,4 +26,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
13 changes: 8 additions & 5 deletions examples/typescript/discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This example demonstrates how to use the x402 discovery feature to find and list
## Setup

1. Install and build all packages from the typescript examples root:

```bash
cd ../../
pnpm install
Expand All @@ -18,13 +19,15 @@ cd examples/typescript/discovery
```

2. Start the discovery example:

```bash
pnpm dev
```

## How It Works

The example demonstrates how to:

1. Use the x402 facilitator to discover available resources
2. List all x402-protected endpoints in the network
3. View detailed information about each resource including:
Expand All @@ -37,16 +40,16 @@ The example demonstrates how to:
## Example Code

```typescript
import { useFacilitator } from "x402/verify";
import { useFacilitator } from "@space-meridian/x402/verify";
import { facilitator } from "@coinbase/x402";

// No API keys required for discovery
const { list } = useFacilitator(facilitator);

list().then(response => {
console.log('\nDiscovered X402 Resources:');
console.log('========================\n');
console.log("\nDiscovered X402 Resources:");
console.log("========================\n");

response.items.forEach((item, index) => {
console.log(`Resource ${index + 1}:`);
console.log(` Resource URL: ${item.resource}`);
Expand All @@ -57,7 +60,7 @@ list().then(response => {
if (item.metadata && Object.keys(item.metadata).length > 0) {
console.log(` Metadata: ${JSON.stringify(item.metadata, null, 2)}`);
}
console.log('------------------------\n');
console.log("------------------------\n");
});
});
```
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/discovery/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFacilitator } from "x402/verify";
import { useFacilitator } from "@space-meridian/x402/verify";
import { facilitator } from "@coinbase/x402";

const { list } = useFacilitator(facilitator);
Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/discovery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"axios": "^1.7.9",
"viem": "^2.21.26",
"x402": "workspace:*",
"@space-meridian/x402": "workspace:*",
"@coinbase/x402": "workspace:*"
},
"devDependencies": {
Expand All @@ -27,4 +27,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
6 changes: 3 additions & 3 deletions examples/typescript/dynamic_agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"hono": "^4.7.7",
"llamaindex": "^0.10.2",
"viem": "^2.28.3",
"x402": "workspace:*",
"x402-axios": "workspace:*",
"@space-meridian/x402": "workspace:*",
"@space-meridian/x402-axios": "workspace:*",
"x402-hono": "workspace:*",
"zod": "^3.24.3"
},
Expand All @@ -38,4 +38,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
4 changes: 2 additions & 2 deletions examples/typescript/facilitator/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */
import { config } from "dotenv";
import express, { Request, Response } from "express";
import { verify, settle } from "x402/facilitator";
import { verify, settle } from "@space-meridian/x402/facilitator";
import {
PaymentRequirementsSchema,
type PaymentRequirements,
Expand All @@ -16,7 +16,7 @@ import {
SupportedPaymentKind,
isSvmSignerWallet,
type X402Config,
} from "x402/types";
} from "@space-meridian/x402/types";

config();

Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/facilitator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"dotenv": "^16.4.7",
"express": "^4.18.2",
"x402": "workspace:*"
"@space-meridian/x402": "workspace:*"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
Expand All @@ -27,4 +27,4 @@
"tsx": "^4.7.0",
"typescript": "^5.3.0"
}
}
}
21 changes: 0 additions & 21 deletions examples/typescript/fullstack/auth_based_pricing/.env-local

This file was deleted.

54 changes: 0 additions & 54 deletions examples/typescript/fullstack/auth_based_pricing/.gitignore

This file was deleted.

Loading