@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.d.cts CHANGED
@@ -529,11 +529,6 @@ declare abstract class LiquidEvmBaseWallet extends BaseWallet {
529
529
  * @returns The signature as a hex string (with 0x prefix)
530
530
  */
531
531
  protected abstract signWithProvider(typedData: SignTypedDataParams, evmAddress: string): Promise<string>;
532
- /**
533
- * Ensure the wallet is on the Algorand chain (4160).
534
- * Queries the current chain first, and only switches/adds if needed.
535
- */
536
- protected ensureAlgorandChain(): Promise<void>;
537
532
  /**
538
533
  * Initialize the Liquid EVM SDK for deriving Algorand addresses
539
534
  */
@@ -601,27 +596,17 @@ declare class RainbowKitWallet extends LiquidEvmBaseWallet {
601
596
  */
602
597
  setGetEvmAccounts(fn: () => Promise<string[]>): void;
603
598
  private get wagmiConfig();
604
- /**
605
- * If the Algorand chain (4160) isn't already in the wagmi config, add it.
606
- * This is needed so wagmi's switchChain and signTypedData work without
607
- * falling back to raw provider calls.
608
- */
609
- private ensureChainRegistered;
610
599
  protected initializeProvider(): Promise<void>;
611
600
  /**
612
601
  * Get the raw EIP-1193 provider from the active wagmi connector.
613
- * Used by the base class's getEvmProvider and ensureAlgorandChain.
614
602
  */
615
603
  private getRawProvider;
616
604
  getEvmProvider(): Promise<any>;
617
605
  /**
618
606
  * Sign EIP-712 typed data using wagmi's signTypedData.
619
607
  *
620
- * wagmi's signTypedData does NOT validate the domain's chainId against the
621
- * connected chain it simply forwards the typed data to the wallet via viem.
622
- * EIP-712 signing is chain-agnostic (the chain ID is in the typed data domain,
623
- * not in the RPC method), so this works regardless of which chain the wallet
624
- * reports being on.
608
+ * The EIP-712 domain uses only (name, version) with no chainId, so signing
609
+ * works regardless of which chain the wallet reports being on.
625
610
  */
626
611
  protected signWithProvider(typedData: SignTypedDataParams, evmAddress: string): Promise<string>;
627
612
  /**
package/dist/index.d.ts CHANGED
@@ -529,11 +529,6 @@ declare abstract class LiquidEvmBaseWallet extends BaseWallet {
529
529
  * @returns The signature as a hex string (with 0x prefix)
530
530
  */
531
531
  protected abstract signWithProvider(typedData: SignTypedDataParams, evmAddress: string): Promise<string>;
532
- /**
533
- * Ensure the wallet is on the Algorand chain (4160).
534
- * Queries the current chain first, and only switches/adds if needed.
535
- */
536
- protected ensureAlgorandChain(): Promise<void>;
537
532
  /**
538
533
  * Initialize the Liquid EVM SDK for deriving Algorand addresses
539
534
  */
@@ -601,27 +596,17 @@ declare class RainbowKitWallet extends LiquidEvmBaseWallet {
601
596
  */
602
597
  setGetEvmAccounts(fn: () => Promise<string[]>): void;
603
598
  private get wagmiConfig();
604
- /**
605
- * If the Algorand chain (4160) isn't already in the wagmi config, add it.
606
- * This is needed so wagmi's switchChain and signTypedData work without
607
- * falling back to raw provider calls.
608
- */
609
- private ensureChainRegistered;
610
599
  protected initializeProvider(): Promise<void>;
611
600
  /**
612
601
  * Get the raw EIP-1193 provider from the active wagmi connector.
613
- * Used by the base class's getEvmProvider and ensureAlgorandChain.
614
602
  */
615
603
  private getRawProvider;
616
604
  getEvmProvider(): Promise<any>;
617
605
  /**
618
606
  * Sign EIP-712 typed data using wagmi's signTypedData.
619
607
  *
620
- * wagmi's signTypedData does NOT validate the domain's chainId against the
621
- * connected chain it simply forwards the typed data to the wallet via viem.
622
- * EIP-712 signing is chain-agnostic (the chain ID is in the typed data domain,
623
- * not in the RPC method), so this works regardless of which chain the wallet
624
- * reports being on.
608
+ * The EIP-712 domain uses only (name, version) with no chainId, so signing
609
+ * works regardless of which chain the wallet reports being on.
625
610
  */
626
611
  protected signWithProvider(typedData: SignTypedDataParams, evmAddress: string): Promise<string>;
627
612
  /**
package/dist/index.js CHANGED
@@ -8612,39 +8612,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8612
8612
  * Subclasses MUST override this with their own metadata including isLiquid: "EVM"
8613
8613
  */
8614
8614
  static defaultMetadata;
8615
- /**
8616
- * Ensure the wallet is on the Algorand chain (4160).
8617
- * Queries the current chain first, and only switches/adds if needed.
8618
- */
8619
- async ensureAlgorandChain() {
8620
- const provider = await this.getEvmProvider();
8621
- const { ALGORAND_CHAIN_ID_HEX, ALGORAND_EVM_CHAIN_CONFIG } = await import("liquid-accounts-evm");
8622
- const rawChainId = await provider.request({ method: "eth_chainId" });
8623
- const currentChainId = typeof rawChainId === "number" ? "0x" + rawChainId.toString(16) : String(rawChainId);
8624
- if (currentChainId.toLowerCase() === ALGORAND_CHAIN_ID_HEX.toLowerCase()) {
8625
- return;
8626
- }
8627
- this.logger.info(
8628
- `Wrong chain (${currentChainId}), switching to Algorand (${ALGORAND_CHAIN_ID_HEX})...`
8629
- );
8630
- try {
8631
- await provider.request({
8632
- method: "wallet_switchEthereumChain",
8633
- params: [{ chainId: ALGORAND_CHAIN_ID_HEX }]
8634
- });
8635
- } catch (switchError) {
8636
- const chainUnknown = [4902, -32600, -32603].includes(switchError.code);
8637
- if (chainUnknown) {
8638
- this.logger.info("Algorand chain not found, adding it...");
8639
- await provider.request({
8640
- method: "wallet_addEthereumChain",
8641
- params: [ALGORAND_EVM_CHAIN_CONFIG]
8642
- });
8643
- } else {
8644
- throw switchError;
8645
- }
8646
- }
8647
- }
8648
8615
  /**
8649
8616
  * Initialize the Liquid EVM SDK for deriving Algorand addresses
8650
8617
  */
@@ -8760,7 +8727,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8760
8727
  const txnsAsUint8 = txnsToSign.map(({ txn }) => algosdk11.encodeUnsignedTransaction(txn));
8761
8728
  await onBeforeSign(txnsAsUint8, indexesToSign);
8762
8729
  }
8763
- await this.ensureAlgorandChain();
8764
8730
  const { signer: evmSigner } = await liquidEvmSdk.getSigner({
8765
8731
  evmAddress,
8766
8732
  signMessage: (typedData) => this.signWithProvider(typedData, evmAddress)
@@ -8834,10 +8800,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8834
8800
  };
8835
8801
 
8836
8802
  // src/wallets/rainbowkit.ts
8837
- import {
8838
- ALGORAND_CHAIN_ID,
8839
- algorandChain
8840
- } from "liquid-accounts-evm";
8841
8803
  var ICON13 = `data:image/svg+xml;base64,${btoa(`
8842
8804
  <svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
8843
8805
  <rect width="120" height="120" rx="24" fill="#627EEA"/>
@@ -8865,7 +8827,6 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8865
8827
  if (!this.options.wagmiConfig) {
8866
8828
  throw new Error("RainbowKitWallet requires wagmiConfig in options");
8867
8829
  }
8868
- this.ensureChainRegistered();
8869
8830
  }
8870
8831
  static defaultMetadata = {
8871
8832
  name: "EVM Wallet",
@@ -8891,25 +8852,11 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8891
8852
  get wagmiConfig() {
8892
8853
  return this.options.wagmiConfig;
8893
8854
  }
8894
- /**
8895
- * If the Algorand chain (4160) isn't already in the wagmi config, add it.
8896
- * This is needed so wagmi's switchChain and signTypedData work without
8897
- * falling back to raw provider calls.
8898
- */
8899
- ensureChainRegistered() {
8900
- const chains = this.wagmiConfig.chains;
8901
- if (chains.some((c) => c.id === ALGORAND_CHAIN_ID)) {
8902
- return;
8903
- }
8904
- this.logger.info(`Registering Algorand chain (${ALGORAND_CHAIN_ID}) in wagmi config`);
8905
- chains.push(algorandChain);
8906
- }
8907
8855
  async initializeProvider() {
8908
8856
  this.logger.info("Using wagmi for EVM provider management");
8909
8857
  }
8910
8858
  /**
8911
8859
  * Get the raw EIP-1193 provider from the active wagmi connector.
8912
- * Used by the base class's getEvmProvider and ensureAlgorandChain.
8913
8860
  */
8914
8861
  async getRawProvider() {
8915
8862
  const { getAccount } = await import("@wagmi/core");
@@ -8923,11 +8870,8 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8923
8870
  /**
8924
8871
  * Sign EIP-712 typed data using wagmi's signTypedData.
8925
8872
  *
8926
- * wagmi's signTypedData does NOT validate the domain's chainId against the
8927
- * connected chain it simply forwards the typed data to the wallet via viem.
8928
- * EIP-712 signing is chain-agnostic (the chain ID is in the typed data domain,
8929
- * not in the RPC method), so this works regardless of which chain the wallet
8930
- * reports being on.
8873
+ * The EIP-712 domain uses only (name, version) with no chainId, so signing
8874
+ * works regardless of which chain the wallet reports being on.
8931
8875
  */
8932
8876
  async signWithProvider(typedData, evmAddress) {
8933
8877
  const { signTypedData } = await import("@wagmi/core");