@d13co/use-wallet 4.5.1 → 4.5.2

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
@@ -436,7 +436,7 @@ interface LiquidEvmOptions {
436
436
  *
437
437
  * Subclasses must implement provider-specific methods:
438
438
  * - initializeProvider(): Initialize the specific EVM wallet SDK/provider
439
- * - getProvider(): Get the EVM provider instance
439
+ * - getEvmProvider(): Get the EVM provider instance
440
440
  * - signWithProvider(): Sign a message with the specific EVM wallet
441
441
  */
442
442
  declare abstract class LiquidEvmBaseWallet extends BaseWallet {
@@ -461,10 +461,11 @@ declare abstract class LiquidEvmBaseWallet extends BaseWallet {
461
461
  */
462
462
  protected abstract initializeProvider(): Promise<void>;
463
463
  /**
464
- * Get the EVM provider instance.
465
- * This should return the provider object that can make eth_* RPC calls.
464
+ * Get the EVM provider (EIP-1193 compatible).
465
+ * Returns the provider object that can make eth_* RPC calls.
466
+ * Consumers can use this for arbitrary EVM operations (e.g., bridge transactions).
466
467
  */
467
- protected abstract getProvider(): Promise<any>;
468
+ abstract getEvmProvider(): Promise<any>;
468
469
  /**
469
470
  * Sign EIP-712 typed data with the specific EVM wallet provider.
470
471
  * @param typedData - The EIP-712 typed data (domain, types, primaryType, message)
@@ -526,7 +527,7 @@ declare class MetaMaskWallet extends LiquidEvmBaseWallet {
526
527
  isLiquid: "EVM";
527
528
  };
528
529
  protected initializeProvider(): Promise<void>;
529
- protected getProvider(): Promise<SDKProvider>;
530
+ getEvmProvider(): Promise<SDKProvider>;
530
531
  protected signWithProvider(typedData: liquid_accounts_evm.SignTypedDataParams, evmAddress: string): Promise<string>;
531
532
  connect: () => Promise<WalletAccount[]>;
532
533
  disconnect: () => Promise<void>;
@@ -603,7 +604,7 @@ declare class RainbowWallet extends LiquidEvmBaseWallet {
603
604
  isLiquid: "EVM";
604
605
  };
605
606
  protected initializeProvider(): Promise<void>;
606
- protected getProvider(): Promise<EIP1193Provider>;
607
+ getEvmProvider(): Promise<EIP1193Provider>;
607
608
  protected signWithProvider(typedData: liquid_accounts_evm.SignTypedDataParams, evmAddress: string): Promise<string>;
608
609
  connect: () => Promise<WalletAccount[]>;
609
610
  disconnect: () => Promise<void>;
@@ -1071,6 +1072,7 @@ type WalletConstructor<T extends keyof WalletOptionsMap> = BaseWalletConstructor
1071
1072
  type WalletAccount = {
1072
1073
  name: string;
1073
1074
  address: string;
1075
+ metadata?: Record<string, unknown>;
1074
1076
  };
1075
1077
  /** @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0001.md#interface-multisigmetadata */
1076
1078
  interface MultisigMetadata {
@@ -1379,7 +1381,7 @@ declare const BUILTIN_SKINS: Record<string, WalletConnectSkin>;
1379
1381
  *
1380
1382
  * @example
1381
1383
  * ```typescript
1382
- * import { registerSkin } from '@d13co/use-wallet'
1384
+ * import { registerSkin } from '@txnlab/use-wallet'
1383
1385
  *
1384
1386
  * registerSkin({
1385
1387
  * id: 'mywallet',
package/dist/index.d.ts CHANGED
@@ -436,7 +436,7 @@ interface LiquidEvmOptions {
436
436
  *
437
437
  * Subclasses must implement provider-specific methods:
438
438
  * - initializeProvider(): Initialize the specific EVM wallet SDK/provider
439
- * - getProvider(): Get the EVM provider instance
439
+ * - getEvmProvider(): Get the EVM provider instance
440
440
  * - signWithProvider(): Sign a message with the specific EVM wallet
441
441
  */
442
442
  declare abstract class LiquidEvmBaseWallet extends BaseWallet {
@@ -461,10 +461,11 @@ declare abstract class LiquidEvmBaseWallet extends BaseWallet {
461
461
  */
462
462
  protected abstract initializeProvider(): Promise<void>;
463
463
  /**
464
- * Get the EVM provider instance.
465
- * This should return the provider object that can make eth_* RPC calls.
464
+ * Get the EVM provider (EIP-1193 compatible).
465
+ * Returns the provider object that can make eth_* RPC calls.
466
+ * Consumers can use this for arbitrary EVM operations (e.g., bridge transactions).
466
467
  */
467
- protected abstract getProvider(): Promise<any>;
468
+ abstract getEvmProvider(): Promise<any>;
468
469
  /**
469
470
  * Sign EIP-712 typed data with the specific EVM wallet provider.
470
471
  * @param typedData - The EIP-712 typed data (domain, types, primaryType, message)
@@ -526,7 +527,7 @@ declare class MetaMaskWallet extends LiquidEvmBaseWallet {
526
527
  isLiquid: "EVM";
527
528
  };
528
529
  protected initializeProvider(): Promise<void>;
529
- protected getProvider(): Promise<SDKProvider>;
530
+ getEvmProvider(): Promise<SDKProvider>;
530
531
  protected signWithProvider(typedData: liquid_accounts_evm.SignTypedDataParams, evmAddress: string): Promise<string>;
531
532
  connect: () => Promise<WalletAccount[]>;
532
533
  disconnect: () => Promise<void>;
@@ -603,7 +604,7 @@ declare class RainbowWallet extends LiquidEvmBaseWallet {
603
604
  isLiquid: "EVM";
604
605
  };
605
606
  protected initializeProvider(): Promise<void>;
606
- protected getProvider(): Promise<EIP1193Provider>;
607
+ getEvmProvider(): Promise<EIP1193Provider>;
607
608
  protected signWithProvider(typedData: liquid_accounts_evm.SignTypedDataParams, evmAddress: string): Promise<string>;
608
609
  connect: () => Promise<WalletAccount[]>;
609
610
  disconnect: () => Promise<void>;
@@ -1071,6 +1072,7 @@ type WalletConstructor<T extends keyof WalletOptionsMap> = BaseWalletConstructor
1071
1072
  type WalletAccount = {
1072
1073
  name: string;
1073
1074
  address: string;
1075
+ metadata?: Record<string, unknown>;
1074
1076
  };
1075
1077
  /** @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0001.md#interface-multisigmetadata */
1076
1078
  interface MultisigMetadata {
@@ -1379,7 +1381,7 @@ declare const BUILTIN_SKINS: Record<string, WalletConnectSkin>;
1379
1381
  *
1380
1382
  * @example
1381
1383
  * ```typescript
1382
- * import { registerSkin } from '@d13co/use-wallet'
1384
+ * import { registerSkin } from '@txnlab/use-wallet'
1383
1385
  *
1384
1386
  * registerSkin({
1385
1387
  * id: 'mywallet',
package/dist/index.js CHANGED
@@ -8218,7 +8218,7 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8218
8218
  * Queries the current chain first, and only switches/adds if needed.
8219
8219
  */
8220
8220
  async ensureAlgorandChain() {
8221
- const provider = await this.getProvider();
8221
+ const provider = await this.getEvmProvider();
8222
8222
  const { ALGORAND_CHAIN_ID_HEX, ALGORAND_EVM_CHAIN_CONFIG } = await import("liquid-accounts-evm");
8223
8223
  const currentChainId = await provider.request({ method: "eth_chainId" });
8224
8224
  if (currentChainId === ALGORAND_CHAIN_ID_HEX) {
@@ -8273,7 +8273,8 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8273
8273
  this.evmAddressMap.set(algorandAddress, evmAddress);
8274
8274
  walletAccounts.push({
8275
8275
  name: `${this.metadata.name} ${evmAddress}`,
8276
- address: algorandAddress
8276
+ address: algorandAddress,
8277
+ metadata: { evmAddress }
8277
8278
  });
8278
8279
  }
8279
8280
  return walletAccounts;
@@ -8396,6 +8397,12 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8396
8397
  this.logger.info("No session to resume");
8397
8398
  return;
8398
8399
  }
8400
+ for (const account of walletState.accounts) {
8401
+ const evmAddr = account.metadata?.evmAddress;
8402
+ if (evmAddr) {
8403
+ this.evmAddressMap.set(account.address, evmAddr);
8404
+ }
8405
+ }
8399
8406
  const walletAccounts = await this.deriveAlgorandAccounts(evmAddresses);
8400
8407
  const match = compareAccounts(walletAccounts, walletState.accounts);
8401
8408
  if (!match) {
@@ -8469,7 +8476,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
8469
8476
  this.logger.info("MetaMask SDK initialized");
8470
8477
  }
8471
8478
  }
8472
- async getProvider() {
8479
+ async getEvmProvider() {
8473
8480
  if (!this.provider) {
8474
8481
  await this.initializeProvider();
8475
8482
  this.provider = this.metamaskSdk.getProvider() || null;
@@ -8480,7 +8487,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
8480
8487
  return this.provider;
8481
8488
  }
8482
8489
  async signWithProvider(typedData, evmAddress) {
8483
- const provider = await this.getProvider();
8490
+ const provider = await this.getEvmProvider();
8484
8491
  return await provider.request({
8485
8492
  method: "eth_signTypedData_v4",
8486
8493
  params: [evmAddress, JSON.stringify(typedData)]
@@ -8490,7 +8497,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
8490
8497
  this.logger.info("Connecting...");
8491
8498
  await this.initializeProvider();
8492
8499
  await this.initializeEvmSdk();
8493
- const provider = await this.getProvider();
8500
+ const provider = await this.getEvmProvider();
8494
8501
  const evmAddresses = await provider.request({
8495
8502
  method: "eth_requestAccounts"
8496
8503
  });
@@ -8534,7 +8541,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
8534
8541
  this.logger.info("Resuming session...");
8535
8542
  await this.initializeProvider();
8536
8543
  await this.initializeEvmSdk();
8537
- const provider = await this.getProvider();
8544
+ const provider = await this.getEvmProvider();
8538
8545
  const evmAddresses = await provider.request({
8539
8546
  method: "eth_accounts"
8540
8547
  });
@@ -9004,7 +9011,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
9004
9011
  }
9005
9012
  this.logger.warn("Rainbow extension not detected. Note: Rainbow mobile app requires WalletConnect.");
9006
9013
  }
9007
- async getProvider() {
9014
+ async getEvmProvider() {
9008
9015
  if (!this.provider) {
9009
9016
  await this.initializeProvider();
9010
9017
  const windowEth = window.ethereum;
@@ -9025,7 +9032,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
9025
9032
  return this.provider;
9026
9033
  }
9027
9034
  async signWithProvider(typedData, evmAddress) {
9028
- const provider = await this.getProvider();
9035
+ const provider = await this.getEvmProvider();
9029
9036
  try {
9030
9037
  return await provider.request({
9031
9038
  method: "eth_signTypedData_v4",
@@ -9042,7 +9049,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
9042
9049
  this.logger.info("Connecting...");
9043
9050
  await this.initializeProvider();
9044
9051
  await this.initializeEvmSdk();
9045
- const provider = await this.getProvider();
9052
+ const provider = await this.getEvmProvider();
9046
9053
  try {
9047
9054
  this.logger.info("Requesting Rainbow wallet connection...");
9048
9055
  const evmAddresses = await provider.request({
@@ -9089,7 +9096,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
9089
9096
  this.logger.info("Resuming session...");
9090
9097
  await this.initializeProvider();
9091
9098
  await this.initializeEvmSdk();
9092
- const provider = await this.getProvider();
9099
+ const provider = await this.getEvmProvider();
9093
9100
  const evmAddresses = await provider.request({
9094
9101
  method: "eth_accounts"
9095
9102
  });