API

Please get in touch with us if you would like to use our APIs in a third-party application.

We have the following endpoints available:

Tokens

Returns an overview of all tokens available on Astrolescent.

Return value:

[{
    "address": "resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3",
    "symbol": "ASTRL",
    "name": "Astrolescent (Babylon)",
    "description": "Official yield bearing and governance token of Astrolescent.",
    "iconUrl": "https://astrolescent.com/assets/img/babylon/astrl-icon.png",
    "infoUrl": "https://astrolescent.com/",
    "divisibility": 18
  }]

Prices

Returns an overview of all token prices and their price history across the Radix network.

The prices are currently refreshed every 10 minutes and are a liquidity-weighted average of the prices on the most important DEXes on Radix (DefiPlaza, Ociswap, and CaviarNine).

Return value:

{
    "resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3": {
        "address": "resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3",
        "symbol": "ASTRL",
        "name": "Astrolescent (Babylon)",
        "description": "Official yield bearing and governance token of Astrolescent.",
        "iconUrl": "https://astrolescent.com/assets/img/babylon/astrl-icon.png",
        "infoUrl": "https://astrolescent.com/",
        "divisibility": 18,
        "tokenPriceXRD": 1.062598098730236,
        "tokenPriceUSD": 0.05351588111136494,
        "diff24H": -0.004460795201074588,
        "diff24HUSD": -0.03278713163358024,
        "diff7Days": -0.035580778487088474,
        "diff7DaysUSD": -0.033143834640006045,
        "icon_url": "https://astrolescent.com/assets/img/babylon/astrl-icon.png"
  },
}

Swap

Calculates the optimal route for a given input and output token and the number of input tokens

Swap accepts as POST parameters:

  • inputToken as token address

  • outputToken as token address

  • inputAmount in 10^1, not 10^18

  • fromAddress as account address

Return value

{
    "inputTokens": 1000,
    "outputTokens": 612.0492827471103,
    "priceImpact": 2,
    "swapFee": "0.612661944691802078525450114506979586034416769007540559028443355",
    "manifest": "\nCALL_METHOD\n\tAddress(\"account_rdx16y6spuy7pvxj3v9ruezge6dvnvjkjja70wmv8fa4c73n4csl9p3pr5\")\n\t\"withdraw\"\n\tAddress(\"resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3\")\n\tDecimal(\"1000\")\n; \n\nTAKE_FROM_WORKTOP\n\tAddress(\"resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3\")\n\tDecimal(\"545.454545454545454546\")\n  \tBucket(\"Astro_Multi_mi5ln\")\n;\n\n\nCALL_METHOD\n\tAddress(\"component_rdx1cqg95d25q8sa26k6996yxl3qg95edwqn4a775nf3s2zxy6tt22s9xf\")\n\t\"swap\"\n\tBucket(\"Astro_Multi_mi5ln\")\n\tAddress(\"resource_rdx1t52pvtk5wfhltchwh3rkzls2x0r98fw9cjhpyrf3vsykhkuwrf7jg8\")\n;\n\nTAKE_FROM_WORKTOP\n\tAddress(\"resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3\")\n\tDecimal(\"454.545454545454545454\")\n  \tBucket(\"OciSimple_nkh67\")\n;\n\n\nCALL_METHOD\n\tAddress(\"component_rdx1cq7tc2pgyzawwjp4qf7ddfeq36scmkghmgl7ww4zp9tqpjuc452mp7\")\n\t\"swap\"\n\tBucket(\"OciSimple_nkh67\")\n;\n\nTAKE_ALL_FROM_WORKTOP\n\tAddress(\"resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd\")\n  \tBucket(\"OciSimple_8dh5h\")\n;\n\n\nCALL_METHOD\n\tAddress(\"component_rdx1cz89w3ecvh9jvdd892vycs44rr042lteg75zgdydq9csn5d87snvdw\")\n\t\"swap\"\n\tBucket(\"OciSimple_8dh5h\")\n;\n\nTAKE_FROM_WORKTOP\n  Address(\"resource_rdx1t52pvtk5wfhltchwh3rkzls2x0r98fw9cjhpyrf3vsykhkuwrf7jg8\")\n  Decimal(\"0.612661944691802079\")\n  Bucket(\"fee_bucket\")\n;\n\nCALL_METHOD\n\tAddress(\"component_rdx1cpxvjgh5a0mewtzkx7j8gzpq0dh676gq5t4hh3svjm02xwakmxa6l7\")\n\t\"deposit\"\n\tBucket(\"fee_bucket\")\n;\n\nCALL_METHOD\n\tAddress(\"account_rdx16y6spuy7pvxj3v9ruezge6dvnvjkjja70wmv8fa4c73n4csl9p3pr5\")\n\t\"deposit_batch\"\n\tExpression(\"ENTIRE_WORKTOP\")\n;",
    "routes": [
        {
            "pools": [
                {
                    "type": "Astro_Multi",
                    "baseToken": "resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3",
                    "quoteToken": "resource_rdx1t52pvtk5wfhltchwh3rkzls2x0r98fw9cjhpyrf3vsykhkuwrf7jg8"
                }
            ],
            "startPrice": "0",
            "endPrice": "0.614051695126398528",
            "impact": 1,
            "tokensIn": 545.4545454545455,
            "tokensOut": 334.93728825076283
        },
        {
            "pools": [
                {
                    "type": "OciSimple",
                    "baseToken": "resource_rdx1t4tjx4g3qzd98nayqxm7qdpj0a0u8ns6a0jrchq49dyfevgh6u0gj3",
                    "quoteToken": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd"
                },
                {
                    "type": "OciSimple",
                    "baseToken": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd",
                    "quoteToken": "resource_rdx1t52pvtk5wfhltchwh3rkzls2x0r98fw9cjhpyrf3vsykhkuwrf7jg8"
                }
            ],
            "startPrice": "0",
            "endPrice": "0.610994244170286339",
            "impact": 1,
            "tokensIn": 454.54545454545456,
            "tokensOut": 277.72465644103926
        }
    ]
}

The manifest field can be directly sent to the Radix dApp Toolkit to initiate a transaction.

Fees

We have developed a custom fee component that we might be able to offer to our partners to insert their fees into the manifest as well. Contact us to see how we can best offer this to you and integrate it into our API.

Last updated