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
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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 Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
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.