Skip to content

Commit

Permalink
Fix wallet connect derived bech32 address (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki authored Sep 28, 2024
2 parents b7cbb96 + c460ea1 commit 47eecf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/graz/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graz",
"description": "React hooks for Cosmos",
"version": "0.1.24",
"version": "0.1.25",
"author": "Griko Nibras <[email protected]>",
"repository": "https://github.com/graz-sh/graz.git",
"homepage": "https://github.com/graz-sh/graz",
Expand Down
17 changes: 9 additions & 8 deletions packages/graz/src/actions/wallet/wallet-connect/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { AminoSignResponse } from "@cosmjs/amino";
import { fromBech32, toBech32 } from "@cosmjs/encoding";
import type { AccountData, Algo, DirectSignResponse } from "@cosmjs/proto-signing";
import type { Keplr, Key } from "@keplr-wallet/types";
import { SignClient } from "@walletconnect/sign-client";
Expand Down Expand Up @@ -250,13 +249,15 @@ export const getWalletConnect = (params?: GetWalletConnectParams): Wallet => {
const acc = _acc[0];
if (!acc) return reject(new Error("No accounts"));
const resAcc: Record<string, Key> = {};
chainId.forEach((x) => {
resAcc[x] = {
...acc,
bech32Address: toBech32(
chains!.find((y) => y.chainId === x)!.bech32Config.bech32PrefixAccAddr,
fromBech32(_acc[0]!.bech32Address).data,
),
_acc.forEach((x) => {
resAcc[x.chainId!] = {
address: x.address,
algo: x.algo as Algo,
bech32Address: x.bech32Address,
isNanoLedger: x.isNanoLedger,
isKeystone: x.isKeystone,
name: x.name,
pubKey: x.pubKey,
};
});

Expand Down

0 comments on commit 47eecf2

Please sign in to comment.