-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DaemonRpcClient::getTransactionPool()
- Loading branch information
refring
committed
Oct 11, 2023
1 parent
6e72090
commit 8c7bc18
Showing
16 changed files
with
320 additions
and
35 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
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RefRing\MoneroRpcPhp\DaemonOther; | ||
|
||
use RefRing\MoneroRpcPhp\Request\OtherRpcRequest; | ||
use RefRing\MoneroRpcPhp\Trait\EmptyOtherRpcRequest; | ||
|
||
/** | ||
* Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory. | ||
*/ | ||
class GetTransactionPoolRequest extends OtherRpcRequest | ||
{ | ||
use EmptyOtherRpcRequest; | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RefRing\MoneroRpcPhp\DaemonOther; | ||
|
||
use RefRing\MoneroRpcPhp\DaemonRpc\DaemonRpcAccessResponseFields; | ||
use RefRing\MoneroRpcPhp\Model\MemPoolTransaction; | ||
use RefRing\MoneroRpcPhp\Model\SpentOutputKeyImages; | ||
use RefRing\MoneroRpcPhp\Trait\JsonSerializeBigInt; | ||
use Square\Pjson\Json; | ||
use Square\Pjson\JsonDataSerializable; | ||
|
||
/** | ||
* Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory. | ||
*/ | ||
class GetTransactionPoolResponse implements JsonDataSerializable | ||
{ | ||
use JsonSerializeBigInt; | ||
use DaemonRpcAccessResponseFields; | ||
|
||
/** @var SpentOutputKeyImages[] */ | ||
#[Json('spent_key_images', type: SpentOutputKeyImages::class)] | ||
public array $spentKeyImages; | ||
|
||
/** @var MemPoolTransaction[] */ | ||
#[Json(type: MemPoolTransaction::class)] | ||
public array $transactions; | ||
} |
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
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
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,160 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RefRing\MoneroRpcPhp\Model; | ||
|
||
use RefRing\MoneroRpcPhp\Monero\Amount; | ||
use RefRing\MoneroRpcPhp\Trait\JsonSerializeBigInt; | ||
use Square\Pjson\Json; | ||
use Square\Pjson\JsonDataSerializable; | ||
|
||
class MemPoolTransaction implements JsonDataSerializable | ||
{ | ||
use JsonSerializeBigInt{ | ||
fromJsonData as fromJsonDataOriginal; | ||
} | ||
|
||
/** | ||
* The size of the full transaction blob. | ||
*/ | ||
#[Json('blob_size')] | ||
public int $blobSize; | ||
|
||
#[Json('do_not_relay')] | ||
public bool $doNotRelay; | ||
|
||
/** | ||
* States if this transaction has been seen as double spend. | ||
*/ | ||
#[Json('double_spend_seen')] | ||
public bool $doubleSpendSeen; | ||
|
||
/** | ||
* The amount of the mining fee included in the transaction, in piconero. | ||
*/ | ||
#[Json] | ||
public Amount $fee; | ||
|
||
/** | ||
* The transaction ID hash. | ||
*/ | ||
#[Json('id_hash')] | ||
public string $idHash; | ||
|
||
/** | ||
* States if the tx was included in a block at least once (`true`) or not (`false`). | ||
*/ | ||
#[Json('kept_by_block')] | ||
public bool $keptByBlock; | ||
|
||
/** | ||
* If the transaction validation has previously failed, this tells at what height that occured. | ||
*/ | ||
#[Json('last_failed_height')] | ||
public int $lastFailedHeight; | ||
|
||
/** | ||
* Like the previous, this tells the previous transaction ID hash. | ||
*/ | ||
#[Json('last_failed_id_hash')] | ||
public string $lastFailedIdHash; | ||
|
||
/** | ||
* Last unix time at which the transaction has been relayed. | ||
*/ | ||
#[Json('last_relayed_time')] | ||
public int $lastRelayedTime; | ||
|
||
/** | ||
* Tells the height of the most recent block with an output used in this transaction. | ||
*/ | ||
#[Json('max_used_block_height')] | ||
public int $maxUsedBlockHeight; | ||
|
||
/** | ||
* Tells the hash of the most recent block with an output used in this transaction. | ||
*/ | ||
#[Json('max_used_block_id_hash')] | ||
public string $maxUsedBlockIdHash; | ||
|
||
/** | ||
* The Unix time that the transaction was first seen on the network by the node. | ||
*/ | ||
#[Json('receive_time')] | ||
public int $receiveTime; | ||
|
||
/** | ||
* States if this transaction has been relayed | ||
*/ | ||
#[Json] | ||
public bool $relayed; | ||
|
||
/** | ||
* Hexadecimal blob represnting the transaction. | ||
*/ | ||
#[Json('tx_blob')] | ||
public string $txBlob; | ||
|
||
/** | ||
* JSON structure of all information in the transaction: | ||
*/ | ||
#[Json('tx_json')] | ||
public string $txJson; | ||
|
||
/** | ||
* Structure of all information in the transaction | ||
*/ | ||
public ?TransactionData $transaction = null; | ||
|
||
#[Json] | ||
public int $weight; | ||
|
||
public function __construct( | ||
int $blobSize, | ||
bool $doubleSpendSeen, | ||
Amount $fee, | ||
string $idHash, | ||
bool $keptByBlock, | ||
int $lastFailedHeight, | ||
string $lastFailedIdHash, | ||
int $lastRelayedTime, | ||
int $maxUsedBlockHeight, | ||
string $maxUsedBlockIdHash, | ||
int $receiveTime, | ||
bool $relayed, | ||
string $txBlob, | ||
string $txJson, | ||
int $weight, | ||
) { | ||
$this->blobSize = $blobSize; | ||
$this->doubleSpendSeen = $doubleSpendSeen; | ||
$this->fee = $fee; | ||
$this->idHash = $idHash; | ||
$this->keptByBlock = $keptByBlock; | ||
$this->lastFailedHeight = $lastFailedHeight; | ||
$this->lastFailedIdHash = $lastFailedIdHash; | ||
$this->lastRelayedTime = $lastRelayedTime; | ||
$this->maxUsedBlockHeight = $maxUsedBlockHeight; | ||
$this->maxUsedBlockIdHash = $maxUsedBlockIdHash; | ||
$this->receiveTime = $receiveTime; | ||
$this->relayed = $relayed; | ||
$this->txBlob = $txBlob; | ||
$this->txJson = $txJson; | ||
$this->weight = $weight; | ||
} | ||
|
||
/** | ||
* @param string[] $jd | ||
* @param mixed[]|string $path | ||
*/ | ||
public static function fromJsonData($jd, array|string $path = []): static | ||
{ | ||
$data = self::fromJsonDataOriginal($jd, $path); | ||
|
||
$transaction = TransactionData::fromJsonString($jd['tx_json']); | ||
$data->transaction = $transaction; | ||
|
||
return $data; | ||
} | ||
} |
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.