@d13co/use-wallet 4.5.8 → 4.5.9

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.cjs CHANGED
@@ -8657,39 +8657,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8657
8657
  * Subclasses MUST override this with their own metadata including isLiquid: "EVM"
8658
8658
  */
8659
8659
  static defaultMetadata;
8660
- /**
8661
- * Ensure the wallet is on the Algorand chain (4160).
8662
- * Queries the current chain first, and only switches/adds if needed.
8663
- */
8664
- async ensureAlgorandChain() {
8665
- const provider = await this.getEvmProvider();
8666
- const { ALGORAND_CHAIN_ID_HEX, ALGORAND_EVM_CHAIN_CONFIG } = await import("liquid-accounts-evm");
8667
- const rawChainId = await provider.request({ method: "eth_chainId" });
8668
- const currentChainId = typeof rawChainId === "number" ? "0x" + rawChainId.toString(16) : String(rawChainId);
8669
- if (currentChainId.toLowerCase() === ALGORAND_CHAIN_ID_HEX.toLowerCase()) {
8670
- return;
8671
- }
8672
- this.logger.info(
8673
- `Wrong chain (${currentChainId}), switching to Algorand (${ALGORAND_CHAIN_ID_HEX})...`
8674
- );
8675
- try {
8676
- await provider.request({
8677
- method: "wallet_switchEthereumChain",
8678
- params: [{ chainId: ALGORAND_CHAIN_ID_HEX }]
8679
- });
8680
- } catch (switchError) {
8681
- const chainUnknown = [4902, -32600, -32603].includes(switchError.code);
8682
- if (chainUnknown) {
8683
- this.logger.info("Algorand chain not found, adding it...");
8684
- await provider.request({
8685
- method: "wallet_addEthereumChain",
8686
- params: [ALGORAND_EVM_CHAIN_CONFIG]
8687
- });
8688
- } else {
8689
- throw switchError;
8690
- }
8691
- }
8692
- }
8693
8660
  /**
8694
8661
  * Initialize the Liquid EVM SDK for deriving Algorand addresses
8695
8662
  */
@@ -8805,7 +8772,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8805
8772
  const txnsAsUint8 = txnsToSign.map(({ txn }) => import_algosdk11.default.encodeUnsignedTransaction(txn));
8806
8773
  await onBeforeSign(txnsAsUint8, indexesToSign);
8807
8774
  }
8808
- await this.ensureAlgorandChain();
8809
8775
  const { signer: evmSigner } = await liquidEvmSdk.getSigner({
8810
8776
  evmAddress,
8811
8777
  signMessage: (typedData) => this.signWithProvider(typedData, evmAddress)
@@ -8879,7 +8845,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8879
8845
  };
8880
8846
 
8881
8847
  // src/wallets/rainbowkit.ts
8882
- var import_liquid_accounts_evm = require("liquid-accounts-evm");
8883
8848
  var ICON13 = `data:image/svg+xml;base64,${btoa(`
8884
8849
  <svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
8885
8850
  <rect width="120" height="120" rx="24" fill="#627EEA"/>
@@ -8907,7 +8872,6 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8907
8872
  if (!this.options.wagmiConfig) {
8908
8873
  throw new Error("RainbowKitWallet requires wagmiConfig in options");
8909
8874
  }
8910
- this.ensureChainRegistered();
8911
8875
  }
8912
8876
  static defaultMetadata = {
8913
8877
  name: "EVM Wallet",
@@ -8933,25 +8897,11 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8933
8897
  get wagmiConfig() {
8934
8898
  return this.options.wagmiConfig;
8935
8899
  }
8936
- /**
8937
- * If the Algorand chain (4160) isn't already in the wagmi config, add it.
8938
- * This is needed so wagmi's switchChain and signTypedData work without
8939
- * falling back to raw provider calls.
8940
- */
8941
- ensureChainRegistered() {
8942
- const chains = this.wagmiConfig.chains;
8943
- if (chains.some((c) => c.id === import_liquid_accounts_evm.ALGORAND_CHAIN_ID)) {
8944
- return;
8945
- }
8946
- this.logger.info(`Registering Algorand chain (${import_liquid_accounts_evm.ALGORAND_CHAIN_ID}) in wagmi config`);
8947
- chains.push(import_liquid_accounts_evm.algorandChain);
8948
- }
8949
8900
  async initializeProvider() {
8950
8901
  this.logger.info("Using wagmi for EVM provider management");
8951
8902
  }
8952
8903
  /**
8953
8904
  * Get the raw EIP-1193 provider from the active wagmi connector.
8954
- * Used by the base class's getEvmProvider and ensureAlgorandChain.
8955
8905
  */
8956
8906
  async getRawProvider() {
8957
8907
  const { getAccount } = await import("@wagmi/core");
@@ -8965,11 +8915,8 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8965
8915
  /**
8966
8916
  * Sign EIP-712 typed data using wagmi's signTypedData.
8967
8917
  *
8968
- * wagmi's signTypedData does NOT validate the domain's chainId against the
8969
- * connected chain it simply forwards the typed data to the wallet via viem.
8970
- * EIP-712 signing is chain-agnostic (the chain ID is in the typed data domain,
8971
- * not in the RPC method), so this works regardless of which chain the wallet
8972
- * reports being on.
8918
+ * The EIP-712 domain uses only (name, version) with no chainId, so signing
8919
+ * works regardless of which chain the wallet reports being on.
8973
8920
  */
8974
8921
  async signWithProvider(typedData, evmAddress) {
8975
8922
  const { signTypedData } = await import("@wagmi/core");