Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Предзаказ обмена

Сначала необходимо получить квоту (информацию о цене, по которой в течение последующих 10 секунд можно будет обменять деньги).
Для этого используем:

mutation {
  getSwapQuote(
      marketId: String!,
      from: String!,
      to: String!,
      # direction can be 'to' or 'from'                    
      direction: String!,
      amount: String!
  ): SwapQuote
}

Обратите внимание, параметр direction помогает указать в какой валюте указывается amount - во входящей или исходящей.

Пример 1.

Я хочу поменять 100 USDT на ETH запрос будет выглядеть:

mutation {
  swapQuote(
    from: "USDT",
    to: "ETH",
    marketId: "ETH-USDT",
    direction: "from",
    amount: "100"
  ) {
    id
    serviceId
    from
    to
    direction
    amount
    give
    receive
    rate
    internalGive
    internalReceive
    expireAt
    status
    isActive
    isErrored
  }
}

Пример 2.

Я хочу поменять USDT и получить в результате 0.001 ETH запрос будет выглядеть:

mutation {
  swapQuote(
    from: "USDT",
    to: "ETH",
    marketId: "ETH-USDT",
    direction: "to",
    amount: "0.001"
  ) {
    id
    serviceId
    from
    to
    direction
    amount
    give
    receive
    rate
    internalGive
    internalReceive
    expireAt
    status
    isActive
    isErrored
  }
}

Параметры из ответа:

give - сколько клиент должен будет заплатить без учета комиссии нашей системы (приблизительно, если direction = “to” и точно, если direction = “from”)

receive - сколько клиент получит без учета комиссии нашей системы (приблизительно, если direction = “from” и точно, если direction = “to”)

rate - receive / give

internalGive - сколько клиент заплатит с учетом нашей комиссии (приблизительно если direction = “to” и точно, если direction = “from”)

internalReceive - сколько клиент получит без учета комиссии нашей системы (приблизительно, если direction = “from” и точно, если direction = “to”)

expireAt - время, когда текущая квота утратит свою актуальность.

Обмен

После принятия клиентом решения об обмене (если попадаем в 10секундный интервал) используется следующий:

mutation {
  confirmSwapQuote(id: String!): SwapQuote
}

Передаем id квоты, serviceId, marketId

UX

Screenshot from 2024-04-24 18-18-12.png

Off- chain Swap Step 1

As a User, I can see main details of the form:

  • 'Quick Swap' header

  • Send section with main details:

    • 'Drop down' button to select Currency to Send with logo and ID (Ticker)

    • In case there is only one option for Currency to Send: the user can observe just this option with logo and currency ID (without drop-down

    • Currency to Send is selected according Wallet selected (by default for each Wallet) with logo and ID (Ticker)

    • Input field for amount to Swap (Send internally), pre-set "Minimum amount" to Swap by default

    • “Max” button

    • Asset's balance available for operation, in selected currency with currency ID

    'Reverse' button for changing Currency positions between 'Send' and 'Receive'

  • Receive section with main details:

    • 'Drop down' button to select Currency to Receive with logo and ID (Ticker)

    • The field 'Receive' with a calculated amount (Approximate) in Currency to Receive

    • The second Asset's balance (Currency to Receive) is currently available in its Wallet

  • Platform commission portion and ID (commission ID can be in the quote or base currency according to market settings)

  • Platform rate portion for selected Market Pair: Currency to Swap -> Currency to Receive (price precision, according to market settings)

  • Estimated result rate for selected Market Pair: Currency to Swap -> Currency to Receive (price precision, according to market settings)

    'Switch' icons as buttons to switch the Estimated result rate or Platform rate reflection Currency to Receive -> Currency to Swap

    'Swap' button

    'X' button below the main form to close the modal window


Actions on Step 1:


1. Press 'Drop Down' button to change Currency to Send and open the Currencies drop-down list :

  • See the list of currencies suggested as Currencies to Send (according to Market Pairs on the platform): - ‘Search’ field
    - Logo, ID/Ticker
    - Asset's balance available for operation
    - Selected Currency is ‘marked’

  • Select the Currency to Send from the list

See the Swap details changed according to the Market parameters with new selected Currency:

  • Pre-set for Send in the Input field for amount to Send (Minimum amount to send according to market settings)

  • Current Balance of Currency to Send

  • Option(s) for Currency(ies) to receive

  • Field 'Receive' with the calculated amount (Approximate) in Currency to Receive

  • Current Balance of Currency to Receive

  • Platform commission

  • Platform rate

  • Estimated result rate

  1. Press “Max” button and use all available balance for Swap operation:

  • See the calculated amount (Approximate) of Currency to Receive in the field 'Receive'

  • Observe that the Amount of the Currency to Receive depends on the estimated rate of the selected Market Pair and changes if the Amount to Send is edited

  • See the 'Swap' Button activated if the input amount fits the requirements

  • Platform commission displays data

  • Platform rate displays data

  • The estimated result rate displays the data
    In case the maximum balance is lower than the minimum required for Send:

  • 'Minimum amount to send' notification on top of the input field "Amount" (according to market settings)

  • See the 'Swap' Button deactivated

  • Field 'Receive' with “0.00” amount in Currency to Receive. The text has an error color

  • Platform commission has a ' – ' amount

  • Platform rate displays data

  • Estimated result rate has a ' – ' amount

  1. Press the 'Reverse' button and change the position of selected currencies Currency to Receive -> Currency to Send

  2. Press the 'Drop Down' button to change Currency to Receive and open the Currencies drop-down list

  • See the list of currencies suggested as Currencies to Receive (according to Market Pairs on the platform):
    - ‘Search’ field
    - Logo, ID/Ticker
    - Asset's balance available for operation
    - Selected Currency is ‘marked’

  • Select the Currency to Receive from the list

See the Swap details changed according to the Market parameters with the new selected Currency:

  • Pre-set for Send in the Input field for the amount to Send (Minimum amount to send according to market settings)

  • Current Balance of Currency to Send

  • Option(s) for Currency(ies) to Send

  • Field 'Receive' with a calculated amount (Approximate) in Currency to Receive

  • Current Balance of Currency to Receive

  • Platform commission

  • Platform rate

  • Estimated result rate

  1. Press the 'Switch' icon as a button in the Platform rate portion and change the rate reflection Base/Quote or Quote/Base
    Press the 'Switch' icon as a button in the Estimated result rate portion and change the rate reflection Base/Quote or Quote/Base

  1. Click on the Input field for the amount to Send and see previous input clears automatically and the 'Minimum amount to send' notification is on top of the input field "Amount" (according to market settings)

  2. Input amount for Send and:

  • See the calculated amount (Approximate) of Currency to Receive in the field 'Receive'

  • Observe that the Amount of the Currency to Receive depends on the estimated rate of the selected Market Pair and changes if the Amount to Send is edited

  • See the 'Swap' Button activated if the input amount fits the requirements

  • Input only 'dot' first and see automatically changing to ' 0. ' in the Input field

  • Platform commission displays data

  • Platform rate displays data

  • The estimated result rate displays the data

  1. Input amount of the Currency to Swap lower than the minimum allowed and...

  • 'Minimum amount to send' notification on top of the input field "Amount" (according to market settings)

  • See the 'Swap' Button deactivated

  • Field 'Receive' with “0.00” amount in Currency to Receive. The text has an error color

  • Platform commission has a ' – ' amount

  • Platform rate displays data

  • Estimated result rate has a ' – ' amount

  1. Input amount of the Currency to Send bigger than the amount of the Available Assets:

  • See the 'Swap' Button deactivated

  • The field 'Receive' with a calculated amount (Approximate) in Currency to Receive. The text has an error color

  • Platform commission displays data

  • Platform rate displays data

  • The estimated result rate displays the data

  1. Leave the input field for Amount to Send empty:

  • 'Minimum amount to send' notification on top of the input field "Amount" (according to market settings)

  • Field 'Receive' with “0.00” amount in Currency to Receive. The text has an error color

  • Platform commission has a ' – ' amount

  • Platform rate displays data

  • Estimated result rate has a ' – ' amount

  • See the 'Swap' Button deactivated

  1. In case the available balance of the Currency to Send is lower than the minimum amount of the Currency to Send (the first time open the form)

  • See the amount pre-set equal to the minimum amount to Send in the input field for Currency to Send

  • Field 'Receive' with a calculated amount (Approximate) in Currency to Receive. The text has an error color

  • See the 'Swap' Button deactivated

  • Platform commission displays data

  • Platform rate displays data

  • The estimated result rate displays the data

  1. Press the 'Swap' button and go to Off-chain Swap Step 2

  2. Press the ‘X' button below the 'Quick Swap' form and close the modal window 'Quick Swap’ form and get back to Wallet details

Off- chain Swap Step 2

Screenshot from 2024-04-24 18-57-48.png

As a User I can see main details of the form:

  • 'Confirmation' header

  • Send section with main details:

    • Currency to Send with logo and ID (Ticker)

    • Currency to Send is selected according to Step 1

    • Amount to Swap (Send internally) according to Step 1 inputs

  • 'Arrow' icon for displaying Currency swap positions between 'Send' and 'Receive'

  • Receive section with main details:

    • Currency to Receive with logo and ID (Ticker). Selected according to Step 1

    • The field 'Receive' with a calculated amount in Currency to Receive

  • Notice text message “Swap result in precise according to current rate”

  • Rate portion for selected Market Pair: Currency to Swap -> Currency to Receive (price precision, according to market settings)

  • Inverse rate portion for selected Market Pair: Currency to Swap -> Currency to Receive (price precision, according to market settings)

  • 'Confirm Swap' button (with timer)

  • 'X' button below the main form to close the modal window

Actions on Step 2:

  1. Press 'Confirm Swap' button and:

  • See popup notification 'Successful' if everything is correct

  • See the modal window 'Swap form' closing and get back to Wallet details

In case time is over 'Confirm Swap' button changes to “Refresh Quote” button

  • Rate portion and Inverse rate portions for selected Market Pair have stable data without updates

Screenshot from 2024-04-24 20-09-06.png

  1. Press ”Refresh Quote” button and:

  • Rate portion and Inverse rate portions for selected Market Pair updated with fresh data

  • The “Refresh Quote”' button changes to Confirm Swap' button with a timer

  1. Press the ‘X' button below the 'Confirmation' form and close the modal window 'Confirmation’ form and get back to Wallet details

Main Formulas:

Receive amount =

Platform commission =

Platform rate =

Estimated result rate =

Examples of commission currency

Screenshot from 2024-04-25 08-03-46.png

  • No labels