@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.js CHANGED
@@ -641,7 +641,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
641
641
  value: transaction.value ? `0x${BigInt(transaction.value).toString(16)}` : void 0,
642
642
  data: transaction.data || "0x",
643
643
  gas: transaction.gas ? `0x${BigInt(transaction.gas).toString(16)}` : void 0,
644
- gasPrice: transaction.gasPrice ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
644
+ gasPrice: transaction.gasPrice && transaction.gasPrice !== "auto" ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
645
645
  maxFeePerGas: transaction.maxFeePerGas ? `0x${BigInt(transaction.maxFeePerGas).toString(16)}` : void 0,
646
646
  maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? `0x${BigInt(transaction.maxPriorityFeePerGas).toString(16)}` : void 0,
647
647
  nonce: transaction.nonce !== void 0 ? `0x${transaction.nonce.toString(16)}` : void 0,
@@ -739,6 +739,16 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
739
739
  throw new Error("Wallet client not initialized");
740
740
  }
741
741
  try {
742
+ console.log("\u{1F50D} [MetaMask writeContract] params.gasPrice:", params.gasPrice, "type:", typeof params.gasPrice);
743
+ let processedGasPrice;
744
+ if (!params.gasPrice) {
745
+ processedGasPrice = void 0;
746
+ } else if (params.gasPrice === "auto") {
747
+ processedGasPrice = void 0;
748
+ } else {
749
+ processedGasPrice = BigInt(params.gasPrice);
750
+ }
751
+ console.log("\u{1F50D} [MetaMask writeContract] processedGasPrice:", processedGasPrice);
742
752
  const txHash = await this.walletClient.writeContract({
743
753
  address: params.address,
744
754
  abi: params.abi,
@@ -746,7 +756,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
746
756
  ...params.args ? { args: params.args } : {},
747
757
  value: params.value ? BigInt(params.value) : void 0,
748
758
  gas: params.gas ? BigInt(params.gas) : void 0,
749
- gasPrice: params.gasPrice ? BigInt(params.gasPrice) : void 0
759
+ gasPrice: processedGasPrice
750
760
  });
751
761
  return txHash;
752
762
  } catch (error) {
@@ -2218,11 +2228,11 @@ var WalletDetector = class {
2218
2228
  }
2219
2229
  }
2220
2230
  /**
2221
- * 检测 MetaMask
2231
+ * 检测 MetaMask(现在支持所有 window.ethereum 钱包)
2222
2232
  */
2223
2233
  isMetaMaskAvailable() {
2224
2234
  const w = window;
2225
- return !!(w.ethereum && w.ethereum.isMetaMask);
2235
+ return !!w.ethereum;
2226
2236
  }
2227
2237
  /**
2228
2238
  * 检测 TronLink