pub struct Keychain<T: ReadOnly + SignOnly> {
pub keys: Vec<T>,
pub short_addr_to_key_index: HashMap<Id, u32>,
}
Expand description
Support multiple keys as a chain. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/vms/secp256k1fx#Keychain ref. https://github.com/ava-labs/avalanchego/blob/v1.7.9/wallet/chain/p/builder.go
Fields
keys: Vec<T>
short_addr_to_key_index: HashMap<Id, u32>
Implementations
sourceimpl<T> Keychain<T>where
T: ReadOnly + SignOnly + Clone,
impl<T> Keychain<T>where
T: ReadOnly + SignOnly + Clone,
pub fn new(keys: Vec<T>) -> Self
sourcepub fn get(&self, short_addr: &Id) -> Option<T>
pub fn get(&self, short_addr: &Id) -> Option<T>
ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/vms/secp256k1fx#Keychain.Get
sourcepub fn match_threshold(
&self,
output_owners: &OutputOwners,
time: u64
) -> Option<(Vec<u32>, Vec<T>)>
pub fn match_threshold(
&self,
output_owners: &OutputOwners,
time: u64
) -> Option<(Vec<u32>, Vec<T>)>
ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/vms/secp256k1fx#Keychain.Match
sourcepub fn spend(
&self,
output: &TransferOutput,
time: u64
) -> Option<(TransferInput, Vec<T>)>
pub fn spend(
&self,
output: &TransferOutput,
time: u64
) -> Option<(TransferInput, Vec<T>)>
Returns “None” if the threshold is NOT met. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/vms/secp256k1fx#Keychain.Spend TODO: support spend on “secp256k1fx::MintOutput”
Trait Implementations
sourceimpl<'de, T: ReadOnly + SignOnly> Deserialize<'de> for Keychain<T>where
T: Deserialize<'de>,
impl<'de, T: ReadOnly + SignOnly> Deserialize<'de> for Keychain<T>where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: PartialEq + ReadOnly + SignOnly> PartialEq<Keychain<T>> for Keychain<T>
impl<T: PartialEq + ReadOnly + SignOnly> PartialEq<Keychain<T>> for Keychain<T>
impl<T: Eq + ReadOnly + SignOnly> Eq for Keychain<T>
impl<T: ReadOnly + SignOnly> StructuralEq for Keychain<T>
impl<T: ReadOnly + SignOnly> StructuralPartialEq for Keychain<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Keychain<T>where
T: RefUnwindSafe,
impl<T> Send for Keychain<T>where
T: Send,
impl<T> Sync for Keychain<T>where
T: Sync,
impl<T> Unpin for Keychain<T>where
T: Unpin,
impl<T> UnwindSafe for Keychain<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request