@1llet.xyz/erc4337-gasless-sdk 0.4.20 → 0.4.22

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.js CHANGED
@@ -1755,6 +1755,7 @@ var CCTPStrategy = class {
1755
1755
  };
1756
1756
  async function processCCTPSettlement(context, crossChainConfig) {
1757
1757
  const { paymentPayload, sourceChain, amount, recipient, facilitatorPrivateKey, depositTxHash } = context;
1758
+ console.log(`[SDK v0.4.22] Processing CCTP. DepositHash: ${depositTxHash} (${typeof depositTxHash})`);
1758
1759
  if (!facilitatorPrivateKey) {
1759
1760
  return {
1760
1761
  success: false,
@@ -1789,20 +1790,26 @@ async function processCCTPSettlement(context, crossChainConfig) {
1789
1790
  errorReason: `Invalid deposit transaction: ${e instanceof Error ? e.message : "Unknown error"}`
1790
1791
  };
1791
1792
  }
1792
- }
1793
- let facilitatorBalance = BigInt(0);
1794
- const maxRetries = depositTxHash ? 5 : 1;
1795
- for (let i = 0; i < maxRetries; i++) {
1796
- facilitatorBalance = await publicClient.readContract({
1797
- address: usdcAddress,
1798
- abi: usdcErc3009Abi,
1799
- functionName: "balanceOf",
1800
- args: [facilitatorAccount.address]
1801
- });
1802
- if (facilitatorBalance >= amountBigInt) break;
1803
- if (depositTxHash) await new Promise((r) => setTimeout(r, 2e3));
1804
- }
1805
- if (facilitatorBalance < amountBigInt) {
1793
+ let facilitatorBalance = BigInt(0);
1794
+ const maxRetries = 5;
1795
+ for (let i = 0; i < maxRetries; i++) {
1796
+ facilitatorBalance = await publicClient.readContract({
1797
+ address: usdcAddress,
1798
+ abi: usdcErc3009Abi,
1799
+ functionName: "balanceOf",
1800
+ args: [facilitatorAccount.address]
1801
+ });
1802
+ if (facilitatorBalance >= amountBigInt) break;
1803
+ await new Promise((r) => setTimeout(r, 2e3));
1804
+ }
1805
+ if (facilitatorBalance < amountBigInt) {
1806
+ return {
1807
+ success: false,
1808
+ errorReason: "Deposit verified but facilitator balance insufficient (Funds sent to wrong address?)"
1809
+ };
1810
+ }
1811
+ } else {
1812
+ console.log("[SDK v0.4.22] No deposit hash. Returning PENDING_USER_DEPOSIT.");
1806
1813
  return {
1807
1814
  success: true,
1808
1815
  data: {
@@ -1811,10 +1818,10 @@ async function processCCTPSettlement(context, crossChainConfig) {
1811
1818
  chainId: networkConfig.chainId
1812
1819
  },
1813
1820
  attestation: {
1814
- message: "PENDING_USER_DEPOSIT",
1821
+ message: "PENDING_USER_DEPOSIT_v22",
1815
1822
  attestation: "0x"
1816
1823
  },
1817
- transactionHash: "PENDING_USER_DEPOSIT"
1824
+ transactionHash: "PENDING_USER_DEPOSIT_v22"
1818
1825
  };
1819
1826
  }
1820
1827
  const transferHash = depositTxHash || "0x0000000000000000000000000000000000000000000000000000000000000000";