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