@cardanowall/sdk-ts 0.0.0 → 0.2.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 +23 -19
- package/dist/client/index.cjs +34 -34
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +52 -52
- package/dist/client/index.d.ts +52 -52
- package/dist/client/index.js +33 -33
- package/dist/client/index.js.map +1 -1
- package/dist/conformance/cli.cjs +34 -34
- package/dist/conformance/cli.cjs.map +1 -1
- package/dist/conformance/cli.js +34 -34
- package/dist/conformance/cli.js.map +1 -1
- package/dist/identity/index.cjs.map +1 -1
- package/dist/identity/index.d.cts +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/ids/index.cjs.map +1 -1
- package/dist/ids/index.js.map +1 -1
- package/dist/index.cjs +67 -67
- 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 +65 -65
- package/dist/index.js.map +1 -1
- package/dist/merkle/index.cjs +1 -1
- package/dist/merkle/index.cjs.map +1 -1
- package/dist/merkle/index.js +1 -1
- package/dist/merkle/index.js.map +1 -1
- package/dist/{types-BQMtbRCb.d.cts → types-DGsZTMuZ.d.cts} +6 -6
- package/dist/{types-BQMtbRCb.d.ts → types-DGsZTMuZ.d.ts} +6 -6
- package/dist/verifier/index.cjs +34 -34
- package/dist/verifier/index.cjs.map +1 -1
- package/dist/verifier/index.d.cts +3 -3
- package/dist/verifier/index.d.ts +3 -3
- package/dist/verifier/index.js +34 -34
- package/dist/verifier/index.js.map +1 -1
- package/package.json +10 -9
package/dist/client/index.js
CHANGED
|
@@ -56,7 +56,7 @@ function buildSigStructure(args) {
|
|
|
56
56
|
args.payload
|
|
57
57
|
]);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function buildLabel309SigStructure(args) {
|
|
60
60
|
const toSign = new Uint8Array(
|
|
61
61
|
CARDANO_POE_SIG_DOMAIN_PREFIX_BYTES.length + args.recordBodyCbor.length
|
|
62
62
|
);
|
|
@@ -384,7 +384,7 @@ function prepareSigStructure(args) {
|
|
|
384
384
|
}
|
|
385
385
|
const { protectedHeaderBytes } = encodePath1ProtectedHeader(args.signerPubkey);
|
|
386
386
|
const recordBodyCbor = encodeRecordBodyForSigning(args.record);
|
|
387
|
-
const sigStructureBytes =
|
|
387
|
+
const sigStructureBytes = buildLabel309SigStructure({
|
|
388
388
|
bodyProtectedBytes: protectedHeaderBytes,
|
|
389
389
|
recordBodyCbor
|
|
390
390
|
});
|
|
@@ -478,7 +478,7 @@ function extractProblemExtensions(problem) {
|
|
|
478
478
|
}
|
|
479
479
|
return out;
|
|
480
480
|
}
|
|
481
|
-
var
|
|
481
|
+
var Label309HttpError = class extends Error {
|
|
482
482
|
problem;
|
|
483
483
|
code;
|
|
484
484
|
httpStatus;
|
|
@@ -493,7 +493,7 @@ var Cip309HttpError = class extends Error {
|
|
|
493
493
|
retryAfterSeconds;
|
|
494
494
|
constructor(init) {
|
|
495
495
|
super(init.problem.detail || `${init.problem.title} (HTTP ${init.problem.status})`);
|
|
496
|
-
this.name = "
|
|
496
|
+
this.name = "Label309HttpError";
|
|
497
497
|
this.problem = init.problem;
|
|
498
498
|
this.code = init.problem.code;
|
|
499
499
|
this.httpStatus = init.problem.status;
|
|
@@ -510,7 +510,7 @@ var Cip309HttpError = class extends Error {
|
|
|
510
510
|
};
|
|
511
511
|
|
|
512
512
|
// src/client/batch-empty-error.ts
|
|
513
|
-
var BatchEmptyError = class extends
|
|
513
|
+
var BatchEmptyError = class extends Label309HttpError {
|
|
514
514
|
constructor(init) {
|
|
515
515
|
super(init);
|
|
516
516
|
this.name = "BatchEmptyError";
|
|
@@ -521,7 +521,7 @@ var BatchEmptyError = class extends Cip309HttpError {
|
|
|
521
521
|
function readInt(value) {
|
|
522
522
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
523
523
|
}
|
|
524
|
-
var BatchTooLargeError = class extends
|
|
524
|
+
var BatchTooLargeError = class extends Label309HttpError {
|
|
525
525
|
max;
|
|
526
526
|
got;
|
|
527
527
|
constructor(init) {
|
|
@@ -533,7 +533,7 @@ var BatchTooLargeError = class extends Cip309HttpError {
|
|
|
533
533
|
};
|
|
534
534
|
|
|
535
535
|
// src/client/forbidden-error.ts
|
|
536
|
-
var ForbiddenError = class extends
|
|
536
|
+
var ForbiddenError = class extends Label309HttpError {
|
|
537
537
|
constructor(init) {
|
|
538
538
|
super(init);
|
|
539
539
|
this.name = "ForbiddenError";
|
|
@@ -541,7 +541,7 @@ var ForbiddenError = class extends Cip309HttpError {
|
|
|
541
541
|
};
|
|
542
542
|
|
|
543
543
|
// src/client/idempotency-conflict-error.ts
|
|
544
|
-
var IdempotencyConflictError = class extends
|
|
544
|
+
var IdempotencyConflictError = class extends Label309HttpError {
|
|
545
545
|
constructor(init) {
|
|
546
546
|
super(init);
|
|
547
547
|
this.name = "IdempotencyConflictError";
|
|
@@ -561,7 +561,7 @@ function readBigIntString(value) {
|
|
|
561
561
|
function readString(value) {
|
|
562
562
|
return typeof value === "string" ? value : void 0;
|
|
563
563
|
}
|
|
564
|
-
var InsufficientFundsError = class extends
|
|
564
|
+
var InsufficientFundsError = class extends Label309HttpError {
|
|
565
565
|
balanceUsdMicros;
|
|
566
566
|
requiredUsdMicros;
|
|
567
567
|
topUpUrl;
|
|
@@ -579,7 +579,7 @@ function readScopeArray(value) {
|
|
|
579
579
|
if (!Array.isArray(value)) return [];
|
|
580
580
|
return value.filter((entry) => typeof entry === "string");
|
|
581
581
|
}
|
|
582
|
-
var InsufficientScopeError = class extends
|
|
582
|
+
var InsufficientScopeError = class extends Label309HttpError {
|
|
583
583
|
requiredScopes;
|
|
584
584
|
grantedScopes;
|
|
585
585
|
constructor(init) {
|
|
@@ -595,7 +595,7 @@ var InsufficientScopeError = class extends Cip309HttpError {
|
|
|
595
595
|
};
|
|
596
596
|
|
|
597
597
|
// src/client/internal-server-error.ts
|
|
598
|
-
var InternalServerError = class extends
|
|
598
|
+
var InternalServerError = class extends Label309HttpError {
|
|
599
599
|
constructor(init) {
|
|
600
600
|
super(init);
|
|
601
601
|
this.name = "InternalServerError";
|
|
@@ -603,7 +603,7 @@ var InternalServerError = class extends Cip309HttpError {
|
|
|
603
603
|
};
|
|
604
604
|
|
|
605
605
|
// src/client/invalid-body-error.ts
|
|
606
|
-
var InvalidBodyError = class extends
|
|
606
|
+
var InvalidBodyError = class extends Label309HttpError {
|
|
607
607
|
constructor(init) {
|
|
608
608
|
super(init);
|
|
609
609
|
this.name = "InvalidBodyError";
|
|
@@ -611,7 +611,7 @@ var InvalidBodyError = class extends Cip309HttpError {
|
|
|
611
611
|
};
|
|
612
612
|
|
|
613
613
|
// src/client/malformed-cbor-error.ts
|
|
614
|
-
var MalformedCborError = class extends
|
|
614
|
+
var MalformedCborError = class extends Label309HttpError {
|
|
615
615
|
constructor(init) {
|
|
616
616
|
super(init);
|
|
617
617
|
this.name = "MalformedCborError";
|
|
@@ -619,7 +619,7 @@ var MalformedCborError = class extends Cip309HttpError {
|
|
|
619
619
|
};
|
|
620
620
|
|
|
621
621
|
// src/client/not-found-error.ts
|
|
622
|
-
var NotFoundError = class extends
|
|
622
|
+
var NotFoundError = class extends Label309HttpError {
|
|
623
623
|
constructor(init) {
|
|
624
624
|
super(init);
|
|
625
625
|
this.name = "NotFoundError";
|
|
@@ -630,7 +630,7 @@ var NotFoundError = class extends Cip309HttpError {
|
|
|
630
630
|
function readString2(value) {
|
|
631
631
|
return typeof value === "string" ? value : void 0;
|
|
632
632
|
}
|
|
633
|
-
var QuoteAlreadyConsumedError = class extends
|
|
633
|
+
var QuoteAlreadyConsumedError = class extends Label309HttpError {
|
|
634
634
|
quoteId;
|
|
635
635
|
constructor(init) {
|
|
636
636
|
super(init);
|
|
@@ -643,7 +643,7 @@ var QuoteAlreadyConsumedError = class extends Cip309HttpError {
|
|
|
643
643
|
function readString3(value) {
|
|
644
644
|
return typeof value === "string" ? value : void 0;
|
|
645
645
|
}
|
|
646
|
-
var QuoteExpiredError = class extends
|
|
646
|
+
var QuoteExpiredError = class extends Label309HttpError {
|
|
647
647
|
quoteId;
|
|
648
648
|
constructor(init) {
|
|
649
649
|
super(init);
|
|
@@ -656,7 +656,7 @@ var QuoteExpiredError = class extends Cip309HttpError {
|
|
|
656
656
|
function readString4(value) {
|
|
657
657
|
return typeof value === "string" ? value : void 0;
|
|
658
658
|
}
|
|
659
|
-
var QuoteNotFoundError = class extends
|
|
659
|
+
var QuoteNotFoundError = class extends Label309HttpError {
|
|
660
660
|
quoteId;
|
|
661
661
|
constructor(init) {
|
|
662
662
|
super(init);
|
|
@@ -666,7 +666,7 @@ var QuoteNotFoundError = class extends Cip309HttpError {
|
|
|
666
666
|
};
|
|
667
667
|
|
|
668
668
|
// src/client/rate-limited-error.ts
|
|
669
|
-
var RateLimitedError = class extends
|
|
669
|
+
var RateLimitedError = class extends Label309HttpError {
|
|
670
670
|
constructor(init) {
|
|
671
671
|
super(init);
|
|
672
672
|
this.name = "RateLimitedError";
|
|
@@ -674,7 +674,7 @@ var RateLimitedError = class extends Cip309HttpError {
|
|
|
674
674
|
};
|
|
675
675
|
|
|
676
676
|
// src/client/record-not-found-error.ts
|
|
677
|
-
var RecordNotFoundError = class extends
|
|
677
|
+
var RecordNotFoundError = class extends Label309HttpError {
|
|
678
678
|
constructor(init) {
|
|
679
679
|
super(init);
|
|
680
680
|
this.name = "RecordNotFoundError";
|
|
@@ -682,7 +682,7 @@ var RecordNotFoundError = class extends Cip309HttpError {
|
|
|
682
682
|
};
|
|
683
683
|
|
|
684
684
|
// src/client/service-unavailable-error.ts
|
|
685
|
-
var ServiceUnavailableError = class extends
|
|
685
|
+
var ServiceUnavailableError = class extends Label309HttpError {
|
|
686
686
|
constructor(init) {
|
|
687
687
|
super(init);
|
|
688
688
|
this.name = "ServiceUnavailableError";
|
|
@@ -690,7 +690,7 @@ var ServiceUnavailableError = class extends Cip309HttpError {
|
|
|
690
690
|
};
|
|
691
691
|
|
|
692
692
|
// src/client/unauthorized-error.ts
|
|
693
|
-
var UnauthorizedError = class extends
|
|
693
|
+
var UnauthorizedError = class extends Label309HttpError {
|
|
694
694
|
constructor(init) {
|
|
695
695
|
super(init);
|
|
696
696
|
this.name = "UnauthorizedError";
|
|
@@ -698,7 +698,7 @@ var UnauthorizedError = class extends Cip309HttpError {
|
|
|
698
698
|
};
|
|
699
699
|
|
|
700
700
|
// src/client/validation-failed-error.ts
|
|
701
|
-
var ValidationFailedError = class extends
|
|
701
|
+
var ValidationFailedError = class extends Label309HttpError {
|
|
702
702
|
constructor(init) {
|
|
703
703
|
super(init);
|
|
704
704
|
this.name = "ValidationFailedError";
|
|
@@ -816,7 +816,7 @@ function parseHttpError(args) {
|
|
|
816
816
|
case "fx-stale":
|
|
817
817
|
return new ServiceUnavailableError(init);
|
|
818
818
|
default:
|
|
819
|
-
return new
|
|
819
|
+
return new Label309HttpError(init);
|
|
820
820
|
}
|
|
821
821
|
}
|
|
822
822
|
|
|
@@ -2360,7 +2360,7 @@ var PoeNamespace = class {
|
|
|
2360
2360
|
* publish time against the locked price snapshot.
|
|
2361
2361
|
*
|
|
2362
2362
|
* On HTTP-level failure (auth, rate limit, malformed request) this throws
|
|
2363
|
-
* a typed `
|
|
2363
|
+
* a typed `Label309HttpError` subclass. Per-file failures inside a 200
|
|
2364
2364
|
* response are NOT thrown by `uploads()` itself — the response body is
|
|
2365
2365
|
* returned verbatim so the caller can decide how to react. The
|
|
2366
2366
|
* higher-level helpers (`publishSealed`, `publishMerkle`) treat any failed
|
|
@@ -2445,7 +2445,7 @@ var PoeNamespace = class {
|
|
|
2445
2445
|
}
|
|
2446
2446
|
/**
|
|
2447
2447
|
* High-level hash-only publish: hash the supplied content, build a
|
|
2448
|
-
* single-item
|
|
2448
|
+
* single-item Label 309 record, optionally sign it with the caller-supplied
|
|
2449
2449
|
* signer, and submit. No Arweave, no storage round-trip — anchors the
|
|
2450
2450
|
* digest only.
|
|
2451
2451
|
*/
|
|
@@ -2463,7 +2463,7 @@ var PoeNamespace = class {
|
|
|
2463
2463
|
/**
|
|
2464
2464
|
* Sealed-PoE: encrypt the supplied content to the recipient X25519 public
|
|
2465
2465
|
* keys (age-style sealed envelope), upload the ciphertext to Arweave via
|
|
2466
|
-
* /uploads, build a
|
|
2466
|
+
* /uploads, build a Label 309 record with the resulting `ar://` URI, sign
|
|
2467
2467
|
* it (optional), and submit via /publish.
|
|
2468
2468
|
*
|
|
2469
2469
|
* The sender SHOULD include their own X25519 public key in `recipients`
|
|
@@ -2561,7 +2561,7 @@ var RecordsNamespace = class {
|
|
|
2561
2561
|
return await readJson(response);
|
|
2562
2562
|
}
|
|
2563
2563
|
/**
|
|
2564
|
-
* Run the canonical
|
|
2564
|
+
* Run the canonical Label 309 verifier against the record at `txHash`.
|
|
2565
2565
|
* Returns the same `VerifyReport` shape the standalone verifier emits —
|
|
2566
2566
|
* `VerifyReport` IS the wire body of this endpoint, with no transformer in
|
|
2567
2567
|
* between.
|
|
@@ -2584,31 +2584,31 @@ var RecordsNamespace = class {
|
|
|
2584
2584
|
}
|
|
2585
2585
|
};
|
|
2586
2586
|
|
|
2587
|
-
// src/client/
|
|
2587
|
+
// src/client/label-309-client.ts
|
|
2588
2588
|
function resolveFetch(provided) {
|
|
2589
2589
|
if (provided !== void 0) return provided;
|
|
2590
2590
|
if (typeof globalThis.fetch === "function") {
|
|
2591
2591
|
return globalThis.fetch.bind(globalThis);
|
|
2592
2592
|
}
|
|
2593
2593
|
throw new Error(
|
|
2594
|
-
"
|
|
2594
|
+
"Label309Client: no fetch implementation available. Pass `fetch` in the config or run on a platform with globalThis.fetch."
|
|
2595
2595
|
);
|
|
2596
2596
|
}
|
|
2597
2597
|
function resolveBaseUrl(config) {
|
|
2598
2598
|
const baseUrl = config.baseUrl?.trim();
|
|
2599
2599
|
if (baseUrl === void 0 || baseUrl === "") {
|
|
2600
2600
|
throw new InvalidClientConfigError(
|
|
2601
|
-
"
|
|
2601
|
+
"Label309Client: baseUrl is required. Pass the base URL of the Label 309 gateway you are targeting (e.g. https://gateway.example.com)."
|
|
2602
2602
|
);
|
|
2603
2603
|
}
|
|
2604
2604
|
return baseUrl.replace(/\/$/, "");
|
|
2605
2605
|
}
|
|
2606
|
-
var
|
|
2606
|
+
var Label309Client = class {
|
|
2607
2607
|
poe;
|
|
2608
2608
|
records;
|
|
2609
2609
|
account;
|
|
2610
2610
|
/**
|
|
2611
|
-
* Construct a client against a
|
|
2611
|
+
* Construct a client against a Label 309 gateway.
|
|
2612
2612
|
*
|
|
2613
2613
|
* `config.baseUrl` is required — there is no default deployment. The
|
|
2614
2614
|
* `config.apiKey`, when supplied, is an opaque bearer token sent verbatim as
|
|
@@ -2636,6 +2636,6 @@ var Cip309Client = class {
|
|
|
2636
2636
|
(*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
|
|
2637
2637
|
*/
|
|
2638
2638
|
|
|
2639
|
-
export { AccountNamespace, BatchEmptyError, BatchTooLargeError,
|
|
2639
|
+
export { AccountNamespace, BatchEmptyError, BatchTooLargeError, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309HttpError, MalformedCborError, NotFoundError, OffHostSignError, PartialUploadError, PoeNamespace, PublishError, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteNotFoundError, RateLimitedError, RecordNotFoundError, RecordsNamespace, ServiceUnavailableError, UnauthorizedError, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed };
|
|
2640
2640
|
//# sourceMappingURL=index.js.map
|
|
2641
2641
|
//# sourceMappingURL=index.js.map
|