Skip to content

Commit

Permalink
Merge pull request #40 from MinterTeam/dev
Browse files Browse the repository at this point in the history
fix BuyCoinTx
  • Loading branch information
grkamil authored Dec 19, 2018
2 parents e18f802 + 3e93445 commit 314ebd4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ $tx = new MinterTx([
'coinToBuy' => 'MNT',
'valueToBuy' => '1',
'coinToSell' => 'TEST',
'minimumValueToBuy' => 1
'maximumValueToSell' => 1
],
'payload' => '',
'serviceData' => '',
Expand Down
4 changes: 2 additions & 2 deletions src/Minter/SDK/MinterCoins/MinterBuyCoinTx.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function encode(): array
'coinToSell' => MinterConverter::convertCoinName($this->data['coinToSell']),

// Convert field from BIP to PIP
'maximumValueToSell' => MinterConverter::convertCoinName($this->data['maximumValueToSell'])
'maximumValueToSell' => MinterConverter::convertValue($this->data['maximumValueToSell'], 'pip')
];
}

Expand All @@ -75,7 +75,7 @@ public function decode(array $txData): array
'coinToSell' => Helper::pack2hex($txData[2]),

// Convert field from PIP to BIP
'maximumValueToSell' => MinterConverter::convertValue(Helper::hexDecode($txData[1]), 'bip')
'maximumValueToSell' => MinterConverter::convertValue(Helper::hexDecode($txData[3]), 'bip')
];
}
}
2 changes: 1 addition & 1 deletion tests/MinterBuyCoinTxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class MinterBuyCoinTxTest extends TestCase
/**
* Predefined valid signature
*/
const VALID_SIGNATURE = '0xf88401018a4d4e540000000000000004abea8a54455354000000000000880de0b6b3a76400008a4d4e54000000000000008a31000000000000000000808001b845f8431ba0c30019067fe6ede8d5dff8e6977ac19d02a34159ff6f9ac270879b1154ae738ba07038e90b2ba9d5a779a3eb41de5f55679b4b144f8e8ab03ac1d1ea7952531235';
const VALID_SIGNATURE = '0xf88201018a4d4e540000000000000004a9e88a54455354000000000000880de0b6b3a76400008a4d4e5400000000000000880de0b6b3a7640000808001b845f8431ca035fb922663baf737c65083dbf0ffa1976b40e5fd2cea86a5385356d73d06ee1fa052841d46ebfa251898337eb317526e8dcd2d0ba00cfb99797d0c1ca0c94a0ac9';

/**
* Test to decode data for MinterSendCoinTx
Expand Down

0 comments on commit 314ebd4

Please sign in to comment.