@d13co/use-wallet 4.5.0 → 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.cjs +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8264,7 +8264,7 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
|
|
|
8264
8264
|
* Queries the current chain first, and only switches/adds if needed.
|
|
8265
8265
|
*/
|
|
8266
8266
|
async ensureAlgorandChain() {
|
|
8267
|
-
const provider = await this.
|
|
8267
|
+
const provider = await this.getEvmProvider();
|
|
8268
8268
|
const { ALGORAND_CHAIN_ID_HEX, ALGORAND_EVM_CHAIN_CONFIG } = await import("liquid-accounts-evm");
|
|
8269
8269
|
const currentChainId = await provider.request({ method: "eth_chainId" });
|
|
8270
8270
|
if (currentChainId === ALGORAND_CHAIN_ID_HEX) {
|
|
@@ -8319,7 +8319,8 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
|
|
|
8319
8319
|
this.evmAddressMap.set(algorandAddress, evmAddress);
|
|
8320
8320
|
walletAccounts.push({
|
|
8321
8321
|
name: `${this.metadata.name} ${evmAddress}`,
|
|
8322
|
-
address: algorandAddress
|
|
8322
|
+
address: algorandAddress,
|
|
8323
|
+
metadata: { evmAddress }
|
|
8323
8324
|
});
|
|
8324
8325
|
}
|
|
8325
8326
|
return walletAccounts;
|
|
@@ -8442,6 +8443,12 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
|
|
|
8442
8443
|
this.logger.info("No session to resume");
|
|
8443
8444
|
return;
|
|
8444
8445
|
}
|
|
8446
|
+
for (const account of walletState.accounts) {
|
|
8447
|
+
const evmAddr = account.metadata?.evmAddress;
|
|
8448
|
+
if (evmAddr) {
|
|
8449
|
+
this.evmAddressMap.set(account.address, evmAddr);
|
|
8450
|
+
}
|
|
8451
|
+
}
|
|
8445
8452
|
const walletAccounts = await this.deriveAlgorandAccounts(evmAddresses);
|
|
8446
8453
|
const match = compareAccounts(walletAccounts, walletState.accounts);
|
|
8447
8454
|
if (!match) {
|
|
@@ -8515,7 +8522,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
|
|
|
8515
8522
|
this.logger.info("MetaMask SDK initialized");
|
|
8516
8523
|
}
|
|
8517
8524
|
}
|
|
8518
|
-
async
|
|
8525
|
+
async getEvmProvider() {
|
|
8519
8526
|
if (!this.provider) {
|
|
8520
8527
|
await this.initializeProvider();
|
|
8521
8528
|
this.provider = this.metamaskSdk.getProvider() || null;
|
|
@@ -8526,7 +8533,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
|
|
|
8526
8533
|
return this.provider;
|
|
8527
8534
|
}
|
|
8528
8535
|
async signWithProvider(typedData, evmAddress) {
|
|
8529
|
-
const provider = await this.
|
|
8536
|
+
const provider = await this.getEvmProvider();
|
|
8530
8537
|
return await provider.request({
|
|
8531
8538
|
method: "eth_signTypedData_v4",
|
|
8532
8539
|
params: [evmAddress, JSON.stringify(typedData)]
|
|
@@ -8536,7 +8543,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
|
|
|
8536
8543
|
this.logger.info("Connecting...");
|
|
8537
8544
|
await this.initializeProvider();
|
|
8538
8545
|
await this.initializeEvmSdk();
|
|
8539
|
-
const provider = await this.
|
|
8546
|
+
const provider = await this.getEvmProvider();
|
|
8540
8547
|
const evmAddresses = await provider.request({
|
|
8541
8548
|
method: "eth_requestAccounts"
|
|
8542
8549
|
});
|
|
@@ -8580,7 +8587,7 @@ var MetaMaskWallet = class extends LiquidEvmBaseWallet {
|
|
|
8580
8587
|
this.logger.info("Resuming session...");
|
|
8581
8588
|
await this.initializeProvider();
|
|
8582
8589
|
await this.initializeEvmSdk();
|
|
8583
|
-
const provider = await this.
|
|
8590
|
+
const provider = await this.getEvmProvider();
|
|
8584
8591
|
const evmAddresses = await provider.request({
|
|
8585
8592
|
method: "eth_accounts"
|
|
8586
8593
|
});
|
|
@@ -9050,7 +9057,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
|
|
|
9050
9057
|
}
|
|
9051
9058
|
this.logger.warn("Rainbow extension not detected. Note: Rainbow mobile app requires WalletConnect.");
|
|
9052
9059
|
}
|
|
9053
|
-
async
|
|
9060
|
+
async getEvmProvider() {
|
|
9054
9061
|
if (!this.provider) {
|
|
9055
9062
|
await this.initializeProvider();
|
|
9056
9063
|
const windowEth = window.ethereum;
|
|
@@ -9071,7 +9078,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
|
|
|
9071
9078
|
return this.provider;
|
|
9072
9079
|
}
|
|
9073
9080
|
async signWithProvider(typedData, evmAddress) {
|
|
9074
|
-
const provider = await this.
|
|
9081
|
+
const provider = await this.getEvmProvider();
|
|
9075
9082
|
try {
|
|
9076
9083
|
return await provider.request({
|
|
9077
9084
|
method: "eth_signTypedData_v4",
|
|
@@ -9088,7 +9095,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
|
|
|
9088
9095
|
this.logger.info("Connecting...");
|
|
9089
9096
|
await this.initializeProvider();
|
|
9090
9097
|
await this.initializeEvmSdk();
|
|
9091
|
-
const provider = await this.
|
|
9098
|
+
const provider = await this.getEvmProvider();
|
|
9092
9099
|
try {
|
|
9093
9100
|
this.logger.info("Requesting Rainbow wallet connection...");
|
|
9094
9101
|
const evmAddresses = await provider.request({
|
|
@@ -9135,7 +9142,7 @@ var RainbowWallet = class extends LiquidEvmBaseWallet {
|
|
|
9135
9142
|
this.logger.info("Resuming session...");
|
|
9136
9143
|
await this.initializeProvider();
|
|
9137
9144
|
await this.initializeEvmSdk();
|
|
9138
|
-
const provider = await this.
|
|
9145
|
+
const provider = await this.getEvmProvider();
|
|
9139
9146
|
const evmAddresses = await provider.request({
|
|
9140
9147
|
method: "eth_accounts"
|
|
9141
9148
|
});
|