mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
The following methods are available directly under the RippleAPI object, not under schemaValidator: isValidAddress, isValidSecret, deriveKeypair, deriveAddress
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
## xrpToDrops
|
|
|
|
`xrpToDrops(xrp: string | BigNumber): string`
|
|
|
|
Converts an XRP amount to drops. 1 XRP = 1,000,000 drops, so 1 drop = 0.000001 XRP. This method is useful when converting amounts for use with the rippled API, which requires XRP amounts to be specified in drops.
|
|
|
|
### Parameters
|
|
|
|
`xrp`: A string or BigNumber representing an amount of XRP. If `xrp` is a string, it may start with `-`, must contain at least one number, and may contain up to one `.`. This method throws a `ValidationError` for invalid input.
|
|
|
|
### Return Value
|
|
|
|
A string representing an equivalent amount of drops.
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
return api.xrpToDrops('1');
|
|
```
|
|
|
|
```json
|
|
'1000000'
|
|
```
|
|
|
|
## dropsToXrp
|
|
|
|
`dropsToXrp(drops: string | BigNumber): string`
|
|
|
|
Converts an amount of drops to XRP. 1 drop = 0.000001 XRP, so 1 XRP = 1,000,000 drops. This method is useful when converting amounts from the rippled API, which describes XRP amounts in drops.
|
|
|
|
### Parameters
|
|
|
|
`drops`: A string or BigNumber representing an amount of drops. If `drops` is a string, it may start with `-` and must contain at least one number. This method throws a `ValidationError` for invalid input.
|
|
|
|
### Return Value
|
|
|
|
A string representing an equivalent amount of XRP.
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
return api.dropsToXrp('1');
|
|
```
|
|
|
|
```json
|
|
'0.000001'
|
|
```
|