1: <?php declare( strict_types = 1 );
2:
3: namespace Waves\Transactions;
4:
5: use Waves\Account\PublicKey;
6:
7: class Transaction extends TransactionOrOrder
8: {
9: private int $type;
10:
11: function type(): int
12: {
13: if( !isset( $this->type ) )
14: $this->type = $this->json->get( 'type' )->asInt();
15: return $this->type;
16: }
17:
18: /**
19: * @return mixed
20: */
21: function setType( int $type )
22: {
23: $this->type = $type;
24: $this->json->put( 'type', $type );
25: return $this;
26: }
27:
28: protected function setBase( PublicKey $sender, int $type, int $version, int $minFee ): void
29: {
30: $this->setSender( $sender );
31: $this->setType( $type );
32: $this->setVersion( $version );
33: $this->setFee( Amount::of( $minFee ) );
34:
35: $this->setChainId();
36: $this->setTimestamp();
37: $this->setProofs();
38: }
39:
40: function getProtobufTransactionBase(): \Waves\Protobuf\Transaction
41: {
42: $pb_Transaction = new \Waves\Protobuf\Transaction();
43: $pb_Transaction->setSenderPublicKey( $this->sender()->bytes() );
44: $pb_Transaction->setVersion( $this->version() );
45: $pb_Transaction->setFee( $this->fee()->toProtobuf() );
46: $pb_Transaction->setChainId( $this->chainId()->asInt() );
47: $pb_Transaction->setTimestamp( $this->timestamp() );
48:
49: return $pb_Transaction;
50: }
51: }
52: