pub struct DeriveCredential { /* private fields */ }Expand description
Derive Chain smart-contract wallet + session-key + subaccount triple.
Implementations§
Source§impl DeriveCredential
impl DeriveCredential
Sourcepub fn new(
wallet_address: String,
session_key: String,
subaccount_id: u64,
) -> Self
pub fn new( wallet_address: String, session_key: String, subaccount_id: u64, ) -> Self
Creates a new DeriveCredential instance.
Sourcepub fn wallet_address(&self) -> &str
pub fn wallet_address(&self) -> &str
Returns the Derive Chain smart-contract wallet address (X-LYRAWALLET).
Sourcepub fn session_key(&self) -> &str
pub fn session_key(&self) -> &str
Returns the secp256k1 session-key private key (hex-encoded).
Sourcepub const fn subaccount_id(&self) -> u64
pub const fn subaccount_id(&self) -> u64
Returns the subaccount integer ID.
Sourcepub fn resolve(
wallet_address: Option<String>,
session_key: Option<String>,
subaccount_id: Option<u64>,
environment: DeriveEnvironment,
) -> Result<Self>
pub fn resolve( wallet_address: Option<String>, session_key: Option<String>, subaccount_id: Option<u64>, environment: DeriveEnvironment, ) -> Result<Self>
Resolves a DeriveCredential from explicit values, falling back to
the documented environment variables when fields are unset.
Resolution order per field is: explicit value, then env var. The env
var name set is selected by environment via credential_env_vars.
§Errors
Returns an error when any of the wallet address, session key, or
subaccount ID cannot be resolved from either source, or when the
subaccount id env var is not a valid u64.
Trait Implementations§
Source§impl Clone for DeriveCredential
impl Clone for DeriveCredential
Source§fn clone(&self) -> DeriveCredential
fn clone(&self) -> DeriveCredential
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeriveCredential
impl Debug for DeriveCredential
Source§impl Display for DeriveCredential
impl Display for DeriveCredential
Source§impl Drop for DeriveCredential
impl Drop for DeriveCredential
Auto Trait Implementations§
impl Freeze for DeriveCredential
impl RefUnwindSafe for DeriveCredential
impl Send for DeriveCredential
impl Sync for DeriveCredential
impl Unpin for DeriveCredential
impl UnsafeUnpin for DeriveCredential
impl UnwindSafe for DeriveCredential
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more