-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from MinterTeam/taconet
Upgrade sdk to taconet
- Loading branch information
Showing
48 changed files
with
2,073 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
|
||
namespace Minter\SDK\MinterCoins; | ||
|
||
use Minter\Contracts\MinterTxInterface; | ||
use Minter\Library\Helper; | ||
use Minter\SDK\MinterConverter; | ||
|
||
/** | ||
* Class MinterAddLiquidityTx | ||
* @package Minter\SDK\MinterCoins | ||
*/ | ||
class MinterAddLiquidityTx extends MinterCoinTx implements MinterTxInterface | ||
{ | ||
public $coin0; | ||
public $coin1; | ||
public $volume0; | ||
public $maximumVolume1; | ||
|
||
const TYPE = 21; | ||
|
||
/** | ||
* MinterAddLiquidityTx constructor. | ||
* @param $coin0 | ||
* @param $coin1 | ||
* @param $volume0 | ||
* @param $maximumVolume1 | ||
*/ | ||
public function __construct($coin0, $coin1, $volume0, $maximumVolume1) | ||
{ | ||
$this->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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Minter\SDK\MinterCoins; | ||
|
||
use Minter\Contracts\MinterTxInterface; | ||
use Minter\Library\Helper; | ||
use Minter\SDK\MinterConverter; | ||
|
||
/** | ||
* Class MinterBurnTokenTx | ||
* @package Minter\SDK\MinterCoins | ||
*/ | ||
class MinterBurnTokenTx extends MinterCoinTx implements MinterTxInterface | ||
{ | ||
public $coin; | ||
public $value; | ||
|
||
const TYPE = 29; | ||
|
||
/** | ||
* MinterBurnTokenTx constructor. | ||
* @param $coin | ||
* @param $value | ||
*/ | ||
public function __construct($coin, $value) | ||
{ | ||
$this->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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
|
||
namespace Minter\SDK\MinterCoins; | ||
|
||
use Minter\Contracts\MinterTxInterface; | ||
use Minter\Library\Helper; | ||
use Minter\SDK\MinterConverter; | ||
|
||
/** | ||
* Class MinterBuySwapPoolTx | ||
* @package Minter\SDK\MinterCoins | ||
*/ | ||
class MinterBuySwapPoolTx extends MinterCoinTx implements MinterTxInterface | ||
{ | ||
public $coins; | ||
public $valueToBuy; | ||
public $maximumValueToSell; | ||
|
||
const TYPE = 24; | ||
|
||
/** | ||
* MinterBuySwapPoolTx constructor. | ||
* @param $coins | ||
* @param $valueToBuy | ||
* @param $maximumValueToSell | ||
*/ | ||
public function __construct($coins, $valueToBuy, $maximumValueToSell) | ||
{ | ||
$this->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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.