Skip to content

Commit

Permalink
merge symfony bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterProof committed Apr 19, 2021
1 parent 7360780 commit 02ddc95
Show file tree
Hide file tree
Showing 590 changed files with 2,510 additions and 2,346 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ down: ## stop containers

.PHONY: test
test: ## run tests
${RUN_PHP} ./vendor/bin/phpunit
${RUN_PHP} ./vendor/bin/phpunit --testdox

.PHONY: shell
shell: ## enter php container
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,29 @@ $key->getAddress();
RPC clients generated with [jane](https://jane.readthedocs.io/en/latest/documentation/OpenAPI.html) are available.

The open api files are taken from [the official Tezos repo](https://gitlab.com/tezos/tezos/-/tree/master/docs/api).

### Symfony

#### Enable the Bundle

enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:

```php
// config/bundles.php

return [
// ...
Bzzhh\Pezos\Bridge\Symfony\BzzhhPezosBundle::class => ['all' => true],
];
```

#### Configuration

Configure your host:

```yaml
# config/packages/bzzhh_pezos.yaml
bzzhh_pezos:
rpc_host: https://edonet.duckdns.org
```
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@
],
"autoload": {
"psr-4": {
"Pezos\\": "src/",
"Pezos\\Generated\\Shell\\": "generated/shell",
"Pezos\\Generated\\Proto\\": "generated/proto",
"Pezos\\Generated\\Mempool\\": "generated/mempool"
"Bzzhh\\Pezos\\": "src/",
"Bzzhh\\Pezos\\Generated\\Shell\\": "generated/shell",
"Bzzhh\\Pezos\\Generated\\Proto\\": "generated/proto",
"Bzzhh\\Pezos\\Generated\\Mempool\\": "generated/mempool"
},
"files": [
"src/_bootstrap.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
"Bzzhh\\Pezos\\Tests\\": "tests/"
}
},
"require": {
"php": "^7.4",
"ext-sodium": "*",
"bitwasp/buffertools": "^0.5.7",
"bitwasp/bitcoin": "^1.0",
"jane-php/open-api-runtime": "^6.3"
"jane-php/open-api-runtime": "^6.3",
"symfony/framework-bundle": "^5.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
Expand All @@ -41,7 +42,7 @@
"nyholm/psr7": "^1.4",
"php-http/curl-client": "^2.2"
},
"version": "v0.1.1",
"version": "v0.1.2",
"archive": {
"exclude": [
"*",
Expand Down
2 changes: 1 addition & 1 deletion config/jane-mempool-openapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

return [
'openapi-file' => __DIR__.'/edo-mempool-openapi.json',
'namespace' => 'Pezos\Generated\Mempool',
'namespace' => 'Bzzhh\Pezos\Generated\Mempool',
'directory' => \dirname(__DIR__).'/generated/mempool',
];
2 changes: 1 addition & 1 deletion config/jane-proto-openapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

return [
'openapi-file' => __DIR__.'/edo-openapi.json',
'namespace' => 'Pezos\Generated\Proto',
'namespace' => 'Bzzhh\Pezos\Generated\Proto',
'directory' => \dirname(__DIR__).'/generated/proto',
];
2 changes: 1 addition & 1 deletion config/jane-shell-openapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

return [
'openapi-file' => __DIR__.'/rpc-openapi.json',
'namespace' => 'Pezos\Generated\Shell',
'namespace' => 'Bzzhh\Pezos\Generated\Shell',
'directory' => \dirname(__DIR__).'/generated/shell',
];
26 changes: 13 additions & 13 deletions generated/mempool/Client.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Pezos\Generated\Mempool;
namespace Bzzhh\Pezos\Generated\Mempool;

class Client extends \Pezos\Generated\Mempool\Runtime\Client\Client
class Client extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Client
{
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
Expand All @@ -11,7 +11,7 @@ class Client extends \Pezos\Generated\Mempool\Runtime\Client\Client
*/
public function getFilter(string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Pezos\Generated\Mempool\Endpoint\GetFilter(), $fetch);
return $this->executeEndpoint(new \Bzzhh\Pezos\Generated\Mempool\Endpoint\GetFilter(), $fetch);
}
/**
* Set the configuration of the mempool filter.
Expand All @@ -23,7 +23,7 @@ public function getFilter(string $fetch = self::FETCH_OBJECT)
*/
public function postFilter($requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Pezos\Generated\Mempool\Endpoint\PostFilter($requestBody), $fetch);
return $this->executeEndpoint(new \Bzzhh\Pezos\Generated\Mempool\Endpoint\PostFilter($requestBody), $fetch);
}
/**
* Monitor the mempool operations.
Expand All @@ -36,32 +36,32 @@ public function postFilter($requestBody = null, string $fetch = self::FETCH_OBJE
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return null|\Pezos\Generated\Mempool\Model\NextOperation[]|\Psr\Http\Message\ResponseInterface
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\NextOperation[]|\Psr\Http\Message\ResponseInterface
*/
public function getMonitorOperations(array $queryParameters = array(), string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Pezos\Generated\Mempool\Endpoint\GetMonitorOperations($queryParameters), $fetch);
return $this->executeEndpoint(new \Bzzhh\Pezos\Generated\Mempool\Endpoint\GetMonitorOperations($queryParameters), $fetch);
}
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return null|\Pezos\Generated\Mempool\Model\PendingOperationsGetResponse200|\Psr\Http\Message\ResponseInterface
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\PendingOperationsGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getPendingOperation(string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Pezos\Generated\Mempool\Endpoint\GetPendingOperation(), $fetch);
return $this->executeEndpoint(new \Bzzhh\Pezos\Generated\Mempool\Endpoint\GetPendingOperation(), $fetch);
}
/**
* Request the operations of your peers.
*
* @param null|\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody
* @param null|\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return null|\Pezos\Generated\Mempool\Model\RequestOperationsPostResponse200|\Psr\Http\Message\ResponseInterface
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function postRequestOperation(?\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody = null, string $fetch = self::FETCH_OBJECT)
public function postRequestOperation(?\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Pezos\Generated\Mempool\Endpoint\PostRequestOperation($requestBody), $fetch);
return $this->executeEndpoint(new \Bzzhh\Pezos\Generated\Mempool\Endpoint\PostRequestOperation($requestBody), $fetch);
}
public static function create($httpClient = null, array $additionalPlugins = array())
{
Expand All @@ -75,7 +75,7 @@ public static function create($httpClient = null, array $additionalPlugins = arr
}
$requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
$streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
$serializer = new \Symfony\Component\Serializer\Serializer(array(new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \Pezos\Generated\Mempool\Normalizer\JaneObjectNormalizer()), array(new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(array('json_decode_associative' => true)))));
$serializer = new \Symfony\Component\Serializer\Serializer(array(new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \Bzzhh\Pezos\Generated\Mempool\Normalizer\JaneObjectNormalizer()), array(new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(array('json_decode_associative' => true)))));
return new static($httpClient, $requestFactory, $serializer, $streamFactory);
}
}
6 changes: 3 additions & 3 deletions generated/mempool/Endpoint/GetFilter.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Pezos\Generated\Mempool\Endpoint;
namespace Bzzhh\Pezos\Generated\Mempool\Endpoint;

class GetFilter extends \Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Pezos\Generated\Mempool\Runtime\Client\Endpoint
class GetFilter extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Endpoint
{
use \Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
use \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
Expand Down
10 changes: 5 additions & 5 deletions generated/mempool/Endpoint/GetMonitorOperations.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Pezos\Generated\Mempool\Endpoint;
namespace Bzzhh\Pezos\Generated\Mempool\Endpoint;

class GetMonitorOperations extends \Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Pezos\Generated\Mempool\Runtime\Client\Endpoint
class GetMonitorOperations extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Endpoint
{
/**
* Monitor the mempool operations.
Expand All @@ -18,7 +18,7 @@ public function __construct(array $queryParameters = array())
{
$this->queryParameters = $queryParameters;
}
use \Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
use \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
Expand Down Expand Up @@ -51,12 +51,12 @@ protected function getQueryOptionsResolver() : \Symfony\Component\OptionsResolve
* {@inheritdoc}
*
*
* @return null|\Pezos\Generated\Mempool\Model\NextOperation[]
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\NextOperation[]
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'Pezos\\Generated\\Mempool\\Model\\NextOperation[]', 'json');
return $serializer->deserialize($body, 'Bzzhh\\Pezos\\Generated\\Mempool\\Model\\NextOperation[]', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
Expand Down
10 changes: 5 additions & 5 deletions generated/mempool/Endpoint/GetPendingOperation.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Pezos\Generated\Mempool\Endpoint;
namespace Bzzhh\Pezos\Generated\Mempool\Endpoint;

class GetPendingOperation extends \Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Pezos\Generated\Mempool\Runtime\Client\Endpoint
class GetPendingOperation extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Endpoint
{
use \Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
use \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
Expand All @@ -25,12 +25,12 @@ public function getExtraHeaders() : array
* {@inheritdoc}
*
*
* @return null|\Pezos\Generated\Mempool\Model\PendingOperationsGetResponse200
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\PendingOperationsGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'Pezos\\Generated\\Mempool\\Model\\PendingOperationsGetResponse200', 'json');
return $serializer->deserialize($body, 'Bzzhh\\Pezos\\Generated\\Mempool\\Model\\PendingOperationsGetResponse200', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
Expand Down
6 changes: 3 additions & 3 deletions generated/mempool/Endpoint/PostFilter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Pezos\Generated\Mempool\Endpoint;
namespace Bzzhh\Pezos\Generated\Mempool\Endpoint;

class PostFilter extends \Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Pezos\Generated\Mempool\Runtime\Client\Endpoint
class PostFilter extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Endpoint
{
/**
* Set the configuration of the mempool filter.
Expand All @@ -13,7 +13,7 @@ public function __construct($requestBody = null)
{
$this->body = $requestBody;
}
use \Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
use \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
Expand Down
16 changes: 8 additions & 8 deletions generated/mempool/Endpoint/PostRequestOperation.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

namespace Pezos\Generated\Mempool\Endpoint;
namespace Bzzhh\Pezos\Generated\Mempool\Endpoint;

class PostRequestOperation extends \Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Pezos\Generated\Mempool\Runtime\Client\Endpoint
class PostRequestOperation extends \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\BaseEndpoint implements \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\Endpoint
{
/**
* Request the operations of your peers.
*
* @param null|\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody
* @param null|\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody
*/
public function __construct(?\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody = null)
public function __construct(?\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostBody $requestBody = null)
{
$this->body = $requestBody;
}
use \Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
use \Bzzhh\Pezos\Generated\Mempool\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
Expand All @@ -24,7 +24,7 @@ public function getUri() : string
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \Pezos\Generated\Mempool\Model\RequestOperationsPostBody) {
if ($this->body instanceof \Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostBody) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
Expand All @@ -37,12 +37,12 @@ public function getExtraHeaders() : array
* {@inheritdoc}
*
*
* @return null|\Pezos\Generated\Mempool\Model\RequestOperationsPostResponse200
* @return null|\Bzzhh\Pezos\Generated\Mempool\Model\RequestOperationsPostResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'Pezos\\Generated\\Mempool\\Model\\RequestOperationsPostResponse200', 'json');
return $serializer->deserialize($body, 'Bzzhh\\Pezos\\Generated\\Mempool\\Model\\RequestOperationsPostResponse200', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
Expand Down
2 changes: 1 addition & 1 deletion generated/mempool/Model/NextOperation.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class NextOperation
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class PendingOperationsGetResponse200
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class PendingOperationsGetResponse200AppliedItem
{
Expand Down
2 changes: 1 addition & 1 deletion generated/mempool/Model/RequestOperationsPostBody.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class RequestOperationsPostBody
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class RequestOperationsPostResponse200
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class _008PtEdo2ZkBlockHeaderAlphaFullHeader
{
Expand Down
2 changes: 1 addition & 1 deletion generated/mempool/Model/_008PtEdo2ZkInlinedEndorsement.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class _008PtEdo2ZkInlinedEndorsement
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pezos\Generated\Mempool\Model;
namespace Bzzhh\Pezos\Generated\Mempool\Model;

class _008PtEdo2ZkInlinedEndorsementContents
{
Expand Down
Loading

0 comments on commit 02ddc95

Please sign in to comment.