@t2000/sdk 10.16.1 → 10.17.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/README.md +1 -1
- package/dist/browser.cjs +0 -17
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +0 -17
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +1 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1163,7 +1163,6 @@ async function payWithMpp(args) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
assertNotSelfPayment(signer.getAddress(), requirements.payTo);
|
|
1165
1165
|
const result = await payViaX402({ signer, client, options, reqInit, requirements });
|
|
1166
|
-
await reportDirectPayment(result, options.url);
|
|
1167
1166
|
return result;
|
|
1168
1167
|
}
|
|
1169
1168
|
const headerChallenge = await parseMppSuiChallenge(probe);
|
|
@@ -1177,7 +1176,6 @@ async function payWithMpp(args) {
|
|
|
1177
1176
|
}
|
|
1178
1177
|
assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
|
|
1179
1178
|
const result = await payViaMppHeader({ signer, client, options });
|
|
1180
|
-
await reportDirectPayment(result, options.url);
|
|
1181
1179
|
return result;
|
|
1182
1180
|
}
|
|
1183
1181
|
if (pick.kind === "incomplete") {
|
|
@@ -1192,21 +1190,6 @@ async function payWithMpp(args) {
|
|
|
1192
1190
|
`Endpoint returned 402 without an x402 'exact' / sui:${client.network} requirement in the body or an MPP 'sui' challenge in WWW-Authenticate. Nothing this SDK can pay.`
|
|
1193
1191
|
);
|
|
1194
1192
|
}
|
|
1195
|
-
var MPP_REPORT_URL = "https://mpp.t2000.ai/api/mpp/report";
|
|
1196
|
-
var REPORT_TIMEOUT_MS = 2e3;
|
|
1197
|
-
async function reportDirectPayment(result, url) {
|
|
1198
|
-
if (!result.paid || !result.receipt?.reference) return;
|
|
1199
|
-
try {
|
|
1200
|
-
if (new URL(url).origin === new URL(MPP_REPORT_URL).origin) return;
|
|
1201
|
-
await fetch(MPP_REPORT_URL, {
|
|
1202
|
-
method: "POST",
|
|
1203
|
-
headers: { "content-type": "application/json" },
|
|
1204
|
-
body: JSON.stringify({ digest: result.receipt.reference, url }),
|
|
1205
|
-
signal: AbortSignal.timeout(REPORT_TIMEOUT_MS)
|
|
1206
|
-
});
|
|
1207
|
-
} catch {
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
1193
|
async function parseMppSuiChallenge(response) {
|
|
1211
1194
|
try {
|
|
1212
1195
|
const { Challenge } = await import('mppx');
|
|
@@ -2106,7 +2089,7 @@ function resolveApiKey(apiKey) {
|
|
|
2106
2089
|
if (!key) {
|
|
2107
2090
|
throw new T2000Error(
|
|
2108
2091
|
"INVALID_KEY",
|
|
2109
|
-
"No Private Inference key. Pass `apiKey` or set T2000_API_KEY. Generate one at
|
|
2092
|
+
"No Private Inference key. Pass `apiKey` or set T2000_API_KEY. Generate one at t2000.ai/manage."
|
|
2110
2093
|
);
|
|
2111
2094
|
}
|
|
2112
2095
|
return key;
|