Files
mDuo13 08bbcc4dd7 AMM reference docs
AMM object: some clarifications

AMM references: incomplete draft

AMM updates

AMM: add AMMBid, clarify more stuff

Docs for AMMBid transaction

AMM: more work on error codes

AMM: example transactions, related upates

Fix broken links

AMM: reflect naming updates

more AMMBid edits

Add amm_info API method

Add style for AMM label

AMM: more clarifications on tx, accounts

AMM references: Clean up draft

amm_info: reflect code updates

AMM: updates for the latest changes

AMM: update flags for Deposit/Withdraw

AMM: update JSON examples for latest code

Serialization: add STIssue type

STIssue: clarify definition with commas
2022-11-21 22:40:12 -08:00

6.5 KiB

html, parent, blurb, status, labels
html parent blurb status labels
amm_info.html path-and-order-book-methods.html Get info about an Automted Market Maker (AMM) instance. not_enabled
Decentralized Exchange
Cross-Currency
AMM

amm_info

[Source]

The {{currentpage.name}} method gets information about an Automated Market Maker (AMM) instance.

{% include '_snippets/amm-disclaimer.md' %}

Request Format

An example of the request format:

{% include '_snippets/no-cli-syntax.md' %}

WebSocket

{
    "command": "{{currentpage.name}}",
    "asset": {
      "currency": "XRP"
    },
    "asset2": {
      "currency": "TST",
      "issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
    }
}

JSON-RPC

{
    "method": "{{currentpage.name}}",
    "params": [{
      "asset": {
        "currency": "XRP"
      },
      "asset2": {
        "currency": "TST",
        "issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
      }
    }]
}

The request includes the following parameters:

Field Type Description
asset Object or String One of the assets of the AMM to look up, as an object with currency and issuer fields (omit issuer for XRP), like [currency amounts][Currency Amount]. For XRP, you can specify as the string XRP instead of as an object.
asset2 Object or String The other of the assets of the AMM, as an object with currency and issuer fields (omit issuer for XRP), like [currency amounts][Currency Amount].

Response Format

An example of a successful response:

WebSocket

{
  "result": {
    "amm": {
        "AMMAccount" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
        "Asset" : {
          "currency" : "XRP"
        },
        "Asset2" : {
          "currency" : "TST",
          "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
        },
        "AuctionSlot" : {
          "Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
          "AuthAccounts" : [
              {
                "AuthAccount" : {
                    "Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
                }
              },
              {
                "AuthAccount" : {
                    "Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
                }
              }
          ],
          "DiscountedFee" : 0,
          "Expiration" : 721870180,
          "Price" : {
              "currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
              "issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
              "value" : "0.8696263565463045"
          }
        },
        "Flags" : 0,
        "LPTokenBalance" : {
          "currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
          "issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
          "value" : "71150.53584131501"
        },
        "TradingFee" : 600,
        "VoteSlots" : [
          {
              "VoteEntry" : {
                "Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
                "TradingFee" : 600,
                "VoteWeight" : 100000
              }
          }
        ]
    },
    "ledger_current_index": 226645,
    "validated": false
  },
  "status": "success",
  "type": "response"
}

JSON-RPC

200 OK

{
  "result": {
    "amm": {
        "AMMAccount" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
        "Asset" : {
          "currency" : "XRP"
        },
        "Asset2" : {
          "currency" : "TST",
          "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
        },
        "AuctionSlot" : {
          "Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
          "AuthAccounts" : [
              {
                "AuthAccount" : {
                    "Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
                }
              },
              {
                "AuthAccount" : {
                    "Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
                }
              }
          ],
          "DiscountedFee" : 0,
          "Expiration" : 721870180,
          "Price" : {
              "currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
              "issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
              "value" : "0.8696263565463045"
          }
        },
        "Flags" : 0,
        "LPTokenBalance" : {
          "currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
          "issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
          "value" : "71150.53584131501"
        },
        "TradingFee" : 600,
        "VoteSlots" : [
          {
              "VoteEntry" : {
                "Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
                "TradingFee" : 600,
                "VoteWeight" : 100000
              }
          }
        ]
    },
    "ledger_current_index": 226620,
    "status": "success",
    "validated": false
  }
}

The response follows the [standard format][], with a successful result containing the following fields:

Field Type Description
amm Object The AMM object for the requested asset pair.
ledger_current_index Integer (Omitted if ledger_index is provided instead) The [ledger index][] of the current in-progress ledger, which was used when retrieving this information.
ledger_index Integer (Omitted if ledger_current_index is provided instead) The [ledger index][] of the ledger version used when retrieving this information.
validated Boolean If true, the ledger used for this request is validated and these results are final; if omitted or set to false, the data is pending and may change.

Possible Errors

  • Any of the [universal error types][].
  • actNotFound - The AMM for this asset pair does not exist, or an issuing account specified in the request does not exist.
  • invalidParams - One or more fields are specified incorrectly, or one or more required fields are missing.

{% include '_snippets/rippled-api-links.md' %} {% include '_snippets/tx-type-links.md' %} {% include '_snippets/rippled_versions.md' %}