@pay-skill/sdk 0.1.7 → 0.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/README.md +80 -91
- package/dist/auth.d.ts +11 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +19 -7
- package/dist/auth.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/keychain.d.ts +8 -0
- package/dist/keychain.d.ts.map +1 -0
- package/dist/keychain.js +17 -0
- package/dist/keychain.js.map +1 -0
- package/dist/wallet.d.ts +135 -104
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +683 -280
- package/dist/wallet.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +5 -2
- package/src/auth.ts +28 -18
- package/src/errors.ts +10 -3
- package/src/index.ts +12 -39
- package/src/keychain.ts +18 -0
- package/src/wallet.ts +1074 -355
- package/tests/test_auth_rejection.ts +43 -95
- package/tests/test_crypto.ts +59 -172
- package/tests/test_e2e.ts +46 -105
- package/tests/test_errors.ts +9 -1
- package/tests/test_ows.ts +153 -0
- package/tests/test_wallet.ts +194 -0
- package/dist/client.d.ts +0 -94
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -443
- package/dist/client.js.map +0 -1
- package/dist/models.d.ts +0 -78
- package/dist/models.d.ts.map +0 -1
- package/dist/models.js +0 -2
- package/dist/models.js.map +0 -1
- package/dist/ows-signer.d.ts +0 -75
- package/dist/ows-signer.d.ts.map +0 -1
- package/dist/ows-signer.js +0 -130
- package/dist/ows-signer.js.map +0 -1
- package/dist/signer.d.ts +0 -46
- package/dist/signer.d.ts.map +0 -1
- package/dist/signer.js +0 -111
- package/dist/signer.js.map +0 -1
- package/src/client.ts +0 -644
- package/src/models.ts +0 -77
- package/src/ows-signer.ts +0 -223
- package/src/signer.ts +0 -147
- package/tests/test_ows_integration.ts +0 -92
- package/tests/test_ows_signer.ts +0 -365
- package/tests/test_signer.ts +0 -47
- package/tests/test_validation.ts +0 -66
package/dist/client.js
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PayClient — single entry point for the pay SDK.
|
|
3
|
-
*/
|
|
4
|
-
import { PayNetworkError, PayServerError, PayValidationError, } from "./errors.js";
|
|
5
|
-
import { createSigner } from "./signer.js";
|
|
6
|
-
import { buildAuthHeaders, buildAuthHeadersWithSigner, } from "./auth.js";
|
|
7
|
-
import { sign as viemSign, serializeSignature, privateKeyToAccount } from "viem/accounts";
|
|
8
|
-
import { signTransferAuthorization, combinedSignature, } from "./eip3009.js";
|
|
9
|
-
const ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
10
|
-
const DIRECT_MIN = 1_000_000; // $1.00 USDC
|
|
11
|
-
const TAB_MIN = 5_000_000; // $5.00 USDC
|
|
12
|
-
export const DEFAULT_API_URL = "https://pay-skill.com/api/v1";
|
|
13
|
-
function validateAddress(address, field = "address") {
|
|
14
|
-
if (!ADDRESS_RE.test(address)) {
|
|
15
|
-
throw new PayValidationError(`Invalid Ethereum address: ${address}`, field);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function validateAmount(amount, minimum, field = "amount") {
|
|
19
|
-
if (amount < minimum) {
|
|
20
|
-
const minUsd = minimum / 1_000_000;
|
|
21
|
-
throw new PayValidationError(`Amount ${amount} below minimum ($${minUsd.toFixed(2)})`, field);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export class PayClient {
|
|
25
|
-
apiUrl;
|
|
26
|
-
/** URL path prefix extracted from apiUrl (e.g., "/api/v1"). */
|
|
27
|
-
_basePath;
|
|
28
|
-
signer;
|
|
29
|
-
_privateKey;
|
|
30
|
-
_authConfig;
|
|
31
|
-
_chainId;
|
|
32
|
-
_address;
|
|
33
|
-
constructor(options = {}) {
|
|
34
|
-
this.apiUrl = (options.apiUrl ?? DEFAULT_API_URL).replace(/\/+$/, "");
|
|
35
|
-
// Extract the URL path to prepend to auth signing paths.
|
|
36
|
-
// e.g., "http://host:3001/api/v1" → "/api/v1"
|
|
37
|
-
try {
|
|
38
|
-
this._basePath = new URL(this.apiUrl).pathname.replace(/\/+$/, "");
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
this._basePath = "";
|
|
42
|
-
}
|
|
43
|
-
if (typeof options.signer === "object") {
|
|
44
|
-
this.signer = options.signer;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this.signer = createSigner(options.signer ?? "cli", {
|
|
48
|
-
...options.signerOptions,
|
|
49
|
-
key: options.signerOptions?.key ?? options.privateKey,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// Private key for direct signing (preferred over Signer for auth)
|
|
53
|
-
this._privateKey = options.privateKey
|
|
54
|
-
? (options.privateKey.startsWith("0x")
|
|
55
|
-
? options.privateKey
|
|
56
|
-
: "0x" + options.privateKey)
|
|
57
|
-
: null;
|
|
58
|
-
this._chainId = options.chainId ?? 8453;
|
|
59
|
-
this._address = this._privateKey
|
|
60
|
-
? privateKeyToAccount(this._privateKey).address
|
|
61
|
-
: (options.signerOptions?.address ?? "");
|
|
62
|
-
// Auth config for EIP-712 domain
|
|
63
|
-
if (options.chainId && options.routerAddress) {
|
|
64
|
-
this._authConfig = {
|
|
65
|
-
chainId: options.chainId,
|
|
66
|
-
routerAddress: options.routerAddress,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this._authConfig = null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async getContracts() {
|
|
74
|
-
return this.get("/contracts");
|
|
75
|
-
}
|
|
76
|
-
// ── Direct Payment ──────────────────────────────────────────────
|
|
77
|
-
async payDirect(to, amount, options = {}) {
|
|
78
|
-
validateAddress(to, "to");
|
|
79
|
-
validateAmount(amount, DIRECT_MIN);
|
|
80
|
-
// Get contract addresses to determine the spender
|
|
81
|
-
const contracts = await this.get("/contracts");
|
|
82
|
-
const permit = await this.prepareAndSignPermit(amount, contracts.direct);
|
|
83
|
-
const data = await this.post("/direct", {
|
|
84
|
-
to,
|
|
85
|
-
amount,
|
|
86
|
-
memo: options.memo ?? "",
|
|
87
|
-
permit,
|
|
88
|
-
});
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
// ── Tab Management ──────────────────────────────────────────────
|
|
92
|
-
async openTab(provider, amount, options) {
|
|
93
|
-
validateAddress(provider, "provider");
|
|
94
|
-
validateAmount(amount, TAB_MIN);
|
|
95
|
-
if (options.maxChargePerCall <= 0) {
|
|
96
|
-
throw new PayValidationError("maxChargePerCall must be positive", "maxChargePerCall");
|
|
97
|
-
}
|
|
98
|
-
const contracts = await this.get("/contracts");
|
|
99
|
-
const permit = await this.prepareAndSignPermit(amount, contracts.tab);
|
|
100
|
-
return this.post("/tabs", {
|
|
101
|
-
provider,
|
|
102
|
-
amount,
|
|
103
|
-
max_charge_per_call: options.maxChargePerCall,
|
|
104
|
-
permit,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
async closeTab(tabId) {
|
|
108
|
-
return this.post(`/tabs/${tabId}/close`, {});
|
|
109
|
-
}
|
|
110
|
-
async topUpTab(tabId, amount) {
|
|
111
|
-
validateAmount(amount, 1, "amount");
|
|
112
|
-
const contracts = await this.get("/contracts");
|
|
113
|
-
const permit = await this.prepareAndSignPermit(amount, contracts.tab);
|
|
114
|
-
return this.post(`/tabs/${tabId}/topup`, { amount, permit });
|
|
115
|
-
}
|
|
116
|
-
async listTabs() {
|
|
117
|
-
return this.get("/tabs");
|
|
118
|
-
}
|
|
119
|
-
async getTab(tabId) {
|
|
120
|
-
return this.get(`/tabs/${tabId}`);
|
|
121
|
-
}
|
|
122
|
-
// ── x402 ────────────────────────────────────────────────────────
|
|
123
|
-
static X402_TAB_MULTIPLIER = 10;
|
|
124
|
-
async request(url, options = {}) {
|
|
125
|
-
const method = options.method ?? "GET";
|
|
126
|
-
const headers = options.headers ?? {};
|
|
127
|
-
const bodyStr = options.body ? JSON.stringify(options.body) : undefined;
|
|
128
|
-
const resp = await fetch(url, { method, body: bodyStr, headers });
|
|
129
|
-
if (resp.status !== 402)
|
|
130
|
-
return resp;
|
|
131
|
-
return this.handle402(resp, url, method, bodyStr, headers);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Parse x402 V2 payment requirements from a 402 response.
|
|
135
|
-
*
|
|
136
|
-
* Checks PAYMENT-REQUIRED header first (base64-encoded JSON),
|
|
137
|
-
* falls back to response body for requirements.
|
|
138
|
-
*/
|
|
139
|
-
async parse402Requirements(resp) {
|
|
140
|
-
// Try PAYMENT-REQUIRED header (base64-encoded JSON)
|
|
141
|
-
const prHeader = resp.headers.get("payment-required");
|
|
142
|
-
if (prHeader) {
|
|
143
|
-
try {
|
|
144
|
-
const decoded = JSON.parse(atob(prHeader));
|
|
145
|
-
return PayClient.extractRequirements(decoded);
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
// Fall through to body parsing
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// Fallback: parse from response body
|
|
152
|
-
const body = (await resp.json());
|
|
153
|
-
const requirements = (body.requirements ?? body);
|
|
154
|
-
return PayClient.extractRequirements(requirements);
|
|
155
|
-
}
|
|
156
|
-
static extractRequirements(obj) {
|
|
157
|
-
// x402 v2 format: { accepts: [{ payTo, amount, extra: { settlement } }] }
|
|
158
|
-
const accepts = obj.accepts;
|
|
159
|
-
if (Array.isArray(accepts) && accepts.length > 0) {
|
|
160
|
-
const offer = accepts[0];
|
|
161
|
-
const extra = (offer.extra ?? {});
|
|
162
|
-
return {
|
|
163
|
-
settlement: String(extra.settlement ?? "direct"),
|
|
164
|
-
amount: Number(offer.amount ?? 0),
|
|
165
|
-
to: String(offer.payTo ?? ""),
|
|
166
|
-
accepted: offer,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
// Legacy v1 format
|
|
170
|
-
return {
|
|
171
|
-
settlement: String(obj.settlement ?? "direct"),
|
|
172
|
-
amount: Number(obj.amount ?? 0),
|
|
173
|
-
to: String(obj.to ?? ""),
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
async handle402(resp, url, method, body, headers) {
|
|
177
|
-
const reqs = await this.parse402Requirements(resp);
|
|
178
|
-
if (reqs.settlement === "tab") {
|
|
179
|
-
return this.settleViaTab(url, method, body, headers, reqs);
|
|
180
|
-
}
|
|
181
|
-
return this.settleViaDirect(url, method, body, headers, reqs);
|
|
182
|
-
}
|
|
183
|
-
async settleViaDirect(url, method, body, headers, reqs) {
|
|
184
|
-
if (!this._privateKey) {
|
|
185
|
-
throw new PayValidationError("privateKey required for x402 direct settlement", "privateKey");
|
|
186
|
-
}
|
|
187
|
-
const contracts = await this.getContracts();
|
|
188
|
-
const auth = await signTransferAuthorization(this._privateKey, reqs.to, reqs.amount, this._chainId, contracts.usdc);
|
|
189
|
-
const paymentPayload = {
|
|
190
|
-
x402Version: 2,
|
|
191
|
-
accepted: reqs.accepted ?? {
|
|
192
|
-
scheme: "exact",
|
|
193
|
-
network: `eip155:${this._chainId}`,
|
|
194
|
-
amount: String(reqs.amount),
|
|
195
|
-
payTo: reqs.to,
|
|
196
|
-
},
|
|
197
|
-
payload: {
|
|
198
|
-
signature: combinedSignature(auth),
|
|
199
|
-
authorization: {
|
|
200
|
-
from: auth.from,
|
|
201
|
-
to: auth.to,
|
|
202
|
-
value: String(reqs.amount),
|
|
203
|
-
validAfter: "0",
|
|
204
|
-
validBefore: "0",
|
|
205
|
-
nonce: auth.nonce,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
extensions: {},
|
|
209
|
-
};
|
|
210
|
-
return fetch(url, {
|
|
211
|
-
method,
|
|
212
|
-
body,
|
|
213
|
-
headers: {
|
|
214
|
-
...headers,
|
|
215
|
-
"Content-Type": "application/json",
|
|
216
|
-
"PAYMENT-SIGNATURE": btoa(JSON.stringify(paymentPayload)),
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
async settleViaTab(url, method, body, headers, reqs) {
|
|
221
|
-
const tabs = await this.listTabs();
|
|
222
|
-
let tab = tabs.find((t) => t.provider === reqs.to && t.status === "open");
|
|
223
|
-
if (!tab) {
|
|
224
|
-
const tabAmount = Math.max(reqs.amount * PayClient.X402_TAB_MULTIPLIER, TAB_MIN);
|
|
225
|
-
tab = await this.openTab(reqs.to, tabAmount, {
|
|
226
|
-
maxChargePerCall: reqs.amount,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
const chargeData = await this.post(`/tabs/${tab.tabId}/charge`, { amount: reqs.amount });
|
|
230
|
-
const paymentPayload = {
|
|
231
|
-
x402Version: 2,
|
|
232
|
-
accepted: reqs.accepted ?? {
|
|
233
|
-
scheme: "exact",
|
|
234
|
-
network: `eip155:${this._chainId}`,
|
|
235
|
-
amount: String(reqs.amount),
|
|
236
|
-
payTo: reqs.to,
|
|
237
|
-
},
|
|
238
|
-
payload: {
|
|
239
|
-
authorization: { from: this._address },
|
|
240
|
-
},
|
|
241
|
-
extensions: {
|
|
242
|
-
pay: {
|
|
243
|
-
settlement: "tab",
|
|
244
|
-
tabId: tab.tabId,
|
|
245
|
-
chargeId: chargeData.charge_id ?? "",
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
return fetch(url, {
|
|
250
|
-
method,
|
|
251
|
-
body,
|
|
252
|
-
headers: {
|
|
253
|
-
...headers,
|
|
254
|
-
"Content-Type": "application/json",
|
|
255
|
-
"PAYMENT-SIGNATURE": btoa(JSON.stringify(paymentPayload)),
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
// ── Wallet ──────────────────────────────────────────────────────
|
|
260
|
-
async getStatus() {
|
|
261
|
-
const raw = await this.get("/status");
|
|
262
|
-
return {
|
|
263
|
-
address: raw.wallet,
|
|
264
|
-
balance: raw.balance_usdc ? Number(raw.balance_usdc) : 0,
|
|
265
|
-
openTabs: [],
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
// ── Webhooks ────────────────────────────────────────────────────
|
|
269
|
-
async registerWebhook(url, options = {}) {
|
|
270
|
-
const payload = { url };
|
|
271
|
-
if (options.events)
|
|
272
|
-
payload.events = options.events;
|
|
273
|
-
if (options.secret)
|
|
274
|
-
payload.secret = options.secret;
|
|
275
|
-
const raw = await this.post("/webhooks", payload);
|
|
276
|
-
return { webhookId: raw.id, url: raw.url, events: raw.events };
|
|
277
|
-
}
|
|
278
|
-
async listWebhooks() {
|
|
279
|
-
const raw = await this.get("/webhooks");
|
|
280
|
-
return raw.map(w => ({ webhookId: w.id, url: w.url, events: w.events }));
|
|
281
|
-
}
|
|
282
|
-
async deleteWebhook(webhookId) {
|
|
283
|
-
await this.del(`/webhooks/${webhookId}`);
|
|
284
|
-
}
|
|
285
|
-
// ── Funding ─────────────────────────────────────────────────────
|
|
286
|
-
/** Create a one-time fund link via the server. Returns the dashboard URL. */
|
|
287
|
-
async createFundLink(options) {
|
|
288
|
-
const data = await this.post("/links/fund", {
|
|
289
|
-
messages: options?.messages ?? [],
|
|
290
|
-
agent_name: options?.agentName,
|
|
291
|
-
});
|
|
292
|
-
return data.url;
|
|
293
|
-
}
|
|
294
|
-
/** Create a one-time withdraw link via the server. Returns the dashboard URL. */
|
|
295
|
-
async createWithdrawLink(options) {
|
|
296
|
-
const data = await this.post("/links/withdraw", {
|
|
297
|
-
messages: options?.messages ?? [],
|
|
298
|
-
agent_name: options?.agentName,
|
|
299
|
-
});
|
|
300
|
-
return data.url;
|
|
301
|
-
}
|
|
302
|
-
// ── Discovery ──────────────────────────────────────────────────
|
|
303
|
-
/** Search for discoverable paid API services. Public, no auth required. */
|
|
304
|
-
async discover(options) {
|
|
305
|
-
const params = new URLSearchParams();
|
|
306
|
-
if (options?.query)
|
|
307
|
-
params.set("q", options.query);
|
|
308
|
-
if (options?.sort)
|
|
309
|
-
params.set("sort", options.sort);
|
|
310
|
-
if (options?.category)
|
|
311
|
-
params.set("category", options.category);
|
|
312
|
-
if (options?.settlement)
|
|
313
|
-
params.set("settlement", options.settlement);
|
|
314
|
-
const qs = params.toString();
|
|
315
|
-
const url = `${this.apiUrl}/discover${qs ? `?${qs}` : ""}`;
|
|
316
|
-
const resp = await fetch(url);
|
|
317
|
-
if (!resp.ok) {
|
|
318
|
-
const body = await resp.text().catch(() => "");
|
|
319
|
-
throw new PayServerError(`discover failed: ${body}`, resp.status);
|
|
320
|
-
}
|
|
321
|
-
const data = (await resp.json());
|
|
322
|
-
return data.services;
|
|
323
|
-
}
|
|
324
|
-
// ── Permit signing ────────────────────────────────────────────
|
|
325
|
-
/**
|
|
326
|
-
* Prepare and sign a USDC EIP-2612 permit.
|
|
327
|
-
*
|
|
328
|
-
* 1. Calls GET /api/v1/permit/prepare to get the EIP-712 hash
|
|
329
|
-
* 2. Signs the hash with the agent's private key
|
|
330
|
-
* 3. Returns {nonce, deadline, v, r, s} for inclusion in payment body
|
|
331
|
-
*/
|
|
332
|
-
async prepareAndSignPermit(amount, spender) {
|
|
333
|
-
if (!this._privateKey) {
|
|
334
|
-
throw new PayValidationError("privateKey required for permit signing", "privateKey");
|
|
335
|
-
}
|
|
336
|
-
const prepare = await this.post("/permit/prepare", { amount, spender });
|
|
337
|
-
// Sign the hash
|
|
338
|
-
const hashHex = prepare.hash;
|
|
339
|
-
const raw = await viemSign({ hash: hashHex, privateKey: this._privateKey });
|
|
340
|
-
const sigHex = serializeSignature(raw);
|
|
341
|
-
// Parse signature into v, r, s
|
|
342
|
-
const sigBytes = Buffer.from(sigHex.slice(2), "hex");
|
|
343
|
-
const r = "0x" + sigBytes.subarray(0, 32).toString("hex");
|
|
344
|
-
const s = "0x" + sigBytes.subarray(32, 64).toString("hex");
|
|
345
|
-
const v = sigBytes[64];
|
|
346
|
-
return {
|
|
347
|
-
nonce: prepare.nonce,
|
|
348
|
-
deadline: prepare.deadline,
|
|
349
|
-
v,
|
|
350
|
-
r,
|
|
351
|
-
s,
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
// ── Auth headers ──────────────────────────────────────────────
|
|
355
|
-
async authHeaders(method, path) {
|
|
356
|
-
if (!this._authConfig)
|
|
357
|
-
return null;
|
|
358
|
-
// Sign only the path portion (no query string) — server verifies against uri.path().
|
|
359
|
-
// e.g., basePath="/api/v1" + path="/status" → "/api/v1/status"
|
|
360
|
-
const fullPath = this._basePath + path.split("?")[0];
|
|
361
|
-
if (this._privateKey) {
|
|
362
|
-
return buildAuthHeaders(this._privateKey, method, fullPath, this._authConfig);
|
|
363
|
-
}
|
|
364
|
-
if (this.signer.address) {
|
|
365
|
-
return buildAuthHeadersWithSigner(this.signer, method, fullPath, this._authConfig);
|
|
366
|
-
}
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
// ── HTTP helpers ────────────────────────────────────────────────
|
|
370
|
-
async get(path) {
|
|
371
|
-
let resp;
|
|
372
|
-
try {
|
|
373
|
-
const auth = await this.authHeaders("GET", path);
|
|
374
|
-
resp = await fetch(`${this.apiUrl}${path}`, {
|
|
375
|
-
method: "GET",
|
|
376
|
-
headers: {
|
|
377
|
-
"Content-Type": "application/json",
|
|
378
|
-
...auth,
|
|
379
|
-
},
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
catch (e) {
|
|
383
|
-
throw new PayNetworkError(String(e));
|
|
384
|
-
}
|
|
385
|
-
return this.handleResponse(resp);
|
|
386
|
-
}
|
|
387
|
-
async post(path, payload) {
|
|
388
|
-
let resp;
|
|
389
|
-
try {
|
|
390
|
-
const auth = await this.authHeaders("POST", path);
|
|
391
|
-
resp = await fetch(`${this.apiUrl}${path}`, {
|
|
392
|
-
method: "POST",
|
|
393
|
-
headers: {
|
|
394
|
-
"Content-Type": "application/json",
|
|
395
|
-
...auth,
|
|
396
|
-
},
|
|
397
|
-
body: JSON.stringify(payload),
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
catch (e) {
|
|
401
|
-
throw new PayNetworkError(String(e));
|
|
402
|
-
}
|
|
403
|
-
return this.handleResponse(resp);
|
|
404
|
-
}
|
|
405
|
-
async del(path) {
|
|
406
|
-
let resp;
|
|
407
|
-
try {
|
|
408
|
-
const auth = await this.authHeaders("DELETE", path);
|
|
409
|
-
resp = await fetch(`${this.apiUrl}${path}`, {
|
|
410
|
-
method: "DELETE",
|
|
411
|
-
headers: {
|
|
412
|
-
"Content-Type": "application/json",
|
|
413
|
-
...auth,
|
|
414
|
-
},
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
catch (e) {
|
|
418
|
-
throw new PayNetworkError(String(e));
|
|
419
|
-
}
|
|
420
|
-
if (resp.status >= 400) {
|
|
421
|
-
const text = await resp.text();
|
|
422
|
-
throw new PayServerError(text, resp.status);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
async handleResponse(resp) {
|
|
426
|
-
if (resp.status >= 400) {
|
|
427
|
-
let msg;
|
|
428
|
-
try {
|
|
429
|
-
const body = (await resp.json());
|
|
430
|
-
msg = body.error ?? (await resp.text());
|
|
431
|
-
}
|
|
432
|
-
catch {
|
|
433
|
-
msg = await resp.text();
|
|
434
|
-
}
|
|
435
|
-
throw new PayServerError(msg, resp.status);
|
|
436
|
-
}
|
|
437
|
-
if (resp.status === 204) {
|
|
438
|
-
return undefined;
|
|
439
|
-
}
|
|
440
|
-
return (await resp.json());
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,Y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GAAG,EAAE,CAAC;YACxB,OAAO,SAAc,CAAC;QACxB,CAAC;QACD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAM,CAAC;IAClC,CAAC"}
|
package/dist/models.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/** Tab lifecycle states. */
|
|
2
|
-
export type TabStatus = "open" | "closed";
|
|
3
|
-
/** Result of a direct payment. */
|
|
4
|
-
export interface DirectPaymentResult {
|
|
5
|
-
txHash: string;
|
|
6
|
-
status: string;
|
|
7
|
-
/** Amount in USDC micro-units (6 decimals). */
|
|
8
|
-
amount: number;
|
|
9
|
-
/** Fee deducted in USDC micro-units. */
|
|
10
|
-
fee: number;
|
|
11
|
-
}
|
|
12
|
-
/** Tab state. */
|
|
13
|
-
export interface Tab {
|
|
14
|
-
tabId: string;
|
|
15
|
-
provider: string;
|
|
16
|
-
/** Total locked amount in USDC micro-units. */
|
|
17
|
-
amount: number;
|
|
18
|
-
/** Remaining balance in USDC micro-units. */
|
|
19
|
-
balanceRemaining: number;
|
|
20
|
-
/** Total charged so far in USDC micro-units. */
|
|
21
|
-
totalCharged: number;
|
|
22
|
-
/** Number of charges made. */
|
|
23
|
-
chargeCount: number;
|
|
24
|
-
/** Max per-charge limit in USDC micro-units. */
|
|
25
|
-
maxChargePerCall: number;
|
|
26
|
-
/** Total withdrawn so far in USDC micro-units. */
|
|
27
|
-
totalWithdrawn: number;
|
|
28
|
-
status: TabStatus;
|
|
29
|
-
/** Number of charges buffered awaiting batch settlement. */
|
|
30
|
-
pendingChargeCount: number;
|
|
31
|
-
/** Total amount of pending charges in USDC micro-units. */
|
|
32
|
-
pendingChargeTotal: number;
|
|
33
|
-
/** balance_remaining minus pending charges — the true available balance. */
|
|
34
|
-
effectiveBalance: number;
|
|
35
|
-
}
|
|
36
|
-
/** Wallet status. */
|
|
37
|
-
export interface StatusResponse {
|
|
38
|
-
address: string;
|
|
39
|
-
/** USDC balance in micro-units. */
|
|
40
|
-
balance: number;
|
|
41
|
-
openTabs: Tab[];
|
|
42
|
-
}
|
|
43
|
-
/** Discoverable service from the facilitator catalog. */
|
|
44
|
-
export interface DiscoverService {
|
|
45
|
-
name: string;
|
|
46
|
-
description: string;
|
|
47
|
-
/** Public base URL for pay request (e.g. "https://weather.example.com"). */
|
|
48
|
-
baseUrl: string;
|
|
49
|
-
category: string;
|
|
50
|
-
keywords: string[];
|
|
51
|
-
routes: {
|
|
52
|
-
path: string;
|
|
53
|
-
method?: string;
|
|
54
|
-
price?: string;
|
|
55
|
-
settlement?: string;
|
|
56
|
-
free?: boolean;
|
|
57
|
-
}[];
|
|
58
|
-
/** URL to API documentation (OpenAPI spec, docs page, etc). */
|
|
59
|
-
docsUrl?: string;
|
|
60
|
-
}
|
|
61
|
-
/** Options for discover search. */
|
|
62
|
-
export interface DiscoverOptions {
|
|
63
|
-
/** Search query (matches keywords and description). */
|
|
64
|
-
query?: string;
|
|
65
|
-
/** Sort order: "volume" (default), "newest", "price_asc", "price_desc". */
|
|
66
|
-
sort?: string;
|
|
67
|
-
/** Filter by category. */
|
|
68
|
-
category?: string;
|
|
69
|
-
/** Filter by settlement mode: "direct" or "tab". */
|
|
70
|
-
settlement?: string;
|
|
71
|
-
}
|
|
72
|
-
/** Registered webhook. */
|
|
73
|
-
export interface WebhookRegistration {
|
|
74
|
-
webhookId: string;
|
|
75
|
-
url: string;
|
|
76
|
-
events: string[];
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=models.d.ts.map
|
package/dist/models.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1C,kCAAkC;AAClC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+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AC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,0BAA0B;AAC1B,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
package/dist/models.js
DELETED
package/dist/models.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":""}
|
package/dist/ows-signer.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OWS (Open Wallet Standard) signer adapter.
|
|
3
|
-
*
|
|
4
|
-
* Wraps the @open-wallet-standard/core FFI module to implement the Pay
|
|
5
|
-
* Signer interface. OWS handles encrypted key storage + policy-gated signing;
|
|
6
|
-
* this adapter translates between Pay's (domain, types, value) EIP-712
|
|
7
|
-
* calling convention and OWS's JSON string convention.
|
|
8
|
-
*
|
|
9
|
-
* Priority: Pay's own CLI signer is #1, OWS is #2. OWS only activates when
|
|
10
|
-
* OWS_WALLET_ID is set AND @open-wallet-standard/core is installed. If the
|
|
11
|
-
* env var is set but the package is missing, creation fails loud with
|
|
12
|
-
* install instructions.
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* const signer = await OwsSigner.create({ walletId: "pay-my-agent" });
|
|
16
|
-
* const wallet = new Wallet({ signer });
|
|
17
|
-
*/
|
|
18
|
-
import type { Signer } from "./signer.js";
|
|
19
|
-
/** EIP-712 domain fields. */
|
|
20
|
-
export interface TypedDataDomain {
|
|
21
|
-
name?: string;
|
|
22
|
-
version?: string;
|
|
23
|
-
chainId?: number | bigint;
|
|
24
|
-
verifyingContract?: string;
|
|
25
|
-
}
|
|
26
|
-
/** EIP-712 type definitions. */
|
|
27
|
-
export interface TypedDataTypes {
|
|
28
|
-
[typeName: string]: Array<{
|
|
29
|
-
name: string;
|
|
30
|
-
type: string;
|
|
31
|
-
}>;
|
|
32
|
-
}
|
|
33
|
-
/** Options for {@link OwsSigner.create}. */
|
|
34
|
-
export interface OwsSignerOptions {
|
|
35
|
-
/** OWS wallet name or UUID (e.g. "pay-my-agent"). */
|
|
36
|
-
walletId: string;
|
|
37
|
-
/** Chain name - only used for logging, not passed to OWS. Default: "base". */
|
|
38
|
-
chain?: string;
|
|
39
|
-
/** OWS API key token (passed as passphrase to OWS signing calls). */
|
|
40
|
-
owsApiKey?: string;
|
|
41
|
-
/** @internal Inject OWS module for testing - bypasses dynamic import. */
|
|
42
|
-
_owsModule?: unknown;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Signer backed by the Open Wallet Standard.
|
|
46
|
-
*
|
|
47
|
-
* - Keys live in OWS's encrypted vault (~/.ows/wallets/), never in env vars.
|
|
48
|
-
* - Signing calls go through OWS FFI, which evaluates policy rules before signing.
|
|
49
|
-
* - Use the static {@link create} factory - the constructor is private because
|
|
50
|
-
* address resolution requires a synchronous FFI call that must happen before
|
|
51
|
-
* sign() can work.
|
|
52
|
-
*/
|
|
53
|
-
export declare class OwsSigner implements Signer {
|
|
54
|
-
#private;
|
|
55
|
-
private constructor();
|
|
56
|
-
/**
|
|
57
|
-
* Create an OwsSigner by resolving the wallet address from OWS.
|
|
58
|
-
*
|
|
59
|
-
* Lazily imports @open-wallet-standard/core so the module is only required
|
|
60
|
-
* when OWS is actually used (keeps it an optional peer dependency).
|
|
61
|
-
*/
|
|
62
|
-
static create(options: OwsSignerOptions): Promise<OwsSigner>;
|
|
63
|
-
get address(): string;
|
|
64
|
-
sign(_hash: Uint8Array): Uint8Array;
|
|
65
|
-
/**
|
|
66
|
-
* Sign EIP-712 typed data via OWS FFI.
|
|
67
|
-
*
|
|
68
|
-
* This is the primary signing method for OWS. Pay's auth module should
|
|
69
|
-
* call this instead of sign() when an OwsSigner is detected.
|
|
70
|
-
*/
|
|
71
|
-
signTypedData(domain: TypedDataDomain, types: TypedDataTypes, value: Record<string, unknown>): Promise<string>;
|
|
72
|
-
/** Prevent wallet ID / key leakage in serialization. */
|
|
73
|
-
toJSON(): Record<string, string>;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=ows-signer.d.ts.map
|
package/dist/ows-signer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ows-signer.d.ts","sourceRoot":"","sources":["../src/ows-signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAwB1C,6BAA6B;AAC7B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED,4CAA4C;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;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