update protocol and transaction models to work with new protocol

This commit is contained in:
Dario Rekowski on RockPI 2021-04-09 18:09:19 +00:00
parent a37d844c1d
commit c5e849c79d
22 changed files with 173 additions and 393 deletions

View File

@ -30,9 +30,9 @@
"autoload": {
"psr-4": {
"App\\": "src/",
"" : "src/",
"GPBMetadata\\": "src/GPBMetadata",
"Model\\Messages\\Gradido\\" : "src/Model/Messages/Gradido"
"" : "src/",
"GPBMetadata\\Gradido\\": "src/Model/Messages/GPBMetadata/Gradido/",
"Proto\\Gradido\\" : "src/Model/Messages/Proto/Gradido/"
}
},
"autoload-dev": {

View File

@ -5003,16 +5003,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
"version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"shasum": ""
},
"require": {
@ -5055,7 +5055,7 @@
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2020-10-23T02:01:07+00:00"
"time": "2021-04-09T00:54:41+00:00"
},
{
"name": "symfony/finder",

View File

@ -1,41 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: BasicTypes.proto
namespace GPBMetadata;
class BasicTypes
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0afe030a10426173696354797065732e70726f746f12166d6f64656c2e6d" .
"657373616765732e6772616469646f22380a034b657912110a0765643235" .
"35313918022001280c480012170a0d656432353531395f72656631301803" .
"2001280c480042050a036b657922580a0d5369676e617475726550616972" .
"120e0a067075624b657918012001280c12110a0765643235353139180220" .
"01280c480012170a0d656432353531395f726566313018032001280c4800" .
"420b0a097369676e617475726522460a0c5369676e61747572654d617012" .
"360a077369675061697218012003280b32252e6d6f64656c2e6d65737361" .
"6765732e6772616469646f2e5369676e617475726550616972222b0a0954" .
"696d657374616d70120f0a077365636f6e6473180120012803120d0a056e" .
"616e6f7318022001280522230a1054696d657374616d705365636f6e6473" .
"120f0a077365636f6e647318012001280322590a0c53656e646572416d6f" .
"756e74121d0a15656432353531395f73656e6465725f7075626b65791801" .
"2001280c120e0a06616d6f756e74180220012812121a0a1273656e646572" .
"46696e616c42616c616e636518032001281222410a0e5265636569766572" .
"416d6f756e74121f0a17656432353531395f72656365697665725f707562" .
"6b657918012001280c120e0a06616d6f756e74180220012812620670726f" .
"746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,32 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: StateCreateGroup.proto
namespace GPBMetadata;
class StateCreateGroup
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0ae4010a16537461746543726561746547726f75702e70726f746f12166d" .
"6f64656c2e6d657373616765732e6772616469646f22a9010a1053746174" .
"6543726561746547726f7570120c0a046e616d6518012001280912330a0e" .
"67726f75705075626c69634b657918022001280b321b2e6d6f64656c2e6d" .
"657373616765732e6772616469646f2e4b657912390a14706172656e7447" .
"726f75705075626c69634b657918032001280b321b2e6d6f64656c2e6d65" .
"7373616765732e6772616469646f2e4b65794a0408041005521168656465" .
"7261436f6e73656e7375734964620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,33 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: StateGroupChangeParent.proto
namespace GPBMetadata;
class StateGroupChangeParent
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0a8a020a1c537461746547726f75704368616e6765506172656e742e7072" .
"6f746f12166d6f64656c2e6d657373616765732e6772616469646f22c901" .
"0a16537461746547726f75704368616e6765506172656e7412330a0e6772" .
"6f75705075626c69634b657918012001280b321b2e6d6f64656c2e6d6573" .
"73616765732e6772616469646f2e4b6579123c0a176e6577506172656e74" .
"47726f75705075626c69634b657918022001280b321b2e6d6f64656c2e6d" .
"657373616765732e6772616469646f2e4b6579123c0a176f6c6450617265" .
"6e7447726f75705075626c69634b657918032001280b321b2e6d6f64656c" .
"2e6d657373616765732e6772616469646f2e4b6579620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,32 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Transaction.proto
namespace GPBMetadata;
class Transaction
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0ae4010a115472616e73616374696f6e2e70726f746f12166d6f64656c2e" .
"6d657373616765732e6772616469646f22ae010a0b5472616e7361637469" .
"6f6e120a0a026964180120012804123a0a08726563656976656418022001" .
"280b32282e6d6f64656c2e6d657373616765732e6772616469646f2e5469" .
"6d657374616d705365636f6e647312340a067369674d617018032001280b" .
"32242e6d6f64656c2e6d657373616765732e6772616469646f2e5369676e" .
"61747572654d6170120e0a0674784861736818042001280c12110a09626f" .
"6479427974657318052001280c620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,46 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: TransactionBody.proto
namespace GPBMetadata;
class TransactionBody
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\Transfer::initOnce();
\GPBMetadata\StateCreateGroup::initOnce();
\GPBMetadata\StateGroupChangeParent::initOnce();
\GPBMetadata\TransactionCreation::initOnce();
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0a84040a155472616e73616374696f6e426f64792e70726f746f12166d6f" .
"64656c2e6d657373616765732e6772616469646f1a165374617465437265" .
"61746547726f75702e70726f746f1a1c537461746547726f75704368616e" .
"6765506172656e742e70726f746f1a195472616e73616374696f6e437265" .
"6174696f6e2e70726f746f1a10426173696354797065732e70726f746f22" .
"e7020a0f5472616e73616374696f6e426f6479120c0a046d656d6f180120" .
"01280912390a076372656174656418022001280b32282e6d6f64656c2e6d" .
"657373616765732e6772616469646f2e54696d657374616d705365636f6e" .
"6473123f0a0b63726561746547726f757018062001280b32282e6d6f6465" .
"6c2e6d657373616765732e6772616469646f2e5374617465437265617465" .
"47726f75704800124b0a1167726f75704368616e6765506172656e741807" .
"2001280b322e2e6d6f64656c2e6d657373616765732e6772616469646f2e" .
"537461746547726f75704368616e6765506172656e74480012340a087472" .
"616e7366657218082001280b32202e6d6f64656c2e6d657373616765732e" .
"6772616469646f2e5472616e736665724800123f0a086372656174696f6e" .
"18092001280b322b2e6d6f64656c2e6d657373616765732e677261646964" .
"6f2e5472616e73616374696f6e4372656174696f6e480042060a04646174" .
"61620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,32 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: TransactionCreation.proto
namespace GPBMetadata;
class TransactionCreation
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0ae6010a195472616e73616374696f6e4372656174696f6e2e70726f746f" .
"12166d6f64656c2e6d657373616765732e6772616469646f22a8010a1354" .
"72616e73616374696f6e4372656174696f6e123e0a0e7265636569766572" .
"416d6f756e7418012001280b32262e6d6f64656c2e6d657373616765732e" .
"6772616469646f2e5265636569766572416d6f756e7412120a0a6964656e" .
"745f68617368180220012811123d0a0b7461726765745f64617465180320" .
"01280b32282e6d6f64656c2e6d657373616765732e6772616469646f2e54" .
"696d657374616d705365636f6e6473620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -1,31 +0,0 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Transfer.proto
namespace GPBMetadata;
class Transfer
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\BasicTypes::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0abb010a0e5472616e736665722e70726f746f12166d6f64656c2e6d6573" .
"73616765732e6772616469646f2288010a085472616e73666572123b0a0d" .
"73656e646572416d6f756e747318012003280b32242e6d6f64656c2e6d65" .
"7373616765732e6772616469646f2e53656e646572416d6f756e74123f0a" .
"0f7265636569766572416d6f756e747318022003280b32262e6d6f64656c" .
"2e6d657373616765732e6772616469646f2e5265636569766572416d6f75" .
"6e74620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -59,8 +59,8 @@ class StateBalance extends Entity
if($decay_duration === 0) {
return $this->amount;
}
return $this->amount;
//return $this->amount * pow(0.99999997802044727, $decay_duration);
//return $this->amount;
return $this->amount * pow(0.99999997802044727, $decay_duration);
}
public function partDecay($target_date)
@ -69,8 +69,8 @@ class StateBalance extends Entity
if($decay_duration <= 0) {
return $this->amount;
}
return 0;
//return $this->amount * pow(0.99999997802044727, $decay_duration);
//return 0;
return $this->amount * pow(0.99999997802044727, $decay_duration);
}
public function decayDuration($target_date)

View File

@ -22,9 +22,9 @@ class Key extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $ed25519
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
* @type string $ed25519_ref10
* ed25519 ref10 signature
* ed25519 ref10 signature
* }
*/
public function __construct($data = NULL) {
@ -33,7 +33,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
*
* Generated from protobuf field <code>bytes ed25519 = 2;</code>
* @return string
@ -44,7 +44,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
*
* Generated from protobuf field <code>bytes ed25519 = 2;</code>
* @param string $var
@ -59,7 +59,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 ref10 signature
* ed25519 ref10 signature
*
* Generated from protobuf field <code>bytes ed25519_ref10 = 3;</code>
* @return string
@ -70,7 +70,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 ref10 signature
* ed25519 ref10 signature
*
* Generated from protobuf field <code>bytes ed25519_ref10 = 3;</code>
* @param string $var

View File

@ -14,7 +14,7 @@ use Google\Protobuf\Internal\GPBUtil;
class SignatureMap extends \Google\Protobuf\Internal\Message
{
/**
* Each signature pair corresponds to a unique Key required to sign the transaction.
* Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field <code>repeated .proto.gradido.SignaturePair sigPair = 1;</code>
*/
@ -27,7 +27,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type \Proto\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $sigPair
* Each signature pair corresponds to a unique Key required to sign the transaction.
* Each signature pair corresponds to a unique Key required to sign the transaction.
* }
*/
public function __construct($data = NULL) {
@ -36,7 +36,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
* Each signature pair corresponds to a unique Key required to sign the transaction.
* Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field <code>repeated .proto.gradido.SignaturePair sigPair = 1;</code>
* @return \Google\Protobuf\Internal\RepeatedField
@ -47,7 +47,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
* Each signature pair corresponds to a unique Key required to sign the transaction.
* Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field <code>repeated .proto.gradido.SignaturePair sigPair = 1;</code>
* @param \Proto\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $var

View File

@ -27,9 +27,9 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
*
* @type string $pubKey
* @type string $ed25519
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
* @type string $ed25519_ref10
* ed25519 ref10 signature
* ed25519 ref10 signature
* }
*/
public function __construct($data = NULL) {
@ -60,7 +60,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
*
* Generated from protobuf field <code>bytes ed25519 = 2;</code>
* @return string
@ -71,7 +71,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 signature (libsodium default)
* ed25519 signature (libsodium default)
*
* Generated from protobuf field <code>bytes ed25519 = 2;</code>
* @param string $var
@ -86,7 +86,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 ref10 signature
* ed25519 ref10 signature
*
* Generated from protobuf field <code>bytes ed25519_ref10 = 3;</code>
* @return string
@ -97,7 +97,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
* ed25519 ref10 signature
* ed25519 ref10 signature
*
* Generated from protobuf field <code>bytes ed25519_ref10 = 3;</code>
* @param string $var

View File

@ -16,13 +16,13 @@ use Google\Protobuf\Internal\GPBUtil;
class Timestamp extends \Google\Protobuf\Internal\Message
{
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
*/
private $seconds = 0;
/**
* Number of nanoseconds since the start of the last second
* Number of nanoseconds since the start of the last second
*
* Generated from protobuf field <code>int32 nanos = 2;</code>
*/
@ -35,9 +35,9 @@ class Timestamp extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
* @type int $nanos
* Number of nanoseconds since the start of the last second
* Number of nanoseconds since the start of the last second
* }
*/
public function __construct($data = NULL) {
@ -46,7 +46,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
* @return int|string
@ -57,7 +57,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
* @param int|string $var
@ -72,7 +72,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
* Number of nanoseconds since the start of the last second
* Number of nanoseconds since the start of the last second
*
* Generated from protobuf field <code>int32 nanos = 2;</code>
* @return int
@ -83,7 +83,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
* Number of nanoseconds since the start of the last second
* Number of nanoseconds since the start of the last second
*
* Generated from protobuf field <code>int32 nanos = 2;</code>
* @param int $var

View File

@ -16,7 +16,7 @@ use Google\Protobuf\Internal\GPBUtil;
class TimestampSeconds extends \Google\Protobuf\Internal\Message
{
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
*/
@ -29,7 +29,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
* }
*/
public function __construct($data = NULL) {
@ -38,7 +38,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
* @return int|string
@ -49,7 +49,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
* Number of complete seconds since the start of the epoch
* Number of complete seconds since the start of the epoch
*
* Generated from protobuf field <code>int64 seconds = 1;</code>
* @param int|string $var

View File

@ -20,7 +20,11 @@ class TransactionBody extends \Google\Protobuf\Internal\Message
*/
private $memo = '';
/**
* Generated from protobuf field <code>uint64 version_number = 6;</code>
* Generated from protobuf field <code>.proto.gradido.TimestampSeconds created = 2;</code>
*/
private $created = null;
/**
* Generated from protobuf field <code>uint64 version_number = 3;</code>
*/
private $version_number = 0;
protected $data;
@ -33,11 +37,12 @@ class TransactionBody extends \Google\Protobuf\Internal\Message
*
* @type string $memo
* max 150 chars
* @type \Proto\Gradido\TimestampSeconds $created
* @type int|string $version_number
* @type \Proto\Gradido\GradidoTransfer $transfer
* @type \Proto\Gradido\GradidoCreation $creation
* @type \Proto\Gradido\GroupFriendsUpdate $group_friends_update
* @type \Proto\Gradido\GroupMemberUpdate $group_member_update
* @type int|string $version_number
* }
*/
public function __construct($data = NULL) {
@ -72,95 +77,29 @@ class TransactionBody extends \Google\Protobuf\Internal\Message
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoTransfer transfer = 2;</code>
* @return \Proto\Gradido\GradidoTransfer
* Generated from protobuf field <code>.proto.gradido.TimestampSeconds created = 2;</code>
* @return \Proto\Gradido\TimestampSeconds
*/
public function getTransfer()
public function getCreated()
{
return $this->readOneof(2);
return $this->created;
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoTransfer transfer = 2;</code>
* @param \Proto\Gradido\GradidoTransfer $var
* Generated from protobuf field <code>.proto.gradido.TimestampSeconds created = 2;</code>
* @param \Proto\Gradido\TimestampSeconds $var
* @return $this
*/
public function setTransfer($var)
public function setCreated($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GradidoTransfer::class);
$this->writeOneof(2, $var);
GPBUtil::checkMessage($var, \Proto\Gradido\TimestampSeconds::class);
$this->created = $var;
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoCreation creation = 3;</code>
* @return \Proto\Gradido\GradidoCreation
*/
public function getCreation()
{
return $this->readOneof(3);
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoCreation creation = 3;</code>
* @param \Proto\Gradido\GradidoCreation $var
* @return $this
*/
public function setCreation($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GradidoCreation::class);
$this->writeOneof(3, $var);
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupFriendsUpdate group_friends_update = 4;</code>
* @return \Proto\Gradido\GroupFriendsUpdate
*/
public function getGroupFriendsUpdate()
{
return $this->readOneof(4);
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupFriendsUpdate group_friends_update = 4;</code>
* @param \Proto\Gradido\GroupFriendsUpdate $var
* @return $this
*/
public function setGroupFriendsUpdate($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GroupFriendsUpdate::class);
$this->writeOneof(4, $var);
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupMemberUpdate group_member_update = 5;</code>
* @return \Proto\Gradido\GroupMemberUpdate
*/
public function getGroupMemberUpdate()
{
return $this->readOneof(5);
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupMemberUpdate group_member_update = 5;</code>
* @param \Proto\Gradido\GroupMemberUpdate $var
* @return $this
*/
public function setGroupMemberUpdate($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GroupMemberUpdate::class);
$this->writeOneof(5, $var);
return $this;
}
/**
* Generated from protobuf field <code>uint64 version_number = 6;</code>
* Generated from protobuf field <code>uint64 version_number = 3;</code>
* @return int|string
*/
public function getVersionNumber()
@ -169,7 +108,7 @@ class TransactionBody extends \Google\Protobuf\Internal\Message
}
/**
* Generated from protobuf field <code>uint64 version_number = 6;</code>
* Generated from protobuf field <code>uint64 version_number = 3;</code>
* @param int|string $var
* @return $this
*/
@ -181,6 +120,94 @@ class TransactionBody extends \Google\Protobuf\Internal\Message
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoTransfer transfer = 6;</code>
* @return \Proto\Gradido\GradidoTransfer
*/
public function getTransfer()
{
return $this->readOneof(6);
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoTransfer transfer = 6;</code>
* @param \Proto\Gradido\GradidoTransfer $var
* @return $this
*/
public function setTransfer($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GradidoTransfer::class);
$this->writeOneof(6, $var);
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoCreation creation = 7;</code>
* @return \Proto\Gradido\GradidoCreation
*/
public function getCreation()
{
return $this->readOneof(7);
}
/**
* Generated from protobuf field <code>.proto.gradido.GradidoCreation creation = 7;</code>
* @param \Proto\Gradido\GradidoCreation $var
* @return $this
*/
public function setCreation($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GradidoCreation::class);
$this->writeOneof(7, $var);
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupFriendsUpdate group_friends_update = 8;</code>
* @return \Proto\Gradido\GroupFriendsUpdate
*/
public function getGroupFriendsUpdate()
{
return $this->readOneof(8);
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupFriendsUpdate group_friends_update = 8;</code>
* @param \Proto\Gradido\GroupFriendsUpdate $var
* @return $this
*/
public function setGroupFriendsUpdate($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GroupFriendsUpdate::class);
$this->writeOneof(8, $var);
return $this;
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupMemberUpdate group_member_update = 9;</code>
* @return \Proto\Gradido\GroupMemberUpdate
*/
public function getGroupMemberUpdate()
{
return $this->readOneof(9);
}
/**
* Generated from protobuf field <code>.proto.gradido.GroupMemberUpdate group_member_update = 9;</code>
* @param \Proto\Gradido\GroupMemberUpdate $var
* @return $this
*/
public function setGroupMemberUpdate($var)
{
GPBUtil::checkMessage($var, \Proto\Gradido\GroupMemberUpdate::class);
$this->writeOneof(9, $var);
return $this;
}
/**
* @return string
*/

View File

@ -29,12 +29,12 @@ class SignatureMap {
static public function fromEntity($transactionSignatures)
{
$protoSigMap = new \Model\Messages\Proto\Gradido\SignatureMap();
$protoSigMap = new \Proto\Gradido\SignatureMap();
$sigPairs = $protoSigMap->getSigPair();
//echo "sigPairs: "; var_dump($sigPairs); echo "<br>";
//return null;
foreach($transactionSignatures as $signature) {
$sigPair = new \Model\Messages\Proto\Gradido\SignaturePair();
$sigPair = new \Proto\Gradido\SignaturePair();
$sigPair->setPubKey(stream_get_contents($signature->pubkey));
$sigPair->setEd25519(stream_get_contents($signature->signature));
@ -46,14 +46,14 @@ class SignatureMap {
static public function build($bodyBytes, array $keys)
{
$protoSigMap = new \Model\Messages\Proto\Gradido\SignatureMap();
$protoSigMap = new \Proto\Gradido\SignatureMap();
$sigPairs = $protoSigMap->getSigPair();
//echo "sigPairs: "; var_dump($sigPairs); echo "<br>";
//return null;
// sign with keys
foreach($keys as $key) {
$sigPair = new \Model\Messages\Proto\Gradido\SignaturePair();
$sigPair = new \Proto\Gradido\SignaturePair();
$sigPair->setPubKey(hex2bin($key['pub']));
$sigPair->setEd25519(sodium_crypto_sign_detached($bodyBytes, hex2bin($key['priv'])));

View File

@ -25,7 +25,7 @@ class Transaction extends TransactionBase {
//$transactionBin = base64_decode($base64Data, true);
//if($transactionBin == false) {
//sodium_base64_VARIANT_URLSAFE_NO_PADDING
if(is_a($base64Data, '\Model\Messages\Proto\Gradido\Transaction')) {
if(is_a($base64Data, '\Proto\Gradido\Transaction')) {
$this->mProtoTransaction = $base64Data;
$this->mTransactionBody = new TransactionBody($this->mProtoTransaction->getBodyBytes());
return;
@ -50,7 +50,7 @@ class Transaction extends TransactionBase {
$this->addError('Transaction', 'base64 decode error: ' . $base64Data);
} else {
//var_dump($transactionBin);
$this->mProtoTransaction = new \Model\Messages\Proto\Gradido\Transaction();
$this->mProtoTransaction = new \Proto\Gradido\GradidoTransaction();
try {
$this->mProtoTransaction->mergeFromString($transactionBin);
//var_dump($this->mProtoTransaction);
@ -70,11 +70,11 @@ class Transaction extends TransactionBase {
}
}
static public function build(\Model\Messages\Proto\Gradido\TransactionBody $transactionBody, $senderKeyPair)
static public function build(\Proto\Gradido\TransactionBody $transactionBody, $senderKeyPair)
{
$protoTransaction = new \Model\Messages\Proto\Gradido\Transaction();
$protoTransaction = new \Proto\Gradido\GradidoTransaction();
$recevied = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$recevied = new \Proto\Gradido\TimestampSeconds();
$recevied->setSeconds(time());
$protoTransaction->setReceived($recevied);
@ -198,14 +198,14 @@ class Transaction extends TransactionBase {
'TransactionSignatures'])
->first();
//var_dump($transactionEntry->toArray());
$protoTransaction = new \Model\Messages\Proto\Gradido\Transaction();
$protoTransaction = new \Proto\Gradido\Transaction();
$protoTransaction->setId($transactionEntry->id);
$recevied = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$recevied = new \Proto\Gradido\TimestampSeconds();
$recevied->setSeconds($transactionEntry->received->getTimestamp());
$protoTransaction->setReceived($recevied);
@ -229,7 +229,7 @@ class Transaction extends TransactionBase {
}
//echo "verify bodybytes: <br>" . bin2hex($bodyBytes) . '<br>';
$created = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$created = new \Proto\Gradido\TimestampSeconds();
$created->setSeconds($recevied->getSeconds());
$body->setCreated($created);
$bodyBytes = $body->serializeToString();

View File

@ -12,7 +12,7 @@ class TransactionBody extends TransactionBase {
private $transactionTypeId = 0;
public function __construct($bodyBytes) {
$this->mProtoTransactionBody = new \Model\Messages\Proto\Gradido\TransactionBody();
$this->mProtoTransactionBody = new \Proto\Gradido\TransactionBody();
try {
$this->mProtoTransactionBody->mergeFromString($bodyBytes);
// cannot catch Exception with cakePHP, I don't know why
@ -155,7 +155,7 @@ class TransactionBody extends TransactionBase {
static public function fromEntity($memo, $transaction)
{
$protoBody = new \Model\Messages\Proto\Gradido\TransactionBody();
$protoBody = new \Proto\Gradido\TransactionBody();
$protoBody->setMemo($memo);
//$created->setSeconds($var);
@ -176,7 +176,7 @@ class TransactionBody extends TransactionBase {
static public function build($memo, $specificTransaction)
{
$protoBody = new \Model\Messages\Proto\Gradido\TransactionBody();
$protoBody = new \Proto\Gradido\TransactionBody();
$protoBody->setMemo($memo);
if(is_a($specificTransaction, 'TransactionCreation')) {

View File

@ -28,7 +28,7 @@ class TransactionCreation extends TransactionBase {
static public function build($amount, $memo, $receiver_public_hex, $targetDate = null)
{
$receiver = new \Model\Messages\Proto\Gradido\TransferAmount();
$receiver = new \Proto\Gradido\TransferAmount();
$receiver->setAmount($amount);
//$this->receiver_pubkey_hex = $receiver_public_hex;
if(strlen($receiver_public_hex) != 64) {
@ -38,10 +38,10 @@ class TransactionCreation extends TransactionBase {
$receiver->setPubkey($pubKeyBin);
//var_dump($requestData);
$creationDate = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$creationDate = new \Proto\Gradido\TimestampSeconds();
$creationDate->setSeconds(time());
$transactionBody = new \Model\Messages\Proto\Gradido\TransactionBody();
$transactionBody = new \Proto\Gradido\TransactionBody();
$transactionBody->setMemo($memo);
$transactionBody->setCreated($creationDate);
@ -52,7 +52,7 @@ class TransactionCreation extends TransactionBase {
//var_dump($targetDate);
//die('die');
if($targetDate) {
$targetDateTimestamp = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$targetDateTimestamp = new \Proto\Gradido\TimestampSeconds();
$targetDateTimestamp->setSeconds($targetDate->getTimestamp());
//var_dump($targetDateTimestamp); die('target');
$transaction->setTargetDate($targetDateTimestamp);
@ -209,7 +209,7 @@ class TransactionCreation extends TransactionBase {
static public function fromEntity($transactionCreationEntity)
{
$protoCreation = new \Model\Messages\Proto\Gradido\GradidoCreation();
$protoCreation = new \Proto\Gradido\GradidoCreation();
//var_dump($transactionCreationEntity);
$stateUsersTable = TableRegistry::getTableLocator()->get('state_users');
@ -220,7 +220,7 @@ class TransactionCreation extends TransactionBase {
$stateUser = $stateUsersTable->get($userId);
$receiverAmount = new \Model\Messages\Proto\Gradido\TransferAmount();
$receiverAmount = new \Proto\Gradido\TransferAmount();
$receiverAmount->setPubkey(stream_get_contents($stateUser->public_key));
$receiverAmount->setAmount($transactionCreationEntity->amount);

View File

@ -23,7 +23,7 @@ class TransactionTransfer extends TransactionBase {
// repeated SenderAmount senderAmounts = 1;
// repeated ReceiverAmount receiverAmounts = 2;
$sender = new \Model\Messages\Proto\Gradido\TransferAmount();
$sender = new \Proto\Gradido\TransferAmount();
$sender->setAmount($amount);
if(strlen($receiver_public_hex) != 64) {
@ -38,15 +38,15 @@ class TransactionTransfer extends TransactionBase {
$sender->setPubkey($senderPubKeyBin);
//var_dump($requestData);
$creationDate = new \Model\Messages\Proto\Gradido\TimestampSeconds();
$creationDate = new \Proto\Gradido\TimestampSeconds();
$creationDate->setSeconds(time());
$transactionBody = new \Model\Messages\Proto\Gradido\TransactionBody();
$transactionBody = new \Proto\Gradido\TransactionBody();
$transactionBody->setMemo($memo);
$transactionBody->setCreated($creationDate);
$transfer = new \Model\Messages\Proto\Gradido\GradidoTransfer();
$local_transfer = new \Model\Messages\Proto\Gradido\LocalTransfer();
$transfer = new \Proto\Gradido\GradidoTransfer();
$local_transfer = new \Proto\Gradido\LocalTransfer();
$local_transfer->setReceiver($receiverPubKeyBin);
$local_transfer->setSender($sender);
$transfer->setLocal($local_transfer);

@ -1 +1 @@
Subproject commit 81a461566e46d71533dc3e284fa075d7d68fd020
Subproject commit 77dee5685ebba543ea1cd2321580ad56c92f5775