Skip to content

Commit

Permalink
API
Browse files Browse the repository at this point in the history
  • Loading branch information
Sluder committed May 13, 2024
1 parent b8e1bef commit a5e6b6f
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 204 deletions.
36 changes: 29 additions & 7 deletions src/dex/api/sundaeswap-v3-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class SundaeSwapV3Api extends BaseApi {
this.dex = dex;
this.api = axios.create({
timeout: requestConfig.timeout,
baseURL: `${appendSlash(requestConfig.proxyUrl)}https://stats.sundaeswap.finance/graphql`,
baseURL: `${appendSlash(requestConfig.proxyUrl)}https://api.sundae.fi/graphql`,
headers: {
'Content-Type': 'application/json',
}
Expand All @@ -34,15 +34,16 @@ export class SundaeSwapV3Api extends BaseApi {
const assets: string[] = [assetAId, assetBId].sort();

return await this.api.post('', {
operationName: 'fetchPoolsByPair',
operationName: 'fetchPoolByAssets',
query: `
query fetchPoolsByPair($assetA: ID!, $assetB: ID!) {
pools {
byPair(assetA: $assetA, assetB: $assetB) {
...PoolBrambleFragment
}
query fetchPoolByAssets($assets: [ID!]!) {
pools {
byAssets(assets: $assets) {
...PoolBrambleFragment
}
}
}
fragment PoolBrambleFragment on Pool {
id
assetA {
Expand Down Expand Up @@ -78,9 +79,30 @@ export class SundaeSwapV3Api extends BaseApi {
}
version
}
fragment AssetBrambleFragment on Asset {
id
policyId
description
dateListed {
format
}
decimals
ticker
name
logo
assetName
metadata {
... on OnChainLabel20 {
__typename
}
... on OnChainLabel721 {
__typename
}
... on CardanoTokenRegistry {
__typename
}
}
}
`,
variables: {
Expand Down
Loading

0 comments on commit a5e6b6f

Please sign in to comment.