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