|
| 1 | +from pydantic import BaseModel, Field |
| 2 | +from typing import Optional |
| 3 | + |
| 4 | + |
| 5 | +class EmptyParameters(BaseModel): |
| 6 | + pass |
| 7 | + |
| 8 | + |
| 9 | +class GetTokenListParameters(BaseModel): |
| 10 | + chainId: str = Field(description="ID of a chain") |
| 11 | + |
| 12 | + |
| 13 | +class GetOrderDataParameters(BaseModel): |
| 14 | + id: str = Field(description="ID of the order") |
| 15 | + |
| 16 | + |
| 17 | +class GetOrderStatusParameters(BaseModel): |
| 18 | + id: str = Field(description="ID of the order") |
| 19 | + |
| 20 | + |
| 21 | +class GetOrderIDsParameters(BaseModel): |
| 22 | + hash: str = Field(description="Hash of the creation transaction") |
| 23 | + |
| 24 | + |
| 25 | +class CancelOrderParameters(BaseModel): |
| 26 | + id: str = Field(description="ID of the order") |
| 27 | + |
| 28 | + |
| 29 | +class CancelExternalCallParameters(BaseModel): |
| 30 | + id: str = Field(description="ID of the order") |
| 31 | + |
| 32 | + |
| 33 | +class CreateOrderTransactionParameters(BaseModel): |
| 34 | + srcChainId: str = Field( |
| 35 | + description= |
| 36 | + "An ID of a source chain, a chain where the cross-chain swap will start" |
| 37 | + ) |
| 38 | + srcChainTokenIn: str = Field( |
| 39 | + description="An address (on a source chain) of an input token to swap") |
| 40 | + srcChainTokenInAmount: str = Field( |
| 41 | + description="An amount of input tokens to swap") |
| 42 | + dstChainId: str = Field( |
| 43 | + description= |
| 44 | + "An ID of a destination chain, a chain where the cross-chain swap will finish. Must differ from srcChainId!" |
| 45 | + ) |
| 46 | + dstChainTokenOut: str = Field( |
| 47 | + description="An address (on a destination chain) of a target token") |
| 48 | + dstChainTokenOutAmount: Optional[str] = Field( |
| 49 | + default="auto", |
| 50 | + description= |
| 51 | + "Amount of the target asset the market maker expects to receive upon order fulfillment.", |
| 52 | + ) |
| 53 | + additionalTakerRewardBps: Optional[int] = Field( |
| 54 | + description= |
| 55 | + "additionalTakerRewardBps is additionally laid in on top of default taker margin" |
| 56 | + ) |
| 57 | + srcIntermediaryTokenAddress: Optional[str] = Field( |
| 58 | + description= |
| 59 | + "An address (on a source chain) of an intermediary token a user's input funds should be swapped to prior order creation" |
| 60 | + ) |
| 61 | + dstIntermediaryTokenAddress: Optional[str] = Field( |
| 62 | + description= |
| 63 | + "An address (on a destination chain) of an intermediary token whose value assumed to be equal to the value of srcIntermediaryTokenAddress" |
| 64 | + ) |
| 65 | + dstIntermediaryTokenSpenderAddress: Optional[str] = Field( |
| 66 | + description= |
| 67 | + "Applicable to a EVM-compatible destination chain. An address (on a EVM-compatible destination chain) assumed as a spender of the intermediary token (set as dstIntermediaryTokenAddress) during order fulfillment" |
| 68 | + ) |
| 69 | + intermediaryTokenUSDPrice: Optional[float] = Field( |
| 70 | + description= |
| 71 | + "A value (a spot price) of the given intermediary token expressed in US dollars" |
| 72 | + ) |
| 73 | + dstChainTokenOutRecipient: Optional[str] = Field( |
| 74 | + description= |
| 75 | + "Address (on the destination chain) where target tokens should be transferred to after the swap. Required for transaction construction, otherwise only the quote is returned!" |
| 76 | + ) |
| 77 | + senderAddress: Optional[str] = Field( |
| 78 | + description= |
| 79 | + "Address (on the source chain) who submits input tokens for a cross-chain swap" |
| 80 | + ) |
| 81 | + srcChainOrderAuthorityAddress: Optional[str] = Field( |
| 82 | + description= |
| 83 | + "Address (on the source chain) who submits input tokens for a cross-chain swap. Required for transaction construction, otherwise only the quote is returned!" |
| 84 | + ) |
| 85 | + srcAllowedCancelBeneficiary: Optional[str] = Field( |
| 86 | + description= |
| 87 | + "Fixed recipient of the funds of an order in case it is being cancelled. If not set, the recipient could be set later upon order cancellation" |
| 88 | + ) |
| 89 | + referralCode: Optional[float] = Field( |
| 90 | + default=31494, |
| 91 | + description= |
| 92 | + "Your referral code which can be generated here: https://app.debridge.finance/refer", |
| 93 | + ) |
| 94 | + affiliateFeePercent: Optional[float] = Field( |
| 95 | + default=0, |
| 96 | + description= |
| 97 | + "The share of the input amount to be distributed to the affiliateFeeRecipient (if given) address as an affiliate fee", |
| 98 | + ) |
| 99 | + affiliateFeeRecipient: Optional[str] = Field( |
| 100 | + description= |
| 101 | + "An address (on an origin chain) that will receive affiliate fees according to the affiliateFeePercent parameter" |
| 102 | + ) |
| 103 | + srcChainTokenInSenderPermit: Optional[str] = Field( |
| 104 | + description= |
| 105 | + "Typically, a sender is required to approve token transfer to deBridge forwarder for further transfer and swap" |
| 106 | + ) |
| 107 | + dstChainOrderAuthorityAddress: Optional[str] = Field( |
| 108 | + description= |
| 109 | + "Address on the destination chain whom should be granted the privileges to manage the order (patch, cancel, etc). Required for transaction construction, otherwise only the quote is returned!" |
| 110 | + ) |
| 111 | + enableEstimate: Optional[bool] = Field( |
| 112 | + description= |
| 113 | + "This flag forces deSwap API to validate the resulting transaction and estimate its gas consumption" |
| 114 | + ) |
| 115 | + allowedTaker: Optional[str] = Field( |
| 116 | + description="An address (on a destination chain) of a allowed taker") |
| 117 | + dlnHook: Optional[str] = Field( |
| 118 | + description="JSON representing a DLN Hook to be attached to an order") |
| 119 | + prependOperatingExpenses: Optional[bool] = Field( |
| 120 | + default=False, |
| 121 | + description= |
| 122 | + "Tells API server to prepend operating expenses to the input amount", |
| 123 | + ) |
| 124 | + metadata: Optional[str] = Field(default=False, description="Metadata") |
| 125 | + ptp: Optional[bool] = Field( |
| 126 | + default=False, |
| 127 | + description= |
| 128 | + "Forces a P2P order where input and output tokens are left intact", |
| 129 | + ) |
| 130 | + skipSolanaRecipientValidation: Optional[bool] = Field( |
| 131 | + default=False, |
| 132 | + description= |
| 133 | + "Skip system address validation dstChainTokenOutRecipient in Solana", |
| 134 | + ) |
| 135 | + |
| 136 | + |
| 137 | +class SingleChainSwapEstimationParameters(BaseModel): |
| 138 | + chainId: str = Field( |
| 139 | + description="An ID of a chain, a chain where the swap must be performed" |
| 140 | + ) |
| 141 | + tokenIn: str = Field(description="An address of an input token to swap") |
| 142 | + tokenInAmount: str = Field(description="An amount of input tokens to swap") |
| 143 | + slippage: Optional[str] = Field( |
| 144 | + default="auto", |
| 145 | + description= |
| 146 | + "A slippage constraint (in %) is a safeguard during swaps (on both source and destination chains, if applicable). It is also used to calculate the minimum possible outcome during estimation", |
| 147 | + ) |
| 148 | + tokenOut: str = Field(description="An address of a target token") |
| 149 | + affiliateFeePercent: Optional[float] = Field( |
| 150 | + default=0, |
| 151 | + description= |
| 152 | + "The share of the input amount to be distributed to the affiliateFeeRecipient (if given) address as an affiliate fee", |
| 153 | + ) |
| 154 | + affiliateFeeRecipient: Optional[str] = Field( |
| 155 | + description= |
| 156 | + "An address (on an origin chain) that will receive affiliate fees according to the affiliateFeePercent parameter" |
| 157 | + ) |
| 158 | + |
| 159 | + |
| 160 | +class SingleChainSwapTransactionParameters(BaseModel): |
| 161 | + chainId: str = Field( |
| 162 | + description="An ID of a chain, a chain where the swap must be performed" |
| 163 | + ) |
| 164 | + tokenIn: str = Field(description="An address of an input token to swap") |
| 165 | + tokenInAmount: str = Field(description="An amount of input tokens to swap") |
| 166 | + slippage: Optional[str] = Field( |
| 167 | + default="auto", |
| 168 | + description= |
| 169 | + "A slippage constraint (in %) is a safeguard during swaps (on both source and destination chains, if applicable). It is also used to calculate the minimum possible outcome during estimation", |
| 170 | + ) |
| 171 | + tokenOut: str = Field(description="An address of a target token") |
| 172 | + tokenOutRecipient: str = Field( |
| 173 | + description="Address who receives the tokens from the swap") |
| 174 | + affiliateFeePercent: Optional[float] = Field( |
| 175 | + default=0, |
| 176 | + description= |
| 177 | + "The share of the input amount to be distributed to the affiliateFeeRecipient (if given) address as an affiliate fee", |
| 178 | + ) |
| 179 | + affiliateFeeRecipient: Optional[str] = Field( |
| 180 | + description= |
| 181 | + "An address (on an origin chain) that will receive affiliate fees according to the affiliateFeePercent parameter" |
| 182 | + ) |
| 183 | + senderAddress: Optional[str] = Field( |
| 184 | + description= |
| 185 | + "Address (on the source chain) who submits input tokens for a cross-chain swap" |
| 186 | + ) |
0 commit comments