Struct ergo_lib_wasm::wallet::Wallet
source · [−]pub struct Wallet(_);
Expand description
A collection of secret keys. This simplified signing by matching the secret keys to the correct inputs automatically.
Implementations
sourceimpl Wallet
impl Wallet
sourcepub fn from_mnemonic(
mnemonic_phrase: &str,
mnemonic_pass: &str
) -> Result<Wallet, JsValue>
pub fn from_mnemonic(
mnemonic_phrase: &str,
mnemonic_pass: &str
) -> Result<Wallet, JsValue>
Create wallet instance loading secret key from mnemonic Returns None if a DlogSecretKey cannot be parsed from the provided phrase
sourcepub fn from_secrets(secret: &SecretKeys) -> Wallet
pub fn from_secrets(secret: &SecretKeys) -> Wallet
Create wallet using provided secret key
sourcepub fn add_secret(&mut self, secret: &SecretKey)
pub fn add_secret(&mut self, secret: &SecretKey)
Add a secret to the wallets prover
sourcepub fn sign_transaction(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes
) -> Result<Transaction, JsValue>
pub fn sign_transaction(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes
) -> Result<Transaction, JsValue>
Sign a transaction:
tx
- transaction to sign
boxes_to_spend
- boxes corresponding to UnsignedTransaction::inputs
data_boxes
- boxes corresponding to UnsignedTransaction::data_inputs
sourcepub fn sign_transaction_multi(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes,
tx_hints: &TransactionHintsBag
) -> Result<Transaction, JsValue>
pub fn sign_transaction_multi(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes,
tx_hints: &TransactionHintsBag
) -> Result<Transaction, JsValue>
Sign a multi signature transaction:
tx
- transaction to sign
boxes_to_spend
- boxes corresponding to UnsignedTransaction::inputs
data_boxes
- boxes corresponding to UnsignedTransaction::data_inputs
tx_hints
- transaction hints bag corresponding to TransactionHintsBag
sourcepub fn sign_reduced_transaction(
&self,
reduced_tx: &ReducedTransaction
) -> Result<Transaction, JsValue>
pub fn sign_reduced_transaction(
&self,
reduced_tx: &ReducedTransaction
) -> Result<Transaction, JsValue>
Sign a transaction:
reduced_tx
- reduced transaction, i.e. unsigned transaction where for each unsigned input
added a script reduction result.
sourcepub fn sign_reduced_transaction_multi(
&self,
reduced_tx: &ReducedTransaction,
tx_hints: &TransactionHintsBag
) -> Result<Transaction, JsValue>
pub fn sign_reduced_transaction_multi(
&self,
reduced_tx: &ReducedTransaction,
tx_hints: &TransactionHintsBag
) -> Result<Transaction, JsValue>
Sign a multi signature reduced transaction:
reduced_tx
- reduced transaction, i.e. unsigned transaction where for each unsigned input
added a script reduction result.
tx_hints
- transaction hints bag corresponding to TransactionHintsBag
sourcepub fn generate_commitments(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes
) -> Result<TransactionHintsBag, JsValue>
pub fn generate_commitments(
&self,
_state_context: &ErgoStateContext,
tx: &UnsignedTransaction,
boxes_to_spend: &ErgoBoxes,
data_boxes: &ErgoBoxes
) -> Result<TransactionHintsBag, JsValue>
Generate Commitments for unsigned tx
sourcepub fn generate_commitments_for_reduced_transaction(
&self,
reduced_tx: &ReducedTransaction
) -> Result<TransactionHintsBag, JsValue>
pub fn generate_commitments_for_reduced_transaction(
&self,
reduced_tx: &ReducedTransaction
) -> Result<TransactionHintsBag, JsValue>
Generate Commitments for reduced Transaction
sourcepub fn sign_message_using_p2pk(
&self,
address: &Address,
message: &[u8]
) -> Result<Uint8Array, JsValue>
pub fn sign_message_using_p2pk(
&self,
address: &Address,
message: &[u8]
) -> Result<Uint8Array, JsValue>
Sign an arbitrary message using a P2PK address
Trait Implementations
sourceimpl FromWasmAbi for Wallet
impl FromWasmAbi for Wallet
sourceimpl IntoWasmAbi for Wallet
impl IntoWasmAbi for Wallet
sourceimpl OptionFromWasmAbi for Wallet
impl OptionFromWasmAbi for Wallet
sourceimpl OptionIntoWasmAbi for Wallet
impl OptionIntoWasmAbi for Wallet
sourceimpl RefFromWasmAbi for Wallet
impl RefFromWasmAbi for Wallet
type Anchor = Ref<'static, Wallet>
type Anchor = Ref<'static, Wallet>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read moresourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
sourceimpl RefMutFromWasmAbi for Wallet
impl RefMutFromWasmAbi for Wallet
Auto Trait Implementations
impl !RefUnwindSafe for Wallet
impl !Send for Wallet
impl !Sync for Wallet
impl Unpin for Wallet
impl !UnwindSafe for Wallet
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
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
self
, then passes self.deref()
into the pipe function.sourceimpl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read moreimpl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read morefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read morefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read morefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read morefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read moreimpl<F> TryExtractInto<F> for F
impl<F> TryExtractInto<F> for F
fn try_extract_into<T>(self) -> Result<T, TryExtractFromError>where
T: TryExtractFrom<F>,
fn try_extract_into<T>(self) -> Result<T, TryExtractFromError>where
T: TryExtractFrom<F>,
super::value::Value
])
on which [TryExtractFrom
] is implemented Read more