pub struct Faucet {
pub time_slice: Duration,
/* private fields */
}
Fields§
§time_slice: Duration
Implementations§
Source§impl Faucet
impl Faucet
pub fn new( faucet_keypair: Keypair, time_input: Option<u64>, per_time_cap: Option<u64>, per_request_cap: Option<u64>, ) -> Self
pub fn new_with_allowed_ips( faucet_keypair: Keypair, time_input: Option<u64>, per_time_cap: Option<u64>, per_request_cap: Option<u64>, allowed_ips: HashSet<IpAddr>, ) -> Self
pub fn check_time_request_limit<T: LimitByTime + Display>( &mut self, request_amount: u64, to: T, ) -> Result<(), FaucetError>
pub fn clear_caches(&mut self)
Sourcepub fn build_airdrop_transaction(
&mut self,
req: FaucetRequest,
ip: IpAddr,
) -> Result<FaucetTransaction, FaucetError>
pub fn build_airdrop_transaction( &mut self, req: FaucetRequest, ip: IpAddr, ) -> Result<FaucetTransaction, FaucetError>
Checks per-request and per-time-ip limits; if both pass, this method returns a signed
SystemProgram::Transfer transaction from the faucet keypair to the requested recipient. If
the request exceeds this per-request limit, this method returns a signed SPL Memo
transaction with the memo: “request too large; req:
Sourcepub fn process_faucet_request(
&mut self,
bytes: &[u8],
ip: IpAddr,
) -> Result<Vec<u8>, FaucetError>
pub fn process_faucet_request( &mut self, bytes: &[u8], ip: IpAddr, ) -> Result<Vec<u8>, FaucetError>
Deserializes a received airdrop request, and returns a serialized transaction
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Faucet
impl RefUnwindSafe for Faucet
impl Send for Faucet
impl Sync for Faucet
impl Unpin for Faucet
impl UnwindSafe for Faucet
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
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>
Converts
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>
Converts
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