aiorocket2.models

Modules (dataclases) used by aiorocket2

Functions

to_dict(obj[, keep_enums, keep_datetime])

Recursively converts an object to a dictionary suitable for JSON serialization.

Classes

Balance(currency, balance)

Represents a balance entity returned by the xRocket Pay API.

Base()

Base class for all models

Cheque(id, currency, total, per_user, users, ...)

Represents a multi-cheque entity returned by the xRocket Pay API.

Currency(currency, name, min_transfer, ...)

Represents a Currency entity returned by the xRocket Pay API.

DateTimeStr(value)

Time object, to comfortable get time from the api

Info(name, fee_percents, balances)

Represents a info entity returned by the xRocket Pay API.

Invoice(id, amount, min_payment, ...)

Represents a Invoice entity returned by the xRocket Pay API.

PaginatedCheque(total, limit, offset, results)

Represents a PaginatedCheque entity returned by the xRocket Pay API.

PaginatedInvoice(total, limit, offset, results)

Represents a PaginatedInvoice entity returned by the xRocket Pay API.

TgResource(telegram_id, name, username)

Represents a TgResourse entity returned by the xRocket Pay API.

Transfer(id, tg_user_id, currency, amount, ...)

Represents a transfer entity returned by the xRocket Pay API.

Withdrawal(network, address, currency, ...)

Represents a Withdrawal entity returned by the xRocket Pay API.

WithdrawalCoin(code, min_withdrawal, fees)

Represents a WithdrawalCoin entity returned by the xRocket Pay API.

WithdrawalCoinFees(network_code, fee, currency)

Represents a WithdrawalCoinFees entity returned by the xRocket Pay API.

WithdrawalFee(currency, networks)

Represents a WithdrawalFee entity returned by the xRocket Pay API.

class aiorocket2.models.Balance(currency, balance)[source]

Bases: Base

Represents a balance entity returned by the xRocket Pay API.

Parameters:
  • currency (str)

  • balance (float)

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

balance: float
currency: str
classmethod from_api(j)[source]

Build Info from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Balance

class aiorocket2.models.Cheque(id, currency, total, per_user, users, password, description, send_notifications, ref_program_percents, ref_reward_per_user, captcha_enabled, state, link, disabled_languages, enabled_countries, for_premium, for_new_users_only, linked_wallet, tg_resources, activations, ref_rewards)[source]

Bases: Base

Represents a multi-cheque entity returned by the xRocket Pay API.

Parameters:
  • id (int)

  • currency (str)

  • total (int)

  • per_user (int)

  • users (int)

  • password (str)

  • description (str)

  • send_notifications (bool)

  • ref_program_percents (int)

  • ref_reward_per_user (float)

  • captcha_enabled (bool)

  • state (ChequeState)

  • link (str)

  • disabled_languages (List[str])

  • enabled_countries (List[Country])

  • for_premium (bool)

  • for_new_users_only (bool)

  • linked_wallet (bool)

  • tg_resources (List[TgResource])

  • activations (int)

  • ref_rewards (int)

activations: int

How many times cheque is activate

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

captcha_enabled: bool

enable / disable cheque captcha

currency: str
description: str

Cheque description

disabled_languages: List[str]

Disable languages

enabled_countries: List[Country]

Enabled countries

for_new_users_only: bool

Only new users can activate this cheque

for_premium: bool

Only users with Telegram Premium can activate this cheque

classmethod from_api(j)[source]

Build Cheque from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Cheque

id: int

Cheque ID

linked_wallet: bool

Only users with connected wallets can activate this cheque

password: str

Cheque password

per_user: int

Amount of cheque per user

ref_program_percents: int

percentage of cheque that rewarded for referral program

ref_reward_per_user: float

amount of referral user reward

ref_rewards: int

How many times referral reward is payed

send_notifications: bool

send notifications about cheque activation to application cheque webhook or not

state: ChequeState
tg_resources: List[TgResource]
total: int

Total amount of cheque (this amount is charged from balance)

users: int

Number of users that can activate your cheque

class aiorocket2.models.Currency(currency, name, min_transfer, min_cheque, min_invoice, min_withdraw, withdraw_fee)[source]

Bases: Base

Represents a Currency entity returned by the xRocket Pay API.

Parameters:
  • currency (str)

  • name (str)

  • min_transfer (float)

  • min_cheque (float)

  • min_invoice (float)

  • min_withdraw (float)

  • withdraw_fee (WithdrawalFee)

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

currency: str

ID of currency, use in Rocket Pay Api

classmethod from_api(j)[source]

Build Currency from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Currency

min_cheque: float

Minimal amount for cheque

min_invoice: float

Minimal amount for invoice

min_transfer: float

Minimal amount for transfer

min_withdraw: float

Minimal amount for withdrawals

name: str

Name of currency

withdraw_fee: WithdrawalFee
class aiorocket2.models.Info(name, fee_percents, balances)[source]

Bases: Base

Represents a info entity returned by the xRocket Pay API.

Parameters:
  • name (str)

  • fee_percents (float)

  • balances (List[Balance])

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

balances: List[Balance]
fee_percents: float

Fee for incoming transactions

classmethod from_api(j)[source]

Build Info from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Info

name: str

Name of current app

class aiorocket2.models.Invoice(id, amount, min_payment, total_activations, activations_left, description, hidden_message, payload, callback_url, comments_enabled, currency, created, paid, status, expired_in, link)[source]

Bases: Base

Represents a Invoice entity returned by the xRocket Pay API.

Parameters:
  • id (int)

  • amount (float)

  • min_payment (float)

  • total_activations (int)

  • activations_left (int)

  • description (str)

  • hidden_message (str)

  • payload (str)

  • callback_url (str)

  • comments_enabled (bool)

  • currency (str)

  • created (DateTimeStr)

  • paid (DateTimeStr)

  • status (InvoiceStatus)

  • expired_in (int)

  • link (str)

activations_left: int

Activations left of invoice

amount: float

Amount of invoice

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

callback_url: str

url that will be set for Return button after invoice is paid

comments_enabled: bool

Allow comments for invoice

created: DateTimeStr

(date-time) When invoice was created

currency: str
description: str

Invoice description

expired_in: int

Invoice expire time in seconds, max 1 day, 0 - none expired

classmethod from_api(j)[source]

Build Invoice from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Invoice

hidden_message: str

Message that will be displayed after invoice payment

id: int

Invoice ID

min_payment: float

Min payment of invoice

paid: DateTimeStr

(date-time) When invoice was paid

payload: str

Any data that is attached to invoice

status: InvoiceStatus
total_activations: int

Total activations of invoice

class aiorocket2.models.PaginatedCheque(total, limit, offset, results)[source]

Bases: Base

Represents a PaginatedCheque entity returned by the xRocket Pay API.

Parameters:
  • total (int)

  • limit (int)

  • offset (int)

  • results (List[Cheque])

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

classmethod from_api(j)[source]

Build PaginatedCheque from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

PaginatedCheque

limit: int
offset: int
results: List[Cheque]
total: int

Total times

class aiorocket2.models.PaginatedInvoice(total, limit, offset, results)[source]

Bases: Base

Represents a PaginatedInvoice entity returned by the xRocket Pay API.

Parameters:
  • total (int)

  • limit (int)

  • offset (int)

  • results (List[Invoice])

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

classmethod from_api(j)[source]

Build PaginatedInvoice from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

PaginatedInvoice

limit: int
offset: int
results: List[Invoice]
total: int

Total times

class aiorocket2.models.TgResource(telegram_id, name, username)[source]

Bases: Base

Represents a TgResourse entity returned by the xRocket Pay API.

Parameters:
  • telegram_id (int)

  • name (str)

  • username (str)

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

classmethod from_api(j)[source]

Build Cheque from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

TgResource

name: str
telegram_id: int
username: str
class aiorocket2.models.Transfer(id, tg_user_id, currency, amount, description)[source]

Bases: Base

Represents a transfer entity returned by the xRocket Pay API.

Parameters:
  • id (int)

  • tg_user_id (int)

  • currency (str)

  • amount (float)

  • description (str)

amount: float

Transfer amount. 9 decimal places, others cut off

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

currency: str

Currency code

description: str

Transfer description

classmethod from_api(j)[source]

Build Transfer from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Transfer

id: int

Transfer ID

tg_user_id: int
class aiorocket2.models.Withdrawal(network, address, currency, amount, withdrawal_id, status, comment, tx_hash, tx_link)[source]

Bases: Base

Represents a Withdrawal entity returned by the xRocket Pay API.

Parameters:
  • network (Network)

  • address (str)

  • currency (str)

  • amount (float)

  • withdrawal_id (str)

  • status (WithdrawalStatus)

  • comment (str)

  • tx_hash (str)

  • tx_link (str)

address: str

Withdrawal address

amount: float

Withdrawal amount. 9 decimal places, others cut off

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

comment: str

Withdrawal comment

currency: str

Currency code

classmethod from_api(j)[source]

Build Withdrawal from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

Withdrawal

network: Network

Network code.

status: WithdrawalStatus

Withdrawal status

tx_hash: str

Withdrawal TX hash. Provided only after withdrawal.

Withdrawal TX link. Provided only after withdrawal

withdrawal_id: str

Unique withdrawal ID in your system to prevent double spends

class aiorocket2.models.WithdrawalCoin(code, min_withdrawal, fees)[source]

Bases: Base

Represents a WithdrawalCoin entity returned by the xRocket Pay API.

Parameters:
as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

code: str

Crypto code

fees: List[WithdrawalCoinFees]
classmethod from_api(j)[source]

Build WithdrawalCoin from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

WithdrawalCoin

min_withdrawal: float

Minimal amount for withdrawals

class aiorocket2.models.WithdrawalCoinFees(network_code, fee, currency)[source]

Bases: Base

Represents a WithdrawalCoinFees entity returned by the xRocket Pay API.

Parameters:
  • network_code (Network)

  • fee (float)

  • currency (str)

as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

currency: str

Withdraw fee currency

fee: float

Fee amount

classmethod from_api(j)[source]

Build WithdrawalCoinFees from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

WithdrawalCoinFees

network_code: Network

Network code for withdraw

class aiorocket2.models.WithdrawalFee(currency, networks)[source]

Bases: Base

Represents a WithdrawalFee entity returned by the xRocket Pay API.

Parameters:
as_dict(keep_enums=False, keep_datetime=False)

### Note: - To export data use method .as_dict(). - To just convert data to a dict use built-in function dict()

Return type:

dict

currency: str

ID of main currency for token

classmethod from_api(j)[source]

Build WithdrawalFee from API JSON object.

Parameters:

j (Mapping[str, Any])

Return type:

WithdrawalFee

networks: List[WithdrawalCoinFees]