@warppay402/sdk 1.1.8 → 1.1.10
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 +7 -0
- package/README.md +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
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,
|
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,
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warppay402/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Official WarpPay402 TypeScript SDK: Enabling seamless pay-per-use AI tools across Base Mainnet, Solana, and Arbitrum One.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@solana/spl-token": "^0.4.15",
|
|
42
42
|
"@solana/web3.js": "^1.98.4",
|
|
43
|
-
"@warppay402/server": "^1.2.
|
|
43
|
+
"@warppay402/server": "^1.2.5",
|
|
44
44
|
"bs58": "^6.0.0",
|
|
45
45
|
"viem": "^2.0.0"
|
|
46
46
|
},
|