@t2000/sdk 10.25.1 → 10.27.0
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/dist/browser.cjs +22 -11
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +22 -11
- package/dist/browser.js.map +1 -1
- package/dist/{commerce-B_eH6fvR.d.cts → commerce-DR_F-Eg6.d.cts} +56 -2
- package/dist/{commerce-B_eH6fvR.d.ts → commerce-DR_F-Eg6.d.ts} +56 -2
- package/dist/index.cjs +97 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -3
- package/dist/index.d.ts +31 -3
- package/dist/index.js +94 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.cjs
CHANGED
|
@@ -544,11 +544,8 @@ function preflightPay(input) {
|
|
|
544
544
|
}
|
|
545
545
|
return PREFLIGHT_OK;
|
|
546
546
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
let options = args.options;
|
|
550
|
-
const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
|
|
551
|
-
if (!pf.valid) throw new exports.T2000Error(pf.code, pf.error);
|
|
547
|
+
function normalizePayRequest(input) {
|
|
548
|
+
let options = input;
|
|
552
549
|
const method = (options.method ?? "GET").toUpperCase();
|
|
553
550
|
const canHaveBody = method !== "GET" && method !== "HEAD";
|
|
554
551
|
if (canHaveBody && typeof options.body === "string" && isJsonText(options.body) && !hasContentType(options.headers)) {
|
|
@@ -557,11 +554,23 @@ async function payWithX402(args) {
|
|
|
557
554
|
headers: { ...options.headers ?? {}, "content-type": "application/json" }
|
|
558
555
|
};
|
|
559
556
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
557
|
+
return {
|
|
558
|
+
options,
|
|
559
|
+
reqInit: {
|
|
560
|
+
method,
|
|
561
|
+
headers: options.headers,
|
|
562
|
+
body: canHaveBody ? options.body : void 0
|
|
563
|
+
}
|
|
564
564
|
};
|
|
565
|
+
}
|
|
566
|
+
async function payWithX402(args) {
|
|
567
|
+
const { signer, client } = args;
|
|
568
|
+
let options = args.options;
|
|
569
|
+
const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
|
|
570
|
+
if (!pf.valid) throw new exports.T2000Error(pf.code, pf.error);
|
|
571
|
+
const normalized = normalizePayRequest(options);
|
|
572
|
+
options = normalized.options;
|
|
573
|
+
const reqInit = normalized.reqInit;
|
|
565
574
|
const probe = await fetch(options.url, reqInit);
|
|
566
575
|
if (probe.status !== 402) {
|
|
567
576
|
return finalize(probe, { paid: false });
|
|
@@ -1319,10 +1328,12 @@ init_coinSelection();
|
|
|
1319
1328
|
init_errors();
|
|
1320
1329
|
init_token_registry();
|
|
1321
1330
|
init_coinSelection();
|
|
1322
|
-
|
|
1331
|
+
var MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b91cefc098fc2eed75942dcb5bcbe7";
|
|
1332
|
+
process.env.A2A_ESCROW_OPENING_PACKAGE_ID ?? MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID;
|
|
1323
1333
|
|
|
1324
1334
|
// src/wallet/job.ts
|
|
1325
|
-
var
|
|
1335
|
+
var MAINNET_A2A_ESCROW_PACKAGE_ID = "0x358a819c1c016e2cc84ef5fbea81cba90c31f7f8a62bf45cb5e5276acf198bdd";
|
|
1336
|
+
var A2A_ESCROW_PACKAGE_ID = process.env.A2A_ESCROW_PACKAGE_ID ?? MAINNET_A2A_ESCROW_PACKAGE_ID;
|
|
1326
1337
|
var A2A_ESCROW_FEE_CONFIG_ID = process.env.A2A_ESCROW_FEE_CONFIG_ID ?? "0xddaa25570950b7484dbf20797ebcf75707be9c87cd67bef2a06ed2e81d2c494b";
|
|
1327
1338
|
var A2A_ESCROW_FEE_CONFIG_VERSION = Number(
|
|
1328
1339
|
process.env.A2A_ESCROW_FEE_CONFIG_VERSION ?? 931861903
|