Skip to content

Commit

Permalink
Stringify unconfirmed_balance and immature_balance too
Browse files Browse the repository at this point in the history
  • Loading branch information
ftab committed Mar 1, 2020
1 parent 050ee38 commit 6b7cd7b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ plugins:
phpmd:
enabled: true
exclude_patterns:
- "tests/"
- "tests/"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.0.2 - 2020/03/01

Add unconfirmed_balance and immature_balance to the keys that are stringified (walletinfo)

## 3.0.1 - 2020/02/16

Negative numbers need some love too
Expand Down
38 changes: 19 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Dogecoin API Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion src/Responses/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(ResponseInterface $response)
$this->response = $response;
/* PHP floats lose precision at around 13-14 significant digits which can be common among Dogecoin transactions
and balances. Force them to be strings and use bcmath to add */
$getString = preg_replace('/"(amount|fee|balance)":([\d\.\-]+)/', '"$1":"$2"',
$getString = preg_replace('/"(amount|fee|balance|unconfirmed_balance|immature_balance)":([\d\.\-]+)/', '"$1":"$2"',
(string)$response->getBody());
$this->container = json_decode($getString, true);
}
Expand Down

0 comments on commit 6b7cd7b

Please sign in to comment.