pub struct UserWalletsClient { /* private fields */ }Expand description
Async HTTP client for the Circle W3S User-Controlled Wallets API.
Implementations§
Source§impl UserWalletsClient
impl UserWalletsClient
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Creates a new client using the Circle production base URL.
Sourcepub fn with_base_url(
api_key: impl Into<String>,
base_url: impl Into<String>,
) -> Self
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).
Sourcepub async fn create_user(
&self,
req: &CreateUserRequest,
) -> Result<UserResponse, Error>
pub async fn create_user( &self, req: &CreateUserRequest, ) -> Result<UserResponse, Error>
Register a new end-user.
POST /v1/w3s/users
Sourcepub async fn list_users(&self, params: &ListUsersParams) -> Result<Users, Error>
pub async fn list_users(&self, params: &ListUsersParams) -> Result<Users, Error>
List all end-users with optional filtering and pagination.
GET /v1/w3s/users
Sourcepub async fn get_user(&self, id: &str) -> Result<GetUserByIdResponse, Error>
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}
Sourcepub async fn get_user_token(
&self,
req: &GetUserTokenRequest,
) -> Result<UserTokenResponse, Error>
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
Obtain a device token for social sign-in flows.
POST /v1/w3s/users/social/token
Sourcepub async fn get_device_token_email(
&self,
req: &DeviceTokenEmailRequest,
) -> Result<DeviceTokenEmailResponse, Error>
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
Sourcepub async fn refresh_user_token(
&self,
user_token: &str,
req: &RefreshUserTokenRequest,
) -> Result<RefreshUserTokenResponse, Error>
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
Sourcepub async fn resend_otp(
&self,
user_token: &str,
req: &ResendOtpRequest,
) -> Result<ResendOtpResponse, Error>
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
Sourcepub async fn get_user_by_token(
&self,
user_token: &str,
) -> Result<UserResponse, Error>
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
Sourcepub async fn initialize_user(
&self,
user_token: &str,
req: &SetPinAndInitWalletRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn create_pin_challenge(
&self,
user_token: &str,
req: &SetPinRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn update_pin_challenge(
&self,
user_token: &str,
req: &SetPinRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn restore_pin_challenge(
&self,
user_token: &str,
req: &SetPinRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn list_challenges(
&self,
user_token: &str,
) -> Result<Challenges, Error>
pub async fn list_challenges( &self, user_token: &str, ) -> Result<Challenges, Error>
List challenges for the authenticated user.
GET /v1/w3s/user/challenges
Sourcepub async fn get_challenge(
&self,
user_token: &str,
id: &str,
) -> Result<ChallengeResponse, Error>
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}
Sourcepub async fn create_wallet(
&self,
user_token: &str,
req: &CreateEndUserWalletRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn list_wallets(
&self,
user_token: &str,
params: &ListWalletsParams,
) -> Result<Wallets, Error>
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
Sourcepub async fn get_wallet(
&self,
user_token: &str,
id: &str,
) -> Result<WalletResponse, Error>
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}
Sourcepub async fn update_wallet(
&self,
user_token: &str,
id: &str,
req: &UpdateWalletRequest,
) -> Result<WalletResponse, Error>
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}
Sourcepub async fn list_wallet_balances(
&self,
user_token: &str,
wallet_id: &str,
params: &ListWalletBalancesParams,
) -> Result<Balances, Error>
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
Sourcepub async fn list_wallet_nfts(
&self,
user_token: &str,
wallet_id: &str,
params: &ListWalletNftsParams,
) -> Result<Nfts, Error>
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
Sourcepub async fn create_transfer_transaction(
&self,
user_token: &str,
req: &CreateTransferTxRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn accelerate_transaction(
&self,
user_token: &str,
id: &str,
req: &AccelerateTxRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn cancel_transaction(
&self,
user_token: &str,
id: &str,
req: &CancelTxRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn create_contract_execution_transaction(
&self,
user_token: &str,
req: &CreateContractExecutionTxRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn create_wallet_upgrade_transaction(
&self,
user_token: &str,
req: &CreateWalletUpgradeTxRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn list_transactions(
&self,
user_token: &str,
params: &ListTransactionsParams,
) -> Result<Transactions, Error>
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
Sourcepub async fn get_transaction(
&self,
user_token: &str,
id: &str,
) -> Result<TransactionResponse, Error>
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}
Sourcepub async fn get_lowest_nonce_transaction(
&self,
params: &GetLowestNonceTxParams,
) -> Result<GetLowestNonceTransactionResponse, Error>
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
Sourcepub async fn estimate_transfer_fee(
&self,
user_token: &str,
req: &EstimateTransferFeeRequest,
) -> Result<EstimateTransactionFee, Error>
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
Sourcepub async fn estimate_contract_execution_fee(
&self,
user_token: &str,
req: &EstimateContractExecFeeRequest,
) -> Result<EstimateTransactionFee, Error>
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
Sourcepub async fn validate_address(
&self,
req: &ValidateAddressRequest,
) -> Result<ValidateAddressResponse, Error>
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
Sourcepub async fn get_token(&self, id: &str) -> Result<TokenResponse, Error>
pub async fn get_token(&self, id: &str) -> Result<TokenResponse, Error>
Retrieve token metadata by its Circle token ID.
GET /v1/w3s/tokens/{id}
Sourcepub async fn sign_message(
&self,
user_token: &str,
req: &SignMessageRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn sign_typed_data(
&self,
user_token: &str,
req: &SignTypedDataRequest,
) -> Result<ChallengeIdResponse, Error>
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
Sourcepub async fn sign_transaction(
&self,
user_token: &str,
req: &SignTransactionRequest,
) -> Result<ChallengeIdResponse, Error>
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