@itzannetos/x402-tools 1.0.1 → 1.0.2

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.
@@ -69,9 +69,17 @@ export const X402ToolsPlugin: Plugin = async () => {
69
69
  const privateKey = await getPrivateKey()
70
70
  const client = createPaymentClient(privateKey)
71
71
 
72
- const response = await client.post(X_SEARCHER_PATH, {
73
- message: args.query,
74
- })
72
+ let response
73
+ try {
74
+ response = await client.post(X_SEARCHER_PATH, {
75
+ message: args.query,
76
+ })
77
+ } catch (error) {
78
+ if (axios.isAxiosError(error) && error.response?.status === 402) {
79
+ throw new Error("Not enough USDC in your wallet, please top up")
80
+ }
81
+ throw error
82
+ }
75
83
 
76
84
  if (!response.data?.data?.response) {
77
85
  throw new Error("Unexpected response from X Searcher")
@@ -90,9 +98,17 @@ export const X402ToolsPlugin: Plugin = async () => {
90
98
  const privateKey = await getPrivateKey()
91
99
  const client = createPaymentClient(privateKey)
92
100
 
93
- const response = await client.post(FIND_PEOPLE_PATH, {
94
- message: args.query,
95
- })
101
+ let response
102
+ try {
103
+ response = await client.post(FIND_PEOPLE_PATH, {
104
+ message: args.query,
105
+ })
106
+ } catch (error) {
107
+ if (axios.isAxiosError(error) && error.response?.status === 402) {
108
+ throw new Error("Not enough USDC in your wallet, please top up")
109
+ }
110
+ throw error
111
+ }
96
112
 
97
113
  if (!response.data?.data?.response) {
98
114
  throw new Error("Unexpected response from Find People")
package/README.md CHANGED
@@ -88,7 +88,7 @@ Before installing this plugin, ensure you have:
88
88
  }
89
89
  ```
90
90
 
91
- **OR** set it in `.env` at the project root:
91
+ **OR** set it in `.env` at the project root (necessary on Windows):
92
92
 
93
93
  ```env
94
94
  X402_PRIVATE_KEY=0x...
@@ -115,7 +115,7 @@ bun install
115
115
  }
116
116
  ```
117
117
 
118
- **OR** set it in `.env` at the project root:
118
+ **OR** set it in `.env` at the project root (necessary on Windows):
119
119
 
120
120
  ```env
121
121
  X402_PRIVATE_KEY=0x...
@@ -330,5 +330,4 @@ For issues, questions, or contributions:
330
330
  - X Searcher tool for X/Twitter search
331
331
  - Find People tool for OSINT research
332
332
  - X402 payment integration
333
- - Base network support
334
- I want to add that this repo is developed and managed by 402box.io , email of contact is george@402box.io. also add pricing for each. x-search is 0.05 and find_people 0.15 USDC
333
+ - Base network support
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itzannetos/x402-tools",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "files": [