Skip to content

Latest commit

 

History

History
445 lines (309 loc) · 16.9 KB

BlocksApi.md

File metadata and controls

445 lines (309 loc) · 16.9 KB

Bzzhh\Tzkt\BlocksApi

All URIs are relative to https://api.tzkt.io, except if the operation defines another base path.

Method HTTP request Description
blocksGet() GET /v1/blocks Get blocks
blocksGetByDate() GET /v1/blocks/{timestamp} Get block by timestamp
blocksGetByDate2() GET /v1/blocks/{timestamp}/level Get level by timestamp
blocksGetByHash() GET /v1/blocks/{hash} Get block by hash
blocksGetByLevel() GET /v1/blocks/{level} Get block by level
blocksGetByLevel2() GET /v1/blocks/{level}/timestamp Get timestamp by level
blocksGetCount() GET /v1/blocks/count Get blocks count

blocksGet()

blocksGet($baker, $anyof, $proposer, $producer, $level, $timestamp, $priority, $block_round, $select, $sort, $offset, $limit, $quote): \Bzzhh\Tzkt\Model\Block[]

Get blocks

Returns a list of blocks.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$baker = new \Bzzhh\Tzkt\Model\AccountsGetDelegateParameter(); // AccountsGetDelegateParameter | [DEPRECATED]
$anyof = new \Bzzhh\Tzkt\Model\BlocksGetAnyofParameter(); // BlocksGetAnyofParameter | Filters by any of the specified fields. Example: `anyof.proposer.producer=tz1...`.
$proposer = new \Bzzhh\Tzkt\Model\AccountsGetDelegateParameter(); // AccountsGetDelegateParameter | Filters blocks by block proposer. Allowed fields for `.eqx` mode: none.
$producer = new \Bzzhh\Tzkt\Model\AccountsGetDelegateParameter(); // AccountsGetDelegateParameter | Filters blocks by block producer. Allowed fields for `.eqx` mode: none.
$level = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | Filters blocks by level.
$timestamp = new \Bzzhh\Tzkt\Model\AccountsGetOperationsTimestampParameter(); // AccountsGetOperationsTimestampParameter | Filters blocks by timestamp.
$priority = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | [DEPRECATED]
$block_round = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | Filters blocks by block round.
$select = new \Bzzhh\Tzkt\Model\AccountsGetSelectParameter(); // AccountsGetSelectParameter | Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes.
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts blocks by specified field. Supported fields: `id` (default), `level`, `payloadRound`, `blockRound`, `validations`, `reward`, `bonus`, `fees`.
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return
$quote = new \Bzzhh\Tzkt\Model\AccountsGetOperationsQuoteParameter(); // AccountsGetOperationsQuoteParameter | Comma-separated list of ticker symbols to inject historical prices into response

try {
    $result = $apiInstance->blocksGet($baker, $anyof, $proposer, $producer, $level, $timestamp, $priority, $block_round, $select, $sort, $offset, $limit, $quote);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
baker AccountsGetDelegateParameter [DEPRECATED] [optional]
anyof BlocksGetAnyofParameter Filters by any of the specified fields. Example: `anyof.proposer.producer=tz1...`. [optional]
proposer AccountsGetDelegateParameter Filters blocks by block proposer. Allowed fields for `.eqx` mode: none. [optional]
producer AccountsGetDelegateParameter Filters blocks by block producer. Allowed fields for `.eqx` mode: none. [optional]
level AccountsGetIdParameter Filters blocks by level. [optional]
timestamp AccountsGetOperationsTimestampParameter Filters blocks by timestamp. [optional]
priority AccountsGetIdParameter [DEPRECATED] [optional]
block_round AccountsGetIdParameter Filters blocks by block round. [optional]
select AccountsGetSelectParameter Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes. [optional]
sort AccountsGetSortParameter Sorts blocks by specified field. Supported fields: `id` (default), `level`, `payloadRound`, `blockRound`, `validations`, `reward`, `bonus`, `fees`. [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]
quote AccountsGetOperationsQuoteParameter Comma-separated list of ticker symbols to inject historical prices into response [optional]

Return type

\Bzzhh\Tzkt\Model\Block[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetByDate()

blocksGetByDate($timestamp, $operations, $micheline, $quote): \Bzzhh\Tzkt\Model\Block

Get block by timestamp

Returns a block closest to the specified timestamp.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$timestamp = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp, e.g. `2020-01-01T00:00:00Z`
$operations = false; // bool | Flag indicating whether to include block operations into returned object or not
$micheline = new \Bzzhh\Tzkt\Model\AccountsGetOperationsMichelineParameter(); // AccountsGetOperationsMichelineParameter | Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string
$quote = new \Bzzhh\Tzkt\Model\AccountsGetOperationsQuoteParameter(); // AccountsGetOperationsQuoteParameter | Comma-separated list of ticker symbols to inject historical prices into response

try {
    $result = $apiInstance->blocksGetByDate($timestamp, $operations, $micheline, $quote);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetByDate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
timestamp \DateTime Timestamp, e.g. `2020-01-01T00:00:00Z`
operations bool Flag indicating whether to include block operations into returned object or not [optional] [default to false]
micheline AccountsGetOperationsMichelineParameter Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string [optional]
quote AccountsGetOperationsQuoteParameter Comma-separated list of ticker symbols to inject historical prices into response [optional]

Return type

\Bzzhh\Tzkt\Model\Block

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetByDate2()

blocksGetByDate2($timestamp): int

Get level by timestamp

Returns a level of the block closest to the specified timestamp.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$timestamp = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp, e.g. `2020-01-01T00:00:00Z`

try {
    $result = $apiInstance->blocksGetByDate2($timestamp);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetByDate2: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
timestamp \DateTime Timestamp, e.g. `2020-01-01T00:00:00Z`

Return type

int

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetByHash()

blocksGetByHash($hash, $operations, $micheline, $quote): \Bzzhh\Tzkt\Model\Block

Get block by hash

Returns a block with the specified hash.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$hash = 'hash_example'; // string | Block hash
$operations = false; // bool | Flag indicating whether to include block operations into returned object or not
$micheline = new \Bzzhh\Tzkt\Model\AccountsGetOperationsMichelineParameter(); // AccountsGetOperationsMichelineParameter | Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string
$quote = new \Bzzhh\Tzkt\Model\AccountsGetOperationsQuoteParameter(); // AccountsGetOperationsQuoteParameter | Comma-separated list of ticker symbols to inject historical prices into response

try {
    $result = $apiInstance->blocksGetByHash($hash, $operations, $micheline, $quote);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetByHash: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
hash string Block hash
operations bool Flag indicating whether to include block operations into returned object or not [optional] [default to false]
micheline AccountsGetOperationsMichelineParameter Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string [optional]
quote AccountsGetOperationsQuoteParameter Comma-separated list of ticker symbols to inject historical prices into response [optional]

Return type

\Bzzhh\Tzkt\Model\Block

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetByLevel()

blocksGetByLevel($level, $operations, $micheline, $quote): \Bzzhh\Tzkt\Model\Block

Get block by level

Returns a block at the specified level.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$level = 56; // int | Block level
$operations = false; // bool | Flag indicating whether to include block operations into returned object or not
$micheline = new \Bzzhh\Tzkt\Model\AccountsGetOperationsMichelineParameter(); // AccountsGetOperationsMichelineParameter | Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string
$quote = new \Bzzhh\Tzkt\Model\AccountsGetOperationsQuoteParameter(); // AccountsGetOperationsQuoteParameter | Comma-separated list of ticker symbols to inject historical prices into response

try {
    $result = $apiInstance->blocksGetByLevel($level, $operations, $micheline, $quote);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetByLevel: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
level int Block level
operations bool Flag indicating whether to include block operations into returned object or not [optional] [default to false]
micheline AccountsGetOperationsMichelineParameter Format of the parameters, storage and diffs: `0` - JSON, `1` - JSON string, `2` - raw micheline, `3` - raw micheline string [optional]
quote AccountsGetOperationsQuoteParameter Comma-separated list of ticker symbols to inject historical prices into response [optional]

Return type

\Bzzhh\Tzkt\Model\Block

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetByLevel2()

blocksGetByLevel2($level): \DateTime

Get timestamp by level

Returns a timestamp of the block at the specified level.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$level = 56; // int | Block level

try {
    $result = $apiInstance->blocksGetByLevel2($level);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetByLevel2: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
level int Block level

Return type

\DateTime

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

blocksGetCount()

blocksGetCount(): int

Get blocks count

Returns the total number of blocks.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\BlocksApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->blocksGetCount();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BlocksApi->blocksGetCount: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

int

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]