mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 05:05:48 +00:00
Use example.com instead of ripple.com Co-authored-by: Elliot Lee <github.public@intelliot.com>
68 lines
3.6 KiB
Plaintext
68 lines
3.6 KiB
Plaintext
# Basic Types
|
|
|
|
## Address
|
|
|
|
```json
|
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
|
```
|
|
|
|
```json
|
|
"X7AcgcsBL6XDcUb289X4mJ8djcdyKaB5hJDWMArnXr61cqZ"
|
|
```
|
|
|
|
An *address* refers to a specific XRP Ledger account. It is a base-58 encoding of a hash of the account's public key. There are two kinds of addresses in common use:
|
|
|
|
### Classic Address
|
|
|
|
A *classic address* encodes a hash of the account's public key and a checksum. It has no other data. This kind of address always starts with the lowercase letter `r`.
|
|
|
|
### X-address
|
|
|
|
An *X-address* encodes a hash of the account's public key, a tag, and a checksum. This kind of address starts with the uppercase letter `X` if it is intended for use on the production XRP Ledger (mainnet). It starts with the uppercase letter `T` if it is intended for use on a test network such as Testnet or Devnet.
|
|
|
|
## Account Sequence Number
|
|
|
|
Every XRP Ledger account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence or a ticketSequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it, or uses a previously generated ticketSequence number. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
|
|
|
|
## Currency
|
|
|
|
Currencies are represented as either 3-character currency codes or 40-character uppercase hexadecimal strings. We recommend using uppercase [ISO 4217 Currency Codes](http://www.xe.com/iso4217.php) only. The string "XRP" is disallowed on trustlines because it is reserved for the XRP Ledger's native currency. The following characters are permitted: all uppercase and lowercase letters, digits, as well as the symbols `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `<`, `>`, `(`, `)`, `{`, `}`, `[`, `]`, and `|`.
|
|
|
|
## Value
|
|
A *value* is a quantity of a currency represented as a decimal string. Be careful: JavaScript's native number format does not have sufficient precision to represent all values. XRP has different precision from other currencies.
|
|
|
|
**XRP** has 6 significant digits past the decimal point. In other words, XRP cannot be divided into positive values smaller than `0.000001` (1e-6). This smallest unit is called a "drop". XRP has a maximum value of `100000000000` (1e11). Some RippleAPI methods accept XRP to maintain compatibility with older versions of the API. For consistency with the `rippled` APIs, we recommend formally specifying XRP values in *drops* in all API requests, and converting them to XRP for display. This is like Bitcoin's *satoshis* and Ethereum's *wei*. 1 XRP = 1,000,000 drops.
|
|
|
|
**Non-XRP values** have 16 decimal digits of precision, with a maximum value of `9999999999999999e80`. The smallest positive non-XRP value is `1e-81`.
|
|
|
|
## Amount
|
|
|
|
Example 100.00 USD amount:
|
|
|
|
```json
|
|
{
|
|
"currency": "USD",
|
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
|
"value": "100"
|
|
}
|
|
```
|
|
|
|
Example 3.0 XRP amount, in drops:
|
|
```json
|
|
{
|
|
"currency": "drops",
|
|
"value": "3000000"
|
|
}
|
|
```
|
|
(Requires `ripple-lib` version 1.0.0 or higher.)
|
|
|
|
An *amount* is an object specifying a currency, a quantity of that currency, and the counterparty (issuer) on the trustline that holds the value. For XRP, there is no counterparty.
|
|
|
|
A *lax amount* allows the counterparty to be omitted for all currencies. If the counterparty is not specified in an amount within a transaction specification, then any counterparty may be used for that amount.
|
|
|
|
A *lax lax amount* allows either or both the counterparty and value to be omitted.
|
|
|
|
A *balance* is an amount than can have a negative value.
|
|
|
|
<%- renderSchema('objects/amountbase.json') %>
|