@warppay402/sdk 1.0.2 → 1.0.6
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.
- package/README.md +28 -4
- package/dist/index.d.ts +29 -0
- package/dist/index.js +18 -0
- package/openclaw.plugin.json +6 -0
- package/package.json +22 -1
- package/src/index.ts +41 -0
package/README.md
CHANGED
|
@@ -17,22 +17,46 @@ const client = new WarpPayClient({
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
async function main() {
|
|
20
|
-
//
|
|
20
|
+
// 1. Scrape any URL into clean Markdown ($0.01 USDC)
|
|
21
21
|
const page = await client.scrapeWeb("https://news.ycombinator.com");
|
|
22
22
|
console.log("Title:", page.title);
|
|
23
23
|
console.log("Markdown:", page.markdown);
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// 2. JS Browser Scraper ($0.05 USDC)
|
|
26
|
+
const rendered = await client.browserScrape("https://example.com");
|
|
27
|
+
console.log("Rendered Content:", rendered);
|
|
28
|
+
|
|
29
|
+
// 3. Capture Full-Page Screenshot ($0.10 USDC)
|
|
30
|
+
const screenshot = await client.renderScreenshot("https://example.com");
|
|
31
|
+
console.log("Screenshot Data:", screenshot);
|
|
32
|
+
|
|
33
|
+
// 4. Extract Structured JSON Data ($0.15 USDC)
|
|
34
|
+
const extracted = await client.extractJson("https://news.ycombinator.com", {
|
|
35
|
+
title: "string",
|
|
36
|
+
topStories: "array",
|
|
37
|
+
});
|
|
38
|
+
console.log("Extracted Data:", extracted);
|
|
39
|
+
|
|
40
|
+
// 5. Fetch Base Wallet Analytics ($0.02 USDC)
|
|
26
41
|
const analytics = await client.getBaseAnalytics("0x556c77792642E8ff95eC930FFb8D46a76579126E");
|
|
27
42
|
console.log("ETH Balance:", analytics.ethBalance);
|
|
28
43
|
|
|
29
|
-
// Extract PDF
|
|
30
|
-
const pdf = await client.extractPdf("https://example.com/document.pdf");
|
|
44
|
+
// 6. Extract PDF Text Preview ($0.05 USDC)
|
|
45
|
+
const pdf = await client.extractPdf("https://example.com/document.pdf");
|
|
31
46
|
console.log("Preview:", pdf.textPreview);
|
|
32
47
|
}
|
|
33
48
|
|
|
34
49
|
main();
|
|
35
50
|
```
|
|
51
|
+
## 🛠️ Available Methods & Pricing
|
|
52
|
+
|
|
53
|
+
* **`scrapeWeb(url)`** — `$0.01 USDC` — Extracts clean Markdown from web pages.
|
|
54
|
+
* **`getBaseAnalytics(address)`** — `$0.02 USDC` — Fetches ETH balance and nonce stats.
|
|
55
|
+
* **`browserScrape(url)`** — `$0.05 USDC` — Unblockable JS browser scraping via proxy workers.
|
|
56
|
+
* **`extractPdf(pdfUrl)`** — `$0.05 USDC` — Parses text preview from public PDF URLs.
|
|
57
|
+
* **`renderScreenshot(url)`** — `$0.10 USDC` — Renders target URL and returns full-page screenshot data.
|
|
58
|
+
* **`extractJson(url, schema?)`** — `$0.15 USDC` — Parses web pages into structured JSON data.
|
|
59
|
+
|
|
36
60
|
## 🛠️ LangChain Integration
|
|
37
61
|
```typescript
|
|
38
62
|
import { WarpPayClient, createWarpPayLangChainTools } from "@warppay402/sdk";
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,23 @@ export interface PdfExtractorResponse {
|
|
|
24
24
|
info: Record<string, any>;
|
|
25
25
|
textPreview: string;
|
|
26
26
|
}
|
|
27
|
+
export interface BrowserScrapeResponse {
|
|
28
|
+
success: boolean;
|
|
29
|
+
url: string;
|
|
30
|
+
content: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ScreenshotResponse {
|
|
33
|
+
success: boolean;
|
|
34
|
+
url: string;
|
|
35
|
+
screenshotUrl?: string;
|
|
36
|
+
base64?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ExtractJsonResponse {
|
|
39
|
+
success: boolean;
|
|
40
|
+
url: string;
|
|
41
|
+
schema: any;
|
|
42
|
+
extractedData: Record<string, any>;
|
|
43
|
+
}
|
|
27
44
|
export declare class WarpPayClient {
|
|
28
45
|
private baseUrl;
|
|
29
46
|
private account;
|
|
@@ -45,4 +62,16 @@ export declare class WarpPayClient {
|
|
|
45
62
|
* Downloads and extracts text preview from a public PDF URL ($0.05 USDC on Base)
|
|
46
63
|
*/
|
|
47
64
|
extractPdf(pdfUrl: string): Promise<PdfExtractorResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Executes JS-rendering browser scraper via proxy workers ($0.05 USDC on Base)
|
|
67
|
+
*/
|
|
68
|
+
browserScrape(url: string): Promise<BrowserScrapeResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Renders target URL and returns full-page screenshot data ($0.10 USDC on Base)
|
|
71
|
+
*/
|
|
72
|
+
renderScreenshot(url: string): Promise<ScreenshotResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Extracts structured JSON schema data from web pages ($0.15 USDC on Base)
|
|
75
|
+
*/
|
|
76
|
+
extractJson(url: string, schema?: object): Promise<ExtractJsonResponse>;
|
|
48
77
|
}
|
package/dist/index.js
CHANGED
|
@@ -121,5 +121,23 @@ class WarpPayClient {
|
|
|
121
121
|
async extractPdf(pdfUrl) {
|
|
122
122
|
return this.executePaidRequest("/api/v1/tools/pdf-extractor", { pdfUrl });
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Executes JS-rendering browser scraper via proxy workers ($0.05 USDC on Base)
|
|
126
|
+
*/
|
|
127
|
+
async browserScrape(url) {
|
|
128
|
+
return this.executePaidRequest("/api/v1/tools/browser-scraper", { url });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Renders target URL and returns full-page screenshot data ($0.10 USDC on Base)
|
|
132
|
+
*/
|
|
133
|
+
async renderScreenshot(url) {
|
|
134
|
+
return this.executePaidRequest("/api/v1/tools/render-screenshot", { url });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Extracts structured JSON schema data from web pages ($0.15 USDC on Base)
|
|
138
|
+
*/
|
|
139
|
+
async extractJson(url, schema) {
|
|
140
|
+
return this.executePaidRequest("/api/v1/tools/extract-json", { url, schema });
|
|
141
|
+
}
|
|
124
142
|
}
|
|
125
143
|
exports.WarpPayClient = WarpPayClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warppay402/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Official TypeScript SDK for WarpPay402 pay-per-use AI tools on Base Mainnet",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,5 +30,26 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^26.2.0",
|
|
32
32
|
"typescript": "^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"openclaw": {
|
|
35
|
+
"compat": {
|
|
36
|
+
"pluginApi": "1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"build": {
|
|
39
|
+
"openclawVersion": "1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"extensions": [
|
|
42
|
+
"dist/index.js"
|
|
43
|
+
],
|
|
44
|
+
"configSchema": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"properties": {
|
|
48
|
+
"privateKey": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Base wallet private key for paying x402 micropayments"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
33
54
|
}
|
|
34
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,26 @@ export interface PdfExtractorResponse {
|
|
|
32
32
|
textPreview: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export interface BrowserScrapeResponse {
|
|
36
|
+
success: boolean;
|
|
37
|
+
url: string;
|
|
38
|
+
content: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ScreenshotResponse {
|
|
42
|
+
success: boolean;
|
|
43
|
+
url: string;
|
|
44
|
+
screenshotUrl?: string;
|
|
45
|
+
base64?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ExtractJsonResponse {
|
|
49
|
+
success: boolean;
|
|
50
|
+
url: string;
|
|
51
|
+
schema: any;
|
|
52
|
+
extractedData: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
export class WarpPayClient {
|
|
36
56
|
private baseUrl: string;
|
|
37
57
|
private account;
|
|
@@ -165,4 +185,25 @@ export class WarpPayClient {
|
|
|
165
185
|
public async extractPdf(pdfUrl: string): Promise<PdfExtractorResponse> {
|
|
166
186
|
return this.executePaidRequest<PdfExtractorResponse>("/api/v1/tools/pdf-extractor", { pdfUrl });
|
|
167
187
|
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Executes JS-rendering browser scraper via proxy workers ($0.05 USDC on Base)
|
|
191
|
+
*/
|
|
192
|
+
public async browserScrape(url: string): Promise<BrowserScrapeResponse> {
|
|
193
|
+
return this.executePaidRequest<BrowserScrapeResponse>("/api/v1/tools/browser-scraper", { url });
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Renders target URL and returns full-page screenshot data ($0.10 USDC on Base)
|
|
198
|
+
*/
|
|
199
|
+
public async renderScreenshot(url: string): Promise<ScreenshotResponse> {
|
|
200
|
+
return this.executePaidRequest<ScreenshotResponse>("/api/v1/tools/render-screenshot", { url });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Extracts structured JSON schema data from web pages ($0.15 USDC on Base)
|
|
205
|
+
*/
|
|
206
|
+
public async extractJson(url: string, schema?: object): Promise<ExtractJsonResponse> {
|
|
207
|
+
return this.executePaidRequest<ExtractJsonResponse>("/api/v1/tools/extract-json", { url, schema });
|
|
208
|
+
}
|
|
168
209
|
}
|