Skip to main content

KeypairExt

Trait KeypairExt 

Source
pub trait KeypairExt {
    // Required methods
    fn from_str(value: &str) -> Result<Keypair, UserError>;
    fn account_id(&self) -> AccountId;
}
Expand description

Extension helpers for building and inspecting sr25519 keypairs.

Required Methods§

Source

fn from_str(value: &str) -> Result<Keypair, UserError>

Parses a secret URI string into a sr25519 keypair.

§Arguments
  • value - Secret URI string (e.g., seed phrase or mnemonic).
§Returns

Returns the derived sr25519 keypair.

§Errors

Returns a UserError if the URI cannot be parsed or keypair derivation fails.

Source

fn account_id(&self) -> AccountId

Derives the associated AccountId from the public key.

§Returns

Returns the AccountId corresponding to this keypair’s public key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§