Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zgrguric committed Mar 28, 2024
1 parent ba28abe commit 4c256b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ There are few utilities available with this package:
- Balance changes
- Flags
- UNLReport Flag Ledger
- Currency dode to readable currency code

### Flags

Expand Down Expand Up @@ -191,6 +192,24 @@ UNLReportFlagLedger::next(6873600); //6873856
UNLReportFlagLedger::nextOrCurrent(6873600); //6873600
```

### Util class
Converts Currency Code ISO or HEX to human readable representation.

```PHP
use XRPLWin\XRPL\Utilities\Util;
#Syntax: Util::currencyToSymbol(string $ISO_or_HEX, $malformedUtf8ReturnString = '?')

//ISO Currency Code
Util::currencyToSymbol('EUR') //EUR
//Deprecated Demurrage Currency Code
Util::currencyToSymbol('0158415500000000C1F76FF6ECB0BAC600000000') //XAU (-0.5% pa)
//Nonstandard Currency Code
Util::currencyToSymbol('534F4C4F00000000000000000000000000000000') //SOLO
```
Read more:
- https://xrpl.org/docs/references/protocol/data-types/currency-formats/#currency-formats
- https://xrpl.org/docs/concepts/tokens/fungible-tokens/demurrage/

## Running tests
Run all tests in "tests" directory.
```
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Util
* @see https://3v4l.org/Mp2Fu
* @return string
*/
public static function currencyToSymbol($currencycode, $malformedUtf8ReturnString = '?') : string
public static function currencyToSymbol(string $currencycode, string $malformedUtf8ReturnString = '?') : string
{
if( \strlen($currencycode) == 40 )
{
Expand Down

0 comments on commit 4c256b7

Please sign in to comment.