@oma3/omatrust 0.1.0-alpha.4 → 0.1.0-alpha.5

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.
@@ -565,7 +565,14 @@ async function submitDelegatedAttestation(params) {
565
565
  var EAS_EVENT_ABI = [
566
566
  "event Attested(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schemaUID)"
567
567
  ];
568
- function parseAttestation(attestation, schema) {
568
+ function parseEventTxHash(event) {
569
+ const txHash = event.transactionHash;
570
+ if (typeof txHash !== "string") {
571
+ return void 0;
572
+ }
573
+ return /^0x[0-9a-fA-F]{64}$/.test(txHash) ? txHash : void 0;
574
+ }
575
+ function parseAttestation(attestation, schema, txHash) {
569
576
  const rawData = attestation.data ?? "0x";
570
577
  const decoded = schema ? decodeAttestationData(schema, rawData) : {};
571
578
  const toBigIntSafe = (value) => {
@@ -585,6 +592,7 @@ function parseAttestation(attestation, schema) {
585
592
  schema: attestation.schema,
586
593
  attester: attestation.attester,
587
594
  recipient: attestation.recipient,
595
+ txHash,
588
596
  revocable: Boolean(attestation.revocable),
589
597
  revocationTime: toBigIntSafe(attestation.revocationTime),
590
598
  expirationTime: toBigIntSafe(attestation.expirationTime),
@@ -643,7 +651,7 @@ async function getAttestationsForDid(params) {
643
651
  if (!attestation || !attestation.uid) {
644
652
  continue;
645
653
  }
646
- results.push(parseAttestation(attestation));
654
+ results.push(parseAttestation(attestation, void 0, parseEventTxHash(event)));
647
655
  }
648
656
  results.sort((a, b) => Number(b.time - a.time));
649
657
  return results;
@@ -683,7 +691,7 @@ async function getLatestAttestations(params) {
683
691
  if (!attestation || !attestation.uid) {
684
692
  continue;
685
693
  }
686
- results.push(parseAttestation(attestation));
694
+ results.push(parseAttestation(attestation, void 0, parseEventTxHash(event)));
687
695
  }
688
696
  results.sort((a, b) => Number(b.time - a.time));
689
697
  return results.slice(0, params.limit ?? 20);