pub trait WalletAccountInfo {
// Required methods
fn address(&self) -> String;
fn public_key(&self) -> Vec<u8> ⓘ;
fn chains(&self) -> Vec<String>;
fn features(&self) -> Vec<String>;
fn label(&self) -> Option<String>;
fn icon(&self) -> Option<String>;
}Expand description
Interface of a WalletAccount, also referred to as an Account.
An account is a read-only data object that is provided from the Wallet to the app, authorizing the app to use it.
The app can use an account to display and query information from a chain.
The app can also act using an account by passing it to {@link Wallet.features | features} of the Wallet.
§Example
#[derive(Clone)]
struct MyAccount {
address: String,
public_key: Vec<u8>,
chains: Vec<String>,
features: Vec<String>,
label: Option<String>,
}
impl WalletAccountInfo for MyAccount {
fn address(&self) -> String {
self.address.clone()
}
fn public_key(&self) -> Vec<u8> {
self.public_key.clone()
}
// ... other implementations
}Required Methods§
Sourcefn address(&self) -> String
fn address(&self) -> String
Address of the account, corresponding with a public key.
This is typically a human-readable string representation of the public key, formatted according to the blockchain’s conventions.
§Example
For Solana: "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH"
Sourcefn public_key(&self) -> Vec<u8> ⓘ
fn public_key(&self) -> Vec<u8> ⓘ
Public key of the account, corresponding with a secret key to use.
This is the raw binary representation of the public key.
§Example
// A 32-byte Ed25519 public key
vec![0, 1, 2, 3 /* ... */]Sourcefn chains(&self) -> Vec<String>
fn chains(&self) -> Vec<String>
Chains supported by the account.
This must be a subset of the {@link Wallet.chains | chains} of the Wallet.
§Example
vec!["solana:mainnet".to_string()]Sourcefn features(&self) -> Vec<String>
fn features(&self) -> Vec<String>
Feature names supported by the account.
This must be a subset of the names of {@link Wallet.features | features} of the Wallet.
§Example
vec![
"solana:signMessage".to_string(),
"solana:signTransaction".to_string(),
]