pub struct QuoteGenerator { /* private fields */ }Expand description
Quote generator for creating payment quotes.
Uses the node’s signing capabilities to sign quotes, which clients use to pay for storage on the Arbitrum network.
Implementations§
Source§impl QuoteGenerator
impl QuoteGenerator
Sourcepub fn new(
rewards_address: RewardsAddress,
metrics_tracker: QuotingMetricsTracker,
) -> Self
pub fn new( rewards_address: RewardsAddress, metrics_tracker: QuotingMetricsTracker, ) -> Self
Create a new quote generator without signing capability.
Call set_signer to enable quote signing.
§Arguments
rewards_address- The EVM address for receiving paymentsmetrics_tracker- Tracker for quoting metrics
Sourcepub fn set_signer<F>(&mut self, pub_key: Vec<u8>, sign_fn: F)
pub fn set_signer<F>(&mut self, pub_key: Vec<u8>, sign_fn: F)
Set the signing function for quote generation.
§Arguments
pub_key- The node’s public key bytessign_fn- Function that signs bytes and returns signature
Sourcepub fn probe_signer(&self) -> Result<()>
pub fn probe_signer(&self) -> Result<()>
Probe the signer with test data to verify it produces a non-empty signature.
§Errors
Returns an error if no signer is set or if signing produces an empty signature.
Sourcepub fn create_quote(
&self,
content: XorName,
data_size: usize,
data_type: u32,
) -> Result<PaymentQuote>
pub fn create_quote( &self, content: XorName, data_size: usize, data_type: u32, ) -> Result<PaymentQuote>
Generate a payment quote for storing data.
§Arguments
content- TheXorNameof the content to storedata_size- Size of the data in bytesdata_type- Type index of the data (0 for chunks)
§Returns
A signed PaymentQuote that the client can use to pay on-chain.
§Errors
Returns an error if signing is not configured.
Sourcepub fn rewards_address(&self) -> &RewardsAddress
pub fn rewards_address(&self) -> &RewardsAddress
Get the rewards address.
Sourcepub fn current_metrics(&self) -> QuotingMetrics
pub fn current_metrics(&self) -> QuotingMetrics
Get current quoting metrics.
Sourcepub fn record_payment(&self)
pub fn record_payment(&self)
Record a payment received (delegates to metrics tracker).
Sourcepub fn record_store(&self, data_type: u32)
pub fn record_store(&self, data_type: u32)
Record data stored (delegates to metrics tracker).
Sourcepub fn create_merkle_candidate_quote(
&self,
data_size: usize,
data_type: u32,
merkle_payment_timestamp: u64,
) -> Result<MerklePaymentCandidateNode>
pub fn create_merkle_candidate_quote( &self, data_size: usize, data_type: u32, merkle_payment_timestamp: u64, ) -> Result<MerklePaymentCandidateNode>
Create a merkle candidate quote for batch payment using ML-DSA-65.
Returns a MerklePaymentCandidateNode constructed with the node’s
ML-DSA-65 public key and signature. This uses the same post-quantum
signing stack as regular payment quotes, rather than the ed25519
signing that the upstream ant-evm library assumes.
The pub_key field stores the raw ML-DSA-65 public key bytes,
and signature stores the ML-DSA-65 signature over bytes_to_sign().
Clients verify these using verify_merkle_candidate_signature().
§Errors
Returns an error if signing is not configured.
Auto Trait Implementations§
impl !Freeze for QuoteGenerator
impl !RefUnwindSafe for QuoteGenerator
impl Send for QuoteGenerator
impl Sync for QuoteGenerator
impl Unpin for QuoteGenerator
impl UnsafeUnpin for QuoteGenerator
impl !UnwindSafe for QuoteGenerator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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