Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TronAwareTrait.php #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jesse77169
Copy link

@jesse77169 jesse77169 commented Jun 28, 2023

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

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

Modifying the code here can solve this problem
@osakey
Copy link

osakey commented Nov 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants