cdp.actions package

Submodules

cdp.actions.quote module

class cdp.actions.quote.BaseQuote(**data)

Bases: BaseModel

A quote to fund an account.

api_clients: ApiClients
async execute()

Execute the quote.

Return type:

FundOperationResult

fees: list[Fee]
fiat_amount: str
fiat_currency: str
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

quote_id: str
token: str
token_amount: str
class cdp.actions.quote.EvmQuote(**data)

Bases: BaseQuote

A quote to fund an EVM account.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: Literal['base', 'ethereum']
class cdp.actions.quote.SolanaQuote(**data)

Bases: BaseQuote

A quote to fund a Solana account.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: Literal['solana']

cdp.actions.types module

class cdp.actions.types.FundOperationResult(**data)

Bases: BaseModel

The result of a fund operation.

id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: str
status: str
target_amount: str
target_currency: str
transaction_hash: str | None

cdp.actions.util module

cdp.actions.util.format_units(amount, decimals)

Convert an amount from atomic units to decimal units.

Parameters:
  • amount – The amount in atomic units, e.g. wei.

  • decimals – The number of decimal places to convert to (e.g. 18 for ETH, 6 for USDC).

Returns:

The amount formatted as a decimal string (e.g. “1.23” for 1.23 ETH).

Return type:

str

cdp.actions.wait_for_fund_operation_receipt module

async cdp.actions.wait_for_fund_operation_receipt.wait_for_fund_operation_receipt(api_clients, transfer_id, timeout_seconds=900, interval_seconds=1)

Wait for a fund operation to be processed.

Parameters:
  • api_clients (ApiClients) – The API clients object.

  • transfer_id (str) – The id of the transfer to wait for.

  • timeout_seconds (float, optional) – Maximum time to wait in seconds. Defaults to 20.

  • interval_seconds (float, optional) – Time between checks in seconds. Defaults to 0.2.

Returns:

The final transfer object.

Return type:

Transfer

Raises:

TimeoutError – If the operation doesn’t complete within the specified timeout.

Module contents

class cdp.actions.EvmQuote(**data)

Bases: BaseQuote

A quote to fund an EVM account.

api_clients: ApiClients
fees: list[Fee]
fiat_amount: str
fiat_currency: str
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: Literal['base', 'ethereum']
quote_id: str
token: str
token_amount: str
class cdp.actions.SolanaQuote(**data)

Bases: BaseQuote

A quote to fund a Solana account.

api_clients: ApiClients
fees: list[Fee]
fiat_amount: str
fiat_currency: str
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

network: Literal['solana']
quote_id: str
token: str
token_amount: str