Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #18 from kori256/master
Browse files Browse the repository at this point in the history
some optimization
  • Loading branch information
xboston authored Jul 22, 2019
2 parents ad8111b + 5631dc9 commit 96eaf26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/MetaHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ public function queryProxy(string $method, array $params = []): array
public function sendTx(string $privateKey, string $to, int $value, string $data = '', int $nonce = 1, int $fee = 0): array
{
$metaHashCrypto = $this->getMetahashCrypto();
$data = $data === '' ? $data : $metaHashCrypto->str2hex($data);
$signText = $metaHashCrypto->makeSign($to, $value, $nonce, $fee, $data);
$sign = $metaHashCrypto->sign($signText, $privateKey);

Expand All @@ -571,7 +572,7 @@ public function sendTx(string $privateKey, string $to, int $value, string $data
'value' => (string)$value,
'fee' => (string)$fee,
'nonce' => (string)$nonce,
'data' => $metaHashCrypto->str2hex($data),
'data' => (string)$data,
'pubkey' => $metaHashCrypto->privateToPublic($privateKey),
'sign' => $sign,
];
Expand Down
2 changes: 0 additions & 2 deletions src/MetaHashCrypto.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ public function checkAdress(string $address): bool
*/
public function makeSign(string $address, int $value, int $nonce, int $fee = 0, string $data = '')
{
$data = $data === '' ? $data : $this->str2hex($data);

$addressClear = (\strpos($address, '0x') === 0) ? \substr($address, 2) : $address;
$valueUInt = IntHelper::VarUInt($value, true);
$feeUInt = IntHelper::VarUInt($fee, true);
Expand Down

0 comments on commit 96eaf26

Please sign in to comment.