@t2000/sdk 10.21.0 → 10.21.2
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 +36 -0
- 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 +35 -1
- package/dist/browser.js.map +1 -1
- package/dist/{commerce-sBVg9pVH.d.cts → commerce-CS4wgrg5.d.cts} +32 -1
- package/dist/{commerce-sBVg9pVH.d.ts → commerce-CS4wgrg5.d.ts} +32 -1
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.cjs
CHANGED
|
@@ -449,6 +449,25 @@ var ZkLoginSigner = class {
|
|
|
449
449
|
// src/wallet/pay.ts
|
|
450
450
|
init_errors();
|
|
451
451
|
|
|
452
|
+
// src/wallet/activity-report.ts
|
|
453
|
+
var DEFAULT_ACTIVITY_REPORT_URL = "https://t2000.ai/api/activity/x402";
|
|
454
|
+
function resolveActivityReportUrl(override) {
|
|
455
|
+
if (override) return override;
|
|
456
|
+
const env = typeof process !== "undefined" && process.env ? process.env.T2000_ACTIVITY_REPORT_URL?.trim() : void 0;
|
|
457
|
+
return env && env.length > 0 ? env : DEFAULT_ACTIVITY_REPORT_URL;
|
|
458
|
+
}
|
|
459
|
+
function reportX402Activity(payload, url) {
|
|
460
|
+
try {
|
|
461
|
+
void fetch(resolveActivityReportUrl(url), {
|
|
462
|
+
method: "POST",
|
|
463
|
+
headers: { "content-type": "application/json" },
|
|
464
|
+
body: JSON.stringify(payload),
|
|
465
|
+
signal: AbortSignal.timeout(1500)
|
|
466
|
+
}).catch(() => void 0);
|
|
467
|
+
} catch {
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
452
471
|
// src/wallet/executeTx.ts
|
|
453
472
|
async function executeTx(client, signer, buildTx, options = {}) {
|
|
454
473
|
const tx = await buildTx();
|
|
@@ -644,6 +663,21 @@ async function payViaX402(args) {
|
|
|
644
663
|
}
|
|
645
664
|
const result = await finalize(res, { paid });
|
|
646
665
|
if (!paid) return { ...result, dialect: "x402" };
|
|
666
|
+
if (digest && options.activityReport !== false) {
|
|
667
|
+
const report = options.activityReport || {};
|
|
668
|
+
reportX402Activity(
|
|
669
|
+
{
|
|
670
|
+
digest,
|
|
671
|
+
payTo: requirements.payTo,
|
|
672
|
+
payer: signer.getAddress(),
|
|
673
|
+
amountMicroUsdc: Number(amountRaw),
|
|
674
|
+
network: requirements.network,
|
|
675
|
+
route: options.url,
|
|
676
|
+
source: report.source ?? "pay"
|
|
677
|
+
},
|
|
678
|
+
report.url
|
|
679
|
+
);
|
|
680
|
+
}
|
|
647
681
|
return {
|
|
648
682
|
...result,
|
|
649
683
|
dialect: "x402",
|
|
@@ -1585,6 +1619,7 @@ init_token_registry();
|
|
|
1585
1619
|
exports.A2A_ESCROW_FEE_CONFIG_ID = A2A_ESCROW_FEE_CONFIG_ID;
|
|
1586
1620
|
exports.A2A_ESCROW_PACKAGE_ID = A2A_ESCROW_PACKAGE_ID;
|
|
1587
1621
|
exports.CLOCK_ID = CLOCK_ID;
|
|
1622
|
+
exports.DEFAULT_ACTIVITY_REPORT_URL = DEFAULT_ACTIVITY_REPORT_URL;
|
|
1588
1623
|
exports.DEFAULT_COMMERCE_API_BASE = DEFAULT_COMMERCE_API_BASE;
|
|
1589
1624
|
exports.DEFAULT_NETWORK = DEFAULT_NETWORK;
|
|
1590
1625
|
exports.GAS_RESERVE_MIN = GAS_RESERVE_MIN;
|
|
@@ -1649,6 +1684,7 @@ exports.putJobSpec = putJobSpec;
|
|
|
1649
1684
|
exports.rawToStable = rawToStable;
|
|
1650
1685
|
exports.rawToUsdc = rawToUsdc;
|
|
1651
1686
|
exports.refineLendingLabel = refineLendingLabel;
|
|
1687
|
+
exports.reportX402Activity = reportX402Activity;
|
|
1652
1688
|
exports.resolveSymbol = resolveSymbol;
|
|
1653
1689
|
exports.resolveTokenType = resolveTokenType;
|
|
1654
1690
|
exports.stableToRaw = stableToRaw;
|