Skip to content

Commit

Permalink
Changed wallet Response classes according to the current wallet_rpc_s…
Browse files Browse the repository at this point in the history
…erver_commands_defs.h definitions from the main Monero repo

Also removed "Alias: *None*." from the comments for the wallet classes
  • Loading branch information
refring committed Sep 14, 2023
1 parent 372c649 commit c9161c0
Show file tree
Hide file tree
Showing 174 changed files with 466 additions and 649 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## v0.3.0 (2023-09-14)
### Added
- Enum NetType
- Enum SignatureType
- Enum IncomingTransferType
- Class KeyImageList
### Changed
- Many changes based on wallet_rpc_server_commands_defs.h from the main Monero repo
- Renamed Tranfer to IncomingTransfer
- Many wallet-rpc Response classes got changed
- Renamed TransferDestination to Recipient
- Some Response classes now extend other Response classes because they were identical

## v0.2.0 (2023-09-13)
### Added
- Added Address class for representing base58 addresses
Expand Down
12 changes: 6 additions & 6 deletions src/DaemonRpc/GetCoinbaseTxSumResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ class GetCoinbaseTxSumResponse
public int $credits;

/**
* Least significant 64 bits for 128 bit integer representing the sum of coinbase rewards in @atomic-units. (See src/rpc/core_rpc_server.cpp store_128)
* Least significant 64 bits for 128 bit integer representing the sum of coinbase rewards in piconero. (See src/rpc/core_rpc_server.cpp store_128)
*/
#[Json('emission_amount')]
public int $emissionAmount;

/**
* Most significant 64 bits for 128 bit integer representing the sum of coinbase rewards in @atomic-units
* Most significant 64 bits for 128 bit integer representing the sum of coinbase rewards in piconero
*/
#[Json('emission_amount_top64')]
public int $emissionAmountTop64;

/**
* Most significant 64 bits for 128 bit integer representing the sum of fees in @atomic-units.
* Most significant 64 bits for 128 bit integer representing the sum of fees in piconero.
*/
#[Json('fee_amount')]
public int $feeAmount;

/**
* Most significant 64 bits for 128 bit integer representing the sum of fees in @atomic-units.
* Most significant 64 bits for 128 bit integer representing the sum of fees in piconero.
*/
#[Json('fee_amount_top64')]
public int $feeAmountTop64;
Expand All @@ -64,13 +64,13 @@ class GetCoinbaseTxSumResponse
public bool $untrusted;

/**
* Sum of coinbase rewards in @atomic-units.
* Sum of coinbase rewards in piconero.
*/
#[Json('wide_emission_amount')]
public string $wideEmissionAmount;

/**
* Sum of fees in @atomic-units.
* Sum of fees in piconero.
*/
#[Json('wide_fee_amount')]
public string $wideFeeAmount;
Expand Down
2 changes: 1 addition & 1 deletion src/DaemonRpc/GetFeeEstimateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GetFeeEstimateResponse
public int $credits;

/**
* Amount of fees estimated per byte in @atomic-units
* Amount of fees estimated per byte in piconero
*/
#[Json]
public int $fee;
Expand Down
12 changes: 12 additions & 0 deletions src/Enum/NetType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace RefRing\MoneroRpcPhp\Enum;

enum NetType: string
{
case MAINNET = 'mainnet';
case TESTNET = 'testnet';
case STAGENET = 'stagenet';
}
11 changes: 11 additions & 0 deletions src/Enum/SignatureType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace RefRing\MoneroRpcPhp\Enum;

enum SignatureType: string
{
case SPEND = 'spend';
case VIEW = 'view';
}
9 changes: 4 additions & 5 deletions src/Model/AccountTagInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
class AccountTagInformation
{
use JsonSerialize;

/**
* Filter tag.
* @var int[] List of tagged account indices.
*/
#[Json]
public string $tag;
public array $accounts;

/**
* Label for the tag.
Expand All @@ -24,10 +23,10 @@ class AccountTagInformation
public string $label;

/**
* @var int[] List of tagged account indices.
* Filter tag.
*/
#[Json]
public array $accounts;
public string $tag;


/**
Expand Down
7 changes: 1 addition & 6 deletions src/Model/AddressBookEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ class AddressBookEntry
#[Json]
public int $index;

#[Json('payment_id')]
public string $paymentId;


public function __construct(string $address, string $description, int $index, string $paymentId)
public function __construct(string $address, string $description, int $index)
{
$this->address = $address;
$this->description = $description;
$this->index = $index;
$this->paymentId = $paymentId;
}
}
2 changes: 1 addition & 1 deletion src/Model/BlockHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class BlockHeader
public string $prevHash;

/**
* The amount of new @atomic-units generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 @atomic-units.
* The amount of new piconero generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 piconero.
*/
#[Json]
public int $reward;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Histogram.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Histogram
use JsonSerialize;

/**
* Output amount in @atomic-units
* Output amount in piconero
*/
#[Json]
public int $amount;
Expand Down
19 changes: 19 additions & 0 deletions src/Model/KeyImageList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace RefRing\MoneroRpcPhp\Model;

use Square\Pjson\Json;
use Square\Pjson\JsonSerialize;

class KeyImageList
{
use JsonSerialize;

/**
* @var string[]
*/
#[Json('key_images')]
public array $keyImages;
}
38 changes: 23 additions & 15 deletions src/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@ class Payment
use JsonSerialize;

/**
* Payment ID matching the input parameter.
* Address receiving the payment; Base58 representation of the public keys.
*/
#[Json('payment_id')]
public string $paymentId;

/**
* Transaction hash used as the transaction ID.
*/
#[Json('tx_hash')]
public string $txHash;
#[Json]
public Address $address;

/**
* Amount for this payment.
Expand All @@ -35,6 +29,24 @@ class Payment
#[Json('block_height')]
public int $blockHeight;

/**
* Payment ID matching the input parameter.
*/
#[Json('payment_id')]
public string $paymentId;

/**
* JSON object containing the major & minor subaddress index:
*/
#[Json('subaddr_index')]
public SubAddressIndex $subaddrIndex;

/**
* Transaction hash used as the transaction ID.
*/
#[Json('tx_hash')]
public string $txHash;

/**
* Time (in block height) until this payment is safe to spend.
*/
Expand All @@ -47,12 +59,6 @@ class Payment
#[Json]
public bool $locked;

/**
* JSON object containing the major & minor subaddress index:
*/
#[Json('subaddr_index')]
public SubAddressIndex $subaddrIndex;


public function __construct(
string $paymentId,
Expand All @@ -62,6 +68,7 @@ public function __construct(
int $unlockTime,
bool $locked,
SubAddressIndex $subaddrIndex,
Address $address
) {
$this->paymentId = $paymentId;
$this->txHash = $txHash;
Expand All @@ -70,5 +77,6 @@ public function __construct(
$this->unlockTime = $unlockTime;
$this->locked = $locked;
$this->subaddrIndex = $subaddrIndex;
$this->address = $address;
}
}
2 changes: 1 addition & 1 deletion src/Model/PaymentUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PaymentUri
public string $address;

/**
* Integer amount to receive, in **@atomic-units** (0 if not provided)
* Integer amount to receive, in **piconero** (0 if not provided)
*/
#[Json]
public int $amount;
Expand Down
4 changes: 2 additions & 2 deletions src/Model/TransferDestination.php → src/Model/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Square\Pjson\Json;
use Square\Pjson\JsonSerialize;

class TransferDestination
class Recipient
{
use JsonSerialize;

/**
* Amount to send to each destination, in @atomic-units.
* Amount to send to each destination, in piconero.
*/
#[Json]
public int $amount;
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Transfer
public string $note;

/**
* @var TransferDestination[] array of JSON objects containing transfer destinations: (only for outgoing transactions):
* @var Recipient[] array of JSON objects containing transfer destinations: (only for outgoing transactions):
*/
#[Json]
public array $destinations;
Expand Down Expand Up @@ -125,13 +125,13 @@ class Transfer
/**
* @param string $address
* @param int $amount
* @param int $amounts
* @param int[] $amounts
* @param int $confirmations
* @param bool $doubleSpendSeen
* @param int $fee
* @param int $height
* @param string $note
* @param TransferDestination[] $destinations
* @param Recipient[] $destinations
* @param string $paymentId
* @param SubAddressIndex $subaddrIndex
* @param SubAddressIndex[] $subaddrIndices
Expand All @@ -142,7 +142,7 @@ class Transfer
* @param bool $locked
* @param TransferType $type
*/
public function __construct(string $address, int $amount, int $amounts, int $confirmations, bool $doubleSpendSeen, int $fee, int $height, string $note, array $destinations, string $paymentId, SubAddressIndex $subaddrIndex, array $subaddrIndices, int $suggestedConfirmationsThreshold, int $timestamp, string $txid, int $unlockTime, bool $locked, TransferType $type)
public function __construct(string $address, int $amount, array $amounts, int $confirmations, bool $doubleSpendSeen, int $fee, int $height, string $note, array $destinations, string $paymentId, SubAddressIndex $subaddrIndex, array $subaddrIndices, int $suggestedConfirmationsThreshold, int $timestamp, string $txid, int $unlockTime, bool $locked, TransferType $type)
{
$this->address = $address;
$this->amount = $amount;
Expand Down
Loading

0 comments on commit c9161c0

Please sign in to comment.