@1llet.xyz/erc4337-gasless-sdk 0.4.48 → 0.4.50

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.mjs CHANGED
@@ -668,13 +668,9 @@ var AccountAbstraction = class {
668
668
  this.tokenService = new TokenService(chainConfig, this.publicClient);
669
669
  this.userOpBuilder = new UserOpBuilder(chainConfig, this.bundlerClient, this.publicClient);
670
670
  }
671
- /**
672
- * Connect to MetaMask OR use Private Key
673
- * @param privateKey (Optional) Hex string of private key. If provided, uses local signing.
674
- */
675
- async connect(privateKey) {
676
- if (privateKey) {
677
- const account = privateKeyToAccount(privateKey);
671
+ async connect(signer) {
672
+ if (typeof signer === "string") {
673
+ const account = privateKeyToAccount(signer);
678
674
  this.owner = account.address;
679
675
  const rpcUrl = this.chainConfig.rpcUrl || this.chainConfig.chain.rpcUrls.default.http[0];
680
676
  this.walletClient = createWalletClient({
@@ -682,6 +678,10 @@ var AccountAbstraction = class {
682
678
  chain: this.chainConfig.chain,
683
679
  transport: http(rpcUrl)
684
680
  });
681
+ } else if (signer && typeof signer === "object") {
682
+ this.walletClient = signer;
683
+ if (!this.walletClient.account) throw new Error("WalletClient must have an account");
684
+ this.owner = this.walletClient.account.address;
685
685
  } else {
686
686
  if (typeof window === "undefined" || !window.ethereum) {
687
687
  throw new Error("MetaMask is not installed and no private key provided");
@@ -1971,7 +1971,7 @@ async function executeCCTPBridge(sourceChain, amount, crossChainConfig, facilita
1971
1971
  const amountBigInt = BigInt(Math.floor(parseFloat(amount) * 1e6));
1972
1972
  const feeRaw = calculateFee();
1973
1973
  const fee = BigInt(Math.floor(feeRaw * 1e6));
1974
- const minRequired = fee * BigInt(2);
1974
+ const minRequired = fee;
1975
1975
  if (amountBigInt <= minRequired) {
1976
1976
  return {
1977
1977
  success: false,
@@ -2027,8 +2027,8 @@ async function executeCCTPBridge(sourceChain, amount, crossChainConfig, facilita
2027
2027
  abi: tokenMessengerAbi,
2028
2028
  functionName: "depositForBurn",
2029
2029
  args: [
2030
- amountBigInt - fee * BigInt(2),
2031
- // Deduct 0.02 USDC Fee (2x Base Fee)
2030
+ amountBigInt - fee,
2031
+ // Deduct 0.02 USDC Fee
2032
2032
  crossChainConfig.destinationDomain,
2033
2033
  mintRecipient,
2034
2034
  networkConfig.usdc,