Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Change to new swap endpoint [600 FLIP] #88

Open
CumpsD opened this issue Sep 27, 2024 · 0 comments
Open

Change to new swap endpoint [600 FLIP] #88

CumpsD opened this issue Sep 27, 2024 · 0 comments
Labels
bug Something isn't working waiting for funding Waiting for funding to start

Comments

@CumpsD
Copy link
Owner

CumpsD commented Sep 27, 2024

Change to new swap GraphQL endpoint

Scope

With the 1.6 release, the endpoint used to get all swap data has been heavily changed. A new "legacy" endpoint was provided to let people gradually migrate, however this legacy endpoint is not usable because it does not have all the data, and times out when making a sorted request (no index).

We need to use the new changed swap schema to get the swap info back. The big changes are the fact a swap request can now have multiple swaps associated with it.

More Info

New request will look something like this:

allSwapRequests(
    orderBy: ID_ASC
    first: 50
    filter: {id: {greaterThan: LAST_ID}}
  ) {
    nodes {
      id
      nativeId
      type
      depositAmount
      depositValueUsd
      sourceAsset
      sourceChain
      destinationAsset
      destinationChain
      destinationAddress
      effectiveBoostFeeBps
      swaps: swapsBySwapRequestId {
        nodes {
          swapScheduledBlockTimestamp
          intermediateAmount
          intermediateValueUsd
          swapInputAmount
          swapInputValueUsd
          swapOutputAmount
          swapOutputValueUsd
          fees: swapFeesBySwapId {
            edges {
              node {
                type
                amount
                asset
                valueUsd
              }
            }
          }
        }
      }
      egress: egressByEgressId {
        amount
        valueUsd
        event: eventByScheduledEventId {
          block: blockByBlockId {
            timestamp
          }
        }
      }
      predeposit: foreignChainTrackingByForeignChainPreDepositBlockId {
        stateChainTimestamp
      }
      deposit: foreignChainTrackingByForeignChainDepositBlockId {
        stateChainTimestamp
      }
      channel: swapChannelByDepositChannelId {
        blockByIssuedBlockId {
          timestamp
        }
        beneficiaries: swapChannelBeneficiariesByDepositChannelId {
          nodes {
            brokerCommissionRateBps
            type
            brokerByBrokerId {
              accountByAccountId {
                idSs58
              }
            }
          }
        }
        broker: brokerByBrokerId {
          accountByAccountId {
            idSs58
          }
        }
      }
      fees: swapFeesBySwapRequestId {
        edges {
          node {
            type
            amount
            asset
            valueUsd
          }
        }
      }
    }
  }
}

Bounty

FLIP required for development: 600 FLIP
To start development, send the bounty to 0x2578f4fa0f36138c76389095bf74331a4f57bcc0 and comment with a link to the transaction.

@CumpsD CumpsD added bug Something isn't working waiting for funding Waiting for funding to start labels Sep 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting for funding Waiting for funding to start
Projects
Status: Waiting for funding
Development

No branches or pull requests

1 participant