This reference documents wallet management with the Dynamic Swift SDK. Wallets are automatically created for authenticated users. Access them via
sdk.wallets.userWallets and observe changes using Combine publishers.Accessing User Wallets
Wallets are automatically created for authenticated users. Access them via the SDK:BaseWallet Properties
- address (String) - Wallet address
- chain (String) - Chain identifier (e.g., “EVM”, “SOL”)
- walletName (String?) - Optional wallet name
- id (String?) - Optional wallet ID
sdk.wallets
Wallet management module for accessing and managing user wallets.userWallets
Get the current user’s wallets.Example
userWalletsChanges
Combine publisher that emits when wallets change.Example
getBalance
Get the balance of a wallet.Parameters
- wallet (BaseWallet) - The wallet to get balance for
Returns
- String - The wallet balance
Example
getNetwork
Get the current network of a wallet.Parameters
- wallet (BaseWallet) - The wallet to get network for
Returns
- NetworkResult - The current network information
Example
switchNetwork
Switch a wallet to a different network.Parameters
- wallet (BaseWallet) - The wallet to switch network for
- network (GenericNetwork) - The target network
Example
setPrimary
Set a wallet as the user’s primary wallet.Parameters
- walletId (String) - The ID of the wallet to set as primary
Example
signMessage
Sign a message with a wallet.Parameters
- wallet (BaseWallet) - The wallet to sign with
- message (String) - The message to sign
Returns
- String - The signature
Example
signTypedData
Sign EIP-712 typed data with a wallet.Parameters
- wallet (BaseWallet) - The wallet to sign with
- typedDataJson (String) - The typed data as a JSON string
Returns
- String - The signature
Example
verifySignature
Verify a message signature.Parameters
- message (String) - Original message that was signed
- signature (String) - Signature to verify
- walletAddress (String) - Wallet address that signed the message
Returns
- Bool - True if signature is valid, false otherwise