@enclave-hq/wallet-sdk 1.0.2 → 1.1.1

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.
@@ -271,7 +271,15 @@ var CHAIN_INFO = {
271
271
  symbol: "BNB",
272
272
  decimals: 18
273
273
  },
274
- rpcUrls: ["https://data-seed-prebsc-1-s1.binance.org:8545"],
274
+ rpcUrls: [
275
+ "https://data-seed-prebsc-2-s1.binance.org:8545",
276
+ "https://data-seed-prebsc-1-s2.binance.org:8545",
277
+ "https://data-seed-prebsc-2-s2.binance.org:8545",
278
+ "https://data-seed-prebsc-1-s3.binance.org:8545",
279
+ "https://data-seed-prebsc-2-s3.binance.org:8545",
280
+ "https://data-seed-prebsc-1-s1.binance.org:8545"
281
+ // 原来的主节点作为最后备选
282
+ ],
275
283
  blockExplorerUrls: ["https://testnet.bscscan.com"]
276
284
  },
277
285
  // Polygon
@@ -463,9 +471,12 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
463
471
  chain: viemChain,
464
472
  transport: custom(provider)
465
473
  });
474
+ const chainInfo = getChainInfo(finalChainId);
475
+ const primaryRpcUrl = chainInfo?.rpcUrls[0];
466
476
  this.publicClient = createPublicClient({
467
477
  chain: viemChain,
468
- transport: custom(provider)
478
+ transport: primaryRpcUrl ? http(primaryRpcUrl) : custom(provider)
479
+ // 优先使用我们的 RPC,降级到 MetaMask provider
469
480
  });
470
481
  const address = formatEVMAddress(accounts[0]);
471
482
  const account = {
@@ -730,7 +741,7 @@ var MetaMaskAdapter = class extends BrowserWalletAdapter {
730
741
  return void 0;
731
742
  }
732
743
  const w = window;
733
- return w.ethereum && w.ethereum.isMetaMask ? w.ethereum : void 0;
744
+ return w.ethereum ? w.ethereum : void 0;
734
745
  }
735
746
  /**
736
747
  * 获取下载链接