@hashgraphonline/standards-sdk 0.1.158 → 0.1.159
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/cjs/inscribe/inscriber.d.ts +1 -1
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/inscription-cost.d.ts +12 -0
- package/dist/cjs/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/cjs/inscribe/types.d.ts +5 -1
- package/dist/cjs/inscribe/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/inscribe/inscriber.d.ts +1 -1
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/inscription-cost.d.ts +12 -0
- package/dist/es/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/es/inscribe/types.d.ts +5 -1
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es109.js +1 -1
- package/dist/es/standards-sdk.es116.js +5 -5
- package/dist/es/standards-sdk.es126.js +1 -1
- package/dist/es/standards-sdk.es127.js +1 -1
- package/dist/es/standards-sdk.es128.js +5 -5
- package/dist/es/standards-sdk.es130.js +32 -44
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +1 -1
- package/dist/es/standards-sdk.es137.js +12 -12
- package/dist/es/standards-sdk.es148.js +240 -78
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +237 -51
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +160 -72
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +318 -13
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +336 -232
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +410 -129
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +209 -200
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +64 -334
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +13 -449
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +65 -323
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +49 -69
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +65 -153
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es160.js +152 -202
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +206 -223
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +227 -107
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +98 -105
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +105 -140
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +140 -164
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +165 -119
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +111 -303
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +297 -225
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +253 -110
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +119 -0
- package/dist/es/standards-sdk.es170.js.map +1 -0
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es58.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/package.json +2 -2
|
@@ -4391,6 +4391,14 @@ function detectKeyTypeFromString(privateKeyString) {
|
|
|
4391
4391
|
}
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
|
+
function normalizeAuthBaseUrl(input) {
|
|
4395
|
+
let url2 = input.trim();
|
|
4396
|
+
url2 = url2.replace(/\/+$/, "");
|
|
4397
|
+
if (url2.endsWith("/api")) {
|
|
4398
|
+
return url2.slice(0, -4);
|
|
4399
|
+
}
|
|
4400
|
+
return url2;
|
|
4401
|
+
}
|
|
4394
4402
|
class Auth {
|
|
4395
4403
|
constructor(config) {
|
|
4396
4404
|
__publicField(this, "accountId");
|
|
@@ -4405,7 +4413,9 @@ class Auth {
|
|
|
4405
4413
|
this.privateKey = config.privateKey;
|
|
4406
4414
|
}
|
|
4407
4415
|
this.network = config.network || "mainnet";
|
|
4408
|
-
this.baseUrl =
|
|
4416
|
+
this.baseUrl = normalizeAuthBaseUrl(
|
|
4417
|
+
config.baseUrl || "https://kiloscribe.com"
|
|
4418
|
+
);
|
|
4409
4419
|
}
|
|
4410
4420
|
async authenticate() {
|
|
4411
4421
|
var _a2, _b2, _c;
|
|
@@ -11305,6 +11315,125 @@ Object.assign(lookup, {
|
|
|
11305
11315
|
io: lookup,
|
|
11306
11316
|
connect: lookup
|
|
11307
11317
|
});
|
|
11318
|
+
function isRecord(value2) {
|
|
11319
|
+
return typeof value2 === "object" && value2 !== null;
|
|
11320
|
+
}
|
|
11321
|
+
function collectMessageStrings(value2, out, depth = 0) {
|
|
11322
|
+
if (depth > 5) return;
|
|
11323
|
+
if (typeof value2 === "string") {
|
|
11324
|
+
const trimmed = value2.trim();
|
|
11325
|
+
if (trimmed) out.push(trimmed);
|
|
11326
|
+
return;
|
|
11327
|
+
}
|
|
11328
|
+
if (Array.isArray(value2)) {
|
|
11329
|
+
for (const item of value2) collectMessageStrings(item, out, depth + 1);
|
|
11330
|
+
return;
|
|
11331
|
+
}
|
|
11332
|
+
if (!isRecord(value2)) return;
|
|
11333
|
+
const directKeys = [
|
|
11334
|
+
"message",
|
|
11335
|
+
"error",
|
|
11336
|
+
"detail",
|
|
11337
|
+
"reason",
|
|
11338
|
+
"title",
|
|
11339
|
+
"description"
|
|
11340
|
+
];
|
|
11341
|
+
for (const key of directKeys) {
|
|
11342
|
+
collectMessageStrings(value2[key], out, depth + 1);
|
|
11343
|
+
}
|
|
11344
|
+
const nestedKeys = ["errors", "details", "causes", "cause"];
|
|
11345
|
+
for (const key of nestedKeys) {
|
|
11346
|
+
collectMessageStrings(value2[key], out, depth + 1);
|
|
11347
|
+
}
|
|
11348
|
+
}
|
|
11349
|
+
function summarizeUnknown(value2) {
|
|
11350
|
+
if (typeof value2 === "string") return value2.trim();
|
|
11351
|
+
try {
|
|
11352
|
+
return JSON.stringify(value2);
|
|
11353
|
+
} catch {
|
|
11354
|
+
return String(value2);
|
|
11355
|
+
}
|
|
11356
|
+
}
|
|
11357
|
+
function getAxiosStatus(error) {
|
|
11358
|
+
var _a2, _b2;
|
|
11359
|
+
if (axios.isAxiosError(error)) {
|
|
11360
|
+
return (_a2 = error.response) == null ? void 0 : _a2.status;
|
|
11361
|
+
}
|
|
11362
|
+
const maybe = error;
|
|
11363
|
+
return (_b2 = maybe.response) == null ? void 0 : _b2.status;
|
|
11364
|
+
}
|
|
11365
|
+
function getAxiosCode(error) {
|
|
11366
|
+
if (axios.isAxiosError(error)) {
|
|
11367
|
+
return error.code;
|
|
11368
|
+
}
|
|
11369
|
+
const maybe = error;
|
|
11370
|
+
return maybe.code;
|
|
11371
|
+
}
|
|
11372
|
+
function getAxiosResponseData(error) {
|
|
11373
|
+
var _a2, _b2;
|
|
11374
|
+
if (axios.isAxiosError(error)) {
|
|
11375
|
+
return (_a2 = error.response) == null ? void 0 : _a2.data;
|
|
11376
|
+
}
|
|
11377
|
+
const maybe = error;
|
|
11378
|
+
return (_b2 = maybe.response) == null ? void 0 : _b2.data;
|
|
11379
|
+
}
|
|
11380
|
+
function isRetryableStartInscriptionError(error) {
|
|
11381
|
+
if (error instanceof Error && error.name === "ValidationError") {
|
|
11382
|
+
return false;
|
|
11383
|
+
}
|
|
11384
|
+
const status = getAxiosStatus(error);
|
|
11385
|
+
if (typeof status === "number") {
|
|
11386
|
+
return [408, 425, 429, 500, 502, 503, 504].includes(status);
|
|
11387
|
+
}
|
|
11388
|
+
const code2 = getAxiosCode(error);
|
|
11389
|
+
if (!code2) return false;
|
|
11390
|
+
return [
|
|
11391
|
+
"ECONNRESET",
|
|
11392
|
+
"ETIMEDOUT",
|
|
11393
|
+
"EAI_AGAIN",
|
|
11394
|
+
"ENOTFOUND",
|
|
11395
|
+
"ECONNREFUSED",
|
|
11396
|
+
"ERR_NETWORK"
|
|
11397
|
+
].includes(code2);
|
|
11398
|
+
}
|
|
11399
|
+
function formatStartInscriptionError(error) {
|
|
11400
|
+
const status = getAxiosStatus(error);
|
|
11401
|
+
const code2 = getAxiosCode(error);
|
|
11402
|
+
const responseData = getAxiosResponseData(error);
|
|
11403
|
+
const messages = [];
|
|
11404
|
+
collectMessageStrings(responseData, messages);
|
|
11405
|
+
collectMessageStrings(error, messages);
|
|
11406
|
+
const unique = Array.from(new Set(messages)).filter(Boolean);
|
|
11407
|
+
const normalizedGenericMarkers = /* @__PURE__ */ new Set([
|
|
11408
|
+
"failed to start inscription",
|
|
11409
|
+
"failed to start inscribe job",
|
|
11410
|
+
"request failed",
|
|
11411
|
+
"bad request"
|
|
11412
|
+
]);
|
|
11413
|
+
const informative = unique.filter((message) => {
|
|
11414
|
+
const normalized = message.toLowerCase().trim();
|
|
11415
|
+
if (!normalized) {
|
|
11416
|
+
return false;
|
|
11417
|
+
}
|
|
11418
|
+
if (normalizedGenericMarkers.has(normalized)) {
|
|
11419
|
+
return false;
|
|
11420
|
+
}
|
|
11421
|
+
if (normalized.startsWith("failed to start inscription")) {
|
|
11422
|
+
return false;
|
|
11423
|
+
}
|
|
11424
|
+
return true;
|
|
11425
|
+
});
|
|
11426
|
+
const best = informative.sort((a, b) => b.length - a.length)[0] ?? unique[0] ?? (error instanceof Error ? error.message : "");
|
|
11427
|
+
const suffixParts = [
|
|
11428
|
+
typeof status === "number" ? `HTTP ${status}` : null,
|
|
11429
|
+
code2 ? `code=${code2}` : null
|
|
11430
|
+
].filter(Boolean);
|
|
11431
|
+
const suffix = suffixParts.length ? ` (${suffixParts.join(", ")})` : "";
|
|
11432
|
+
if (best) {
|
|
11433
|
+
return `Failed to start inscription${suffix}: ${best}`;
|
|
11434
|
+
}
|
|
11435
|
+
return `Failed to start inscription${suffix}: ${summarizeUnknown(responseData) || summarizeUnknown(error)}`;
|
|
11436
|
+
}
|
|
11308
11437
|
const _InscriptionSDK = class _InscriptionSDK2 {
|
|
11309
11438
|
constructor(config) {
|
|
11310
11439
|
__publicField(this, "client");
|
|
@@ -11326,7 +11455,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11326
11455
|
"Content-Type": "application/json"
|
|
11327
11456
|
};
|
|
11328
11457
|
this.client = axios.create({
|
|
11329
|
-
baseURL: "https://v2-api.tier.bot/api",
|
|
11458
|
+
baseURL: config.baseURL || config.baseUrl || "https://v2-api.tier.bot/api",
|
|
11330
11459
|
headers
|
|
11331
11460
|
});
|
|
11332
11461
|
this.logger = Logger.getInstance();
|
|
@@ -11479,68 +11608,72 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11479
11608
|
* @throws Error if the inscription fails
|
|
11480
11609
|
*/
|
|
11481
11610
|
async startInscription(request) {
|
|
11482
|
-
var _a2, _b2;
|
|
11483
11611
|
try {
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11612
|
+
const operation = async () => {
|
|
11613
|
+
this.validateRequest(request);
|
|
11614
|
+
let mimeType = request.file.mimeType;
|
|
11615
|
+
if (request.file.type === "url") {
|
|
11616
|
+
const fileMetadata = await this.getFileMetadata(request.file.url);
|
|
11617
|
+
mimeType = fileMetadata.mimeType || mimeType;
|
|
11618
|
+
if (fileMetadata.size > _InscriptionSDK2.MAX_URL_FILE_SIZE) {
|
|
11619
|
+
throw new ValidationError(
|
|
11620
|
+
`File size exceeds maximum URL file limit of ${_InscriptionSDK2.MAX_URL_FILE_SIZE / 1024 / 1024}MB`
|
|
11621
|
+
);
|
|
11622
|
+
}
|
|
11623
|
+
} else if (request.file.type === "base64") {
|
|
11624
|
+
mimeType = await this.detectMimeTypeFromBase64(request.file.base64);
|
|
11493
11625
|
}
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11626
|
+
if (mimeType === "image/vnd.microsoft.icon") {
|
|
11627
|
+
mimeType = this.normalizeMimeType(mimeType);
|
|
11628
|
+
}
|
|
11629
|
+
if (request.jsonFileURL) {
|
|
11630
|
+
const jsonMetadata = await this.getFileMetadata(request.jsonFileURL);
|
|
11631
|
+
if (jsonMetadata.mimeType !== "application/json") {
|
|
11632
|
+
throw new ValidationError(
|
|
11633
|
+
"JSON file must be of type application/json"
|
|
11634
|
+
);
|
|
11635
|
+
}
|
|
11636
|
+
}
|
|
11637
|
+
const requestBody = {
|
|
11638
|
+
holderId: request.holderId,
|
|
11639
|
+
mode: request.mode,
|
|
11640
|
+
network: this.config.network,
|
|
11641
|
+
onlyJSONCollection: request.onlyJSONCollection ? 1 : 0,
|
|
11642
|
+
creator: request.creator,
|
|
11643
|
+
description: request.description,
|
|
11644
|
+
fileStandard: request.fileStandard,
|
|
11645
|
+
metadataObject: request.metadataObject,
|
|
11646
|
+
jsonFileURL: request.jsonFileURL
|
|
11647
|
+
};
|
|
11648
|
+
if (request.file.type === "url") {
|
|
11649
|
+
const response2 = await this.client.post(
|
|
11650
|
+
"/inscriptions/start-inscription",
|
|
11651
|
+
{
|
|
11652
|
+
...requestBody,
|
|
11653
|
+
fileURL: request.file.url
|
|
11654
|
+
}
|
|
11505
11655
|
);
|
|
11656
|
+
return response2.data;
|
|
11506
11657
|
}
|
|
11507
|
-
|
|
11508
|
-
const requestBody = {
|
|
11509
|
-
holderId: request.holderId,
|
|
11510
|
-
mode: request.mode,
|
|
11511
|
-
network: this.config.network,
|
|
11512
|
-
onlyJSONCollection: request.onlyJSONCollection ? 1 : 0,
|
|
11513
|
-
creator: request.creator,
|
|
11514
|
-
description: request.description,
|
|
11515
|
-
fileStandard: request.fileStandard,
|
|
11516
|
-
metadataObject: request.metadataObject,
|
|
11517
|
-
jsonFileURL: request.jsonFileURL
|
|
11518
|
-
};
|
|
11519
|
-
let response;
|
|
11520
|
-
if (request.file.type === "url") {
|
|
11521
|
-
response = await this.client.post("/inscriptions/start-inscription", {
|
|
11522
|
-
...requestBody,
|
|
11523
|
-
fileURL: request.file.url
|
|
11524
|
-
});
|
|
11525
|
-
} else {
|
|
11526
|
-
response = await this.client.post("/inscriptions/start-inscription", {
|
|
11658
|
+
const response = await this.client.post("/inscriptions/start-inscription", {
|
|
11527
11659
|
...requestBody,
|
|
11528
11660
|
fileBase64: request.file.base64,
|
|
11529
11661
|
fileName: request.file.fileName,
|
|
11530
11662
|
fileMimeType: mimeType || this.getMimeType(request.file.fileName)
|
|
11531
11663
|
});
|
|
11532
|
-
|
|
11533
|
-
|
|
11664
|
+
return response.data;
|
|
11665
|
+
};
|
|
11666
|
+
return await this.retryWithBackoff(operation, {
|
|
11667
|
+
shouldRetry: isRetryableStartInscriptionError
|
|
11668
|
+
});
|
|
11534
11669
|
} catch (error) {
|
|
11535
11670
|
if (error instanceof ValidationError) {
|
|
11536
11671
|
throw error;
|
|
11537
11672
|
}
|
|
11538
11673
|
if (axios.isAxiosError(error)) {
|
|
11539
|
-
throw new Error(
|
|
11540
|
-
((_b2 = (_a2 = error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "Failed to start inscription"
|
|
11541
|
-
);
|
|
11674
|
+
throw new Error(formatStartInscriptionError(error));
|
|
11542
11675
|
}
|
|
11543
|
-
throw error;
|
|
11676
|
+
throw new Error(formatStartInscriptionError(error));
|
|
11544
11677
|
}
|
|
11545
11678
|
}
|
|
11546
11679
|
/**
|
|
@@ -11642,11 +11775,10 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11642
11775
|
);
|
|
11643
11776
|
return wsResult;
|
|
11644
11777
|
} catch (error) {
|
|
11645
|
-
this.logger.
|
|
11646
|
-
"WebSocket inscription failed, falling back to HTTP
|
|
11778
|
+
this.logger.warn(
|
|
11779
|
+
"WebSocket inscription failed, falling back to HTTP",
|
|
11647
11780
|
error
|
|
11648
11781
|
);
|
|
11649
|
-
throw error;
|
|
11650
11782
|
}
|
|
11651
11783
|
} else {
|
|
11652
11784
|
this.logger.info(
|
|
@@ -11772,26 +11904,31 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11772
11904
|
(_b2 = this.socket) == null ? void 0 : _b2.off("inscription-complete", completeHandler);
|
|
11773
11905
|
(_c = this.socket) == null ? void 0 : _c.off("inscription-error", errorHandler);
|
|
11774
11906
|
};
|
|
11775
|
-
const
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11907
|
+
const timeoutMs = this.config.websocketInactivityTimeoutMs;
|
|
11908
|
+
const scheduleTimeout = () => {
|
|
11909
|
+
if (!timeoutMs || timeoutMs <= 0) return;
|
|
11910
|
+
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
11911
|
+
timeoutHandle = setTimeout(() => {
|
|
11912
|
+
this.logger.error(
|
|
11913
|
+
`WebSocket inscription timeout after ${timeoutMs / 1e3} seconds`,
|
|
11914
|
+
{
|
|
11915
|
+
jobId,
|
|
11916
|
+
transactionId,
|
|
11917
|
+
lastTopicId: topicId
|
|
11918
|
+
}
|
|
11919
|
+
);
|
|
11920
|
+
cleanup();
|
|
11921
|
+
resolve({
|
|
11780
11922
|
jobId,
|
|
11781
11923
|
transactionId,
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
topic_id: topicId,
|
|
11791
|
-
status: "timeout",
|
|
11792
|
-
completed: false
|
|
11793
|
-
});
|
|
11794
|
-
}, TIMEOUT_MS);
|
|
11924
|
+
topicId,
|
|
11925
|
+
topic_id: topicId,
|
|
11926
|
+
status: "timeout",
|
|
11927
|
+
completed: false
|
|
11928
|
+
});
|
|
11929
|
+
}, timeoutMs);
|
|
11930
|
+
};
|
|
11931
|
+
scheduleTimeout();
|
|
11795
11932
|
const completeHandler = (data) => {
|
|
11796
11933
|
cleanup();
|
|
11797
11934
|
resolve({
|
|
@@ -11808,6 +11945,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11808
11945
|
reject(new Error(data.error || "Inscription failed"));
|
|
11809
11946
|
};
|
|
11810
11947
|
const progressHandler = (data) => {
|
|
11948
|
+
scheduleTimeout();
|
|
11811
11949
|
this.logger.debug("Progress event received:", {
|
|
11812
11950
|
jobId: data.jobId,
|
|
11813
11951
|
status: data.status,
|
|
@@ -11961,15 +12099,19 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11961
12099
|
transactionId
|
|
11962
12100
|
};
|
|
11963
12101
|
}
|
|
11964
|
-
async retryWithBackoff(operation,
|
|
12102
|
+
async retryWithBackoff(operation, options) {
|
|
12103
|
+
const maxRetries = (options == null ? void 0 : options.maxRetries) ?? 3;
|
|
12104
|
+
const baseDelayMs = (options == null ? void 0 : options.baseDelayMs) ?? 1e3;
|
|
12105
|
+
const shouldRetry = (options == null ? void 0 : options.shouldRetry) ?? (() => true);
|
|
11965
12106
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
11966
12107
|
try {
|
|
11967
12108
|
return await operation();
|
|
11968
12109
|
} catch (error) {
|
|
11969
|
-
|
|
12110
|
+
const isLastAttempt = attempt === maxRetries - 1;
|
|
12111
|
+
if (isLastAttempt || !shouldRetry(error)) {
|
|
11970
12112
|
throw error;
|
|
11971
12113
|
}
|
|
11972
|
-
const delay =
|
|
12114
|
+
const delay = baseDelayMs * Math.pow(2, attempt);
|
|
11973
12115
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
11974
12116
|
this.logger.debug(
|
|
11975
12117
|
`Retry attempt ${attempt + 1}/${maxRetries} after ${delay}ms delay`
|
|
@@ -11999,7 +12141,11 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
11999
12141
|
);
|
|
12000
12142
|
const result = response.data;
|
|
12001
12143
|
const isCompleted = result.completed || result.status.toLowerCase() === "completed";
|
|
12002
|
-
return {
|
|
12144
|
+
return {
|
|
12145
|
+
...result,
|
|
12146
|
+
completed: isCompleted,
|
|
12147
|
+
jobId: result.tx_id || formattedTransactionId
|
|
12148
|
+
};
|
|
12003
12149
|
});
|
|
12004
12150
|
} catch (error) {
|
|
12005
12151
|
this.logger.error("Failed to retrieve inscription:", error);
|
|
@@ -12047,12 +12193,13 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
12047
12193
|
return new _InscriptionSDK2({
|
|
12048
12194
|
apiKey,
|
|
12049
12195
|
network: config.network || "mainnet",
|
|
12196
|
+
baseURL: config.baseUrl,
|
|
12050
12197
|
wsBaseUrl: config.wsBaseUrl,
|
|
12051
12198
|
connectionMode: config.connectionMode || "websocket"
|
|
12052
12199
|
});
|
|
12053
12200
|
}
|
|
12054
|
-
async waitForInscription(txId, maxAttempts =
|
|
12055
|
-
var _a2;
|
|
12201
|
+
async waitForInscription(txId, maxAttempts = Number.MAX_SAFE_INTEGER, intervalMs = 4e3, checkCompletion = false, progressCallback) {
|
|
12202
|
+
var _a2, _b2;
|
|
12056
12203
|
let attempts = 0;
|
|
12057
12204
|
let highestPercentSoFar = 0;
|
|
12058
12205
|
const reportProgress = (stage, message, percent, details) => {
|
|
@@ -12121,6 +12268,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
12121
12268
|
);
|
|
12122
12269
|
const isHashinal = result.mode === "hashinal";
|
|
12123
12270
|
const isHashinalCollection = result.mode === "hashinal-collection";
|
|
12271
|
+
const isBulkFiles = result.mode === "bulk-files";
|
|
12124
12272
|
const isDynamic = ((_a2 = result.fileStandard) == null ? void 0 : _a2.toString()) === "6";
|
|
12125
12273
|
if (isHashinalCollection && isCompleted) {
|
|
12126
12274
|
if (!checkCompletion || isCompleted) {
|
|
@@ -12166,6 +12314,19 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
12166
12314
|
return result;
|
|
12167
12315
|
}
|
|
12168
12316
|
}
|
|
12317
|
+
if (isBulkFiles && isCompleted) {
|
|
12318
|
+
const bulkUploads = (_b2 = result.files) == null ? void 0 : _b2.bulkUploads;
|
|
12319
|
+
const hasBulkUploads = Array.isArray(bulkUploads) && bulkUploads.length > 0;
|
|
12320
|
+
if (!checkCompletion || hasBulkUploads) {
|
|
12321
|
+
reportProgress(
|
|
12322
|
+
"completed",
|
|
12323
|
+
"Inscription verification complete",
|
|
12324
|
+
100,
|
|
12325
|
+
{ result }
|
|
12326
|
+
);
|
|
12327
|
+
return result;
|
|
12328
|
+
}
|
|
12329
|
+
}
|
|
12169
12330
|
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
12170
12331
|
attempts++;
|
|
12171
12332
|
}
|
|
@@ -12218,9 +12379,10 @@ __publicField(_InscriptionSDK, "VALID_MODES", [
|
|
|
12218
12379
|
"file",
|
|
12219
12380
|
"upload",
|
|
12220
12381
|
"hashinal",
|
|
12221
|
-
"hashinal-collection"
|
|
12382
|
+
"hashinal-collection",
|
|
12383
|
+
"bulk-files"
|
|
12222
12384
|
]);
|
|
12223
|
-
__publicField(_InscriptionSDK, "MAX_BASE64_SIZE",
|
|
12385
|
+
__publicField(_InscriptionSDK, "MAX_BASE64_SIZE", 32 * 1024 * 1024);
|
|
12224
12386
|
__publicField(_InscriptionSDK, "MAX_URL_FILE_SIZE", 100 * 1024 * 1024);
|
|
12225
12387
|
__publicField(_InscriptionSDK, "VALID_MIME_TYPES", {
|
|
12226
12388
|
jpg: "image/jpeg",
|