Skip to main content

InjectedProvider

Struct InjectedProvider 

Source
pub struct InjectedProvider { /* private fields */ }
Expand description

Explicit adapter for an application-selected Quai EIP-1193 provider object.

The configured endpoint is an exact routing identity, not a fetched URL. The encoded shard is included in every request as in pinned quais.js. Construction never requests accounts or signatures. Generic Transport is read-only; explicit methods are the only route to supported permission-sensitive wallet requests.

Implementations§

Source§

impl InjectedProvider

Source

pub fn signed_submission_transport(&self) -> InjectedSubmissionTransport

Opt into forwarding verified signed bytes through this wallet’s RPC. Construction performs no network requests or permission/signing prompts. The original InjectedProvider transport retains its read-only allowlist.

Source§

impl InjectedProvider

Source

pub async fn send_quai_transaction( &self, address: QuaiAddress, transaction: &QuaiTransaction, ) -> Result<WalletSendAcknowledgement, WalletSendError>

Explicitly ask the selected wallet to authorize, sign and send a populated type-0 request using quai_sendTransaction. No offline-signing support is required. Retain account/nonce/digest before awaiting in case of cancellation. Wallets may alter fields in their approval flow: the returned acknowledgement does not assert exact signing; call observe to verify and compare the result.

Source§

impl InjectedProvider

Source

pub fn new( provider: JsValue, endpoint: Endpoint, shard: Shard, expected_chain: U256, config: BrowserConfig, ) -> Result<Self, BrowserError>

Bind an explicitly selected JS provider, endpoint identity, shard and expected chain. No global provider discovery or wallet prompt occurs.

Source

pub fn context_revision(&self) -> u32

Monotonic account/chain/disconnect revision shared by adapter clones. Applications can invalidate displayed balances and cached authorization on change.

Source

pub fn monitors_context_events(&self) -> bool

Whether this provider exposes removable EIP-1193 event listeners.

Source

pub async fn read( &self, endpoint: &Endpoint, method: &str, params: Value, ) -> Result<Value, BrowserError>

Read through the fixed injected wallet after a fresh chain check. Account/signing/sending permission methods cannot pass this allowlist.

Source

pub async fn request_accounts(&self) -> Result<Vec<QuaiAddress>, BrowserError>

Request wallet account access explicitly. Call only in the application’s user-approved flow. User rejection preserves numeric EIP-1193 code 4001. No retry occurs.

Source

pub async fn accounts(&self) -> Result<Vec<QuaiAddress>, BrowserError>

Read accounts already exposed by the wallet; never requests additional permission.

Source

pub async fn personal_sign( &self, address: QuaiAddress, message: &[u8], ) -> Result<[u8; 65], BrowserError>

Explicitly ask the wallet to sign these bytes with personal_sign.

Checks the configured chain, account exposure and sender zone before calling. Recovers the exact message signature and requires the requested account. Dropping this future cannot dismiss or revoke a wallet approval already presented by the injected provider.

Source

pub async fn sign_typed_data( &self, address: QuaiAddress, data: &TypedData, policy: DomainPolicy, ) -> Result<[u8; 65], BrowserError>

Explicitly request EIP-712 v4 signing after domain, chain and account checks. The immutable document determines both the serialized request and recovered signature hash. No implicit permission request or automatic retry occurs.

Source

pub async fn sign_quai_transaction( &self, address: QuaiAddress, transaction: &QuaiTransaction, ) -> Result<SignedQuaiTransaction, BrowserError>

Explicitly request signing of an exact, fully populated type-0 Quai transaction. Does not estimate, fill fields, request accounts or broadcast. Canonical returned protobuf must recover the requested exposed account and match every unsigned field, including ordered access-list entries. Dropping the future cannot retract an already displayed wallet approval.

Trait Implementations§

Source§

impl Clone for InjectedProvider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InjectedProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Transport for InjectedProvider

Source§

async fn request( &self, endpoint: &Endpoint, method: &str, params: Value, ) -> Result<Value, RpcError>

Send a request using a browser-compatible future without a Send requirement.
Source§

async fn request_batch( &self, _endpoint: &Endpoint, _requests: Vec<(&str, Value)>, ) -> Option<Result<Vec<Result<Value, RpcError>>, RpcError>>

Optional browser-compatible batch capability; no requests on None.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> FetchThreading for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more