WalletInfo

Trait WalletInfo 

Source
pub trait WalletInfo {
    type Account: WalletAccountInfo;

    // Required methods
    fn version(&self) -> String;
    fn name(&self) -> String;
    fn icon(&self) -> String;
    fn chains(&self) -> Vec<String>;
    fn features(&self) -> Vec<String>;
    fn accounts(&self) -> Vec<Self::Account>;
}
Expand description

Provides information about a wallet implementation.

This trait defines the metadata and capabilities of a wallet, including its name, icon, supported chains, features, and accounts. It serves as the primary interface for applications to discover wallet capabilities.

§Example

struct MyWalletInfo {
    name: String,
    icon: String,
    chains: Vec<String>,
    features: Vec<String>,
    accounts: Vec<MyAccount>,
}

impl WalletInfo for MyWalletInfo {
    type Account = MyAccount;

    fn version(&self) -> String {
        "1.0.0".to_string()
    }

    fn name(&self) -> String {
        self.name.clone()
    }

    // ... other implementations
}

Required Associated Types§

Required Methods§

Source

fn version(&self) -> String

{@link WalletVersion | Version} of the Wallet Standard implemented by the Wallet.

Must be read-only, static, and canonically defined by the Wallet Standard.

Source

fn name(&self) -> String

Name of the Wallet. This may be displayed by the app.

Must be read-only, static, descriptive, unique, and canonically defined by the wallet extension or application.

Source

fn icon(&self) -> String

{@link WalletIcon | Icon} of the Wallet. This may be displayed by the app.

Must be read-only, static, and canonically defined by the wallet extension or application.

Source

fn chains(&self) -> Vec<String>

Chains supported by the Wallet.

A chain is an {@link IdentifierString} which identifies a blockchain in a canonical, human-readable format. CAIP-2 chain IDs are compatible with this, but are not required to be used.

Each blockchain should define its own chains by extension of the Wallet Standard, using its own namespace. The standard and experimental namespaces are reserved by the Wallet Standard.

The {@link “@wallet-standard/features”.EventsFeature | standard:events feature} should be used to notify the app if the value changes.

§Example
vec!["solana:mainnet".to_string(), "solana:devnet".to_string()]
Source

fn features(&self) -> Vec<String>

Features supported by the Wallet.

A feature name is an {@link IdentifierString} which identifies a feature in a canonical, human-readable format.

Each blockchain should define its own features by extension of the Wallet Standard.

The standard and experimental namespaces are reserved by the Wallet Standard.

A feature may have any type. It may be a single method or value, or a collection of them.

A conventional feature has the following structure:

 export type ExperimentalEncryptFeature = {
     // Name of the feature.
     'experimental:encrypt': {
         // Version of the feature.
         version: '1.0.0';
         // Properties of the feature.
         ciphers: readonly 'x25519-xsalsa20-poly1305'[];
         // Methods of the feature.
         encrypt (data: Uint8Array): Promise<Uint8Array>;
     };
 };

The {@link “@wallet-standard/features”.EventsFeature | standard:events feature} should be used to notify the app if the value changes.

§Example
vec![
	"standard:connect".to_string(),
	"standard:disconnect".to_string(),
	"solana:signMessage".to_string(),
	"solana:signTransaction".to_string(),
]
Source

fn accounts(&self) -> Vec<Self::Account>

{@link WalletAccount | Accounts} that the app is authorized to use.

This can be set by the Wallet so the app can use authorized accounts on the initial page load.

The {@link “@wallet-standard/features”.ConnectFeature | standard:connect feature} should be used to obtain authorization to the accounts.

The {@link “@wallet-standard/features”.EventsFeature | standard:events feature} should be used to notify the app if the value changes.

Implementors§