Retrieve wallet addresses from Para wallets for EVM, Cosmos, and Solana networks.
Prerequisites
Before retrieving wallet addresses, ensure you have completed setup and authenticated users.
Core Address Methods
useWallet Hook
The primary way to get the current wallet’s address directly from the wallet object.
import { useWallet } from '@getpara/react-sdk';
export default function GetWalletAddress() {
const { data: wallet } = useWallet();
if (!wallet) return null;
// Direct access to wallet address
const address = wallet.address;
const publicKey = wallet.publicKey; // For Cosmos address derivation
const walletType = wallet.walletType; // EVM, COSMOS, or SOLANA
return <div>Address: {address}</div>;
}
useAccount Hook
Get all wallet addresses including embedded and external wallets.
import { useAccount } from '@getpara/react-sdk';
export default function GetAllAddresses() {
const { data: account } = useAccount();
if (!account) return null;
// Embedded wallet addresses
const embeddedAddresses = account.embedded?.wallets?.map(wallet => ({
type: wallet.walletType,
address: wallet.address
}));
// External wallet addresses
const evmAddress = account.external?.evm?.address;
const solanaAddress = account.external?.solana?.publicKey;
const cosmosData = account.external?.cosmos;
return (
<div>
{embeddedAddresses?.map((wallet, i) => (
<div key={i}>{wallet.type}: {wallet.address}</div>
))}
{evmAddress && <div>External EVM: {evmAddress}</div>}
{solanaAddress && <div>External Solana: {solanaAddress}</div>}
</div>
);
}
Direct Access Methods
getWallet Method
Retrieve a specific wallet by ID and type.
import { useClient } from '@getpara/react-sdk';
export default function GetSpecificWallet() {
const para = useClient();
const getWalletAddress = async (walletId: string, type: 'EVM' | 'COSMOS' | 'SOLANA') => {
if (!para) return;
const wallet = await para.getWallet(walletId, type);
return wallet.address;
};
// Usage
const address = await getWalletAddress('wallet_123', 'EVM');
}
Get All Wallets
For retrieving all wallet IDs and filtering wallets, see the dedicated guide:
getDisplayAddress
Format wallet addresses for display with truncation and chain-specific formatting.
import { useClient, useWallet } from '@getpara/react-sdk';
export default function FormatAddress() {
const para = useClient();
const { data: wallet } = useWallet();
if (!wallet || !para) return null;
// Get formatted address
const fullAddress = await para.getDisplayAddress(wallet.id);
// Get truncated for UI
const displayAddress = await para.getDisplayAddress(wallet.id, {
truncate: true,
targetLength: 12
});
// Custom Cosmos prefix
const osmosisAddress = await para.getDisplayAddress(wallet.id, {
cosmosPrefix: 'osmo'
});
}
truncateAddress
Truncate addresses for UI display.
import { truncateAddress } from '@getpara/react-sdk';
// EVM: 0x1234...5678
const evmDisplay = truncateAddress(evmAddress, 'EVM');
// Cosmos: cosmos1234...5678
const cosmosDisplay = truncateAddress(cosmosAddress, 'COSMOS');
// Custom length
const shortDisplay = truncateAddress(address, 'EVM', { targetLength: 10 });
getCosmosAddress
Derive a Cosmos bech32 address from a public key with custom prefixes.
import { getCosmosAddress, useWallet } from '@getpara/react-sdk';
export default function DeriveCosmosAddress() {
const { data: wallet } = useWallet();
if (!wallet?.publicKey) return null;
// Derive addresses for different Cosmos chains
const cosmosAddress = getCosmosAddress(wallet.publicKey, 'cosmos');
const osmoAddress = getCosmosAddress(wallet.publicKey, 'osmo');
const junoAddress = getCosmosAddress(wallet.publicKey, 'juno');
return (
<div>
<div>Cosmos Hub: {cosmosAddress}</div>
<div>Osmosis: {osmoAddress}</div>
<div>Juno: {junoAddress}</div>
</div>
);
}
Chain-Specific Examples
EVM Addresses
import { useWallet } from '@getpara/react-sdk';
export default function EVMAddress() {
const { data: wallet } = useWallet();
if (!wallet || wallet.walletType !== 'EVM') return null;
// Direct address access
const address = wallet.address;
// For Web3 libraries
const checksumAddress = address; // Para returns checksum addresses
const lowerCaseAddress = address.toLowerCase();
return <div>{address}</div>;
}
Cosmos Multi-Chain
import { useWallet, getCosmosAddress } from '@getpara/react-sdk';
const COSMOS_CHAINS = [
{ name: 'Cosmos Hub', prefix: 'cosmos' },
{ name: 'Osmosis', prefix: 'osmo' },
{ name: 'Juno', prefix: 'juno' },
{ name: 'Stargaze', prefix: 'stars' }
];
export default function CosmosMultiChain() {
const { data: wallet } = useWallet();
if (!wallet?.publicKey) return null;
const addresses = COSMOS_CHAINS.map(chain => ({
chain: chain.name,
address: getCosmosAddress(wallet.publicKey, chain.prefix)
}));
return (
<div>
{addresses.map(({ chain, address }) => (
<div key={chain}>{chain}: {address}</div>
))}
</div>
);
}
Solana Public Key
import { useWallet } from '@getpara/react-sdk';
import { PublicKey } from '@solana/web3.js';
export default function SolanaAddress() {
const { data: wallet } = useWallet();
if (!wallet || wallet.walletType !== 'SOLANA') return null;
// Base58 public key string
const address = wallet.address;
// For Solana Web3.js
const publicKey = new PublicKey(address);
return <div>{address}</div>;
}
Next Steps