Public

A set of apis for public use

Base URL address:

https://api.caviarnine.com

CaviarNine Aggregator

The aggregator at CaviarNine enables a significant proportion of the web2 information and functionality you see at caviarnine.com today. But firstly the disclaimer... CaviarNine Aggregator Public Endpoint Disclaimer

The CaviarNine Aggregator provides a public endpoint for requesting Radix trading manifests, delivering near-optimal routing instructions based on current data. This service is offered on an as-is and as-available basis without any warranties, guarantees, or representations of accuracy, reliability, or suitability for any particular purpose. While we strive to provide efficient routing information, external factors and inherent data limitations may impact the service's performance and output.

Currently, this endpoint is available free of charge as a public resource. Usage is subject to a rate limit of 5 requests per minute. CaviarNine Limited reserves the right to introduce fees, modify, restrict, or terminate access to this endpoint without prior notice. By using this service, you acknowledge and accept these terms, agreeing that CaviarNine Limited will not be held liable for any direct or indirect losses resulting from its use.

All routing instructions and data provided through this service are the intellectual property of CaviarNine Limited and are intended solely for informational purposes. Redistribution or commercial use without prior written consent from CaviarNine Limited is prohibited.

Users are advised to consider the security of their requests, as publicly accessible services may be susceptible to third-party interception or misuse. Additionally, the functionality and output of this endpoint may evolve to accommodate user needs, regulatory requirements, or technological advancements.

Resources

GET /v1.0/aggregator/resources

Available resources that the aggregator has seen in the past and are possible to be able to swap. This does not mean there is a guaranteed swap available for the resource_address

Response

{
  "count": 629,
  "data": [
    "resource_rdx1t40290x6mh42j53lehs56kk2erv6em3cd5jp4hxt2pu8nf2rcknthy",
    "resource_rdx1t40gu7xfffcc723ylrfq7gw7g94v9qjsq7e49ue8r07afz0q2v4qjx",
    ...
    ],
  "utc_now": "2024-11-06T09:46:59.885183"
}

Solve & SolverStream

GET /v1.0/aggregator/solve

GET /v1.0/aggregator/solver_stream

Query Parameters

  • sell_resource_amount (required): Specifies the amount of the resource to sell.

  • sell_resource_address (required): Specifies the address of the resource to sell.

  • buy_resource_address (required): Specifies the address of the resource to buy.

  • account_address (optional): Provides the address of the account making the transaction. If not provided, the response will not include a transaction manifest.

The /v1.0/aggregator/solve and /v1.0/aggregator/solver_stream endpoints provide near-optimal manifest routes within the Radix ecosystem, leveraging internal mappings and available liquidity to determine the best transaction paths.

Functionality Overview

The /solve endpoint is designed to provide the best available solution by continuously refining its calculations. This endpoint waits up to 1 second for any additional improvements; if no further optimisations are found within that time, it returns the best price identified so far. This behaviour allows for a responsive solution without excessive delay, delivering near-optimal routes based on the available liquidity in the Radix ecosystem.

In contrast, the /solver_stream endpoint is an HTTP2 connection that streams progressive solutions over a 10-second session and then maintains the connection for a further 20-30 seconds giving updates on the best manifest found. With each update, it returns increasingly optimised routes, allowing users to see the improvement in real-time and possibly a better final solution than the /solve endpoint.

Additional Notes:

If an account_address is provided, the response will include a transaction manifest, which has been simulated at a Radix gateway. The response’s result field summarises the key details from the simulation.

Both endpoints serve as powerful tools for efficient, liquidity-optimised transaction routing on the Radix network.

Example Query:

https://api.caviarnine.com/v1.0/aggregator/solve?sell_resource_amount=100&sell_resource_address=resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd&buy_resource_address=resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf&account_address=account_rdx129m63lnnexyt90wpw6nkmshlhlvrp3gvry5f3usth2xnktev8qf2na

Example Response:

{
    "event_type": "SolutionUpdate",
    "manifest": '\n            CALL_METHOD\n                Address("account_rdx129m63lnnexyt90wpw6nkmshlhlvrp3gvry5f3usth2xnktev8qf2na")\n                "withdraw"\n                Address("resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd")\n                Decimal("100");\n            \n            TAKE_FROM_WORKTOP\n                Address("resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd") \n                Decimal("2.993684696191894367") \n                Bucket("fe647ac3");\n            \n            CALL_METHOD \n                Address("component_rdx1cz22qr3f2algcsedqw93lkjqa09xhx746wfgzvq8c8ss6tjlr9p05k") \n                "swap" \n                Bucket("fe647ac3");\n        \n            TAKE_FROM_WORKTOP\n                Address("resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd") \n                Decimal("23.889404161552992178") \n                Bucket("2238054d");\n            \n            CALL_METHOD \n                Address("component_rdx1cz79xc57dpuhzd3wylnc88m3pyvfk7c5e03me2qv7x8wh9t6c3aw4g") \n                "swap" \n                Bucket("2238054d");\n        \n            TAKE_ALL_FROM_WORKTOP\n                Address("resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd") \n                Bucket("8c30932a");\n            \n            CALL_METHOD \n                Address("component_rdx1cz8daq5nwmtdju4hj5rxud0ta26wf90sdk5r4nj9fqjcde5eht8p0f") \n                "swap" \n                Bucket("8c30932a");\n        \n            TAKE_ALL_FROM_WORKTOP\n                Address("resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww") \n                Bucket("75da929e");\n            \n            CALL_METHOD \n                Address("component_rdx1cpvngcr2xujqz2tysxsft4th00wttpluhndxuh0rcpzdwq5uzj6n6l") \n                "swap" \n                Bucket("75da929e");\n        \n            TAKE_ALL_FROM_WORKTOP\n                Address("resource_rdx1thrvr3xfs2tarm2dl9emvs26vjqxu6mqvfgvqjne940jv0lnrrg7rw") \n                Bucket("f789d984");\n            \n            CALL_METHOD \n                Address("component_rdx1czh7n0v8qs3req4la3stuuxdyhq3trn4r9hwh5jrjjmr3prexsl5sl") \n                "swap" \n                Bucket("f789d984");\n        \n            CALL_METHOD\n                Address("account_rdx129m63lnnexyt90wpw6nkmshlhlvrp3gvry5f3usth2xnktev8qf2na") \n                "deposit_batch"\n                Expression("ENTIRE_WORKTOP");\n        ',
    "payload": {
        "account_address": "account_rdx129m63lnnexyt90wpw6nkmshlhlvrp3gvry5f3usth2xnktev8qf2na",
        "buy_resource_address": "resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf",
        "sell_resource_address": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd",
        "sell_resource_amount": "100",
    },
    "result": {
        "account_address": "account_rdx129m63lnnexyt90wpw6nkmshlhlvrp3gvry5f3usth2xnktev8qf2na",
        "balance_changes": {
            "DepositEvent": {"resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf": "1.590187"},
            "WithdrawEvent": {"resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd": "100"},
        },
        "details": {
            "buy_resource_address": "resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf",
            "mid_price_buy_to_sell": "62.896472",
            "mid_price_sell_to_buy": "0.0158977",
            "price_buy_to_sell": "62.885685",
            "price_sell_to_buy": "0.0159018",
            "sell_resource_address": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd",
        },
        "error_message": null,
        "fee_summary": {
            "execution_cost_units_consumed": 43787044,
            "finalization_cost_units_consumed": 2776485,
            "xrd_total_execution_cost": "2.1893522",
            "xrd_total_finalization_cost": "0.13882425",
            "xrd_total_royalty_cost": "0",
            "xrd_total_storage_cost": "0.44670104212",
            "xrd_total_tipping_cost": "0",
        },
        "header": {"date_time": "2024-11-07T05:19:29.435Z", "state_version": 161613973, "unix_timestamp_ms": 1730956769435},
        "status": "Succeeded",
    },
    "solver_id": "bb3eaf73-4bf9-4528-b724-543ec491ce5f",
}

Old API endpoints:

Tokens

GET https://api-core.caviarnine.com/v1.0/public/tokens

returns the resource_address to xrd price (mid, bid and ask if available) derived from the prices available on Radix

Last updated