diff --git a/README.md b/README.md
index 6619dfd..7896f1b 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,10 @@ This is a pure PHP SDK for working with Minter blockchain
- [getMinGasPrice](#getmingasprice)
- [getMissedBlocks](#getmissedblocks)
- [getWaitlist](#getwaitlist)
+ - [getPriceCommissions](#getPriceCommissions)
+ - [getPriceVotes](#getPriceVotes)
+ - [getSwapPool](#getSwapPool)
+ - [getSwapPoolProvider](#getSwapPoolProvider)
- [Error handling](#error-handling)
* [Minter SDK](#using-mintersdk)
@@ -51,8 +55,19 @@ This is a pure PHP SDK for working with Minter blockchain
- [RecreateCoin](#example-18)
- [EditCoinOwner](#example-19)
- [EditMultisig](#example-20)
- - [PriceVote](#example-21)
- - [EditCandidatePublicKey](#example-22)
+ - [EditCandidatePublicKey](#example-21)
+ - [AddLiquidity](#example-22)
+ - [RemoveLiquidity](#example-23)
+ - [SellSwapPool](#example-24)
+ - [BuySwapPool](#example-25)
+ - [SellAllSwapPool](#example-26)
+ - [EditCandidateCommission](#example-27)
+ - [MintToken](#example-28)
+ - [BurnToken](#example-29)
+ - [CreateToken](#example-30)
+ - [RecreateToken](#example-31)
+ - [PriceCommission](#example-32)
+ - [CreateSwapPool](#example-33)
- [Sign transaction with multisignatures](#sign-transaction-with-multisignatures)
- [Get fee of transaction](#get-fee-of-transaction)
- [Decode Transaction](#decode-transaction)
@@ -157,7 +172,7 @@ getValidators(?int $height = null, ?int $page = 1, ?int $perPage = null): \stdCl
Return estimate of buy coin transaction.
``
-estimateCoinBuy(string $coinToSell, string $valueToBuy, string $coinToBuy, ?int $height = null): \stdClass
+estimateCoinBuy(string $coinToSell, string $valueToBuy, string $coinToBuy, ?int $height = null, string $swapFrom): \stdClass
``
### estimateCoinSell
@@ -165,7 +180,7 @@ estimateCoinBuy(string $coinToSell, string $valueToBuy, string $coinToBuy, ?int
Return estimate of sell coin transaction.
``
-estimateCoinSell(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null): \stdClass
+estimateCoinSell(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null, string $swapFrom): \stdClass
``
### estimateCoinSellAll
@@ -173,7 +188,7 @@ estimateCoinSell(string $coinToSell, string $valueToSell, string $coinToBuy, ?in
Return estimate of sell coin all transaction.
``
-estimateCoinSellAll(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null): \stdClass
+estimateCoinSellAll(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null, string $swapFrom): \stdClass
``
### getCoinInfo
@@ -229,7 +244,7 @@ getCandidates(?int $height = null, ?bool $includeStakes = false): \stdClass
### estimateTxCommission
-Return estimate of transaction.
+Returns estimate of transaction.
``
estimateTxCommission(string $tx, ?int $height = null): \stdClass
@@ -237,7 +252,7 @@ estimateTxCommission(string $tx, ?int $height = null): \stdClass
### getTransactions
-Return transactions by query.
+Returns transactions by query.
``
getTransactions(string $query, ?int $page = null, ?int $perPage = null): \stdClass
@@ -277,7 +292,7 @@ getMissedBlocks(string $pubKey, ?int $height = null): \stdClass
### getGenesis
-Return network genesis.
+Returns network genesis.
``
getGenesis(): \stdClass
@@ -285,7 +300,7 @@ getGenesis(): \stdClass
### getNetworkInfo
-Return node network information.
+Returns node network information.
``
getNetworkInfo(): \stdClass
@@ -293,12 +308,54 @@ getNetworkInfo(): \stdClass
### getWaitlist
-Return waitlisted stakes by address
+Returns waitlisted stakes by address
``
getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass
``
+### getWaitlist
+
+Returns waitlisted stakes by address
+
+``
+getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass
+``
+
+### getPriceCommissions
+
+Returns the list of the commissions that are set up on the Minter Network
+
+``
+getPriceCommissions(?int $height = null): \stdClass
+``
+
+### getPriceVotes
+
+Returns the list of validators' votes for changing commissions on the network
+
+``
+getPriceVotes(int $height): \stdClass
+``
+
+### getSwapPool
+
+Returns entire liquidity volume of the swap pool
+
+``
+getSwapPool(string $coin0, string $coin1, ?int $height = null): \stdClass
+``
+
+### getSwapPoolProvider
+
+Returns liquidity volume of the swap pool provided by specified address
+
+``
+getSwapPoolProvider(string $coin0, string $coin1, string $provider, ?int $height = null): \stdClass
+``
+
+
+
### Error handling
Example of how you can handle errors and get the response body.
@@ -346,7 +403,7 @@ use Minter\SDK\MinterCoins\MinterSendCoinTx;
$data = new MinterSendCoinTx($coinID, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
At all type of transactions you can also set optional fields:
@@ -362,9 +419,9 @@ $tx = (new MinterTx($nonce, $data))
->setGasPrice(1)
->setGasCoin(MinterTx::BASE_COIN_ID)
->setPayload('some payload')
- ->setServiceData('some data')
+ ->setServiceData('some data');
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -378,7 +435,7 @@ use Minter\SDK\MinterCoins\MinterSellCoinTx;
$data = new MinterSellCoinTx(123, '1', 321, '1');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -392,7 +449,7 @@ use Minter\SDK\MinterCoins\MinterSellAllCoinTx;
$data = new MinterSellAllCoinTx(123, 321, '1');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -406,7 +463,7 @@ use Minter\SDK\MinterCoins\MinterBuyCoinTx;
$data = new MinterBuyCoinTx(123, '1', 321, '1');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -420,7 +477,7 @@ use Minter\SDK\MinterCoins\MinterCreateCoinTx;
$data = new MinterCreateCoinTx('TEST COIN', 'TEST', '10000', '10', 10, '10000');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -438,7 +495,7 @@ $data = new MinterDeclareCandidacyTx(
);
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -452,7 +509,7 @@ use Minter\SDK\MinterCoins\MinterDelegateTx;
$data = new MinterDelegateTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43', 123, '10000');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -466,7 +523,7 @@ use Minter\SDK\MinterCoins\MinterSetCandidateOnTx;
$data = new MinterSetCandidateOnTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -480,7 +537,7 @@ use Minter\SDK\MinterCoins\MinterSetCandidateOffTx;
$data = new MinterSetCandidateOffTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -494,7 +551,7 @@ use Minter\SDK\MinterCoins\MinterRedeemCheckTx;
$data = new MinterRedeemCheckTx('your check', 'created by MinterCheck proof');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -508,7 +565,7 @@ use Minter\SDK\MinterCoins\MinterUnbondTx;
$data = new MinterUnbondTx('Mp....', 123, '10000');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -526,7 +583,7 @@ $data = new MinterMultiSendTx([
]);
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -540,7 +597,7 @@ use Minter\SDK\MinterCoins\MinterEditCandidateTx;
$data = new MinterEditCandidateTx('candidate public key', 'Minter address for rewards', 'Minter address of owner', 'Minter address for control');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -558,7 +615,7 @@ $data = new MinterCreateMultisigTx(7, [1, 3, 5], [
]);
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -571,7 +628,7 @@ use Minter\SDK\MinterCoins\MinterSetHaltBlockTx;
$data = new MinterSetHaltBlockTx('your public key', 236503);
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -584,7 +641,7 @@ use Minter\SDK\MinterCoins\MinterRecreateCoinTx;
$data = new MinterRecreateCoinTx('TEST', '10000', '10', 10000, 10, '10000');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -597,7 +654,7 @@ use Minter\SDK\MinterCoins\MinterEditCoinOwnerTx;
$data = new MinterEditCoinOwnerTx('COINSYMBOL', 'Mxee81347211c72524338f9680072af90744333145');
$tx = new MinterTx($nonce, $data);
-$tx->sign('your private key')
+$tx->sign('your private key');
```
###### Example
@@ -610,31 +667,217 @@ use Minter\SDK\MinterCoins\MinterEditMultisigTx;
$data = new MinterEditMultisigTx(1, [1, 2], ['Mxee81347211c72524338f9680072af90744333145', 'Mxee81347211c72524338f9680072af90744333146']);
$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the EditCandidatePublicKey transaction
+* Constructor: ```MinterEditCandidatePublicKeyTx($publicKey, $newPublicKey)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterEditCandidatePublicKeyTx;
+
+$data = new MinterEditCandidatePublicKeyTx('public key', 'new public key....');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the AddLiquidity transaction
+* Constructor: ```MinterAddLiquidityTx($coin0, $coin1, $volume0, $maximumVolume1)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterAddLiquidityTx;
+
+$data = new MinterAddLiquidityTx(0, 1, '1000', '2000');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the RemoveLiquidity transaction
+* Constructor: ```MinterRemoveLiquidityTx($coin0, $coin1, $liquidity, $minimumVolume0, $minimumVolume1)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterRemoveLiquidityTx;
+
+$data = new MinterRemoveLiquidityTx(0, 1, '2000', '500', '1000');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the SellSwapPool transaction
+* Constructor: ```MinterSellSwapPoolTx($coinToSell, $valueToSell, $coinToBuy, $minimumValueToBuy)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterSellSwapPoolTx;
+
+$data = new MinterSellSwapPoolTx(0, '100', 1, '200');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the BuySwapPool transaction
+* Constructor: ```MinterBuySwapPoolTx($coinToBuy, $valueToBuy, $coinToSell, $maximumValueToSell)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterBuySwapPoolTx;
+
+$data = new MinterBuySwapPoolTx(0, '100', 1, '200');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the SellAllSwapPool transaction
+* Constructor: ```MinterSellAllSwapPoolTx($coinToSell, $coinToBuy, $minimumValueToBuy)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterSellAllSwapPoolTx;
+
+$data = new MinterSellAllSwapPoolTx(0, 1, '100');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the EditCandidateCommission transaction
+* Constructor: ```MinterEditCandidateCommissionTx($publicKey, $commission)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterEditCandidateCommissionTx;
+
+$data = new MinterEditCandidateCommissionTx('public key', 77);
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the MintToken transaction
+* Constructor: ```MinterMintTokenTx($coin, $value)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterMintTokenTx;
+
+$data = new MinterMintTokenTx(2, '3000');
+$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```
###### Example
-* Sign the PriceVote transaction
-* Constructor: ```MinterPriceVoteTx($price)```
+* Sign the BurnToken transaction
+* Constructor: ```MinterBurnTokenTx($coin, $value)```
```php
use Minter\SDK\MinterTx;
-use Minter\SDK\MinterCoins\MinterPriceVoteTx;
+use Minter\SDK\MinterCoins\MinterBurnTokenTx;
-$data = new MinterPriceVoteTx(1000);
+$data = new MinterBurnTokenTx(3, '100000');
$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```
###### Example
-* Sign the EditCandidatePublicKey transaction
-* Constructor: ```MinterEditCandidatePublicKeyTx($publicKey, $newPublicKey)```
+* Sign the CreateToken transaction
+* Constructor: ```MinterCreateTokenTx($name, $symbol, $initialAmount, $maxSupply, $mintable, $burnable)```
```php
use Minter\SDK\MinterTx;
-use Minter\SDK\MinterCoins\MinterEditCandidatePublicKeyTx;
+use Minter\SDK\MinterCoins\MinterCreateTokenTx;
-$data = new MinterEditCandidatePublicKeyTx('public key', 'new public key....');
+$data = new MinterCreateTokenTx('TEST COIN IS MINTABLE ONLY', 'TEST', '10000', '50000', true, false);
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key')
+```
+
+###### Example
+* Sign the RecreateToken transaction
+* Constructor: ```MinterRecreateTokenTx($name, $symbol, $initialAmount, $maxSupply, $mintable, $burnable)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterRecreateTokenTx;
+
+$data = new MinterRecreateTokenTx('TEST COIN IS TURNED TO BE BURNABLE ONLY', 'TEST', '50000', '50000', false, true);
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key')
+```
+
+###### Example
+* Sign the PriceCommission transaction
+* Constructor: ```MinterPriceCommissionTx(
+ $pubKey,
+ $height,
+ $coin,
+ $payloadByte,
+ $send,
+ $buyBancor,
+ $sellBancor,
+ $sellAllBancor,
+ $buyPool,
+ $sellPool,
+ $sellAllPool,
+ $createTicker3,
+ $createTicker4,
+ $createTicker5,
+ $createTicker6,
+ $createTicker7to10,
+ $createCoin,
+ $createToken,
+ $recreateCoin,
+ $recreateToken,
+ $declareCandidacy,
+ $delegate,
+ $unbond,
+ $redeemCheck,
+ $setCandidateOn,
+ $setCandidateOff,
+ $createMultisig,
+ $multisendBase,
+ $multisendDelta,
+ $editCandidate,
+ $setHaltBlock,
+ $editTickerOwner,
+ $editMultisig,
+ $editCandidatePublicKey,
+ $createSwapPool,
+ $addLiquidity,
+ $removeLiquidity,
+ $editCandidateCommission,
+ $burnToken,
+ $mintToken,
+ $voteCommission,
+ $voteUpdate
+ )```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterPriceCommissionTx;
+
+$data = new MinterPriceCommissionTx('public key', 100000,0,'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41');
+$tx = new MinterTx($nonce, $data);
+$tx->sign('your private key');
+```
+
+###### Example
+* Sign the CreateSwapPoll transaction
+* Constructor: ```MinterCreateSwapPoolTx($coin0, $coin1, $volume0, $volume1)```
+
+```php
+use Minter\SDK\MinterTx;
+use Minter\SDK\MinterCoins\MinterCreateSwapPoolTx;
+
+$data = new MinterCreateSwapPoolTx(1, 2, '11000', '22000');
$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```
diff --git a/src/Minter/MinterAPI.php b/src/Minter/MinterAPI.php
index 5734fb5..da7f112 100644
--- a/src/Minter/MinterAPI.php
+++ b/src/Minter/MinterAPI.php
@@ -185,16 +185,14 @@ public function getTransaction(string $hash): \stdClass
}
/**
- * Returns block data at given height.
- *
* @param int $height
+ * @param bool|null $failedTxs
* @return \stdClass
- * @throws Exception
* @throws GuzzleException
*/
- public function getBlock(int $height): \stdClass
+ public function getBlock(int $height, ?bool $failedTxs = false): \stdClass
{
- return $this->get('block/' . $height);
+ return $this->get('block/' . $height, ($failedTxs ? ['failed_txs' => true] : null));
}
/**
@@ -260,6 +258,7 @@ public function getCoinInfo(string $symbol, ?int $height = null): \stdClass
* @param string $valueToSell
* @param string $coinToBuy
* @param null|int $height
+ * @param string $swapFrom
* @return \stdClass
* @throws Exception
* @throws GuzzleException
@@ -268,12 +267,14 @@ public function estimateCoinSell(
string $coinToSell,
string $valueToSell,
string $coinToBuy,
- ?int $height = null
+ ?int $height = null,
+ string $swapFrom = 'optimal'
): \stdClass {
$params = [
'coin_to_sell' => $coinToSell,
'value_to_sell' => $valueToSell,
- 'coin_to_buy' => $coinToBuy
+ 'coin_to_buy' => $coinToBuy,
+ 'swap_from' => $swapFrom
];
if ($height) {
@@ -290,6 +291,7 @@ public function estimateCoinSell(
* @param string $valueToSell
* @param string $coinToBuy
* @param int|null $height
+ * @param string $swapFrom
* @return \stdClass
* @throws GuzzleException
*/
@@ -297,12 +299,14 @@ public function estimateCoinSellAll(
string $coinToSell,
string $valueToSell,
string $coinToBuy,
- ?int $height = null
+ ?int $height = null,
+ string $swapFrom = 'optimal'
): \stdClass {
$params = [
'coin_to_sell' => $coinToSell,
'value_to_sell' => $valueToSell,
- 'coin_to_buy' => $coinToBuy
+ 'coin_to_buy' => $coinToBuy,
+ 'swap_from' => $swapFrom
];
if ($height) {
@@ -319,6 +323,7 @@ public function estimateCoinSellAll(
* @param string $valueToBuy
* @param string $coinToBuy
* @param null|int $height
+ * @param string $swapFrom
* @return \stdClass
* @throws Exception
* @throws GuzzleException
@@ -327,12 +332,15 @@ public function estimateCoinBuy(
string $coinToSell,
string $valueToBuy,
string $coinToBuy,
- ?int $height = null
+ ?int $height = null,
+ string $swapFrom = 'optimal'
): \stdClass {
$params = [
'coin_to_sell' => $coinToSell,
'value_to_buy' => $valueToBuy,
- 'coin_to_buy' => $coinToBuy
+ 'coin_to_buy' => $coinToBuy,
+ 'swap_from' => $swapFrom
+
];
if ($height) {
@@ -517,4 +525,50 @@ public function getWaitlist(string $address, ?string $publicKey = null, ?int $he
return $this->get('waitlist/' . $address, $params);
}
+
+ /**
+ * @param int|null $height
+ * @return \stdClass
+ * @throws GuzzleException
+ */
+ public function getPriceCommissions(?int $height = null): \stdClass
+ {
+ return $this->get('price_commissions', ($height ? ['height' => $height] : null));
+ }
+
+ /**
+ * @param int $height
+ * @return \stdClass
+ * @throws GuzzleException
+ */
+ public function getPriceVotes(int $height): \stdClass
+ {
+ return $this->get('price_votes/' . $height);
+ }
+
+ /**
+ * @param string $coin0
+ * @param string $coin1
+ * @param int|null $height
+ * @return \stdClass
+ * @throws GuzzleException
+ */
+ public function getSwapPool(string $coin0, string $coin1, ?int $height = null): \stdClass
+ {
+ return $this->get('swap_pool/' . $coin0 . '/' . $coin1, ($height ? ['height' => $height] : null));
+ }
+
+ /**
+ * @param string $coin0
+ * @param string $coin1
+ * @param string $provider
+ * @param int|null $height
+ * @return \stdClass
+ * @throws GuzzleException
+ */
+ public function getSwapPoolProvider(string $coin0, string $coin1, string $provider, ?int $height = null): \stdClass
+ {
+ return $this->get('swap_pool/' . $coin0 . '/' . $coin1 . '/' . $provider, ($height ? ['height' => $height] : null));
+ }
+
}
diff --git a/src/Minter/SDK/MinterCoins/MinterAddLiquidityTx.php b/src/Minter/SDK/MinterCoins/MinterAddLiquidityTx.php
new file mode 100644
index 0000000..d55dfe1
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterAddLiquidityTx.php
@@ -0,0 +1,60 @@
+coin0 = $coin0;
+ $this->coin1 = $coin1;
+ $this->volume0 = $volume0;
+ $this->maximumVolume1 = $maximumVolume1;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ function encodeData(): array
+ {
+ return [
+ $this->coin0,
+ $this->coin1,
+ MinterConverter::convertToPip($this->volume0),
+ MinterConverter::convertToPip($this->maximumVolume1)
+ ];
+ }
+
+ function decodeData()
+ {
+ $this->coin0 = hexdec($this->coin0);
+ $this->coin1 = hexdec($this->coin1);
+ $this->volume0 = MinterConverter::convertToBase(Helper::hexDecode($this->volume0));
+ $this->maximumVolume1 = MinterConverter::convertToBase(Helper::hexDecode($this->maximumVolume1));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterBurnTokenTx.php b/src/Minter/SDK/MinterCoins/MinterBurnTokenTx.php
new file mode 100644
index 0000000..8c5807f
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterBurnTokenTx.php
@@ -0,0 +1,49 @@
+coin = $coin;
+ $this->value = $value;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->coin,
+ MinterConverter::convertToPip($this->value)
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->coin = hexdec($this->coin);
+ $this->value = MinterConverter::convertToBase(Helper::hexDecode($this->value));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterBuyCoinTx.php b/src/Minter/SDK/MinterCoins/MinterBuyCoinTx.php
index 97b878a..8f5f06e 100644
--- a/src/Minter/SDK/MinterCoins/MinterBuyCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterBuyCoinTx.php
@@ -17,8 +17,7 @@ class MinterBuyCoinTx extends MinterCoinTx implements MinterTxInterface
public $valueToBuy;
public $maximumValueToSell;
- const TYPE = 4;
- const COMMISSION = 100;
+ const TYPE = 4;
/**
* MinterBuyCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterBuySwapPoolTx.php b/src/Minter/SDK/MinterCoins/MinterBuySwapPoolTx.php
new file mode 100644
index 0000000..270ceba
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterBuySwapPoolTx.php
@@ -0,0 +1,52 @@
+coins = $coins;
+ $this->valueToBuy = $valueToBuy;
+ $this->maximumValueToSell = $maximumValueToSell;
+ }
+
+ public function encodeData(): array
+ {
+ return [
+ $this->coins,
+ MinterConverter::convertToPip($this->valueToBuy),
+ MinterConverter::convertToPip($this->maximumValueToSell)
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->valueToBuy = MinterConverter::convertToBase(Helper::hexDecode($this->valueToBuy));
+ $this->maximumValueToSell = MinterConverter::convertToBase(Helper::hexDecode($this->maximumValueToSell));
+ $this->coins = array_map(function ($value) {
+ return hexdec($value);
+ }, $this->coins);
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterCoinTx.php b/src/Minter/SDK/MinterCoins/MinterCoinTx.php
index 9913f8e..511e848 100644
--- a/src/Minter/SDK/MinterCoins/MinterCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterCoinTx.php
@@ -13,38 +13,39 @@
abstract class MinterCoinTx implements MinterTxInterface
{
public const TYPE_TO_DATA = [
- MinterSendCoinTx::TYPE => MinterSendCoinTx::class,
- MinterSellCoinTx::TYPE => MinterSellCoinTx::class,
- MinterSellAllCoinTx::TYPE => MinterSellAllCoinTx::class,
- MinterBuyCoinTx::TYPE => MinterBuyCoinTx::class,
- MinterCreateCoinTx::TYPE => MinterCreateCoinTx::class,
- MinterDeclareCandidacyTx::TYPE => MinterDeclareCandidacyTx::class,
- MinterDelegateTx::TYPE => MinterDelegateTx::class,
- MinterUnbondTx::TYPE => MinterUnbondTx::class,
- MinterRedeemCheckTx::TYPE => MinterRedeemCheckTx::class,
- MinterSetCandidateOnTx::TYPE => MinterSetCandidateOnTx::class,
- MinterSetCandidateOffTx::TYPE => MinterSetCandidateOffTx::class,
- MinterCreateMultisigTx::TYPE => MinterCreateMultisigTx::class,
- MinterMultiSendTx::TYPE => MinterMultiSendTx::class,
- MinterEditCandidateTx::TYPE => MinterEditCandidateTx::class,
- MinterRecreateCoinTx::TYPE => MinterRecreateCoinTx::class,
- MinterEditCoinOwnerTx::TYPE => MinterEditCoinOwnerTx::class,
- MinterSetHaltBlockTx::TYPE => MinterSetHaltBlockTx::class,
- MinterEditMultisigTx::TYPE => MinterEditMultisigTx::class,
- MinterPriceVoteTx::TYPE => MinterPriceVoteTx::class,
- MinterEditCandidatePublicKeyTx::TYPE => MinterEditCandidatePublicKeyTx::class
+ MinterSendCoinTx::TYPE => MinterSendCoinTx::class,
+ MinterSellCoinTx::TYPE => MinterSellCoinTx::class,
+ MinterSellAllCoinTx::TYPE => MinterSellAllCoinTx::class,
+ MinterBuyCoinTx::TYPE => MinterBuyCoinTx::class,
+ MinterCreateCoinTx::TYPE => MinterCreateCoinTx::class,
+ MinterDeclareCandidacyTx::TYPE => MinterDeclareCandidacyTx::class,
+ MinterDelegateTx::TYPE => MinterDelegateTx::class,
+ MinterUnbondTx::TYPE => MinterUnbondTx::class,
+ MinterRedeemCheckTx::TYPE => MinterRedeemCheckTx::class,
+ MinterSetCandidateOnTx::TYPE => MinterSetCandidateOnTx::class,
+ MinterSetCandidateOffTx::TYPE => MinterSetCandidateOffTx::class,
+ MinterCreateMultisigTx::TYPE => MinterCreateMultisigTx::class,
+ MinterMultiSendTx::TYPE => MinterMultiSendTx::class,
+ MinterEditCandidateTx::TYPE => MinterEditCandidateTx::class,
+ MinterRecreateCoinTx::TYPE => MinterRecreateCoinTx::class,
+ MinterEditCoinOwnerTx::TYPE => MinterEditCoinOwnerTx::class,
+ MinterSetHaltBlockTx::TYPE => MinterSetHaltBlockTx::class,
+ MinterEditMultisigTx::TYPE => MinterEditMultisigTx::class,
+ MinterEditCandidatePublicKeyTx::TYPE => MinterEditCandidatePublicKeyTx::class,
+ MinterAddLiquidityTx::TYPE => MinterAddLiquidityTx::class,
+ MinterRemoveLiquidityTx::TYPE => MinterRemoveLiquidityTx::class,
+ MinterSellSwapPoolTx::TYPE => MinterSellSwapPoolTx::class,
+ MinterBuySwapPoolTx::TYPE => MinterBuySwapPoolTx::class,
+ MinterSellAllSwapPoolTx::TYPE => MinterSellAllSwapPoolTx::class,
+ MinterEditCandidateCommissionTx::TYPE => MinterEditCandidateCommissionTx::class,
+ MinterMintTokenTx::TYPE => MinterMintTokenTx::class,
+ MinterBurnTokenTx::TYPE => MinterBurnTokenTx::class,
+ MinterCreateTokenTx::TYPE => MinterCreateTokenTx::class,
+ MinterRecreateTokenTx::TYPE => MinterRecreateTokenTx::class,
+ MinterPriceCommissionTx::TYPE => MinterPriceCommissionTx::class,
+ MinterCreateSwapPoolTx::TYPE => MinterCreateSwapPoolTx::class
];
- /**
- * Get transaction data fee
- *
- * @return int
- */
- public function getFee()
- {
- return static::COMMISSION;
- }
-
/**
* @return int
*/
diff --git a/src/Minter/SDK/MinterCoins/MinterCreateCoinTx.php b/src/Minter/SDK/MinterCoins/MinterCreateCoinTx.php
index add8084..5e7bd09 100644
--- a/src/Minter/SDK/MinterCoins/MinterCreateCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterCreateCoinTx.php
@@ -19,8 +19,7 @@ class MinterCreateCoinTx extends MinterCoinTx implements MinterTxInterface
public $crr;
public $maxSupply;
- const TYPE = 5;
- const COMMISSION = 1000;
+ const TYPE = 5;
/**
* MinterCreateCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterCreateMultisigTx.php b/src/Minter/SDK/MinterCoins/MinterCreateMultisigTx.php
index 9760de3..dac4b29 100644
--- a/src/Minter/SDK/MinterCoins/MinterCreateMultisigTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterCreateMultisigTx.php
@@ -15,8 +15,7 @@ class MinterCreateMultisigTx extends MinterCoinTx implements MinterTxInterface
public $weights;
public $addresses;
- const TYPE = 12;
- const COMMISSION = 100;
+ const TYPE = 12;
/**
* MinterCreateMultisigTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterCreateSwapPoolTx.php b/src/Minter/SDK/MinterCoins/MinterCreateSwapPoolTx.php
new file mode 100644
index 0000000..dfc0bb0
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterCreateSwapPoolTx.php
@@ -0,0 +1,60 @@
+coin0 = $coin0;
+ $this->coin1 = $coin1;
+ $this->volume0 = $volume0;
+ $this->volume1 = $volume1;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ function encodeData(): array
+ {
+ return [
+ $this->coin0,
+ $this->coin1,
+ MinterConverter::convertToPip($this->volume0),
+ MinterConverter::convertToPip($this->volume1)
+ ];
+ }
+
+ function decodeData()
+ {
+ $this->coin0 = hexdec($this->coin0);
+ $this->coin1 = hexdec($this->coin1);
+ $this->volume0 = MinterConverter::convertToBase(Helper::hexDecode($this->volume0));
+ $this->volume1 = MinterConverter::convertToBase(Helper::hexDecode($this->volume1));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterCreateTokenTx.php b/src/Minter/SDK/MinterCoins/MinterCreateTokenTx.php
new file mode 100644
index 0000000..1534c2f
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterCreateTokenTx.php
@@ -0,0 +1,69 @@
+name = $name;
+ $this->symbol = $symbol;
+ $this->initialAmount = $initialAmount;
+ $this->maxSupply = $maxSupply;
+ $this->mintable = $mintable;
+ $this->burnable = $burnable;
+ }
+
+ /**
+ * Prepare tx data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->name,
+ MinterConverter::convertCoinName($this->symbol),
+ MinterConverter::convertToPip($this->initialAmount),
+ MinterConverter::convertToPip($this->maxSupply),
+ (int) $this->mintable,
+ (int) $this->burnable
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->name = Helper::hex2str($this->name);
+ $this->symbol = Helper::hex2str($this->symbol);
+ $this->initialAmount = MinterConverter::convertToBase(Helper::hexDecode($this->initialAmount));
+ $this->maxSupply = MinterConverter::convertToBase(Helper::hexDecode($this->maxSupply));
+ $this->mintable = (bool) hexdec($this->mintable);
+ $this->burnable = (bool) hexdec($this->burnable);
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterDeclareCandidacyTx.php b/src/Minter/SDK/MinterCoins/MinterDeclareCandidacyTx.php
index de7bb90..1d77fa9 100644
--- a/src/Minter/SDK/MinterCoins/MinterDeclareCandidacyTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterDeclareCandidacyTx.php
@@ -13,8 +13,7 @@
*/
class MinterDeclareCandidacyTx extends MinterCoinTx implements MinterTxInterface
{
- const TYPE = 6;
- const COMMISSION = 10000;
+ const TYPE = 6;
public $address;
public $publicKey;
diff --git a/src/Minter/SDK/MinterCoins/MinterDelegateTx.php b/src/Minter/SDK/MinterCoins/MinterDelegateTx.php
index c8f180c..1ee5d75 100644
--- a/src/Minter/SDK/MinterCoins/MinterDelegateTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterDelegateTx.php
@@ -17,8 +17,7 @@ class MinterDelegateTx extends MinterCoinTx implements MinterTxInterface
public $coin;
public $stake;
- const TYPE = 7;
- const COMMISSION = 200;
+ const TYPE = 7;
/**
* MinterDelegateTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterEditCandidateCommissionTx.php b/src/Minter/SDK/MinterCoins/MinterEditCandidateCommissionTx.php
new file mode 100644
index 0000000..f23ffa6
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterEditCandidateCommissionTx.php
@@ -0,0 +1,50 @@
+publicKey = $publicKey;
+ $this->commission = $commission;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ hex2bin(Helper::removePrefix($this->publicKey, MinterPrefix::PUBLIC_KEY)),
+ $this->commission === 0 ? '' : $this->commission
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->publicKey = MinterPrefix::PUBLIC_KEY . $this->publicKey;
+ $this->commission = (int) Helper::hexDecode($this->commission);
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterEditCandidatePublicKeyTx.php b/src/Minter/SDK/MinterCoins/MinterEditCandidatePublicKeyTx.php
index ad8305e..26d79a5 100644
--- a/src/Minter/SDK/MinterCoins/MinterEditCandidatePublicKeyTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterEditCandidatePublicKeyTx.php
@@ -15,8 +15,7 @@ class MinterEditCandidatePublicKeyTx extends MinterCoinTx implements MinterTxInt
public $publicKey;
public $newPublicKey;
- const TYPE = 20;
- const COMMISSION = 100000000;
+ const TYPE = 20;
/**
* MinterEditCandidatePublicKeyTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterEditCandidateTx.php b/src/Minter/SDK/MinterCoins/MinterEditCandidateTx.php
index f8af10b..c1eec15 100644
--- a/src/Minter/SDK/MinterCoins/MinterEditCandidateTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterEditCandidateTx.php
@@ -17,8 +17,7 @@ class MinterEditCandidateTx extends MinterCoinTx implements MinterTxInterface
public $ownerAddress;
public $controlAddress;
- const TYPE = 14;
- const COMMISSION = 10000;
+ const TYPE = 14;
/**
* MinterEditCandidateTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterEditCoinOwnerTx.php b/src/Minter/SDK/MinterCoins/MinterEditCoinOwnerTx.php
index e44b407..1321afb 100644
--- a/src/Minter/SDK/MinterCoins/MinterEditCoinOwnerTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterEditCoinOwnerTx.php
@@ -15,8 +15,7 @@ class MinterEditCoinOwnerTx extends MinterCoinTx implements MinterTxInterface
public $symbol;
public $newOwner;
- const TYPE = 17;
- const COMMISSION = 10000000;
+ const TYPE = 17;
/**
* MinterEditCoinOwnerTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterEditMultisigTx.php b/src/Minter/SDK/MinterCoins/MinterEditMultisigTx.php
index 8c1dec5..6cb54fc 100644
--- a/src/Minter/SDK/MinterCoins/MinterEditMultisigTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterEditMultisigTx.php
@@ -15,8 +15,7 @@ class MinterEditMultisigTx extends MinterCoinTx implements MinterTxInterface
public $addresses;
public $threshold;
- const TYPE = 18;
- const COMMISSION = 1000;
+ const TYPE = 18;
/**
* MinterEditMultisigTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterMintTokenTx.php b/src/Minter/SDK/MinterCoins/MinterMintTokenTx.php
new file mode 100644
index 0000000..3eef5b1
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterMintTokenTx.php
@@ -0,0 +1,49 @@
+coin = $coin;
+ $this->value = $value;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->coin,
+ MinterConverter::convertToPip($this->value)
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->coin = hexdec($this->coin);
+ $this->value = MinterConverter::convertToBase(Helper::hexDecode($this->value));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterMultiSendTx.php b/src/Minter/SDK/MinterCoins/MinterMultiSendTx.php
index 29b7708..7fa68fd 100644
--- a/src/Minter/SDK/MinterCoins/MinterMultiSendTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterMultiSendTx.php
@@ -12,8 +12,7 @@ class MinterMultiSendTx extends MinterCoinTx implements MinterTxInterface
{
public $list;
- const TYPE = 13;
- const COMMISSION = 5;
+ const TYPE = 13;
/**
* MinterMultiSendTx constructor.
@@ -50,9 +49,4 @@ public function decodeData()
$this->list[$key] = $send;
}
}
-
- public function getFee()
- {
- return MinterSendCoinTx::COMMISSION + (count($this->list) - 1) * self::COMMISSION;
- }
}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterPriceCommissionTx.php b/src/Minter/SDK/MinterCoins/MinterPriceCommissionTx.php
new file mode 100644
index 0000000..5eff70e
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterPriceCommissionTx.php
@@ -0,0 +1,295 @@
+pubKey = $pubKey;
+ $this->height = $height;
+ $this->coin = $coin;
+ $this->payloadByte = $payloadByte;
+ $this->send = $send;
+ $this->buyBancor = $buyBancor;
+ $this->sellBancor = $sellBancor;
+ $this->sellAllBancor = $sellAllBancor;
+ $this->buyPool = $buyPool;
+ $this->sellPool = $sellPool;
+ $this->sellAllPool = $sellAllPool;
+ $this->createTicker3 = $createTicker3;
+ $this->createTicker4 = $createTicker4;
+ $this->createTicker5 = $createTicker5;
+ $this->createTicker6 = $createTicker6;
+ $this->createTicker7to10 = $createTicker7to10;
+ $this->createCoin = $createCoin;
+ $this->createToken = $createToken;
+ $this->recreateCoin = $recreateCoin;
+ $this->recreateToken = $recreateToken;
+ $this->declareCandidacy = $declareCandidacy;
+ $this->delegate = $delegate;
+ $this->unbond = $unbond;
+ $this->redeemCheck = $redeemCheck;
+ $this->setCandidateOn = $setCandidateOn;
+ $this->setCandidateOff = $setCandidateOff;
+ $this->createMultisig = $createMultisig;
+ $this->multisendBase = $multisendBase;
+ $this->multisendDelta = $multisendDelta;
+ $this->editCandidate = $editCandidate;
+ $this->setHaltBlock = $setHaltBlock;
+ $this->editTickerOwner = $editTickerOwner;
+ $this->editMultisig = $editMultisig;
+ $this->editCandidatePublicKey = $editCandidatePublicKey;
+ $this->createSwapPool = $createSwapPool;
+ $this->addLiquidity = $addLiquidity;
+ $this->removeLiquidity = $removeLiquidity;
+ $this->editCandidateCommission = $editCandidateCommission;
+ $this->burnToken = $burnToken;
+ $this->mintToken = $mintToken;
+ $this->voteCommission = $voteCommission;
+ $this->voteUpdate = $voteUpdate;
+ }
+
+ /**
+ * Prepare tx data for signing
+ *
+ * @return array
+ */
+ function encodeData(): array
+ {
+ return [
+ hex2bin(Helper::removePrefix($this->pubKey, MinterPrefix::PUBLIC_KEY)),
+ $this->height,
+ $this->coin,
+ MinterConverter::convertToPip($this->payloadByte),
+ MinterConverter::convertToPip($this->send),
+ MinterConverter::convertToPip($this->buyBancor),
+ MinterConverter::convertToPip($this->sellBancor),
+ MinterConverter::convertToPip($this->sellAllBancor),
+ MinterConverter::convertToPip($this->buyPool),
+ MinterConverter::convertToPip($this->sellPool),
+ MinterConverter::convertToPip($this->sellAllPool),
+ MinterConverter::convertToPip($this->createTicker3),
+ MinterConverter::convertToPip($this->createTicker4),
+ MinterConverter::convertToPip($this->createTicker5),
+ MinterConverter::convertToPip($this->createTicker6),
+ MinterConverter::convertToPip($this->createTicker7to10),
+ MinterConverter::convertToPip($this->createCoin),
+ MinterConverter::convertToPip($this->createToken),
+ MinterConverter::convertToPip($this->recreateCoin),
+ MinterConverter::convertToPip($this->recreateToken),
+ MinterConverter::convertToPip($this->declareCandidacy),
+ MinterConverter::convertToPip($this->delegate),
+ MinterConverter::convertToPip($this->unbond),
+ MinterConverter::convertToPip($this->redeemCheck),
+ MinterConverter::convertToPip($this->setCandidateOn),
+ MinterConverter::convertToPip($this->setCandidateOff),
+ MinterConverter::convertToPip($this->createMultisig),
+ MinterConverter::convertToPip($this->multisendBase),
+ MinterConverter::convertToPip($this->multisendDelta),
+ MinterConverter::convertToPip($this->editCandidate),
+ MinterConverter::convertToPip($this->setHaltBlock),
+ MinterConverter::convertToPip($this->editTickerOwner),
+ MinterConverter::convertToPip($this->editMultisig),
+ MinterConverter::convertToPip($this->editCandidatePublicKey),
+ MinterConverter::convertToPip($this->createSwapPool),
+ MinterConverter::convertToPip($this->addLiquidity),
+ MinterConverter::convertToPip($this->removeLiquidity),
+ MinterConverter::convertToPip($this->editCandidateCommission),
+ MinterConverter::convertToPip($this->burnToken),
+ MinterConverter::convertToPip($this->mintToken),
+ MinterConverter::convertToPip($this->voteCommission),
+ MinterConverter::convertToPip($this->voteUpdate)
+ ];
+ }
+
+
+ function decodeData()
+ {
+ $this->pubKey = MinterPrefix::PUBLIC_KEY . $this->pubKey;
+ $this->height = (int)hexdec($this->height);
+ $this->coin = hexdec($this->coin);
+ $this->payloadByte = MinterConverter::convertToBase(Helper::hexDecode($this->payloadByte));
+ $this->send = MinterConverter::convertToBase(Helper::hexDecode($this->send));
+ $this->buyBancor = MinterConverter::convertToBase(Helper::hexDecode($this->buyBancor));
+ $this->sellBancor = MinterConverter::convertToBase(Helper::hexDecode($this->sellBancor));
+ $this->sellAllBancor = MinterConverter::convertToBase(Helper::hexDecode($this->sellAllBancor));
+ $this->buyPool = MinterConverter::convertToBase(Helper::hexDecode($this->buyPool));
+ $this->sellPool = MinterConverter::convertToBase(Helper::hexDecode($this->sellPool));
+ $this->sellAllPool = MinterConverter::convertToBase(Helper::hexDecode($this->sellAllPool));
+ $this->createTicker3 = MinterConverter::convertToBase(Helper::hexDecode($this->createTicker3));
+ $this->createTicker4 = MinterConverter::convertToBase(Helper::hexDecode($this->createTicker4));
+ $this->createTicker5 = MinterConverter::convertToBase(Helper::hexDecode($this->createTicker5));
+ $this->createTicker6 = MinterConverter::convertToBase(Helper::hexDecode($this->createTicker6));
+ $this->createTicker7to10 = MinterConverter::convertToBase(Helper::hexDecode($this->createTicker7to10));
+ $this->createCoin = MinterConverter::convertToBase(Helper::hexDecode($this->createCoin));
+ $this->createToken = MinterConverter::convertToBase(Helper::hexDecode($this->createToken));
+ $this->recreateCoin = MinterConverter::convertToBase(Helper::hexDecode($this->recreateCoin));
+ $this->recreateToken = MinterConverter::convertToBase(Helper::hexDecode($this->recreateToken));
+ $this->declareCandidacy = MinterConverter::convertToBase(Helper::hexDecode($this->declareCandidacy));
+ $this->delegate = MinterConverter::convertToBase(Helper::hexDecode($this->delegate));
+ $this->unbond = MinterConverter::convertToBase(Helper::hexDecode($this->unbond));
+ $this->redeemCheck = MinterConverter::convertToBase(Helper::hexDecode($this->redeemCheck));
+ $this->setCandidateOn = MinterConverter::convertToBase(Helper::hexDecode($this->setCandidateOn));
+ $this->setCandidateOff = MinterConverter::convertToBase(Helper::hexDecode($this->setCandidateOff));
+ $this->createMultisig = MinterConverter::convertToBase(Helper::hexDecode($this->createMultisig));
+ $this->multisendBase = MinterConverter::convertToBase(Helper::hexDecode($this->multisendBase));
+ $this->multisendDelta = MinterConverter::convertToBase(Helper::hexDecode($this->multisendDelta));
+ $this->editCandidate = MinterConverter::convertToBase(Helper::hexDecode($this->editCandidate));
+ $this->setHaltBlock = MinterConverter::convertToBase(Helper::hexDecode($this->setHaltBlock));
+ $this->editTickerOwner = MinterConverter::convertToBase(Helper::hexDecode($this->editTickerOwner));
+ $this->editMultisig = MinterConverter::convertToBase(Helper::hexDecode($this->editMultisig));
+ $this->editCandidatePublicKey = MinterConverter::convertToBase(Helper::hexDecode($this->editCandidatePublicKey));
+ $this->createSwapPool = MinterConverter::convertToBase(Helper::hexDecode($this->createSwapPool));
+ $this->addLiquidity = MinterConverter::convertToBase(Helper::hexDecode($this->addLiquidity));
+ $this->removeLiquidity = MinterConverter::convertToBase(Helper::hexDecode($this->removeLiquidity));
+ $this->editCandidateCommission = MinterConverter::convertToBase(Helper::hexDecode($this->editCandidateCommission));
+ $this->burnToken = MinterConverter::convertToBase(Helper::hexDecode($this->burnToken));
+ $this->mintToken = MinterConverter::convertToBase(Helper::hexDecode($this->mintToken));
+ $this->voteCommission = MinterConverter::convertToBase(Helper::hexDecode($this->voteCommission));
+ $this->voteUpdate = MinterConverter::convertToBase(Helper::hexDecode($this->voteUpdate));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterPriceVoteTx.php b/src/Minter/SDK/MinterCoins/MinterPriceVoteTx.php
deleted file mode 100644
index bf39f70..0000000
--- a/src/Minter/SDK/MinterCoins/MinterPriceVoteTx.php
+++ /dev/null
@@ -1,38 +0,0 @@
-price = $price;
- }
-
- public function encodeData(): array
- {
- return [
- $this->price,
- ];
- }
-
- public function decodeData()
- {
- $this->price = hexdec($this->price);
- }
-}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterRecreateCoinTx.php b/src/Minter/SDK/MinterCoins/MinterRecreateCoinTx.php
index ca58a09..59fe31b 100644
--- a/src/Minter/SDK/MinterCoins/MinterRecreateCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterRecreateCoinTx.php
@@ -19,8 +19,7 @@ class MinterRecreateCoinTx extends MinterCoinTx implements MinterTxInterface
public $maxSupply;
public $name;
- const TYPE = 16;
- const COMMISSION = 10000000;
+ const TYPE = 16;
/**
* MinterRecreateCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterRecreateTokenTx.php b/src/Minter/SDK/MinterCoins/MinterRecreateTokenTx.php
new file mode 100644
index 0000000..220f6c2
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterRecreateTokenTx.php
@@ -0,0 +1,69 @@
+name = $name;
+ $this->symbol = $symbol;
+ $this->initialAmount = $initialAmount;
+ $this->maxSupply = $maxSupply;
+ $this->mintable = $mintable;
+ $this->burnable = $burnable;
+ }
+
+ /**
+ * Prepare tx data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->name,
+ MinterConverter::convertCoinName($this->symbol),
+ MinterConverter::convertToPip($this->initialAmount),
+ MinterConverter::convertToPip($this->maxSupply),
+ (int) $this->mintable,
+ (int) $this->burnable
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->name = Helper::hex2str($this->name);
+ $this->symbol = Helper::hex2str($this->symbol);
+ $this->initialAmount = MinterConverter::convertToBase(Helper::hexDecode($this->initialAmount));
+ $this->maxSupply = MinterConverter::convertToBase(Helper::hexDecode($this->maxSupply));
+ $this->mintable = (bool) hexdec($this->mintable);
+ $this->burnable = (bool) hexdec($this->burnable);
+ }
+}
diff --git a/src/Minter/SDK/MinterCoins/MinterRedeemCheckTx.php b/src/Minter/SDK/MinterCoins/MinterRedeemCheckTx.php
index 19f68c0..e5af79c 100644
--- a/src/Minter/SDK/MinterCoins/MinterRedeemCheckTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterRedeemCheckTx.php
@@ -15,8 +15,7 @@ class MinterRedeemCheckTx extends MinterCoinTx implements MinterTxInterface
public $check;
public $proof;
- const TYPE = 9;
- const COMMISSION = 30;
+ const TYPE = 9;
/**
* MinterRedeemCheckTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterRemoveLiquidityTx.php b/src/Minter/SDK/MinterCoins/MinterRemoveLiquidityTx.php
new file mode 100644
index 0000000..fb3dfc0
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterRemoveLiquidityTx.php
@@ -0,0 +1,65 @@
+coin0 = $coin0;
+ $this->coin1 = $coin1;
+ $this->liquidity = $liquidity;
+ $this->minimumVolume0 = $minimumVolume0;
+ $this->minimumVolume1 = $minimumVolume1;
+ }
+
+ /**
+ * Prepare data for signing
+ *
+ * @return array
+ */
+ function encodeData(): array
+ {
+ return [
+ $this->coin0,
+ $this->coin1,
+ MinterConverter::convertToPip($this->liquidity),
+ MinterConverter::convertToPip($this->minimumVolume0),
+ MinterConverter::convertToPip($this->minimumVolume1)
+ ];
+ }
+
+ function decodeData()
+ {
+ $this->coin0 = hexdec($this->coin0);
+ $this->coin1 = hexdec($this->coin1);
+ $this->liquidity = MinterConverter::convertToBase(Helper::hexDecode($this->liquidity));
+ $this->minimumVolume0 = MinterConverter::convertToBase(Helper::hexDecode($this->minimumVolume0));
+ $this->minimumVolume1 = MinterConverter::convertToBase(Helper::hexDecode($this->minimumVolume1));
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterSellAllCoinTx.php b/src/Minter/SDK/MinterCoins/MinterSellAllCoinTx.php
index ef85fe2..3aeda56 100644
--- a/src/Minter/SDK/MinterCoins/MinterSellAllCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSellAllCoinTx.php
@@ -16,8 +16,7 @@ class MinterSellAllCoinTx extends MinterCoinTx implements MinterTxInterface
public $coinToSell;
public $minimumValueToBuy;
- const TYPE = 3;
- const COMMISSION = 100;
+ const TYPE = 3;
/**
* MinterSellAllCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterSellAllSwapPoolTx.php b/src/Minter/SDK/MinterCoins/MinterSellAllSwapPoolTx.php
new file mode 100644
index 0000000..f55072e
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterSellAllSwapPoolTx.php
@@ -0,0 +1,52 @@
+coins = $coins;
+ $this->minimumValueToBuy = $minimumValueToBuy;
+ }
+
+ /**
+ * Prepare tx data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->coins,
+ MinterConverter::convertToPip($this->minimumValueToBuy)
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->minimumValueToBuy = MinterConverter::convertToBase(Helper::hexDecode($this->minimumValueToBuy));
+ $this->coins = array_map(function ($value) {
+ return hexdec($value);
+ }, $this->coins);
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterSellCoinTx.php b/src/Minter/SDK/MinterCoins/MinterSellCoinTx.php
index ff35f08..94babb5 100644
--- a/src/Minter/SDK/MinterCoins/MinterSellCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSellCoinTx.php
@@ -17,8 +17,7 @@ class MinterSellCoinTx extends MinterCoinTx implements MinterTxInterface
public $valueToSell;
public $minimumValueToBuy;
- const TYPE = 2;
- const COMMISSION = 100;
+ const TYPE = 2;
/**
* MinterSellCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterSellSwapPoolTx.php b/src/Minter/SDK/MinterCoins/MinterSellSwapPoolTx.php
new file mode 100644
index 0000000..f3c294e
--- /dev/null
+++ b/src/Minter/SDK/MinterCoins/MinterSellSwapPoolTx.php
@@ -0,0 +1,57 @@
+coins = $coins;
+ $this->valueToSell = $valueToSell;
+ $this->minimumValueToBuy = $minimumValueToBuy;
+ }
+
+ /**
+ * Prepare tx data for signing
+ *
+ * @return array
+ */
+ public function encodeData(): array
+ {
+ return [
+ $this->coins,
+ MinterConverter::convertToPip($this->valueToSell),
+ MinterConverter::convertToPip($this->minimumValueToBuy)
+ ];
+ }
+
+ public function decodeData()
+ {
+ $this->valueToSell = MinterConverter::convertToBase(Helper::hexDecode($this->valueToSell));
+ $this->minimumValueToBuy = MinterConverter::convertToBase(Helper::hexDecode($this->minimumValueToBuy));
+ $this->coins = array_map(function ($value) {
+ return hexdec($value);
+ }, $this->coins);
+ }
+}
\ No newline at end of file
diff --git a/src/Minter/SDK/MinterCoins/MinterSendCoinTx.php b/src/Minter/SDK/MinterCoins/MinterSendCoinTx.php
index c04b488..abba8f1 100644
--- a/src/Minter/SDK/MinterCoins/MinterSendCoinTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSendCoinTx.php
@@ -16,8 +16,7 @@ class MinterSendCoinTx extends MinterCoinTx implements MinterTxInterface
public $to;
public $value;
- const TYPE = 1;
- const COMMISSION = 10;
+ const TYPE = 1;
/**
* MinterSendCoinTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterSetCandidateOffTx.php b/src/Minter/SDK/MinterCoins/MinterSetCandidateOffTx.php
index 97bb597..e37b80b 100644
--- a/src/Minter/SDK/MinterCoins/MinterSetCandidateOffTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSetCandidateOffTx.php
@@ -14,8 +14,7 @@ class MinterSetCandidateOffTx extends MinterCoinTx implements MinterTxInterface
{
public $publicKey;
- const TYPE = 11;
- const COMMISSION = 100;
+ const TYPE = 11;
/**
* MinterSetCandidateOffTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterSetCandidateOnTx.php b/src/Minter/SDK/MinterCoins/MinterSetCandidateOnTx.php
index bef14af..4291bfa 100644
--- a/src/Minter/SDK/MinterCoins/MinterSetCandidateOnTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSetCandidateOnTx.php
@@ -14,8 +14,7 @@ class MinterSetCandidateOnTx extends MinterCoinTx implements MinterTxInterface
{
public $publicKey;
- const TYPE = 10;
- const COMMISSION = 100;
+ const TYPE = 10;
/**
* MinterSetCandidateOnTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterSetHaltBlockTx.php b/src/Minter/SDK/MinterCoins/MinterSetHaltBlockTx.php
index 7f5049c..180a110 100644
--- a/src/Minter/SDK/MinterCoins/MinterSetHaltBlockTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterSetHaltBlockTx.php
@@ -15,8 +15,7 @@ class MinterSetHaltBlockTx extends MinterCoinTx implements MinterTxInterface
public $publicKey;
public $height;
- const TYPE = 15;
- const COMMISSION = 1000;
+ const TYPE = 15;
/**
* MinterUnbondTx constructor.
diff --git a/src/Minter/SDK/MinterCoins/MinterUnbondTx.php b/src/Minter/SDK/MinterCoins/MinterUnbondTx.php
index bc33af3..50e7a80 100644
--- a/src/Minter/SDK/MinterCoins/MinterUnbondTx.php
+++ b/src/Minter/SDK/MinterCoins/MinterUnbondTx.php
@@ -17,8 +17,7 @@ class MinterUnbondTx extends MinterCoinTx implements MinterTxInterface
public $coin;
public $value;
- const TYPE = 8;
- const COMMISSION = 200;
+ const TYPE = 8;
/**
* MinterUnbondTx constructor.
diff --git a/src/Minter/SDK/MinterTx.php b/src/Minter/SDK/MinterTx.php
index a365435..b50faaf 100644
--- a/src/Minter/SDK/MinterTx.php
+++ b/src/Minter/SDK/MinterTx.php
@@ -4,18 +4,29 @@
use InvalidArgumentException;
use Minter\Contracts\MinterTxInterface;
+use Minter\SDK\MinterCoins\MinterAddLiquidityTx;
+use Minter\SDK\MinterCoins\MinterBurnTokenTx;
use Minter\SDK\MinterCoins\MinterBuyCoinTx;
+use Minter\SDK\MinterCoins\MinterBuySwapPoolTx;
+use Minter\SDK\MinterCoins\MinterCreateSwapPoolTx;
+use Minter\SDK\MinterCoins\MinterCreateTokenTx;
use Minter\SDK\MinterCoins\MinterEditCoinOwnerTx;
use Minter\SDK\MinterCoins\MinterCreateCoinTx;
use Minter\SDK\MinterCoins\MinterCreateMultisigTx;
use Minter\SDK\MinterCoins\MinterDeclareCandidacyTx;
use Minter\SDK\MinterCoins\MinterDelegateTx;
use Minter\SDK\MinterCoins\MinterEditCandidateTx;
+use Minter\SDK\MinterCoins\MinterMintTokenTx;
use Minter\SDK\MinterCoins\MinterMultiSendTx;
+use Minter\SDK\MinterCoins\MinterPriceCommissionTx;
use Minter\SDK\MinterCoins\MinterRecreateCoinTx;
+use Minter\SDK\MinterCoins\MinterRecreateTokenTx;
use Minter\SDK\MinterCoins\MinterRedeemCheckTx;
+use Minter\SDK\MinterCoins\MinterRemoveLiquidityTx;
use Minter\SDK\MinterCoins\MinterSellAllCoinTx;
+use Minter\SDK\MinterCoins\MinterSellAllSwapPoolTx;
use Minter\SDK\MinterCoins\MinterSellCoinTx;
+use Minter\SDK\MinterCoins\MinterSellSwapPoolTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;
use Minter\SDK\MinterCoins\MinterSetCandidateOffTx;
use Minter\SDK\MinterCoins\MinterSetCandidateOnTx;
@@ -350,7 +361,7 @@ public function getSignatureData(): MinterSignature
}
/**
- * @return MinterSendCoinTx|MinterBuyCoinTx|MinterSellCoinTx|MinterSellAllCoinTx|MinterDelegateTx|MinterUnbondTx|MinterMultiSendTx|MinterCreateMultisigTx|MinterCreateCoinTx|MinterRecreateCoinTx|MinterEditCoinOwnerTx|MinterDeclareCandidacyTx|MinterSetCandidateOnTx|MinterSetCandidateOffTx|MinterEditCandidateTx|MinterRedeemCheckTx|MinterSetHaltBlockTx
+ * @return MinterSendCoinTx|MinterBuyCoinTx|MinterSellCoinTx|MinterSellAllCoinTx|MinterDelegateTx|MinterUnbondTx|MinterMultiSendTx|MinterCreateMultisigTx|MinterCreateCoinTx|MinterRecreateCoinTx|MinterEditCoinOwnerTx|MinterDeclareCandidacyTx|MinterSetCandidateOnTx|MinterSetCandidateOffTx|MinterEditCandidateTx|MinterRedeemCheckTx|MinterSetHaltBlockTx|MinterSellSwapPoolTx|MinterSellAllSwapPoolTx|MinterBuySwapPoolTx|MinterPriceCommissionTx|MinterCreateTokenTx|MinterRecreateTokenTx|MinterCreateSwapPoolTx|MinterBurnTokenTx|MinterMintTokenTx|MinterAddLiquidityTx|MinterRemoveLiquidityTx
*/
public function getData(): MinterTxInterface
{
diff --git a/tests/MinterAddLiquidityTxTest.php b/tests/MinterAddLiquidityTxTest.php
new file mode 100644
index 0000000..9c1a60c
--- /dev/null
+++ b/tests/MinterAddLiquidityTxTest.php
@@ -0,0 +1,64 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coin0, $tx->getData()->coin0);
+ $this->assertSame($validTx->getData()->coin1, $tx->getData()->coin1);
+ $this->assertSame($validTx->getData()->volume0, $tx->getData()->volume0);
+ $this->assertSame($validTx->getData()->maximumVolume1, $tx->getData()->maximumVolume1);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterAddLiquidityTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterAddLiquidityTx(0, 1, '250', '500');
+ return (new MinterTx(13, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
diff --git a/tests/MinterPriceVoteTxTest.php b/tests/MinterBurnTokenTxTest.php
similarity index 54%
rename from tests/MinterPriceVoteTxTest.php
rename to tests/MinterBurnTokenTxTest.php
index 6d92a9c..fb2cf25 100644
--- a/tests/MinterPriceVoteTxTest.php
+++ b/tests/MinterBurnTokenTxTest.php
@@ -1,32 +1,32 @@
assertSame($validTx->getGasCoin(), $tx->getGasCoin());
$this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
$this->assertSame($validTx->getChainID(), $tx->getChainID());
- $this->assertSame($validTx->getData()->price, $tx->getData()->price);
+ $this->assertSame($validTx->getData()->coin, $tx->getData()->coin);
+ $this->assertSame($validTx->getData()->value, $tx->getData()->value);
$this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
}
/**
- * Test signing MinterEditCoinOwnerTx
+ * Test signing MinterBurnTokenTx
*/
public function testSign(): void
{
@@ -55,7 +56,7 @@ public function testSign(): void
*/
private function makeTransaction(): MinterTx
{
- $data = new MinterPriceVoteTx(10000);
- return new MinterTx(10, $data);
+ $data = new MinterBurnTokenTx(4,'2500');
+ return (new MinterTx(24, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
}
}
diff --git a/tests/MinterBuySwapPoolTxTest.php b/tests/MinterBuySwapPoolTxTest.php
new file mode 100644
index 0000000..7840efa
--- /dev/null
+++ b/tests/MinterBuySwapPoolTxTest.php
@@ -0,0 +1,60 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coins, $tx->getData()->coins);
+ $this->assertSame($validTx->getData()->valueToBuy, $tx->getData()->valueToBuy);
+ $this->assertSame($validTx->getData()->maximumValueToSell, $tx->getData()->maximumValueToSell);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterBuySwapPoolTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterBuySwapPoolTx([2, 3], '3', '5000');
+ return (new MinterTx(14, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterCreateSwapPoolTxTest.php b/tests/MinterCreateSwapPoolTxTest.php
new file mode 100644
index 0000000..d659a41
--- /dev/null
+++ b/tests/MinterCreateSwapPoolTxTest.php
@@ -0,0 +1,65 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coin0, $tx->getData()->coin0);
+ $this->assertSame($validTx->getData()->coin1, $tx->getData()->coin1);
+ $this->assertSame($validTx->getData()->volume0, $tx->getData()->volume0);
+ $this->assertSame($validTx->getData()->volume1, $tx->getData()->volume1);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterCreateSwapPoolTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterCreateSwapPoolTx(3,4,'5000','10000');
+ return (new MinterTx(26, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterCreateTokenTxTest.php b/tests/MinterCreateTokenTxTest.php
new file mode 100644
index 0000000..a993451
--- /dev/null
+++ b/tests/MinterCreateTokenTxTest.php
@@ -0,0 +1,63 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->name, $tx->getData()->name);
+ $this->assertSame($validTx->getData()->symbol, $tx->getData()->symbol);
+ $this->assertSame($validTx->getData()->initialAmount, $tx->getData()->initialAmount);
+ $this->assertSame($validTx->getData()->maxSupply, $tx->getData()->maxSupply);
+ $this->assertSame($validTx->getData()->mintable, $tx->getData()->mintable);
+ $this->assertSame($validTx->getData()->burnable, $tx->getData()->burnable);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterCreateTokenTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterCreateTokenTx('BURNABLE TOKEN','BURNABLE','250000','300000',false,true);
+ return (new MinterTx(19, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterEditCandidateCommissionTxTest.php b/tests/MinterEditCandidateCommissionTxTest.php
new file mode 100644
index 0000000..2ce9d37
--- /dev/null
+++ b/tests/MinterEditCandidateCommissionTxTest.php
@@ -0,0 +1,63 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->publicKey, $tx->getData()->publicKey);
+ $this->assertSame($validTx->getData()->commission, $tx->getData()->commission);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterEditCandidateCommissionTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterEditCandidateCommissionTx('Mp325580a8baed04899252ae5b5f6167ee34ec0144f3401d88586b350999999999',15);
+ return (new MinterTx(25, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
diff --git a/tests/MinterMintTokenTxTest.php b/tests/MinterMintTokenTxTest.php
new file mode 100644
index 0000000..e828a3e
--- /dev/null
+++ b/tests/MinterMintTokenTxTest.php
@@ -0,0 +1,62 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coin, $tx->getData()->coin);
+ $this->assertSame($validTx->getData()->value, $tx->getData()->value);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterMintTokenTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterMintTokenTx(3,'2500');
+ return (new MinterTx(23, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
diff --git a/tests/MinterPriceCommissionTxTest.php b/tests/MinterPriceCommissionTxTest.php
new file mode 100644
index 0000000..af01436
--- /dev/null
+++ b/tests/MinterPriceCommissionTxTest.php
@@ -0,0 +1,102 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->pubKey, $tx->getData()->pubKey);
+ $this->assertSame($validTx->getData()->height, $tx->getData()->height);
+ $this->assertSame($validTx->getData()->coin, $tx->getData()->coin);
+ $this->assertSame($validTx->getData()->payloadByte, $tx->getData()->payloadByte);
+ $this->assertSame($validTx->getData()->send, $tx->getData()->send);
+ $this->assertSame($validTx->getData()->buyBancor, $tx->getData()->buyBancor);
+ $this->assertSame($validTx->getData()->sellBancor, $tx->getData()->sellBancor);
+ $this->assertSame($validTx->getData()->sellAllBancor, $tx->getData()->sellAllBancor);
+ $this->assertSame($validTx->getData()->buyPool, $tx->getData()->buyPool);
+ $this->assertSame($validTx->getData()->sellPool, $tx->getData()->sellPool);
+ $this->assertSame($validTx->getData()->sellAllPool, $tx->getData()->sellAllPool);
+ $this->assertSame($validTx->getData()->createTicker3, $tx->getData()->createTicker3);
+ $this->assertSame($validTx->getData()->createTicker4, $tx->getData()->createTicker4);
+ $this->assertSame($validTx->getData()->createTicker5, $tx->getData()->createTicker5);
+ $this->assertSame($validTx->getData()->createTicker6, $tx->getData()->createTicker6);
+ $this->assertSame($validTx->getData()->createTicker7to10, $tx->getData()->createTicker7to10);
+ $this->assertSame($validTx->getData()->createCoin, $tx->getData()->createCoin);
+ $this->assertSame($validTx->getData()->createToken, $tx->getData()->createToken);
+ $this->assertSame($validTx->getData()->recreateCoin, $tx->getData()->recreateCoin);
+ $this->assertSame($validTx->getData()->recreateToken, $tx->getData()->recreateToken);
+ $this->assertSame($validTx->getData()->declareCandidacy, $tx->getData()->declareCandidacy);
+ $this->assertSame($validTx->getData()->delegate, $tx->getData()->delegate);
+ $this->assertSame($validTx->getData()->unbond, $tx->getData()->unbond);
+ $this->assertSame($validTx->getData()->redeemCheck, $tx->getData()->redeemCheck);
+ $this->assertSame($validTx->getData()->setCandidateOn, $tx->getData()->setCandidateOn);
+ $this->assertSame($validTx->getData()->setCandidateOff, $tx->getData()->setCandidateOff);
+ $this->assertSame($validTx->getData()->createMultisig, $tx->getData()->createMultisig);
+ $this->assertSame($validTx->getData()->multisendBase, $tx->getData()->multisendBase);
+ $this->assertSame($validTx->getData()->multisendDelta, $tx->getData()->multisendDelta);
+ $this->assertSame($validTx->getData()->editCandidate, $tx->getData()->editCandidate);
+ $this->assertSame($validTx->getData()->setHaltBlock, $tx->getData()->setHaltBlock);
+ $this->assertSame($validTx->getData()->editTickerOwner, $tx->getData()->editTickerOwner);
+ $this->assertSame($validTx->getData()->editMultisig, $tx->getData()->editMultisig);
+ $this->assertSame($validTx->getData()->editCandidatePublicKey, $tx->getData()->editCandidatePublicKey);
+ $this->assertSame($validTx->getData()->createSwapPool, $tx->getData()->createSwapPool);
+ $this->assertSame($validTx->getData()->addLiquidity, $tx->getData()->addLiquidity);
+ $this->assertSame($validTx->getData()->removeLiquidity, $tx->getData()->removeLiquidity);
+ $this->assertSame($validTx->getData()->editCandidateCommission, $tx->getData()->editCandidateCommission);
+ $this->assertSame($validTx->getData()->burnToken, $tx->getData()->burnToken);
+ $this->assertSame($validTx->getData()->mintToken, $tx->getData()->mintToken);
+ $this->assertSame($validTx->getData()->voteCommission, $tx->getData()->voteCommission);
+ $this->assertSame($validTx->getData()->voteUpdate, $tx->getData()->voteUpdate);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterPriceCommissionTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterPriceCommissionTx('Mp325580a8baed04899252ae5b5f6167ee34ec0144f3401d88586b350999999999', 100000,0,'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41');
+ return (new MinterTx(31, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
diff --git a/tests/MinterRecreateTokenTxTest.php b/tests/MinterRecreateTokenTxTest.php
new file mode 100644
index 0000000..f177dfb
--- /dev/null
+++ b/tests/MinterRecreateTokenTxTest.php
@@ -0,0 +1,63 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->name, $tx->getData()->name);
+ $this->assertSame($validTx->getData()->symbol, $tx->getData()->symbol);
+ $this->assertSame($validTx->getData()->initialAmount, $tx->getData()->initialAmount);
+ $this->assertSame($validTx->getData()->maxSupply, $tx->getData()->maxSupply);
+ $this->assertSame($validTx->getData()->mintable, $tx->getData()->mintable);
+ $this->assertSame($validTx->getData()->burnable, $tx->getData()->burnable);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterRecreateTokenTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterRecreateTokenTx('BURNABLE & MINTABLE TOKEN','BURNABLE','999999','999999',true,true);
+ return (new MinterTx(30, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterRemoveLiquidityTxTest.php b/tests/MinterRemoveLiquidityTxTest.php
new file mode 100644
index 0000000..34688f2
--- /dev/null
+++ b/tests/MinterRemoveLiquidityTxTest.php
@@ -0,0 +1,66 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coin0, $tx->getData()->coin0);
+ $this->assertSame($validTx->getData()->coin1, $tx->getData()->coin1);
+ $this->assertSame($validTx->getData()->liquidity, $tx->getData()->liquidity);
+ $this->assertSame($validTx->getData()->minimumVolume0, $tx->getData()->minimumVolume0);
+ $this->assertSame($validTx->getData()->minimumVolume1, $tx->getData()->minimumVolume1);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterRemoveLiquidityTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterRemoveLiquidityTx(0, 1, '100', '25', '15');
+ return (new MinterTx(6, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterSellAllSwapPoolTxTest.php b/tests/MinterSellAllSwapPoolTxTest.php
new file mode 100644
index 0000000..383393e
--- /dev/null
+++ b/tests/MinterSellAllSwapPoolTxTest.php
@@ -0,0 +1,59 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coins, $tx->getData()->coins);
+ $this->assertSame($validTx->getData()->minimumValueToBuy, $tx->getData()->minimumValueToBuy);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterSellAllSwapPoolTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterSellAllSwapPoolTx([1, 4, 5], '100');
+ return (new MinterTx(16, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file
diff --git a/tests/MinterSellSwapPoolTxTest.php b/tests/MinterSellSwapPoolTxTest.php
new file mode 100644
index 0000000..128151b
--- /dev/null
+++ b/tests/MinterSellSwapPoolTxTest.php
@@ -0,0 +1,60 @@
+makeTransaction();
+
+ $this->assertSame($validTx->getNonce(), $tx->getNonce());
+ $this->assertSame($validTx->getGasCoin(), $tx->getGasCoin());
+ $this->assertSame($validTx->getGasPrice(), $tx->getGasPrice());
+ $this->assertSame($validTx->getChainID(), $tx->getChainID());
+ $this->assertSame($validTx->getData()->coins, $tx->getData()->coins);
+ $this->assertSame($validTx->getData()->valueToSell, $tx->getData()->valueToSell);
+ $this->assertSame($validTx->getData()->minimumValueToBuy, $tx->getData()->minimumValueToBuy);
+ $this->assertSame(self::MINTER_ADDRESS, $tx->getSenderAddress());
+ }
+
+ /**
+ * Test signing MinterSellSwapPoolTx
+ */
+ public function testSign(): void
+ {
+ $signature = $this->makeTransaction()->sign(self::PRIVATE_KEY);
+ $this->assertSame($signature, self::VALID_SIGNATURE);
+ }
+
+ /**
+ * @return MinterTx
+ */
+ private function makeTransaction(): MinterTx
+ {
+ $data = new MinterSellSwapPoolTx([1, 2], '20', '2');
+ return (new MinterTx(5, $data))->setChainID(MinterTx::TESTNET_CHAIN_ID);
+ }
+}
\ No newline at end of file