From ed7716ddf385e294316e95e8954cfafed73910a5 Mon Sep 17 00:00:00 2001 From: denpamusic Date: Fri, 14 Sep 2018 15:12:52 +0300 Subject: [PATCH] Added information on helpers. --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8654c8f..12063f7 100644 --- a/README.md +++ b/README.md @@ -155,10 +155,28 @@ You can use `wallet($name)` function to do a [Multi-Wallet RPC call](https://en. */ $balance = $bitcoind->wallet('wallet2.dat')->getbalance(); -$balance->get(); // 0.10000000 +echo $balance->get(); // 0.10000000 ``` +## Helpers +Package provides following helpers to assist with value handling. +### to_bitcoin +Converts value in satoshi to bitcoin. +```php +echo Denpa\Bitcoin\to_bitcoin(1000); // 0.00001000 +``` +### to_satoshi +Converts value in bitcoin to satoshi. +```php +echo Denpa\Bitcoin\to_satoshi(0.00001); // 1000 +``` +### to_fixed +Trims float value to precision without rounding. +```php +echo Denpa\Bitcoin\to_fixed(0.1236, 3); // 0.123 +``` + ## License This product is distributed under MIT license.