@enclave-hq/wallet-sdk 1.0.1 → 1.0.2

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
@@ -633,7 +633,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
633
633
  value: transaction.value ? `0x${BigInt(transaction.value).toString(16)}` : void 0,
634
634
  data: transaction.data || "0x",
635
635
  gas: transaction.gas ? `0x${BigInt(transaction.gas).toString(16)}` : void 0,
636
- gasPrice: transaction.gasPrice ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
636
+ gasPrice: transaction.gasPrice && transaction.gasPrice !== "auto" ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
637
637
  maxFeePerGas: transaction.maxFeePerGas ? `0x${BigInt(transaction.maxFeePerGas).toString(16)}` : void 0,
638
638
  maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? `0x${BigInt(transaction.maxPriorityFeePerGas).toString(16)}` : void 0,
639
639
  nonce: transaction.nonce !== void 0 ? `0x${transaction.nonce.toString(16)}` : void 0,
@@ -731,6 +731,16 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
731
731
  throw new Error("Wallet client not initialized");
732
732
  }
733
733
  try {
734
+ console.log("\u{1F50D} [MetaMask writeContract] params.gasPrice:", params.gasPrice, "type:", typeof params.gasPrice);
735
+ let processedGasPrice;
736
+ if (!params.gasPrice) {
737
+ processedGasPrice = void 0;
738
+ } else if (params.gasPrice === "auto") {
739
+ processedGasPrice = void 0;
740
+ } else {
741
+ processedGasPrice = BigInt(params.gasPrice);
742
+ }
743
+ console.log("\u{1F50D} [MetaMask writeContract] processedGasPrice:", processedGasPrice);
734
744
  const txHash = await this.walletClient.writeContract({
735
745
  address: params.address,
736
746
  abi: params.abi,
@@ -738,7 +748,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
738
748
  ...params.args ? { args: params.args } : {},
739
749
  value: params.value ? BigInt(params.value) : void 0,
740
750
  gas: params.gas ? BigInt(params.gas) : void 0,
741
- gasPrice: params.gasPrice ? BigInt(params.gasPrice) : void 0
751
+ gasPrice: processedGasPrice
742
752
  });
743
753
  return txHash;
744
754
  } catch (error) {
@@ -2210,11 +2220,11 @@ var WalletDetector = class {
2210
2220
  }
2211
2221
  }
2212
2222
  /**
2213
- * 检测 MetaMask
2223
+ * 检测 MetaMask(现在支持所有 window.ethereum 钱包)
2214
2224
  */
2215
2225
  isMetaMaskAvailable() {
2216
2226
  const w = window;
2217
- return !!(w.ethereum && w.ethereum.isMetaMask);
2227
+ return !!w.ethereum;
2218
2228
  }
2219
2229
  /**
2220
2230
  * 检测 TronLink