XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.19k stars 507 forks source link

Counterparty and another balances with different currency of XRP #823

Closed prinick96 closed 6 years ago

prinick96 commented 6 years ago

Hi, i have a question and don't find the response in Ripple api, sorry for my bad english:

When i get the balances of an ripple addres, with getBalances('the address'), i get then a json with multiple balances in multiples currencies besides xrp

Like this

[
  {
    "value": "922.913243",
    "currency": "XRP"
  },
  {
    "value": "100",
    "currency": "USD",
    "counterparty": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z"
  }
]
  1. What is the meaning of these amounts?
  2. I can send USD to my XRP Address?
    • In this case, how i send USD to my XRP? Or another currency.
  3. The sum of all others amounts in another's currencies is the total value of equivalent XRP + XRP in the account?
  4. I know what the counterparty is another XRP Address, but, how is possible a balance in USD?

Greats

intelliot commented 6 years ago

@prinick96 Thanks for the questions.

  1. These are the account's balances in various currencies. The XRP Ledger supports issued currencies, which are typically tied to holdings of currency or other assets outside the XRP Ledger. Read more about issued currencies.

  2. Yes. Set the currency when specifying the amount. Note that there will need to be a counterparty that issued the currency.

  3. No, the getBalances return value doesn't calculate the total value of equivalent XRP.

  4. The counterparty is the XRP account which issued the currency. Any XRP account can choose to issue a USD balance, but other accounts would need to trust that account to honor its obligations.

See Money in the XRP Ledger.

intelliot commented 6 years ago

I'm closing this issue now, but feel free to let us know if you have additional questions.