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

Commit

Permalink
Changes to constants name
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRow committed Oct 7, 2020
1 parent 336765a commit 4d8a314
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions src/BananoBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public function open(string $pairing_block_id, string $received_amount, string $
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = BananoTool::PREAMBLE;
$this->rawBlockId[] = BananoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = BananoTool::EMPTY32;
$this->rawBlockId[] = BananoTool::EMPTY32_HEX;
$this->rawBlockId[] = BananoTool::account2public($representative);
$this->rawBlockId[] = $balance;
$this->rawBlockId[] = $pairing_block_id;
Expand All @@ -129,7 +129,7 @@ public function open(string $pairing_block_id, string $received_amount, string $
$this->block = [
'type' => 'state',
'account' => $this->account,
'previous' => BananoTool::EMPTY32,
'previous' => BananoTool::EMPTY32_HEX,
'representative' => $representative,
'balance' => hexdec($balance),
'link' => $pairing_block_id,
Expand Down Expand Up @@ -197,7 +197,7 @@ public function receive(string $pairing_block_id, string $received_amount, strin
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = BananoTool::PREAMBLE;
$this->rawBlockId[] = BananoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = BananoTool::account2public($representative);
Expand Down Expand Up @@ -281,7 +281,7 @@ public function send(string $destination, string $sending_amount, string $repres
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = BananoTool::PREAMBLE;
$this->rawBlockId[] = BananoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = BananoTool::account2public($representative);
Expand Down Expand Up @@ -349,12 +349,12 @@ public function change(string $representative): array
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = BananoTool::PREAMBLE;
$this->rawBlockId[] = BananoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = BananoTool::account2public($representative);
$this->rawBlockId[] = $balance;
$this->rawBlockId[] = BananoTool::EMPTY32;
$this->rawBlockId[] = BananoTool::EMPTY32_HEX;

$this->blockId = BananoTool::hashHexs($this->rawBlockId);
$this->signature = BananoTool::sign($this->blockId, $this->privateKey);
Expand All @@ -365,7 +365,7 @@ public function change(string $representative): array
'previous' => $this->prevBlockId,
'representative' => $representative,
'balance' => hexdec($balance),
'link' => BananoTool::EMPTY32,
'link' => BananoTool::EMPTY32_HEX,
'signature' => $this->signature,
'work' => $this->work
];
Expand Down
4 changes: 2 additions & 2 deletions src/BananoRPCExt.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function wallet_sweep(array $args)
'amount' => $balances['balance']
];

if ($send['block'] == BananoTool::EMPTY32) {
if ($send['block'] == BananoTool::EMPTY32_HEX) {
$return['balances'][$account] = [
'error' => 'Bad send',
'amount' => $balances['balance']
Expand Down Expand Up @@ -234,7 +234,7 @@ public function wallet_send(array $args)
'amount' => $balances['balance']
];

if ($send['block'] == BananoTool::EMPTY32) {
if ($send['block'] == BananoTool::EMPTY32_HEX) {
$return['balances'][$account] = [
'error' => 'Bad send',
'amount' => $balances['balance']
Expand Down
6 changes: 3 additions & 3 deletions src/BananoTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class BananoTool
'BANANO' => '100000000000000000000000000000'
];

const PREAMBLE = '0000000000000000000000000000000000000000000000000000000000000006';
const EMPTY32 = '0000000000000000000000000000000000000000000000000000000000000000';
const HARDENED = 0x80000000;
const PREAMBLE_HEX = '0000000000000000000000000000000000000000000000000000000000000006';
const EMPTY32_HEX = '0000000000000000000000000000000000000000000000000000000000000000';
const HARDENED = 0x80000000;


// *
Expand Down
16 changes: 8 additions & 8 deletions src/NanoBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public function open(string $pairing_block_id, string $received_amount, string $
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = NanoTool::PREAMBLE;
$this->rawBlockId[] = NanoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = NanoTool::EMPTY32;
$this->rawBlockId[] = NanoTool::EMPTY32_HEX;
$this->rawBlockId[] = NanoTool::account2public($representative);
$this->rawBlockId[] = $balance;
$this->rawBlockId[] = $pairing_block_id;
Expand All @@ -129,7 +129,7 @@ public function open(string $pairing_block_id, string $received_amount, string $
$this->block = [
'type' => 'state',
'account' => $this->account,
'previous' => NanoTool::EMPTY32,
'previous' => NanoTool::EMPTY32_HEX,
'representative' => $representative,
'balance' => hexdec($balance),
'link' => $pairing_block_id,
Expand Down Expand Up @@ -197,7 +197,7 @@ public function receive(string $pairing_block_id, string $received_amount, strin
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = NanoTool::PREAMBLE;
$this->rawBlockId[] = NanoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = NanoTool::account2public($representative);
Expand Down Expand Up @@ -281,7 +281,7 @@ public function send(string $destination, string $sending_amount, string $repres
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = NanoTool::PREAMBLE;
$this->rawBlockId[] = NanoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = NanoTool::account2public($representative);
Expand Down Expand Up @@ -349,12 +349,12 @@ public function change(string $representative): array
$balance = str_repeat('0', (32 - strlen($balance))) . $balance;

$this->rawBlockId = [];
$this->rawBlockId[] = NanoTool::PREAMBLE;
$this->rawBlockId[] = NanoTool::PREAMBLE_HEX;
$this->rawBlockId[] = $this->publicKey;
$this->rawBlockId[] = $this->prevBlockId;
$this->rawBlockId[] = NanoTool::account2public($representative);
$this->rawBlockId[] = $balance;
$this->rawBlockId[] = NanoTool::EMPTY32;
$this->rawBlockId[] = NanoTool::EMPTY32_HEX;

$this->blockId = NanoTool::hashHexs($this->rawBlockId);
$this->signature = NanoTool::sign($this->blockId, $this->privateKey);
Expand All @@ -365,7 +365,7 @@ public function change(string $representative): array
'previous' => $this->prevBlockId,
'representative' => $representative,
'balance' => hexdec($balance),
'link' => NanoTool::EMPTY32,
'link' => NanoTool::EMPTY32_HEX,
'signature' => $this->signature,
'work' => $this->work
];
Expand Down
4 changes: 2 additions & 2 deletions src/NanoRPCExt.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function wallet_sweep(array $args)
'amount' => $balances['balance']
];

if ($send['block'] == NanoTool::EMPTY32) {
if ($send['block'] == NanoTool::EMPTY32_HEX) {
$return['balances'][$account] = [
'error' => 'Bad send',
'amount' => $balances['balance']
Expand Down Expand Up @@ -234,7 +234,7 @@ public function wallet_send(array $args)
'amount' => $balances['balance']
];

if ($send['block'] == NanoTool::EMPTY32) {
if ($send['block'] == NanoTool::EMPTY32_HEX) {
$return['balances'][$account] = [
'error' => 'Bad send',
'amount' => $balances['balance']
Expand Down
6 changes: 3 additions & 3 deletions src/NanoTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class NanoTool
'Gnano' => '1000000000000000000000000000000000'
];

const PREAMBLE = '0000000000000000000000000000000000000000000000000000000000000006';
const EMPTY32 = '0000000000000000000000000000000000000000000000000000000000000000';
const HARDENED = 0x80000000;
const PREAMBLE_HEX = '0000000000000000000000000000000000000000000000000000000000000006';
const EMPTY32_HEX = '0000000000000000000000000000000000000000000000000000000000000000';
const HARDENED = 0x80000000;


// *
Expand Down

0 comments on commit 4d8a314

Please sign in to comment.