Skip to main content

UserWalletsClient

Struct UserWalletsClient 

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

Async HTTP client for the Circle W3S User-Controlled Wallets API.

Implementations§

Source§

impl UserWalletsClient

Source

pub fn new(api_key: impl Into<String>) -> Self

Creates a new client using the Circle production base URL.

Source

pub fn with_base_url( api_key: impl Into<String>, base_url: impl Into<String>, ) -> Self

Creates a new client with a custom base URL (useful for Prism mock servers).

Source

pub async fn create_user( &self, req: &CreateUserRequest, ) -> Result<UserResponse, Error>

Register a new end-user.

POST /v1/w3s/users

Source

pub async fn list_users(&self, params: &ListUsersParams) -> Result<Users, Error>

List all end-users with optional filtering and pagination.

GET /v1/w3s/users

Source

pub async fn get_user(&self, id: &str) -> Result<GetUserByIdResponse, Error>

Retrieve an end-user by their Circle user ID.

GET /v1/w3s/users/{id}

Source

pub async fn get_user_token( &self, req: &GetUserTokenRequest, ) -> Result<UserTokenResponse, Error>

Obtain a short-lived user token for the given user ID.

POST /v1/w3s/users/token

Source

pub async fn get_device_token_social( &self, req: &DeviceTokenSocialRequest, ) -> Result<DeviceTokenSocialResponse, Error>

Obtain a device token for social sign-in flows.

POST /v1/w3s/users/social/token

Source

pub async fn get_device_token_email( &self, req: &DeviceTokenEmailRequest, ) -> Result<DeviceTokenEmailResponse, Error>

Obtain a device token and OTP for email sign-in flows.

POST /v1/w3s/users/email/token

Source

pub async fn refresh_user_token( &self, user_token: &str, req: &RefreshUserTokenRequest, ) -> Result<RefreshUserTokenResponse, Error>

Refresh a user token using a refresh token.

POST /v1/w3s/users/token/refresh

Source

pub async fn resend_otp( &self, user_token: &str, req: &ResendOtpRequest, ) -> Result<ResendOtpResponse, Error>

Resend a one-time password to the user’s email.

POST /v1/w3s/users/email/resendOTP

Source

pub async fn get_user_by_token( &self, user_token: &str, ) -> Result<UserResponse, Error>

Retrieve the end-user record associated with the supplied user token.

GET /v1/w3s/user

Source

pub async fn initialize_user( &self, user_token: &str, req: &SetPinAndInitWalletRequest, ) -> Result<ChallengeIdResponse, Error>

Initialize a user’s PIN and optionally create wallets in a single challenge.

POST /v1/w3s/user/initialize

Source

pub async fn create_pin_challenge( &self, user_token: &str, req: &SetPinRequest, ) -> Result<ChallengeIdResponse, Error>

Create a challenge for the user to set their PIN.

POST /v1/w3s/user/pin

Source

pub async fn update_pin_challenge( &self, user_token: &str, req: &SetPinRequest, ) -> Result<ChallengeIdResponse, Error>

Create a challenge for the user to update their PIN.

PUT /v1/w3s/user/pin

Source

pub async fn restore_pin_challenge( &self, user_token: &str, req: &SetPinRequest, ) -> Result<ChallengeIdResponse, Error>

Create a challenge for the user to restore a locked PIN.

POST /v1/w3s/user/pin/restore

Source

pub async fn list_challenges( &self, user_token: &str, ) -> Result<Challenges, Error>

List challenges for the authenticated user.

GET /v1/w3s/user/challenges

Source

pub async fn get_challenge( &self, user_token: &str, id: &str, ) -> Result<ChallengeResponse, Error>

Retrieve a single challenge by its ID.

GET /v1/w3s/user/challenges/{id}

Source

pub async fn create_wallet( &self, user_token: &str, req: &CreateEndUserWalletRequest, ) -> Result<ChallengeIdResponse, Error>

Create new wallet(s) for the authenticated user.

Returns a challengeId — the user must complete the challenge in the mobile SDK to finalise wallet creation.

POST /v1/w3s/user/wallets

Source

pub async fn list_wallets( &self, user_token: &str, params: &ListWalletsParams, ) -> Result<Wallets, Error>

List wallets accessible to the authenticated user.

GET /v1/w3s/wallets

Source

pub async fn get_wallet( &self, user_token: &str, id: &str, ) -> Result<WalletResponse, Error>

Retrieve a single wallet by its ID.

GET /v1/w3s/wallets/{id}

Source

pub async fn update_wallet( &self, user_token: &str, id: &str, req: &UpdateWalletRequest, ) -> Result<WalletResponse, Error>

Update the name or reference ID of a wallet.

PUT /v1/w3s/wallets/{id}

Source

pub async fn list_wallet_balances( &self, user_token: &str, wallet_id: &str, params: &ListWalletBalancesParams, ) -> Result<Balances, Error>

List token balances for a wallet.

GET /v1/w3s/wallets/{id}/balances

Source

pub async fn list_wallet_nfts( &self, user_token: &str, wallet_id: &str, params: &ListWalletNftsParams, ) -> Result<Nfts, Error>

List NFTs held by a wallet.

GET /v1/w3s/wallets/{id}/nfts

Source

pub async fn create_transfer_transaction( &self, user_token: &str, req: &CreateTransferTxRequest, ) -> Result<ChallengeIdResponse, Error>

Initiate a token transfer transaction (returns a challengeId).

POST /v1/w3s/user/transactions/transfer

Source

pub async fn accelerate_transaction( &self, user_token: &str, id: &str, req: &AccelerateTxRequest, ) -> Result<ChallengeIdResponse, Error>

Accelerate a stuck transaction (returns a challengeId).

POST /v1/w3s/user/transactions/{id}/accelerate

Source

pub async fn cancel_transaction( &self, user_token: &str, id: &str, req: &CancelTxRequest, ) -> Result<ChallengeIdResponse, Error>

Cancel a pending transaction (returns a challengeId).

POST /v1/w3s/user/transactions/{id}/cancel

Source

pub async fn create_contract_execution_transaction( &self, user_token: &str, req: &CreateContractExecutionTxRequest, ) -> Result<ChallengeIdResponse, Error>

Initiate a smart-contract execution transaction (returns a challengeId).

POST /v1/w3s/user/transactions/contractExecution

Source

pub async fn create_wallet_upgrade_transaction( &self, user_token: &str, req: &CreateWalletUpgradeTxRequest, ) -> Result<ChallengeIdResponse, Error>

Initiate a wallet-upgrade transaction (returns a challengeId).

POST /v1/w3s/user/transactions/walletUpgrade

Source

pub async fn list_transactions( &self, user_token: &str, params: &ListTransactionsParams, ) -> Result<Transactions, Error>

List transactions visible to the authenticated user.

GET /v1/w3s/transactions

Source

pub async fn get_transaction( &self, user_token: &str, id: &str, ) -> Result<TransactionResponse, Error>

Retrieve a single transaction by its ID.

GET /v1/w3s/transactions/{id}

Source

pub async fn get_lowest_nonce_transaction( &self, params: &GetLowestNonceTxParams, ) -> Result<GetLowestNonceTransactionResponse, Error>

Retrieve the transaction with the lowest pending nonce for an address.

GET /v1/w3s/transactions/lowestNonceTransaction

Source

pub async fn estimate_transfer_fee( &self, user_token: &str, req: &EstimateTransferFeeRequest, ) -> Result<EstimateTransactionFee, Error>

Estimate transfer transaction fees.

POST /v1/w3s/transactions/transfer/estimateFee

Source

pub async fn estimate_contract_execution_fee( &self, user_token: &str, req: &EstimateContractExecFeeRequest, ) -> Result<EstimateTransactionFee, Error>

Estimate contract execution transaction fees.

POST /v1/w3s/transactions/contractExecution/estimateFee

Source

pub async fn validate_address( &self, req: &ValidateAddressRequest, ) -> Result<ValidateAddressResponse, Error>

Validate that an address is valid for a given blockchain.

POST /v1/w3s/transactions/validateAddress

Source

pub async fn get_token(&self, id: &str) -> Result<TokenResponse, Error>

Retrieve token metadata by its Circle token ID.

GET /v1/w3s/tokens/{id}

Source

pub async fn sign_message( &self, user_token: &str, req: &SignMessageRequest, ) -> Result<ChallengeIdResponse, Error>

Request a message signing challenge (returns a challengeId).

POST /v1/w3s/user/sign/message

Source

pub async fn sign_typed_data( &self, user_token: &str, req: &SignTypedDataRequest, ) -> Result<ChallengeIdResponse, Error>

Request an EIP-712 typed data signing challenge (returns a challengeId).

POST /v1/w3s/user/sign/typedData

Source

pub async fn sign_transaction( &self, user_token: &str, req: &SignTransactionRequest, ) -> Result<ChallengeIdResponse, Error>

Request a raw transaction signing challenge (returns a challengeId).

POST /v1/w3s/user/sign/transaction

Trait Implementations§

Source§

impl Debug for UserWalletsClient

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.