generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #12 from trustenterprises/feature-client-staking-s…
…upport Laravel client - API staking support
- Loading branch information
Showing
7 changed files
with
294 additions
and
1 deletion.
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,59 @@ | ||
<?php | ||
|
||
namespace Trustenterprises\LaravelHashgraph\Models; | ||
|
||
class AccountTokenBalanceResponse | ||
{ | ||
|
||
private String $token_id; | ||
|
||
private int $amount; | ||
|
||
private int $decimals; | ||
|
||
private String $raw_amount; | ||
|
||
/** | ||
* ConsensusMessageResponse constructor, using the http response contents body object | ||
* @param object $response | ||
*/ | ||
public function __construct(object $response) | ||
{ | ||
$this->token_id = $response->token_id; | ||
$this->amount = $response->amount; | ||
$this->decimals = $response->decimals; | ||
$this->raw_amount = $response->raw_amount; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getAmount(): int | ||
{ | ||
return $this->amount; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getTokenId(): string | ||
{ | ||
return $this->token_id; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getDecimals(): int | ||
{ | ||
return $this->decimals; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getRawAmount(): string | ||
{ | ||
return $this->raw_amount; | ||
} | ||
} |
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,59 @@ | ||
<?php | ||
|
||
namespace Trustenterprises\LaravelHashgraph\Models; | ||
|
||
class SendToken | ||
{ | ||
private String $token_id; | ||
|
||
private String $receiver_id; | ||
|
||
private String $amount; | ||
|
||
/** | ||
* SendToken constructor. | ||
* | ||
* @param String $token_id | ||
* @param String $receiver_id | ||
* @param String $amount | ||
*/ | ||
public function __construct(string $token_id, string $receiver_id, string $amount) | ||
{ | ||
$this->token_id = $token_id; | ||
$this->receiver_id = $receiver_id; | ||
$this->amount = $amount; | ||
} | ||
|
||
public function forRequest(): array | ||
{ | ||
return [ | ||
'token_id' => $this->getTokenId(), | ||
'receiver_id' => $this->getReceiverId(), | ||
'amount' => $this->getAmount(), | ||
]; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getTokenId(): string | ||
{ | ||
return $this->token_id; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getReceiverId(): string | ||
{ | ||
return $this->receiver_id; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAmount(): string | ||
{ | ||
return $this->amount; | ||
} | ||
} |
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,71 @@ | ||
<?php | ||
|
||
namespace Trustenterprises\LaravelHashgraph\Models; | ||
|
||
class SendTokenResponse | ||
{ | ||
private String $amount = ''; | ||
|
||
private String $receiver_id = ''; | ||
|
||
private String $transaction_id = ''; | ||
|
||
private String $error = ''; | ||
|
||
private bool $transfer_success = false; | ||
|
||
/** | ||
* @param object $response | ||
*/ | ||
public function __construct(object $response) | ||
{ | ||
if (property_exists($response, 'error')) { | ||
$this->error = $response->error; | ||
} else { | ||
$this->transfer_success = true; | ||
$this->amount = $response->amount; | ||
$this->receiver_id = $response->receiver_id; | ||
$this->transaction_id = $response->transaction_id; | ||
} | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function hasTransferSucceeded(): bool | ||
{ | ||
return $this->transfer_success; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getError(): string | ||
{ | ||
return $this->error; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getAmount(): string | ||
{ | ||
return $this->amount; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getReceiverId(): string | ||
{ | ||
return $this->receiver_id; | ||
} | ||
|
||
/** | ||
* @return String | ||
*/ | ||
public function getTransactionId(): string | ||
{ | ||
return $this->transaction_id; | ||
} | ||
} |
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