@cardanowall/sdk-ts 0.1.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.
@@ -16,7 +16,7 @@ declare function verifyTx(input: VerifyTxInput): Promise<VerifyReport>;
16
16
  * Use this when you trust an upstream indexer for the (metadataCbor,
17
17
  * blockTime, blockSlot, numConfirmations) tuple and want to skip the
18
18
  * /tx_cbor + /tx_info round-trip. The caller is responsible for the
19
- * confidence that the supplied bytes actually came from a CIP-309 label-309
19
+ * confidence that the supplied bytes actually came from the label-309
20
20
  * metadata field of a confirmed Cardano transaction.
21
21
  */
22
22
  declare function verifyResolved(input: {
@@ -86,7 +86,7 @@ interface ResolvedTx {
86
86
  }
87
87
  declare const KOIOS_MAINNET_URL = "https://api.koios.rest/api/v1";
88
88
  declare const BLOCKFROST_MAINNET_HOST = "https://cardano-mainnet.blockfrost.io/api/v0";
89
- declare class NotACip309RecordError extends Error {
89
+ declare class NotALabel309RecordError extends Error {
90
90
  readonly code: "METADATA_NOT_FOUND";
91
91
  constructor(message: string);
92
92
  }
@@ -173,4 +173,4 @@ declare function fetchItemCiphertext(args: FetchItemCiphertextArgs): Promise<Uin
173
173
 
174
174
  declare function verifyReportToDict(report: VerifyReport): Record<string, unknown>;
175
175
 
176
- export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, ExitCode, FetchOutbound, HttpCallRecord, KOIOS_MAINNET_URL, NotACip309RecordError, Profile, type ResolvedTx, type TxComponents, VerifyItemDecryption, VerifyMerkleCheck, VerifyRecordSignature, VerifyReport, VerifyTxInput, VerifyTxSummary, VerifyTxWitness, VerifyUriCheck, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx };
176
+ export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, ExitCode, FetchOutbound, HttpCallRecord, KOIOS_MAINNET_URL, NotALabel309RecordError, Profile, type ResolvedTx, type TxComponents, VerifyItemDecryption, VerifyMerkleCheck, VerifyRecordSignature, VerifyReport, VerifyTxInput, VerifyTxSummary, VerifyTxWitness, VerifyUriCheck, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx };
@@ -16,7 +16,7 @@ declare function verifyTx(input: VerifyTxInput): Promise<VerifyReport>;
16
16
  * Use this when you trust an upstream indexer for the (metadataCbor,
17
17
  * blockTime, blockSlot, numConfirmations) tuple and want to skip the
18
18
  * /tx_cbor + /tx_info round-trip. The caller is responsible for the
19
- * confidence that the supplied bytes actually came from a CIP-309 label-309
19
+ * confidence that the supplied bytes actually came from the label-309
20
20
  * metadata field of a confirmed Cardano transaction.
21
21
  */
22
22
  declare function verifyResolved(input: {
@@ -86,7 +86,7 @@ interface ResolvedTx {
86
86
  }
87
87
  declare const KOIOS_MAINNET_URL = "https://api.koios.rest/api/v1";
88
88
  declare const BLOCKFROST_MAINNET_HOST = "https://cardano-mainnet.blockfrost.io/api/v0";
89
- declare class NotACip309RecordError extends Error {
89
+ declare class NotALabel309RecordError extends Error {
90
90
  readonly code: "METADATA_NOT_FOUND";
91
91
  constructor(message: string);
92
92
  }
@@ -173,4 +173,4 @@ declare function fetchItemCiphertext(args: FetchItemCiphertextArgs): Promise<Uin
173
173
 
174
174
  declare function verifyReportToDict(report: VerifyReport): Record<string, unknown>;
175
175
 
176
- export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, ExitCode, FetchOutbound, HttpCallRecord, KOIOS_MAINNET_URL, NotACip309RecordError, Profile, type ResolvedTx, type TxComponents, VerifyItemDecryption, VerifyMerkleCheck, VerifyRecordSignature, VerifyReport, VerifyTxInput, VerifyTxSummary, VerifyTxWitness, VerifyUriCheck, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx };
176
+ export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, ExitCode, FetchOutbound, HttpCallRecord, KOIOS_MAINNET_URL, NotALabel309RecordError, Profile, type ResolvedTx, type TxComponents, VerifyItemDecryption, VerifyMerkleCheck, VerifyRecordSignature, VerifyReport, VerifyTxInput, VerifyTxSummary, VerifyTxWitness, VerifyUriCheck, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx };
@@ -150,7 +150,7 @@ function decodeCanonicalCbor(bytes) {
150
150
  ...cdeDecodeOptions,
151
151
  rejectStreaming: true,
152
152
  rejectDuplicateKeys: true,
153
- // A CIP-309 record carries integers, byte/text strings, arrays, maps and
153
+ // A Label 309 record carries integers, byte/text strings, arrays, maps and
154
154
  // `null` — and nothing else. Without these rejections the major-type-7
155
155
  // surface leaks into the decoder: a float16/32/64 that happens to hold an
156
156
  // integral value (e.g. 1.0) silently decodes to the integer 1 and passes
@@ -276,7 +276,7 @@ function decodeCanonicalCbor2(bytes) {
276
276
  ...cdeDecodeOptions,
277
277
  rejectStreaming: true,
278
278
  rejectDuplicateKeys: true,
279
- // A CIP-309 record carries integers, byte/text strings, arrays, maps and
279
+ // A Label 309 record carries integers, byte/text strings, arrays, maps and
280
280
  // `null` — and nothing else. Without these rejections the major-type-7
281
281
  // surface leaks into the decoder: a float16/32/64 that happens to hold an
282
282
  // integral value (e.g. 1.0) silently decodes to the integer 1 and passes
@@ -377,7 +377,7 @@ function buildSigStructure(args) {
377
377
  args.payload
378
378
  ]);
379
379
  }
380
- function buildCip309SigStructure(args) {
380
+ function buildLabel309SigStructure(args) {
381
381
  const toSign = new Uint8Array(
382
382
  CARDANO_POE_SIG_DOMAIN_PREFIX_BYTES.length + args.recordBodyCbor.length
383
383
  );
@@ -451,7 +451,7 @@ function decodeCoseSign1(bytes) {
451
451
  signature: signatureRaw
452
452
  };
453
453
  }
454
- function coseSign1Cip309Verify(args) {
454
+ function coseSign1Label309Verify(args) {
455
455
  let decoded;
456
456
  try {
457
457
  decoded = decodeCoseSign1(args.message);
@@ -518,7 +518,7 @@ function coseSign1Cip309Verify(args) {
518
518
  payload: hashedPayload
519
519
  });
520
520
  } else {
521
- sigStructureBytes = buildCip309SigStructure({
521
+ sigStructureBytes = buildLabel309SigStructure({
522
522
  bodyProtectedBytes: decoded.protectedBytes,
523
523
  recordBodyCbor: args.detachedRecordBodyCbor
524
524
  });
@@ -908,7 +908,7 @@ function validateOneUri(chunks, path, errors) {
908
908
  const cid = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
909
909
  if (!validateCidProfile(cid)) {
910
910
  errors.push(
911
- issue("INVALID_URI", path, "ipfs:// URI is not a valid CID under the CIP-309 profile")
911
+ issue("INVALID_URI", path, "ipfs:// URI is not a valid CID under the Label 309 profile")
912
912
  );
913
913
  }
914
914
  return;
@@ -956,7 +956,7 @@ function checkItemEnc(item, idx, errors) {
956
956
  issue(
957
957
  "UNAUTHENTICATED_CIPHER_FORBIDDEN",
958
958
  [...basePath, "aead"],
959
- `'${enc.aead}' is an unauthenticated cipher; CIP-309 mandates an authenticated (AEAD) cipher`
959
+ `'${enc.aead}' is an unauthenticated cipher; Label 309 mandates an authenticated (AEAD) cipher`
960
960
  )
961
961
  );
962
962
  return;
@@ -3401,7 +3401,7 @@ function decodeCanonicalCbor3(bytes) {
3401
3401
  ...cdeDecodeOptions,
3402
3402
  rejectStreaming: true,
3403
3403
  rejectDuplicateKeys: true,
3404
- // A CIP-309 record carries integers, byte/text strings, arrays, maps and
3404
+ // A Label 309 record carries integers, byte/text strings, arrays, maps and
3405
3405
  // `null` — and nothing else. Without these rejections the major-type-7
3406
3406
  // surface leaks into the decoder: a float16/32/64 that happens to hold an
3407
3407
  // integral value (e.g. 1.0) silently decodes to the integer 1 and passes
@@ -3974,11 +3974,11 @@ function decodeIntKey(h) {
3974
3974
  // src/verifier/resolve.ts
3975
3975
  var KOIOS_MAINNET_URL = "https://api.koios.rest/api/v1";
3976
3976
  var BLOCKFROST_MAINNET_HOST = "https://cardano-mainnet.blockfrost.io/api/v0";
3977
- var NotACip309RecordError = class extends Error {
3977
+ var NotALabel309RecordError = class extends Error {
3978
3978
  code = "METADATA_NOT_FOUND";
3979
3979
  constructor(message) {
3980
3980
  super(message);
3981
- this.name = "NotACip309RecordError";
3981
+ this.name = "NotALabel309RecordError";
3982
3982
  }
3983
3983
  };
3984
3984
  async function resolveCardanoTx(args) {
@@ -3989,7 +3989,7 @@ async function resolveCardanoTx(args) {
3989
3989
  try {
3990
3990
  return await resolveViaKoios(input.txHash, koiosUrl, fetchFn);
3991
3991
  } catch (e) {
3992
- if (e instanceof NotACip309RecordError) throw e;
3992
+ if (e instanceof NotALabel309RecordError) throw e;
3993
3993
  lastErr = e;
3994
3994
  }
3995
3995
  }
@@ -3997,7 +3997,7 @@ async function resolveCardanoTx(args) {
3997
3997
  try {
3998
3998
  return await resolveViaBlockfrost(input.txHash, input.blockfrostProjectId, fetchFn);
3999
3999
  } catch (e) {
4000
- if (e instanceof NotACip309RecordError) throw e;
4000
+ if (e instanceof NotALabel309RecordError) throw e;
4001
4001
  lastErr = e;
4002
4002
  }
4003
4003
  }
@@ -4015,7 +4015,7 @@ async function resolveViaKoios(txHash, koiosUrl, fetchFn) {
4015
4015
  }
4016
4016
  const cborJson = parseJson(cborRes.bytes);
4017
4017
  if (!Array.isArray(cborJson) || cborJson.length === 0) {
4018
- throw new NotACip309RecordError("koios returned empty array for tx_cbor; tx may not exist");
4018
+ throw new NotALabel309RecordError("koios returned empty array for tx_cbor; tx may not exist");
4019
4019
  }
4020
4020
  const cborEntry = cborJson[0];
4021
4021
  if (typeof cborEntry.cbor !== "string") {
@@ -4036,7 +4036,7 @@ async function resolveViaKoios(txHash, koiosUrl, fetchFn) {
4036
4036
  }
4037
4037
  const infoJson = parseJson(infoRes.bytes);
4038
4038
  if (!Array.isArray(infoJson) || infoJson.length === 0) {
4039
- throw new NotACip309RecordError("koios returned empty array for tx_info");
4039
+ throw new NotALabel309RecordError("koios returned empty array for tx_info");
4040
4040
  }
4041
4041
  const infoEntry = infoJson[0];
4042
4042
  if (typeof infoEntry.tx_hash === "string" && infoEntry.tx_hash.toLowerCase() !== txHash.toLowerCase()) {
@@ -4181,7 +4181,7 @@ async function verifyOneSig(index, entry, recordBodyCbor, input) {
4181
4181
  return { index, verdict: "unresolved", reason: "SIGNER_KEY_UNRESOLVED" };
4182
4182
  }
4183
4183
  const { pub, signerType } = resolved;
4184
- const verifyResult = coseSign1Cip309Verify({
4184
+ const verifyResult = coseSign1Label309Verify({
4185
4185
  message: coseBytes,
4186
4186
  detachedRecordBodyCbor: recordBodyCbor,
4187
4187
  expectedSignerKey: pub
@@ -4530,7 +4530,7 @@ async function verifyTx(input) {
4530
4530
  try {
4531
4531
  resolved = await resolveCardanoTx({ input, fetchFn });
4532
4532
  } catch (e) {
4533
- if (e instanceof NotACip309RecordError) {
4533
+ if (e instanceof NotALabel309RecordError) {
4534
4534
  return base({
4535
4535
  verdict: "failed",
4536
4536
  exit_code: 1,
@@ -4843,6 +4843,6 @@ function verifyReportToDict(report) {
4843
4843
  (*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
4844
4844
  */
4845
4845
 
4846
- export { BLOCKFROST_MAINNET_HOST, BodyTooLargeError, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_OUTBOUND_MAX_BYTES, DEFAULT_PROFILE, DENY_HOSTS_DEFAULT, DenyHostError, KOIOS_MAINNET_URL, NotACip309RecordError, OutboundExhaustedError, PROFILE_RANK, UnsupportedMethodError, UnsupportedProtocolError, decodeTxSummary, decodeTxWitnesses, defaultFetchOutbound, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, fetchOutbound, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx, wrapFetchOutbound };
4846
+ export { BLOCKFROST_MAINNET_HOST, BodyTooLargeError, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_OUTBOUND_MAX_BYTES, DEFAULT_PROFILE, DENY_HOSTS_DEFAULT, DenyHostError, KOIOS_MAINNET_URL, NotALabel309RecordError, OutboundExhaustedError, PROFILE_RANK, UnsupportedMethodError, UnsupportedProtocolError, decodeTxSummary, decodeTxWitnesses, defaultFetchOutbound, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, fetchOutbound, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx, wrapFetchOutbound };
4847
4847
  //# sourceMappingURL=index.js.map
4848
4848
  //# sourceMappingURL=index.js.map