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 #17 from trustenterprises/feature/inscriptions-php
Inscription Implementation for Laravel/PHP
- Loading branch information
Showing
15 changed files
with
940 additions
and
8 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,37 @@ | ||
<?php | ||
|
||
namespace Trustenterprises\LaravelHashgraph\Contracts; | ||
|
||
use Trustenterprises\LaravelHashgraph\Models\Inscriptions\BurnInscription; | ||
use Trustenterprises\LaravelHashgraph\Models\Inscriptions\DeployInscription; | ||
use Trustenterprises\LaravelHashgraph\Models\Inscriptions\MintInscription; | ||
use Trustenterprises\LaravelHashgraph\Models\Inscriptions\InscriptionResponse; | ||
use Trustenterprises\LaravelHashgraph\Models\Inscriptions\TransferInscription; | ||
|
||
interface InscriptionMethodInterface | ||
{ | ||
/** | ||
* @param DeployInscription $request | ||
* | ||
* @return InscriptionResponse | ||
*/ | ||
public function deployInscription(DeployInscription $request): InscriptionResponse; | ||
|
||
/** | ||
* @param MintInscription $request | ||
* @return InscriptionResponse | ||
*/ | ||
public function mintInscription(MintInscription $request): InscriptionResponse; | ||
|
||
/** | ||
* @param BurnInscription $request | ||
* @return InscriptionResponse | ||
*/ | ||
public function burnInscription(BurnInscription $request): InscriptionResponse; | ||
|
||
/** | ||
* @param TransferInscription $request | ||
* @return InscriptionResponse | ||
*/ | ||
public function transferInscription(TransferInscription $request): InscriptionResponse; | ||
} |
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,130 @@ | ||
<?php | ||
|
||
namespace Trustenterprises\LaravelHashgraph\Models\Inscriptions; | ||
|
||
use GuzzleHttp\RequestOptions; | ||
|
||
class BurnInscription | ||
{ | ||
private String $from; | ||
|
||
private int $amount; | ||
|
||
private String $ticker; | ||
|
||
private ?String $memo = null; | ||
|
||
private ?String $topic_id = null; | ||
|
||
/** | ||
* FungibleToken constructor. | ||
* @param string $ticker | ||
* @param string $from | ||
* @param int $amount | ||
*/ | ||
public function __construct(string $ticker, string $from, int $amount) | ||
{ | ||
$this->ticker = $ticker; | ||
$this->from = $from; | ||
$this->amount = $amount; | ||
} | ||
|
||
public function forRequest(): array | ||
{ | ||
$payload = [ | ||
'from' => $this->getFrom(), | ||
'amount' => $this->getAmount(), | ||
]; | ||
|
||
if ($this->getMemo()) { | ||
$payload['memo'] = $this->getMemo(); | ||
} | ||
|
||
if ($this->getPrivateTopicId()) { | ||
$payload['topic_id'] = $this->getPrivateTopicId(); | ||
} | ||
|
||
return [ RequestOptions::JSON => $payload ]; | ||
} | ||
|
||
/** | ||
* @return String|string | ||
*/ | ||
public function getTicker() | ||
{ | ||
return $this->ticker; | ||
} | ||
|
||
/** | ||
* @param String|string $ticker | ||
*/ | ||
public function setTicker($ticker): void | ||
{ | ||
$this->ticker = $ticker; | ||
} | ||
|
||
/** | ||
* @return null|string | ||
*/ | ||
public function getMemo(): string|null | ||
{ | ||
return $this->memo; | ||
} | ||
|
||
/** | ||
* @param String $memo | ||
*/ | ||
public function setMemo($memo): void | ||
{ | ||
$this->memo = $memo; | ||
} | ||
|
||
/** | ||
* @return null|string | ||
*/ | ||
public function getPrivateTopicId(): string|null | ||
{ | ||
return $this->topic_id; | ||
} | ||
|
||
/** | ||
* @param String $topic_id | ||
*/ | ||
public function setPrivateTopic($topic_id): void | ||
{ | ||
$this->topic_id = $topic_id; | ||
} | ||
|
||
/** | ||
* @return string|string | ||
*/ | ||
public function getFrom() | ||
{ | ||
return $this->from; | ||
} | ||
|
||
/** | ||
* @param string|string $from | ||
*/ | ||
public function setFrom($from): void | ||
{ | ||
$this->from = $from; | ||
} | ||
|
||
/** | ||
* @return int|int | ||
*/ | ||
public function getAmount() | ||
{ | ||
return $this->amount; | ||
} | ||
|
||
/** | ||
* @param int|int $amount | ||
*/ | ||
public function setAmount($amount): void | ||
{ | ||
$this->amount = $amount; | ||
} | ||
} | ||
|
Oops, something went wrong.