@warppay402/sdk 1.1.9 → 1.1.11
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/.clawhubignore +13 -0
- package/README.md +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/.env.example +0 -12
package/.clawhubignore
ADDED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @warppay402/sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for **WarpPay402**—pay-per-use AI tools monetized via x402 USDC micropayments on Base Mainnet.
|
|
3
|
+
Official TypeScript SDK for **WarpPay402**—pay-per-use AI tools monetized via x402 USDC micropayments on Base Mainnet, Solana SPl (USDC), Arbituim One, and Arc mainnet.
|
|
4
4
|
|
|
5
5
|
## 📦 Installation
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -61,7 +61,7 @@ var WarpPayClient = class {
|
|
|
61
61
|
this.solanaKeypair = import_web3.Keypair.fromSecretKey(decodedSecret);
|
|
62
62
|
}
|
|
63
63
|
if (!this.account && !this.solanaKeypair) {
|
|
64
|
-
throw new Error("WarpPayClient requires either
|
|
64
|
+
throw new Error("WarpPayClient requires either an EVM privateKey or a solanaPrivateKey.");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -129,10 +129,12 @@ var WarpPayClient = class {
|
|
|
129
129
|
const assetContract = evmReq.asset || evmReq.usdcAddress;
|
|
130
130
|
const value = BigInt(evmReq.maxAmountRequired || evmReq.amount || "10000");
|
|
131
131
|
console.log(`\u{1F50D} [SDK DEBUG] Signer Wallet: ${this.account.address} -> PayTo: ${payTo} | Amount: ${value.toString()}`);
|
|
132
|
+
const isArc = evmReq.network === "eip155:5042" || evmReq.chainId === 5042;
|
|
133
|
+
const targetChainId = isArc ? 5042 : Number(evmReq.chainId || 8453);
|
|
132
134
|
const domain = {
|
|
133
135
|
name: evmReq.extra?.name || "USD Coin",
|
|
134
136
|
version: evmReq.extra?.version || "2",
|
|
135
|
-
chainId:
|
|
137
|
+
chainId: targetChainId,
|
|
136
138
|
verifyingContract: assetContract
|
|
137
139
|
};
|
|
138
140
|
const types = {
|
|
@@ -164,7 +166,7 @@ var WarpPayClient = class {
|
|
|
164
166
|
paymentPayload = {
|
|
165
167
|
x402Version: 2,
|
|
166
168
|
scheme: evmReq.scheme || "exact",
|
|
167
|
-
network: evmReq.network || "eip155:8453",
|
|
169
|
+
network: evmReq.network || (isArc ? "eip155:5042" : "eip155:8453"),
|
|
168
170
|
authorization: {
|
|
169
171
|
from: this.account.address,
|
|
170
172
|
to: payTo,
|
|
@@ -195,6 +197,7 @@ var WarpPayClient = class {
|
|
|
195
197
|
if (method === "POST" && payload) {
|
|
196
198
|
retryOptions.body = JSON.stringify(payload);
|
|
197
199
|
}
|
|
200
|
+
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
198
201
|
console.log(`\u{1F50D} [SDK DEBUG] Resubmitting paid ${method} request to: ${url}`);
|
|
199
202
|
response = await fetch(url, retryOptions);
|
|
200
203
|
console.log(`\u{1F50D} [SDK DEBUG] Paid Retry Response Status: ${response.status} ${response.statusText}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface WarpPayConfig {
|
|
2
|
-
/** Base Mainnet private key of the agent's wallet funding micro-payments */
|
|
2
|
+
/** Base Mainnet or Arc Mainnet private key of the agent's wallet funding micro-payments */
|
|
3
3
|
privateKey?: `0x${string}`;
|
|
4
4
|
/** Solana Mainnet base58 private key funding micro-payments */
|
|
5
5
|
solanaPrivateKey?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface WarpPayConfig {
|
|
2
|
-
/** Base Mainnet private key of the agent's wallet funding micro-payments */
|
|
2
|
+
/** Base Mainnet or Arc Mainnet private key of the agent's wallet funding micro-payments */
|
|
3
3
|
privateKey?: `0x${string}`;
|
|
4
4
|
/** Solana Mainnet base58 private key funding micro-payments */
|
|
5
5
|
solanaPrivateKey?: string;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var WarpPayClient = class {
|
|
|
31
31
|
this.solanaKeypair = Keypair.fromSecretKey(decodedSecret);
|
|
32
32
|
}
|
|
33
33
|
if (!this.account && !this.solanaKeypair) {
|
|
34
|
-
throw new Error("WarpPayClient requires either
|
|
34
|
+
throw new Error("WarpPayClient requires either an EVM privateKey or a solanaPrivateKey.");
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -99,10 +99,12 @@ var WarpPayClient = class {
|
|
|
99
99
|
const assetContract = evmReq.asset || evmReq.usdcAddress;
|
|
100
100
|
const value = BigInt(evmReq.maxAmountRequired || evmReq.amount || "10000");
|
|
101
101
|
console.log(`\u{1F50D} [SDK DEBUG] Signer Wallet: ${this.account.address} -> PayTo: ${payTo} | Amount: ${value.toString()}`);
|
|
102
|
+
const isArc = evmReq.network === "eip155:5042" || evmReq.chainId === 5042;
|
|
103
|
+
const targetChainId = isArc ? 5042 : Number(evmReq.chainId || 8453);
|
|
102
104
|
const domain = {
|
|
103
105
|
name: evmReq.extra?.name || "USD Coin",
|
|
104
106
|
version: evmReq.extra?.version || "2",
|
|
105
|
-
chainId:
|
|
107
|
+
chainId: targetChainId,
|
|
106
108
|
verifyingContract: assetContract
|
|
107
109
|
};
|
|
108
110
|
const types = {
|
|
@@ -134,7 +136,7 @@ var WarpPayClient = class {
|
|
|
134
136
|
paymentPayload = {
|
|
135
137
|
x402Version: 2,
|
|
136
138
|
scheme: evmReq.scheme || "exact",
|
|
137
|
-
network: evmReq.network || "eip155:8453",
|
|
139
|
+
network: evmReq.network || (isArc ? "eip155:5042" : "eip155:8453"),
|
|
138
140
|
authorization: {
|
|
139
141
|
from: this.account.address,
|
|
140
142
|
to: payTo,
|
|
@@ -165,6 +167,7 @@ var WarpPayClient = class {
|
|
|
165
167
|
if (method === "POST" && payload) {
|
|
166
168
|
retryOptions.body = JSON.stringify(payload);
|
|
167
169
|
}
|
|
170
|
+
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
168
171
|
console.log(`\u{1F50D} [SDK DEBUG] Resubmitting paid ${method} request to: ${url}`);
|
|
169
172
|
response = await fetch(url, retryOptions);
|
|
170
173
|
console.log(`\u{1F50D} [SDK DEBUG] Paid Retry Response Status: ${response.status} ${response.statusText}`);
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/.env.example
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# EVM / Base Mainnet Wallet Setup
|
|
2
|
-
# Private key for funding Base x402 USDC micropayments (must start with 0x)
|
|
3
|
-
CUSTOMER_BASE_KEY=0x_your_evm_private_key_here
|
|
4
|
-
|
|
5
|
-
# Solana L1 Wallet Setup
|
|
6
|
-
# Base58-encoded secret key for funding Solana SPL USDC micropayments
|
|
7
|
-
CUSTOMER_SOLANA_KEY=base58_encoded_solana_secret_key_here
|
|
8
|
-
|
|
9
|
-
# Optional Configuration Overrides
|
|
10
|
-
# BASE_URL=https://api.warppay402.com
|
|
11
|
-
# BASE_RPC_URL=https://mainnet.base.org
|
|
12
|
-
# SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
|