Source code for pyrogram.raw.functions.payments.get_onramp_quote

#  Pyrogram - Telegram MTProto API Client Library for Python
#  Copyright (C) 2017-present Dan <https://github.com/delivrance>
#
#  This file is part of Pyrogram.
#
#  Pyrogram is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Pyrogram is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with Pyrogram.  If not, see <http://www.gnu.org/licenses/>.

from io import BytesIO

from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrogram.raw.core import TLObject
from pyrogram import raw
from typing import List, Optional, Any

# # # # # # # # # # # # # # # # # # # # # # # #
#               !!! WARNING !!!               #
#          This is a generated file!          #
# All changes made in this file will be lost! #
# # # # # # # # # # # # # # # # # # # # # # # #


[docs] class GetOnrampQuote(TLObject): # type: ignore """ Details: - Layer: ``230`` - ID: ``E06645FA`` Parameters: provider (``str``): N/A crypto_currency (``str``): N/A base_currency (``str``): N/A base_amount (``str``, *optional*): N/A crypto_amount (``str``, *optional*): N/A payment_method (``str``, *optional*): N/A Returns: :obj:`OnrampQuote <pyrogram.raw.base.OnrampQuote>` """ __slots__: List[str] = ["provider", "crypto_currency", "base_currency", "base_amount", "crypto_amount", "payment_method"] ID = 0xe06645fa QUALNAME = "functions.payments.GetOnrampQuote" def __init__(self, *, provider: str, crypto_currency: str, base_currency: str, base_amount: Optional[str] = None, crypto_amount: Optional[str] = None, payment_method: Optional[str] = None) -> None: self.provider = provider # string self.crypto_currency = crypto_currency # string self.base_currency = base_currency # string self.base_amount = base_amount # flags.0?string self.crypto_amount = crypto_amount # flags.1?string self.payment_method = payment_method # flags.2?string @staticmethod def read(b: BytesIO, *args: Any) -> "GetOnrampQuote": flags = Int.read(b) provider = String.read(b) crypto_currency = String.read(b) base_currency = String.read(b) base_amount = String.read(b) if flags & (1 << 0) else None crypto_amount = String.read(b) if flags & (1 << 1) else None payment_method = String.read(b) if flags & (1 << 2) else None return GetOnrampQuote(provider=provider, crypto_currency=crypto_currency, base_currency=base_currency, base_amount=base_amount, crypto_amount=crypto_amount, payment_method=payment_method) def write(self, *args) -> bytes: b = BytesIO() b.write(Int(self.ID, False)) flags = 0 flags |= (1 << 0) if self.base_amount is not None else 0 flags |= (1 << 1) if self.crypto_amount is not None else 0 flags |= (1 << 2) if self.payment_method is not None else 0 b.write(Int(flags)) b.write(String(self.provider)) b.write(String(self.crypto_currency)) b.write(String(self.base_currency)) if self.base_amount is not None: b.write(String(self.base_amount)) if self.crypto_amount is not None: b.write(String(self.crypto_amount)) if self.payment_method is not None: b.write(String(self.payment_method)) return b.getvalue()