pub struct SmartSigner<'a> { /* private fields */ }Expand description
Smart signer with auto-version tracking (matching Dart SDK SmartSigner)
Implementations§
Source§impl<'a> SmartSigner<'a>
impl<'a> SmartSigner<'a>
Sourcepub fn new(
client: &'a AccumulateClient,
keypair: SigningKey,
signer_url: &str,
) -> Self
pub fn new( client: &'a AccumulateClient, keypair: SigningKey, signer_url: &str, ) -> Self
Create a new SmartSigner
Sourcepub async fn refresh_version(&mut self) -> Result<u64, JsonRpcError>
pub async fn refresh_version(&mut self) -> Result<u64, JsonRpcError>
Query and update the cached version
Sourcepub fn sign(
&self,
principal: &str,
body: &Value,
memo: Option<&str>,
) -> Result<Value, JsonRpcError>
pub fn sign( &self, principal: &str, body: &Value, memo: Option<&str>, ) -> Result<Value, JsonRpcError>
Sign a transaction and return the envelope
This uses proper binary encoding matching the Go core implementation:
- Compute signature metadata hash (binary encoded)
- Use that as the transaction initiator
- Compute transaction hash using binary encoding
- Create signing preimage = SHA256(sigMdHash + txHash)
- Sign the preimage
Sourcepub async fn sign_submit_and_wait(
&mut self,
principal: &str,
body: &Value,
memo: Option<&str>,
max_attempts: u32,
) -> TxResult
pub async fn sign_submit_and_wait( &mut self, principal: &str, body: &Value, memo: Option<&str>, max_attempts: u32, ) -> TxResult
Sign, submit, and wait for transaction confirmation
Sourcepub async fn add_key(&mut self, public_key: &[u8]) -> TxResult
pub async fn add_key(&mut self, public_key: &[u8]) -> TxResult
Add a key to the key page using SmartSigner
Sourcepub async fn remove_key(&mut self, public_key_hash: &[u8]) -> TxResult
pub async fn remove_key(&mut self, public_key_hash: &[u8]) -> TxResult
Remove a key from the key page using SmartSigner
Sourcepub async fn set_threshold(&mut self, threshold: u64) -> TxResult
pub async fn set_threshold(&mut self, threshold: u64) -> TxResult
Set the threshold for the key page
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SmartSigner<'a>
impl<'a> !RefUnwindSafe for SmartSigner<'a>
impl<'a> Send for SmartSigner<'a>
impl<'a> Sync for SmartSigner<'a>
impl<'a> Unpin for SmartSigner<'a>
impl<'a> !UnwindSafe for SmartSigner<'a>
Blanket Implementations§
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