@enclave-hq/wallet-sdk 1.0.1 → 1.1.0
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 +27 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +25 -4
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +25 -4
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -278,7 +278,15 @@ var CHAIN_INFO = {
|
|
|
278
278
|
symbol: "BNB",
|
|
279
279
|
decimals: 18
|
|
280
280
|
},
|
|
281
|
-
rpcUrls: [
|
|
281
|
+
rpcUrls: [
|
|
282
|
+
"https://data-seed-prebsc-2-s1.binance.org:8545",
|
|
283
|
+
"https://data-seed-prebsc-1-s2.binance.org:8545",
|
|
284
|
+
"https://data-seed-prebsc-2-s2.binance.org:8545",
|
|
285
|
+
"https://data-seed-prebsc-1-s3.binance.org:8545",
|
|
286
|
+
"https://data-seed-prebsc-2-s3.binance.org:8545",
|
|
287
|
+
"https://data-seed-prebsc-1-s1.binance.org:8545"
|
|
288
|
+
// 原来的主节点作为最后备选
|
|
289
|
+
],
|
|
282
290
|
blockExplorerUrls: ["https://testnet.bscscan.com"]
|
|
283
291
|
},
|
|
284
292
|
// Polygon
|
|
@@ -470,9 +478,12 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
|
|
|
470
478
|
chain: viemChain,
|
|
471
479
|
transport: viem.custom(provider)
|
|
472
480
|
});
|
|
481
|
+
const chainInfo = getChainInfo(finalChainId);
|
|
482
|
+
const primaryRpcUrl = chainInfo?.rpcUrls[0];
|
|
473
483
|
this.publicClient = viem.createPublicClient({
|
|
474
484
|
chain: viemChain,
|
|
475
|
-
transport: viem.custom(provider)
|
|
485
|
+
transport: primaryRpcUrl ? viem.http(primaryRpcUrl) : viem.custom(provider)
|
|
486
|
+
// 优先使用我们的 RPC,降级到 MetaMask provider
|
|
476
487
|
});
|
|
477
488
|
const address = formatEVMAddress(accounts[0]);
|
|
478
489
|
const account = {
|
|
@@ -549,7 +560,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
|
|
|
549
560
|
value: transaction.value ? `0x${BigInt(transaction.value).toString(16)}` : void 0,
|
|
550
561
|
data: transaction.data || "0x",
|
|
551
562
|
gas: transaction.gas ? `0x${BigInt(transaction.gas).toString(16)}` : void 0,
|
|
552
|
-
gasPrice: transaction.gasPrice ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
|
|
563
|
+
gasPrice: transaction.gasPrice && transaction.gasPrice !== "auto" ? `0x${BigInt(transaction.gasPrice).toString(16)}` : void 0,
|
|
553
564
|
maxFeePerGas: transaction.maxFeePerGas ? `0x${BigInt(transaction.maxFeePerGas).toString(16)}` : void 0,
|
|
554
565
|
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? `0x${BigInt(transaction.maxPriorityFeePerGas).toString(16)}` : void 0,
|
|
555
566
|
nonce: transaction.nonce !== void 0 ? `0x${transaction.nonce.toString(16)}` : void 0,
|
|
@@ -647,6 +658,16 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
|
|
|
647
658
|
throw new Error("Wallet client not initialized");
|
|
648
659
|
}
|
|
649
660
|
try {
|
|
661
|
+
console.log("\u{1F50D} [MetaMask writeContract] params.gasPrice:", params.gasPrice, "type:", typeof params.gasPrice);
|
|
662
|
+
let processedGasPrice;
|
|
663
|
+
if (!params.gasPrice) {
|
|
664
|
+
processedGasPrice = void 0;
|
|
665
|
+
} else if (params.gasPrice === "auto") {
|
|
666
|
+
processedGasPrice = void 0;
|
|
667
|
+
} else {
|
|
668
|
+
processedGasPrice = BigInt(params.gasPrice);
|
|
669
|
+
}
|
|
670
|
+
console.log("\u{1F50D} [MetaMask writeContract] processedGasPrice:", processedGasPrice);
|
|
650
671
|
const txHash = await this.walletClient.writeContract({
|
|
651
672
|
address: params.address,
|
|
652
673
|
abi: params.abi,
|
|
@@ -654,7 +675,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
|
|
|
654
675
|
...params.args ? { args: params.args } : {},
|
|
655
676
|
value: params.value ? BigInt(params.value) : void 0,
|
|
656
677
|
gas: params.gas ? BigInt(params.gas) : void 0,
|
|
657
|
-
gasPrice:
|
|
678
|
+
gasPrice: processedGasPrice
|
|
658
679
|
});
|
|
659
680
|
return txHash;
|
|
660
681
|
} catch (error) {
|