Skip to content

Commit

Permalink
Merge pull request #63 from MinterTeam/dev
Browse files Browse the repository at this point in the history
make transaction params in right order before signing
  • Loading branch information
grkamil authored Jun 8, 2019
2 parents 91a5df1 + 144fff6 commit 4204db7
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/Minter/SDK/MinterTx.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class MinterTx
*/
protected $tx;

/**
* @var RLP
*/
/** @var RLP */
protected $rlp;

/**
Expand Down Expand Up @@ -63,24 +61,16 @@ class MinterTx
*/
protected $txDataObject;

/**
* Fee in PIP
*/
/** Fee in PIP */
const PAYLOAD_COMMISSION = 2;

/**
* All gas price multiplied by FEE DEFAULT (PIP)
*/
/** All gas price multiplied by FEE DEFAULT (PIP) */
const FEE_DEFAULT_MULTIPLIER = 1000000000000000;

/**
* Type of single signature for the transaction
*/
/** Type of single signature for the transaction */
const SIGNATURE_SINGLE_TYPE = 1;

/**
* Type of multi signature for the transaction
*/
/** Type of multi signature for the transaction */
const SIGNATURE_MULTI_TYPE = 2;

/** Mainnet chain id */
Expand Down Expand Up @@ -274,7 +264,10 @@ protected function decode(string $tx): array
*/
protected function encode(array $tx, bool $isHexFormat = false): array
{
// validate transaction structure
$this->validateTx($tx);
// make right order in transaction params
$tx = array_replace(array_intersect_key(array_flip($this->structure), $tx), $tx);

switch ($tx['type']) {
case MinterSendCoinTx::TYPE:
Expand Down

0 comments on commit 4204db7

Please sign in to comment.