iexbase / tron-api

A PHP API for interacting with Tron (TRX)
https://iexbase.github.io/tron-api/
MIT License
405 stars 287 forks source link

Update TronAwareTrait.php #179

Open jesse77169 opened 1 year ago

jesse77169 commented 1 year ago

I can't send any trx with a quantity less than 0.0001. For example: $tron->send('Txxxxxxx', 0.00001); This cannot be sent

git1

git2

Modifying the code here can solve this problem

I can send 0.000001 trx

git4

git3

osakey commented 10 months ago

public function toTron($double): int { $double = number_format($double, 6, '.', ''); // 格式化数字,避免科学记数法 return (int)bcmul((string)$double, (string)1e6, 0); } 这样修改就行了,也不会影响之前逻辑,报错原因是 0.000001 被转成了 float(1.0E-6)