Skip to content

Commit 2536c9f

Browse files
fix e2e and bugs
1 parent 07e423d commit 2536c9f

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

packages/react/src/hooks/useSigningClient.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ import { useAsync } from './useAsync';
44
import { useWalletManager } from './useWalletManager';
55

66
export const useSigningClient = (chainName: string, walletName: string) => {
7-
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady } = useWalletManager();
7+
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady, getChainByName } = useWalletManager();
8+
9+
const chain = getChainByName(chainName);
10+
11+
if (chain.chainType !== 'cosmos') {
12+
return {
13+
signingClient: null,
14+
isLoading: false,
15+
error: null,
16+
};
17+
}
818

919
const chainWalletState = getChainWalletState(walletName, chainName);
1020

packages/store/src/store/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ export class InterchainStore {
139139
}
140140
return cws;
141141
});
142-
143142
this.setState({ chainWalletStates: newChainWalletStates });
144143
}
145144

packages/store/src/wallet-manager/wallet-manager-store.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ export class WalletManagerStore implements WalletManager {
7171
restore() {
7272
const oldState = this.localStorage.load();
7373

74-
74+
this.store.setState({
75+
chainWalletStates: oldState.chainWalletStates || [],
76+
currentWalletName: oldState.currentWalletName || '',
77+
currentChainName: oldState.currentChainName || ''
78+
});
7579

7680
// 重建索引映射
7781
this.store.buildIndexMap();
@@ -101,7 +105,6 @@ export class WalletManagerStore implements WalletManager {
101105
}
102106
});
103107
});
104-
105108
// 合并过滤后的状态和新增的状态
106109
const finalChainWalletStates = [...filteredChainWalletStates, ...newChainWalletStates];
107110

@@ -120,7 +123,7 @@ export class WalletManagerStore implements WalletManager {
120123

121124
// 直接设置state,避免触发emit
122125
this.store.setState({
123-
chainWalletStates: oldState.chainWalletStates || [],
126+
chainWalletStates: finalChainWalletStates,
124127
currentWalletName: isOldWalletNameExisted ? oldState.currentWalletName : '',
125128
currentChainName: isOldChainNameExisted ? oldState.currentChainName : '',
126129
});

wallets/ledger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
"crypto": "crypto-es"
5151
},
5252
"gitHead": "3d11fb1fccadec958696aaa78817e2440360cf1c"
53-
}
53+
}

wallets/mock-wallet/src/ethereum-wallet.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { EthereumWallet,Wallet, WalletAccount } from '@interchain-kit/core';
2-
import { Eip1193Provider,ethers, HDNodeWallet } from 'ethers';
1+
import { EthereumWallet, Wallet, WalletAccount } from '@interchain-kit/core';
2+
import { Eip1193Provider, ethers, HDNodeWallet } from 'ethers';
33

44
export interface MockEthereumNetwork {
55
chainId: number;
@@ -48,11 +48,8 @@ export class MockEthereumWallet extends EthereumWallet {
4848

4949

5050
async init(): Promise<void> {
51-
5251
const chains = Array.from(this.chainMap.values());
5352

54-
console.log(chains);
55-
5653
this.currentChainId = chains[0].chainId;
5754

5855
for (const chain of chains) {
@@ -193,7 +190,7 @@ export class MockEthereumWallet extends EthereumWallet {
193190
derivationPaths: string[];
194191
accountCount: number;
195192
currentAccountIndex: number;
196-
} {
193+
} {
197194
return {
198195
mnemonic: this.mnemonic,
199196
derivationPaths: [...this.derivationPaths],

0 commit comments

Comments
 (0)