@t2000/sdk 10.16.1 → 10.17.1
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 +2 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1169,7 +1169,6 @@ async function payWithMpp(args) {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
assertNotSelfPayment(signer.getAddress(), requirements.payTo);
|
|
1171
1171
|
const result = await payViaX402({ signer, client, options, reqInit, requirements });
|
|
1172
|
-
await reportDirectPayment(result, options.url);
|
|
1173
1172
|
return result;
|
|
1174
1173
|
}
|
|
1175
1174
|
const headerChallenge = await parseMppSuiChallenge(probe);
|
|
@@ -1183,7 +1182,6 @@ async function payWithMpp(args) {
|
|
|
1183
1182
|
}
|
|
1184
1183
|
assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
|
|
1185
1184
|
const result = await payViaMppHeader({ signer, client, options });
|
|
1186
|
-
await reportDirectPayment(result, options.url);
|
|
1187
1185
|
return result;
|
|
1188
1186
|
}
|
|
1189
1187
|
if (pick.kind === "incomplete") {
|
|
@@ -1198,21 +1196,6 @@ async function payWithMpp(args) {
|
|
|
1198
1196
|
`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.`
|
|
1199
1197
|
);
|
|
1200
1198
|
}
|
|
1201
|
-
var MPP_REPORT_URL = "https://mpp.t2000.ai/api/mpp/report";
|
|
1202
|
-
var REPORT_TIMEOUT_MS = 2e3;
|
|
1203
|
-
async function reportDirectPayment(result, url) {
|
|
1204
|
-
if (!result.paid || !result.receipt?.reference) return;
|
|
1205
|
-
try {
|
|
1206
|
-
if (new URL(url).origin === new URL(MPP_REPORT_URL).origin) return;
|
|
1207
|
-
await fetch(MPP_REPORT_URL, {
|
|
1208
|
-
method: "POST",
|
|
1209
|
-
headers: { "content-type": "application/json" },
|
|
1210
|
-
body: JSON.stringify({ digest: result.receipt.reference, url }),
|
|
1211
|
-
signal: AbortSignal.timeout(REPORT_TIMEOUT_MS)
|
|
1212
|
-
});
|
|
1213
|
-
} catch {
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
1199
|
async function parseMppSuiChallenge(response) {
|
|
1217
1200
|
try {
|
|
1218
1201
|
const { Challenge } = await import('mppx');
|
|
@@ -2103,7 +2086,7 @@ init_errors();
|
|
|
2103
2086
|
|
|
2104
2087
|
// src/inference.ts
|
|
2105
2088
|
init_errors();
|
|
2106
|
-
var DEFAULT_API_BASE = "https://api.
|
|
2089
|
+
var DEFAULT_API_BASE = "https://api.audric.ai/v1";
|
|
2107
2090
|
function envApiKey() {
|
|
2108
2091
|
return typeof process !== "undefined" ? process.env?.T2000_API_KEY : void 0;
|
|
2109
2092
|
}
|
|
@@ -2112,7 +2095,7 @@ function resolveApiKey(apiKey) {
|
|
|
2112
2095
|
if (!key) {
|
|
2113
2096
|
throw new exports.T2000Error(
|
|
2114
2097
|
"INVALID_KEY",
|
|
2115
|
-
"No Private Inference key. Pass `apiKey` or set T2000_API_KEY. Generate one at
|
|
2098
|
+
"No Private Inference key. Pass `apiKey` or set T2000_API_KEY. Generate one at audric.ai (minting requires $5 of credit)."
|
|
2116
2099
|
);
|
|
2117
2100
|
}
|
|
2118
2101
|
return key;
|