@pafi-dev/issuer 0.28.1 → 0.29.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/dist/index.cjs CHANGED
@@ -2648,13 +2648,43 @@ async function handleClaimStatus(params) {
2648
2648
  lock.userOpHash
2649
2649
  );
2650
2650
  if (receipt) {
2651
- status = receipt.success ? "MINTED" : "FAILED";
2652
- txHash = receipt.txHash;
2653
- await params.ledger.updateMintStatus(lock.lockId, status, receipt.txHash).catch((err) => {
2654
- params.onWarning?.(
2655
- `handleClaimStatus: ledger updateMintStatus failed for lock ${lock.lockId}: ${err}`
2656
- );
2657
- });
2651
+ if (receipt.success && receipt.txHash) {
2652
+ if (!lock.tokenAddress) {
2653
+ params.onWarning?.(
2654
+ `handleClaimStatus: lock ${lock.lockId} has no tokenAddress; falling back to status-only flip (PACI5-24 defence degraded). Migrate the ledger to the multi-token schema.`
2655
+ );
2656
+ await params.ledger.updateMintStatus(lock.lockId, "MINTED", receipt.txHash).catch((err) => {
2657
+ params.onWarning?.(
2658
+ `handleClaimStatus: ledger updateMintStatus failed for lock ${lock.lockId}: ${err}`
2659
+ );
2660
+ });
2661
+ status = "MINTED";
2662
+ txHash = receipt.txHash;
2663
+ } else {
2664
+ try {
2665
+ await params.ledger.deductBalance(
2666
+ lock.userAddress,
2667
+ lock.amount,
2668
+ receipt.txHash,
2669
+ lock.tokenAddress
2670
+ );
2671
+ status = "MINTED";
2672
+ txHash = receipt.txHash;
2673
+ } catch (deductErr) {
2674
+ params.onWarning?.(
2675
+ `handleClaimStatus: deductBalance failed for lock ${lock.lockId}: ${deductErr}`
2676
+ );
2677
+ }
2678
+ }
2679
+ } else {
2680
+ await params.ledger.updateMintStatus(lock.lockId, "FAILED", receipt.txHash).catch((err) => {
2681
+ params.onWarning?.(
2682
+ `handleClaimStatus: ledger updateMintStatus failed for lock ${lock.lockId}: ${err}`
2683
+ );
2684
+ });
2685
+ status = "FAILED";
2686
+ txHash = receipt.txHash;
2687
+ }
2658
2688
  }
2659
2689
  } catch (err) {
2660
2690
  params.onWarning?.(