pub struct Client { /* private fields */ }
Expand description
Client for Coinbase Developer Platform APIs
The Coinbase Developer Platform APIs - leading the world’s transition onchain.
Version: 2.0.0
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl
is the base URL provided to the internal
reqwest::Client
, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: ClientWithMiddleware) -> Self
pub fn new_with_client(baseurl: &str, client: ClientWithMiddleware) -> Self
Construct a new client with an existing reqwest_middleware::ClientWithMiddleware
,
allowing more control over its configuration.
baseurl
is the base URL provided to the internal
reqwest_middleware::ClientWithMiddleware
, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub fn list_data_token_balances(&self) -> ListDataTokenBalances<'_>
pub fn list_data_token_balances(&self) -> ListDataTokenBalances<'_>
List EVM token balances
Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
**Note:** This endpoint provides <1 second freshness from chain tip, <500ms response latency for wallets with reasonable token history, and 99.9% uptime for production use.
Sends a `GET` request to `/v2/data/evm/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The 0x-prefixed EVM address to get balances for. The address does not need to be checksummed.
- `page_size`: The number of balances to return per page.
- `page_token`: The token for the next page of balances. Will be empty if there are no more balances to fetch.
```ignore
let response = client.list_data_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn list_tokens_for_account(&self) -> ListTokensForAccount<'_>
pub fn list_tokens_for_account(&self) -> ListTokensForAccount<'_>
List token addresses for account
Retrieve all ERC-20 token contract addresses that an account has ever received tokens from.
Analyzes transaction history to discover token interactions.
Sends a `GET` request to `/v2/data/evm/token-ownership/{network}/{address}`
Arguments:
- `network`: The blockchain network to query.
- `address`: The account address to analyze for token interactions.
```ignore
let response = client.list_tokens_for_account()
.network(network)
.address(address)
.send()
.await;
```
Sourcepub fn run_sql_query(&self) -> RunSqlQuery<'_>
pub fn run_sql_query(&self) -> RunSqlQuery<'_>
Run SQL Query
Run a read-only SQL query against indexed blockchain data including transactions, events, and decoded logs.
This endpoint provides direct SQL access to comprehensive blockchain data across supported networks.
Queries are executed against optimized data structures for high-performance analytics.
## Allowed Queries
- Standard SQL syntax (ClickHouse dialect)
- Read-only queries (SELECT statements)
- No DDL or DML operations
- No cartesian products
## Supported Tables
- `base.events` - Base mainnet decoded event logs with parameters, event signature, topics, and more.
- `base.transactions` - Base mainnet transaction data including hash, block number, gas usage.
- `base.blocks` - Base mainnet block information.
- `base.encoded_logs` - Encoded log data of event logs that aren't able to be decoded by our event decoder (ex: log0 opcode).
- `base.transfers` - All event logs with event signature `Transfer(address,address,uint256)`. ERC-20, ERC-721, and ERC-1155 transfers are all included.
## Query Limits
- Maximum result set: 10,000 rows
- Query timeout: 30 seconds
- Maximum JOINs: 5
Sends a `POST` request to `/v2/data/query/run`
```ignore
let response = client.run_sql_query()
.body(body)
.send()
.await;
```
Sourcepub fn validate_end_user_access_token(&self) -> ValidateEndUserAccessToken<'_>
pub fn validate_end_user_access_token(&self) -> ValidateEndUserAccessToken<'_>
Validate end user access token
Validates the end user's access token and returns the end user's information. Returns an error if the access token is invalid or expired.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users/auth/validate-token`
```ignore
let response = client.validate_end_user_access_token()
.body(body)
.send()
.await;
```
Sourcepub fn list_evm_accounts(&self) -> ListEvmAccounts<'_>
pub fn list_evm_accounts(&self) -> ListEvmAccounts<'_>
List EVM accounts
Lists the EVM accounts belonging to the developer's CDP Project.
The response is paginated, and by default, returns 20 accounts per page.
Sends a `GET` request to `/v2/evm/accounts`
Arguments:
- `page_size`: The number of accounts to return per page.
- `page_token`: The token for the next page of accounts, if any.
```ignore
let response = client.list_evm_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn create_evm_account(&self) -> CreateEvmAccount<'_>
pub fn create_evm_account(&self) -> CreateEvmAccount<'_>
Create an EVM account
Creates a new EVM account.
Sends a `POST` request to `/v2/evm/accounts`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_evm_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn get_evm_account_by_name(&self) -> GetEvmAccountByName<'_>
pub fn get_evm_account_by_name(&self) -> GetEvmAccountByName<'_>
Get an EVM account by name
Gets an EVM account by its name.
Sends a `GET` request to `/v2/evm/accounts/by-name/{name}`
Arguments:
- `name`: The name of the EVM account.
```ignore
let response = client.get_evm_account_by_name()
.name(name)
.send()
.await;
```
Sourcepub fn export_evm_account_by_name(&self) -> ExportEvmAccountByName<'_>
pub fn export_evm_account_by_name(&self) -> ExportEvmAccountByName<'_>
Export an EVM account by name
Export an existing EVM account's private key by its name. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/evm/accounts/export/by-name/{name}`
Arguments:
- `name`: The name of the EVM account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_evm_account_by_name()
.name(name)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn import_evm_account(&self) -> ImportEvmAccount<'_>
pub fn import_evm_account(&self) -> ImportEvmAccount<'_>
Import an EVM account
Import an existing EVM account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
Sends a `POST` request to `/v2/evm/accounts/import`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.import_evm_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn get_evm_account(&self) -> GetEvmAccount<'_>
pub fn get_evm_account(&self) -> GetEvmAccount<'_>
Get an EVM account by address
Gets an EVM account by its address.
Sends a `GET` request to `/v2/evm/accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
```ignore
let response = client.get_evm_account()
.address(address)
.send()
.await;
```
Sourcepub fn update_evm_account(&self) -> UpdateEvmAccount<'_>
pub fn update_evm_account(&self) -> UpdateEvmAccount<'_>
Update an EVM account
Updates an existing EVM account. Use this to update the account's name or account-level policy.
Sends a `PUT` request to `/v2/evm/accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_evm_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn export_evm_account(&self) -> ExportEvmAccount<'_>
pub fn export_evm_account(&self) -> ExportEvmAccount<'_>
Export an EVM account
Export an existing EVM account's private key. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/evm/accounts/{address}/export`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_evm_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn send_evm_transaction(&self) -> SendEvmTransaction<'_>
pub fn send_evm_transaction(&self) -> SendEvmTransaction<'_>
Send a transaction
Signs a transaction with the given EVM account and sends it to the indicated supported network. This API handles nonce management and gas estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction. The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).
**Transaction fields and API behavior**
- `to` *(Required)*: The address of the contract or account to send the transaction to.
- `chainId` *(Ignored)*: The value of the `chainId` field in the transaction is ignored.
The transaction will be sent to the network indicated by the `network` field in the request body.
- `nonce` *(Optional)*: The nonce to use for the transaction. If not provided, the API will assign
a nonce to the transaction based on the current state of the account.
- `maxPriorityFeePerGas` *(Optional)*: The maximum priority fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `maxFeePerGas` *(Optional)*: The maximum fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `gasLimit` *(Optional)*: The gas limit to use for the transaction. If not provided, the API will estimate a value
based on the `to` and `data` fields of the transaction.
- `value` *(Optional)*: The amount of ETH, in wei, to send with the transaction.
- `data` *(Optional)*: The data to send with the transaction; only used for contract calls.
- `accessList` *(Optional)*: The access list to use for the transaction.
Sends a `POST` request to `/v2/evm/accounts/{address}/send/transaction`
Arguments:
- `address`: The 0x-prefixed address of the Ethereum account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_evm_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_evm_hash(&self) -> SignEvmHash<'_>
pub fn sign_evm_hash(&self) -> SignEvmHash<'_>
Sign a hash
Signs an arbitrary 32 byte hash with the given EVM account.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_hash()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_evm_message(&self) -> SignEvmMessage<'_>
pub fn sign_evm_message(&self) -> SignEvmMessage<'_>
Sign an EIP-191 message
Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/message`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_message()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_evm_transaction(&self) -> SignEvmTransaction<'_>
pub fn sign_evm_transaction(&self) -> SignEvmTransaction<'_>
Sign a transaction
Signs a transaction with the given EVM account.
The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/transaction`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_evm_typed_data(&self) -> SignEvmTypedData<'_>
pub fn sign_evm_typed_data(&self) -> SignEvmTypedData<'_>
Sign EIP-712 typed data
Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given EVM account.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/typed-data`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_typed_data()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn request_evm_faucet(&self) -> RequestEvmFaucet<'_>
pub fn request_evm_faucet(&self) -> RequestEvmFaucet<'_>
Request funds on EVM test networks
Request funds from the CDP Faucet on supported EVM test networks.
Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia, and for ETH only on Ethereum Hoodi.
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
These limits are applied at both the CDP User level and the blockchain address level.
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|:-----:|:-------------------------:|:--------------------------------:|
| ETH | 0.0001 ETH | 0.1 ETH |
| USDC | 1 USDC | 10 USDC |
| EURC | 1 EURC | 10 EURC |
| cbBTC | 0.0001 cbBTC | 0.001 cbBTC |
Sends a `POST` request to `/v2/evm/faucet`
```ignore
let response = client.request_evm_faucet()
.body(body)
.send()
.await;
```
Sourcepub fn list_evm_smart_accounts(&self) -> ListEvmSmartAccounts<'_>
pub fn list_evm_smart_accounts(&self) -> ListEvmSmartAccounts<'_>
List Smart Accounts
Lists the Smart Accounts belonging to the developer's CDP Project.
The response is paginated, and by default, returns 20 accounts per page.
Sends a `GET` request to `/v2/evm/smart-accounts`
Arguments:
- `page_size`: The number of accounts to return per page.
- `page_token`: The token for the next page of accounts, if any.
```ignore
let response = client.list_evm_smart_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn create_evm_smart_account(&self) -> CreateEvmSmartAccount<'_>
pub fn create_evm_smart_account(&self) -> CreateEvmSmartAccount<'_>
Create a Smart Account
Creates a new Smart Account.
Sends a `POST` request to `/v2/evm/smart-accounts`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_evm_smart_account()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn get_evm_smart_account_by_name(&self) -> GetEvmSmartAccountByName<'_>
pub fn get_evm_smart_account_by_name(&self) -> GetEvmSmartAccountByName<'_>
Get a Smart Account by name
Gets a Smart Account by its name.
Sends a `GET` request to `/v2/evm/smart-accounts/by-name/{name}`
Arguments:
- `name`: The name of the Smart Account.
```ignore
let response = client.get_evm_smart_account_by_name()
.name(name)
.send()
.await;
```
Sourcepub fn get_evm_smart_account(&self) -> GetEvmSmartAccount<'_>
pub fn get_evm_smart_account(&self) -> GetEvmSmartAccount<'_>
Get a Smart Account by address
Gets a Smart Account by its address.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the Smart Account.
```ignore
let response = client.get_evm_smart_account()
.address(address)
.send()
.await;
```
Sourcepub fn update_evm_smart_account(&self) -> UpdateEvmSmartAccount<'_>
pub fn update_evm_smart_account(&self) -> UpdateEvmSmartAccount<'_>
Update an EVM Smart Account
Updates an existing EVM smart account. Use this to update the smart account's name.
Sends a `PUT` request to `/v2/evm/smart-accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM smart account. The address does not need to be checksummed.
- `body`
```ignore
let response = client.update_evm_smart_account()
.address(address)
.body(body)
.send()
.await;
```
Sourcepub fn create_spend_permission(&self) -> CreateSpendPermission<'_>
pub fn create_spend_permission(&self) -> CreateSpendPermission<'_>
Create a spend permission
Creates a spend permission for the given smart account address.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/spend-permissions`
Arguments:
- `address`: The address of the Smart Account to create the spend permission for.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_spend_permission()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn list_spend_permissions(&self) -> ListSpendPermissions<'_>
pub fn list_spend_permissions(&self) -> ListSpendPermissions<'_>
List spend permissions
Lists spend permission for the given smart account address.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}/spend-permissions/list`
Arguments:
- `address`: The address of the Smart account to list spend permissions for.
- `page_size`: The number of spend permissions to return per page.
- `page_token`: The token for the next page of spend permissions. Will be empty if there are no more spend permissions to fetch.
```ignore
let response = client.list_spend_permissions()
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn revoke_spend_permission(&self) -> RevokeSpendPermission<'_>
pub fn revoke_spend_permission(&self) -> RevokeSpendPermission<'_>
Revoke a spend permission
Revokes an existing spend permission.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/spend-permissions/revoke`
Arguments:
- `address`: The address of the Smart account this spend permission is valid for.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_spend_permission()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn prepare_user_operation(&self) -> PrepareUserOperation<'_>
pub fn prepare_user_operation(&self) -> PrepareUserOperation<'_>
Prepare a user operation
Prepares a new user operation on a Smart Account for a specific network.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/user-operations`
Arguments:
- `address`: The address of the Smart Account to create the user operation on.
- `body`
```ignore
let response = client.prepare_user_operation()
.address(address)
.body(body)
.send()
.await;
```
Sourcepub fn get_user_operation(&self) -> GetUserOperation<'_>
pub fn get_user_operation(&self) -> GetUserOperation<'_>
Get a user operation
Gets a user operation by its hash.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}/user-operations/{userOpHash}`
Arguments:
- `address`: The address of the Smart Account the user operation belongs to.
- `user_op_hash`: The hash of the user operation to fetch.
```ignore
let response = client.get_user_operation()
.address(address)
.user_op_hash(user_op_hash)
.send()
.await;
```
Sourcepub fn send_user_operation(&self) -> SendUserOperation<'_>
pub fn send_user_operation(&self) -> SendUserOperation<'_>
Send a user operation
Sends a user operation with a signature.
The payload to sign must be the `userOpHash` field of the user operation. This hash should be signed directly (not using `personal_sign` or EIP-191 message hashing).
The signature must be 65 bytes in length, consisting of: - 32 bytes for the `r` value - 32 bytes for the `s` value - 1 byte for the `v` value (must be 27 or 28)
If using the CDP Paymaster, the user operation must be signed and sent within 2 minutes of being prepared.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/user-operations/{userOpHash}/send`
Arguments:
- `address`: The address of the Smart Account to send the user operation from.
- `user_op_hash`: The hash of the user operation to send.
- `body`
```ignore
let response = client.send_user_operation()
.address(address)
.user_op_hash(user_op_hash)
.body(body)
.send()
.await;
```
Sourcepub fn create_evm_swap_quote(&self) -> CreateEvmSwapQuote<'_>
pub fn create_evm_swap_quote(&self) -> CreateEvmSwapQuote<'_>
Create a swap quote
Create a swap quote, which includes the payload to sign as well as the transaction data needed to execute the swap. The developer is responsible for signing the payload and submitting the transaction to the network in order to execute the swap.
Sends a `POST` request to `/v2/evm/swaps`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_evm_swap_quote()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn get_evm_swap_price(&self) -> GetEvmSwapPrice<'_>
pub fn get_evm_swap_price(&self) -> GetEvmSwapPrice<'_>
Get a price estimate for a swap
Get a price estimate for a swap between two tokens on an EVM network.
Sends a `GET` request to `/v2/evm/swaps/quote`
```ignore
let response = client.get_evm_swap_price()
.from_amount(from_amount)
.from_token(from_token)
.gas_price(gas_price)
.network(network)
.signer_address(signer_address)
.slippage_bps(slippage_bps)
.taker(taker)
.to_token(to_token)
.send()
.await;
```
Sourcepub fn list_evm_token_balances(&self) -> ListEvmTokenBalances<'_>
pub fn list_evm_token_balances(&self) -> ListEvmTokenBalances<'_>
List EVM token balances
Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
**Note:** This endpoint is still under development and does not yet provide strong freshness guarantees. Specifically, balances of new tokens can, on occasion, take up to ~30 seconds to appear, while balances of tokens already belonging to an address will generally be close to chain tip. Freshness of new token balances will improve over the coming weeks.
Sends a `GET` request to `/v2/evm/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The 0x-prefixed EVM address to get balances for. The address does not need to be checksummed.
- `page_size`: The number of balances to return per page.
- `page_token`: The token for the next page of balances. Will be empty if there are no more balances to fetch.
```ignore
let response = client.list_evm_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn create_onramp_order(&self) -> CreateOnrampOrder<'_>
pub fn create_onramp_order(&self) -> CreateOnrampOrder<'_>
Create an onramp order
Create a new Onramp order or get a quote for an Onramp order. Either `paymentAmount` or `purchaseAmount` must be provided.
This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`, and the `paymentLink` returned will only work in iOS apps. We do not support web integration via iframes at this time.
For detailed integration instructions and to get access to this API, refer to the [Apple Pay Onramp API docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api).
Sends a `POST` request to `/v2/onramp/orders`
```ignore
let response = client.create_onramp_order()
.body(body)
.send()
.await;
```
Sourcepub fn get_onramp_order_by_id(&self) -> GetOnrampOrderById<'_>
pub fn get_onramp_order_by_id(&self) -> GetOnrampOrderById<'_>
Get an onramp order by ID
Get an onramp order by ID.
Sends a `GET` request to `/v2/onramp/orders/{orderId}`
Arguments:
- `order_id`: The ID of the onramp order to retrieve.
```ignore
let response = client.get_onramp_order_by_id()
.order_id(order_id)
.send()
.await;
```
Sourcepub fn get_crypto_rails(&self) -> GetCryptoRails<'_>
pub fn get_crypto_rails(&self) -> GetCryptoRails<'_>
Get the crypto rails
Gets the crypto rails that can be used to send funds or receive funds.
Sends a `GET` request to `/v2/payments/rails/crypto`
Arguments:
- `networks`: Comma separated list of networks to filter the rails by.
```ignore
let response = client.get_crypto_rails()
.networks(networks)
.send()
.await;
```
Sourcepub fn get_payment_methods(&self) -> GetPaymentMethods<'_>
pub fn get_payment_methods(&self) -> GetPaymentMethods<'_>
Get the fiat payment methods
Gets the fiat payment methods that can be used to send funds or receive funds. This is the list of payment methods configured for your account.
Sends a `GET` request to `/v2/payments/rails/payment-methods`
```ignore
let response = client.get_payment_methods()
.send()
.await;
```
Sourcepub fn create_payment_transfer_quote(&self) -> CreatePaymentTransferQuote<'_>
pub fn create_payment_transfer_quote(&self) -> CreatePaymentTransferQuote<'_>
Create a transfer quote
Creates a new transfer quote, which can then be executed using the Execute a transfer quote endpoint. If you want to automatically execute the transfer without needing to confirm, specify execute as true.
Sends a `POST` request to `/v2/payments/transfers`
```ignore
let response = client.create_payment_transfer_quote()
.body(body)
.send()
.await;
```
Sourcepub fn get_payment_transfer(&self) -> GetPaymentTransfer<'_>
pub fn get_payment_transfer(&self) -> GetPaymentTransfer<'_>
Get a transfer by ID
Gets a transfer by ID.
Sends a `GET` request to `/v2/payments/transfers/{transferId}`
Arguments:
- `transfer_id`: The ID of the transfer.
```ignore
let response = client.get_payment_transfer()
.transfer_id(transfer_id)
.send()
.await;
```
Sourcepub fn execute_payment_transfer_quote(&self) -> ExecutePaymentTransferQuote<'_>
pub fn execute_payment_transfer_quote(&self) -> ExecutePaymentTransferQuote<'_>
Execute a transfer quote
Executes a transfer quote which was created using the Create a transfer quote endpoint.
Sends a `POST` request to `/v2/payments/transfers/{transferId}/execute`
Arguments:
- `transfer_id`: The ID of the transfer.
```ignore
let response = client.execute_payment_transfer_quote()
.transfer_id(transfer_id)
.send()
.await;
```
Sourcepub fn list_policies(&self) -> ListPolicies<'_>
pub fn list_policies(&self) -> ListPolicies<'_>
List policies
Lists the policies belonging to the developer's CDP Project. Use the `scope` parameter to filter the policies by scope.
The response is paginated, and by default, returns 20 policies per page.
Sends a `GET` request to `/v2/policy-engine/policies`
Arguments:
- `page_size`: The number of policies to return per page.
- `page_token`: The token for the next page of policies, if any.
- `scope`: The scope of the policies to return. If `project`, the response will include exactly one policy, which is the project-level policy. If `account`, the response will include all account-level policies for the developer's CDP Project.
```ignore
let response = client.list_policies()
.page_size(page_size)
.page_token(page_token)
.scope(scope)
.send()
.await;
```
Sourcepub fn create_policy(&self) -> CreatePolicy<'_>
pub fn create_policy(&self) -> CreatePolicy<'_>
Create a policy
Create a policy that can be used to govern the behavior of accounts.
Sends a `POST` request to `/v2/policy-engine/policies`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_policy()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn get_policy_by_id(&self) -> GetPolicyById<'_>
pub fn get_policy_by_id(&self) -> GetPolicyById<'_>
Get a policy by ID
Get a policy by its ID.
Sends a `GET` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to get.
```ignore
let response = client.get_policy_by_id()
.policy_id(policy_id)
.send()
.await;
```
Sourcepub fn update_policy(&self) -> UpdatePolicy<'_>
pub fn update_policy(&self) -> UpdatePolicy<'_>
Update a policy
Updates a policy by its ID. This will have the effect of applying the updated policy to all accounts that are currently using it.
Sends a `PUT` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to update.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn delete_policy(&self) -> DeletePolicy<'_>
pub fn delete_policy(&self) -> DeletePolicy<'_>
Delete a policy
Delete a policy by its ID. This will have the effect of removing the policy from all accounts that are currently using it.
Sends a `DELETE` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to delete.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.delete_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```
Sourcepub fn list_solana_accounts(&self) -> ListSolanaAccounts<'_>
pub fn list_solana_accounts(&self) -> ListSolanaAccounts<'_>
List Solana accounts or get account by name
Lists the Solana accounts belonging to the developer.
The response is paginated, and by default, returns 20 accounts per page.
If a name is provided, the response will contain only the account with that name.
Sends a `GET` request to `/v2/solana/accounts`
Arguments:
- `page_size`: The number of accounts to return per page.
- `page_token`: The token for the next page of accounts, if any.
```ignore
let response = client.list_solana_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn create_solana_account(&self) -> CreateSolanaAccount<'_>
pub fn create_solana_account(&self) -> CreateSolanaAccount<'_>
Create a Solana account
Creates a new Solana account.
Sends a `POST` request to `/v2/solana/accounts`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_solana_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn get_solana_account_by_name(&self) -> GetSolanaAccountByName<'_>
pub fn get_solana_account_by_name(&self) -> GetSolanaAccountByName<'_>
Get a Solana account by name
Gets a Solana account by its name.
Sends a `GET` request to `/v2/solana/accounts/by-name/{name}`
Arguments:
- `name`: The name of the Solana account.
```ignore
let response = client.get_solana_account_by_name()
.name(name)
.send()
.await;
```
Sourcepub fn export_solana_account_by_name(&self) -> ExportSolanaAccountByName<'_>
pub fn export_solana_account_by_name(&self) -> ExportSolanaAccountByName<'_>
Export a Solana account by name
Export an existing Solana account's private key by its name. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/solana/accounts/export/by-name/{name}`
Arguments:
- `name`: The name of the Solana account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_solana_account_by_name()
.name(name)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn import_solana_account(&self) -> ImportSolanaAccount<'_>
pub fn import_solana_account(&self) -> ImportSolanaAccount<'_>
Import a Solana account
Import an existing Solana account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
Sends a `POST` request to `/v2/solana/accounts/import`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.import_solana_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn send_solana_transaction(&self) -> SendSolanaTransaction<'_>
pub fn send_solana_transaction(&self) -> SendSolanaTransaction<'_>
Send a Solana transaction
Signs and sends a single Solana transaction using multiple Solana accounts. The transaction may contain contain several instructions, each of which may require signatures from different account keys.
The transaction should be serialized into a byte array and base64 encoded. The API handles recent blockhash management and fee estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana.com/developers/guides/advanced/versions#current-transaction-versions)
* [Versioned transactions](https://solana.com/developers/guides/advanced/versions)
**Instruction Batching**
To batch multiple operations, include multiple instructions within a single transaction. All instructions within a transaction are executed atomically - if any instruction fails, the entire transaction fails and is rolled back.
**Network Support**
The following Solana networks are supported:
* `solana` - Solana Mainnet
* `solana-devnet` - Solana Devnet
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/solana/accounts/send/transaction`
Arguments:
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_solana_transaction()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn get_solana_account(&self) -> GetSolanaAccount<'_>
pub fn get_solana_account(&self) -> GetSolanaAccount<'_>
Get a Solana account by address
Gets a Solana account by its address.
Sends a `GET` request to `/v2/solana/accounts/{address}`
Arguments:
- `address`: The base58 encoded address of the Solana account.
```ignore
let response = client.get_solana_account()
.address(address)
.send()
.await;
```
Sourcepub fn update_solana_account(&self) -> UpdateSolanaAccount<'_>
pub fn update_solana_account(&self) -> UpdateSolanaAccount<'_>
Update a Solana account
Updates an existing Solana account. Use this to update the account's name or account-level policy.
Sends a `PUT` request to `/v2/solana/accounts/{address}`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_solana_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```
Sourcepub fn export_solana_account(&self) -> ExportSolanaAccount<'_>
pub fn export_solana_account(&self) -> ExportSolanaAccount<'_>
Export an Solana account
Export an existing Solana account's private key. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/solana/accounts/{address}/export`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_solana_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_solana_message(&self) -> SignSolanaMessage<'_>
pub fn sign_solana_message(&self) -> SignSolanaMessage<'_>
Sign a message
Signs an arbitrary message with the given Solana account.
**WARNING:** Never sign a message that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
Sends a `POST` request to `/v2/solana/accounts/{address}/sign/message`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_message()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn sign_solana_transaction(&self) -> SignSolanaTransaction<'_>
pub fn sign_solana_transaction(&self) -> SignSolanaTransaction<'_>
Sign a transaction
Signs a transaction with the given Solana account.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
* [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/solana/accounts/{address}/sign/transaction`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```
Sourcepub fn request_solana_faucet(&self) -> RequestSolanaFaucet<'_>
pub fn request_solana_faucet(&self) -> RequestSolanaFaucet<'_>
Request funds on Solana devnet
Request funds from the CDP Faucet on Solana devnet.
Faucets are available for SOL.
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
These limits are applied at both the CDP User level and the blockchain address level.
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|:-----:|:-------------------------:|:--------------------------------:|
| SOL | 0.00125 SOL | 0.0125 SOL |
| USDC | 1 USDC | 10 USDC |
Sends a `POST` request to `/v2/solana/faucet`
```ignore
let response = client.request_solana_faucet()
.body(body)
.send()
.await;
```
Sourcepub fn list_solana_token_balances(&self) -> ListSolanaTokenBalances<'_>
pub fn list_solana_token_balances(&self) -> ListSolanaTokenBalances<'_>
List Solana token balances
Lists the token balances of a Solana address on a given network. The balances include SPL tokens and the native SOL token. The response is paginated, and by default, returns 20 balances per page.
**Note:** This endpoint is still under development and does not yet provide strong availability or freshness guarantees. Freshness and availability of new token balances will improve over the coming weeks.
Sends a `GET` request to `/v2/solana/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The base58 encoded Solana address to get balances for.
- `page_size`: The number of balances to return per page.
- `page_token`: The token for the next page of balances. Will be empty if there are no more balances to fetch.
```ignore
let response = client.list_solana_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```
Sourcepub fn settle_x402_payment(&self) -> SettleX402Payment<'_>
pub fn settle_x402_payment(&self) -> SettleX402Payment<'_>
Settle a payment
Settle an x402 protocol payment with a specific scheme and network.
Sends a `POST` request to `/v2/x402/settle`
```ignore
let response = client.settle_x402_payment()
.body(body)
.send()
.await;
```
Sourcepub fn supported_x402_payment_kinds(&self) -> SupportedX402PaymentKinds<'_>
pub fn supported_x402_payment_kinds(&self) -> SupportedX402PaymentKinds<'_>
Get supported payment schemes and networks
Get the supported x402 protocol payment schemes and networks that the facilitator is able to verify and settle payments for.
Sends a `GET` request to `/v2/x402/supported`
```ignore
let response = client.supported_x402_payment_kinds()
.send()
.await;
```
Sourcepub fn verify_x402_payment(&self) -> VerifyX402Payment<'_>
pub fn verify_x402_payment(&self) -> VerifyX402Payment<'_>
Verify a payment
Verify an x402 protocol payment with a specific scheme and network.
Sends a `POST` request to `/v2/x402/verify`
```ignore
let response = client.verify_x402_payment()
.body(body)
.send()
.await;
```
Trait Implementations§
Source§impl ClientHooks for &Client
impl ClientHooks for &Client
Source§async fn pre<E>(
&self,
request: &mut Request,
info: &OperationInfo,
) -> Result<(), Error<E>>
async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>>
Source§impl ClientInfo<()> for Client
impl ClientInfo<()> for Client
Source§fn api_version() -> &'static str
fn api_version() -> &'static str
Source§fn client(&self) -> &ClientWithMiddleware
fn client(&self) -> &ClientWithMiddleware
reqwest_middleware::ClientWithMiddleware
used to make requests.