@d13co/use-wallet 4.5.7 → 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,38 +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 currentChainId = await provider.request({ method: "eth_chainId" });
8623
- if (currentChainId.toLowerCase() === ALGORAND_CHAIN_ID_HEX.toLowerCase()) {
8624
- return;
8625
- }
8626
- this.logger.info(
8627
- `Wrong chain (${currentChainId}), switching to Algorand (${ALGORAND_CHAIN_ID_HEX})...`
8628
- );
8629
- try {
8630
- await provider.request({
8631
- method: "wallet_switchEthereumChain",
8632
- params: [{ chainId: ALGORAND_CHAIN_ID_HEX }]
8633
- });
8634
- } catch (switchError) {
8635
- const chainUnknown = [4902, -32600, -32603].includes(switchError.code);
8636
- if (chainUnknown) {
8637
- this.logger.info("Algorand chain not found, adding it...");
8638
- await provider.request({
8639
- method: "wallet_addEthereumChain",
8640
- params: [ALGORAND_EVM_CHAIN_CONFIG]
8641
- });
8642
- } else {
8643
- throw switchError;
8644
- }
8645
- }
8646
- }
8647
8615
  /**
8648
8616
  * Initialize the Liquid EVM SDK for deriving Algorand addresses
8649
8617
  */
@@ -8759,7 +8727,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8759
8727
  const txnsAsUint8 = txnsToSign.map(({ txn }) => algosdk11.encodeUnsignedTransaction(txn));
8760
8728
  await onBeforeSign(txnsAsUint8, indexesToSign);
8761
8729
  }
8762
- await this.ensureAlgorandChain();
8763
8730
  const { signer: evmSigner } = await liquidEvmSdk.getSigner({
8764
8731
  evmAddress,
8765
8732
  signMessage: (typedData) => this.signWithProvider(typedData, evmAddress)
@@ -8833,10 +8800,6 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8833
8800
  };
8834
8801
 
8835
8802
  // src/wallets/rainbowkit.ts
8836
- import {
8837
- ALGORAND_CHAIN_ID,
8838
- algorandChain
8839
- } from "liquid-accounts-evm";
8840
8803
  var ICON13 = `data:image/svg+xml;base64,${btoa(`
8841
8804
  <svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
8842
8805
  <rect width="120" height="120" rx="24" fill="#627EEA"/>
@@ -8864,7 +8827,6 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8864
8827
  if (!this.options.wagmiConfig) {
8865
8828
  throw new Error("RainbowKitWallet requires wagmiConfig in options");
8866
8829
  }
8867
- this.ensureChainRegistered();
8868
8830
  }
8869
8831
  static defaultMetadata = {
8870
8832
  name: "EVM Wallet",
@@ -8890,25 +8852,11 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8890
8852
  get wagmiConfig() {
8891
8853
  return this.options.wagmiConfig;
8892
8854
  }
8893
- /**
8894
- * If the Algorand chain (4160) isn't already in the wagmi config, add it.
8895
- * This is needed so wagmi's switchChain and signTypedData work without
8896
- * falling back to raw provider calls.
8897
- */
8898
- ensureChainRegistered() {
8899
- const chains = this.wagmiConfig.chains;
8900
- if (chains.some((c) => c.id === ALGORAND_CHAIN_ID)) {
8901
- return;
8902
- }
8903
- this.logger.info(`Registering Algorand chain (${ALGORAND_CHAIN_ID}) in wagmi config`);
8904
- chains.push(algorandChain);
8905
- }
8906
8855
  async initializeProvider() {
8907
8856
  this.logger.info("Using wagmi for EVM provider management");
8908
8857
  }
8909
8858
  /**
8910
8859
  * Get the raw EIP-1193 provider from the active wagmi connector.
8911
- * Used by the base class's getEvmProvider and ensureAlgorandChain.
8912
8860
  */
8913
8861
  async getRawProvider() {
8914
8862
  const { getAccount } = await import("@wagmi/core");
@@ -8922,11 +8870,8 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8922
8870
  /**
8923
8871
  * Sign EIP-712 typed data using wagmi's signTypedData.
8924
8872
  *
8925
- * wagmi's signTypedData does NOT validate the domain's chainId against the
8926
- * connected chain it simply forwards the typed data to the wallet via viem.
8927
- * EIP-712 signing is chain-agnostic (the chain ID is in the typed data domain,
8928
- * not in the RPC method), so this works regardless of which chain the wallet
8929
- * 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.
8930
8875
  */
8931
8876
  async signWithProvider(typedData, evmAddress) {
8932
8877
  const { signTypedData } = await import("@wagmi/core");