File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { raise } from "$lib/utilities/index.ts"
33import { getCosmosChainBalances } from "./cosmos.ts"
44import { createQueries } from "@tanstack/svelte-query"
55import { erc20ReadMulticall } from "./evm/multicall.ts"
6- import { bytesToBech32Address } from "@unionlabs/client"
6+ import { bech32ToBech32Address } from "@unionlabs/client"
77import type { Chain , UserAddresses } from "$lib/types.ts"
88import { getBalancesFromAlchemy } from "./evm/alchemy.ts"
99import { getBalancesFromRoutescan } from "./evm/routescan.ts"
@@ -72,10 +72,11 @@ export function userBalancesQuery({
7272 const url = chain . rpcs . filter ( rpc => rpc . type === "rest" ) . at ( 0 ) ?. url
7373 if ( ! url ) raise ( `No REST RPC available for chain ${ chain . chain_id } ` )
7474
75- const bech32Address = bytesToBech32Address ( {
75+ const bech32Address = bech32ToBech32Address ( {
7676 toPrefix : chain . addr_prefix ,
77- bytes : userAddr . cosmos . bytes
77+ address : userAddr . cosmos . canonical
7878 } )
79+
7980 return getCosmosChainBalances ( { url, walletAddress : bech32Address } )
8081 }
8182
Original file line number Diff line number Diff line change 11import type { Chain , UserAddresses } from "$lib/types"
2- import { bytesToBech32Address } from "@unionlabs/client"
2+ import { bech32ToBech32Address } from "@unionlabs/client"
33
44export const userAddrOnChain = ( userAddr : UserAddresses , chain ?: Chain ) : string | null => {
55 if ( ! chain ) return null
66
77 if ( chain . rpc_type === "cosmos" ) {
88 if ( userAddr . cosmos ?. bytes ) {
9- return bytesToBech32Address ( { bytes : userAddr . cosmos . bytes , toPrefix : chain . addr_prefix } )
9+ return bech32ToBech32Address ( {
10+ toPrefix : chain . addr_prefix ,
11+ address : userAddr . cosmos . canonical
12+ } )
1013 }
1114 console . log ( "userAddrOnChain got no cosmos address" )
1215 return null
You can’t perform that action at this time.
0 commit comments