Skip to content

Commit

Permalink
fix: wallet address in list command
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerAnsh committed Oct 11, 2024
1 parent adf8205 commit 292b7aa
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/cli/src/handlers/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,18 +416,17 @@ You can create a new wallet by using the generate command:
});
const current = State.wallets.currentWallet;

const chainId = config.get("chain.chainId");
const prefix = config.get("chain.addressPrefix");

for (const wallet of wallets) {
const data = [
wallet.name,
wallet.addresses[prefix] || "",
]
// Highlight the currently selected wallet
const isCurrent = current && wallet.name === current.name;
const addr =
wallet.addresses[chainId] || "";
walletTable.push([
isCurrent ? "*" : "",
isCurrent ? pc.green(wallet.name) : wallet.name,
isCurrent ? pc.green(addr) : addr,
]);

walletTable.push(isCurrent ? ["*", ...data.map(d => pc.green(d))] : ["*", ...data]);
}
console.log(walletTable.toString());
}
Expand Down Expand Up @@ -492,12 +491,10 @@ async function migrateLegacyWallet(legacyName: string) {
export async function setCurrentWallet(
wallet: Wallet,
passphrase?: string,
autoConnect = true
) {
passphrase = passphrase ?? (await State.wallets.getWalletPassphrase(wallet.name));
const signer = await wallet.getWallet(passphrase);
State.wallets.defaultWallet = wallet.name;
if (!autoConnect) return signer;

try {
await State.connectClient(passphrase);
Expand Down

0 comments on commit 292b7aa

Please sign in to comment.