Git Product home page Git Product logo

tzkt-php-client's Introduction

OpenAPIClient-php

Introduction

TzKT Explorer provides a free REST-like API and WebSocket API for accessing detailed Tezos blockchain data and helps developers build more services and applications on top of Tezos. TzKT is an open-source project, so you can easily clone and build it and use it as a self-hosted service to avoid any risks depending on third-party services.

TzKT API is available for the following Tezos networks with the following base URLs:

  • Mainnet: https://api.tzkt.io/ or https://api.mainnet.tzkt.io/ (view docs)
  • Edo2net: https://api.edo2net.tzkt.io/ (view docs)
  • Florencenet: https://api.florencenet.tzkt.io/ (view docs)

We also provide a staging environment for testing newest features and pre-updating client applications before deploying to production:

  • Mainnet staging: https://staging.api.tzkt.io/ or https://staging.api.mainnet.tzkt.io/ (view docs)
  • Edo2net staging: https://staging.api.edo2net.tzkt.io/ (view docs)

Feel free to contact us if you have any questions or feature requests. Your feedback really helps us make TzKT better!

And don't forget to star TzKT project on GitHub ;)

Terms of Use

TzKT API is free for everyone and for both commercial and non-commercial usage.

If your application or service uses the TzKT API in any forms: directly on frontend or indirectly on backend, you should mention that fact on your website or application by placing the label "Powered by TzKT API" with a direct link to tzkt.io.

Rate Limits

There will be no rate limits as long as our servers can handle the load without additional infrastructure costs. However, any apparent abuse will be prevented by setting targeted rate limits.

Check out Tezos Explorer API Best Practices and in particular how to optimize requests count.


For more information, please visit https://baking-bad.org/docs.

Installation & Usage

Requirements

PHP 7.2 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/bzzhh/tzkt-php-client.git"
    }
  ],
  "require": {
    "bzzhh/tzkt-php-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once "/path/to/OpenAPIClient-php/vendor/autoload.php";

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once __DIR__ . "/vendor/autoload.php";

$apiInstance = new Bzzhh\Tzkt\Api\AccountsApi(
  // 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()
);
$type = new \Bzzhh\Tzkt\Model\OneOfAccountTypeParameter(); // OneOfAccountTypeParameter | Filters accounts by type (`user`, `delegate`, `contract`).
$kind = new \Bzzhh\Tzkt\Model\OneOfContractKindParameter(); // OneOfContractKindParameter | Filters accounts by contract kind (`delegator_contract` or `smart_contract`)
$delegate = new \Bzzhh\Tzkt\Model\OneOfAccountParameter(); // OneOfAccountParameter | Filters accounts by delegate. Allowed fields for `.eqx` mode: none.
$balance = new \Bzzhh\Tzkt\Model\OneOfInt64Parameter(); // OneOfInt64Parameter | Filters accounts by balance
$staked = new \Bzzhh\Tzkt\Model\OneOfBoolParameter(); // OneOfBoolParameter | Filters accounts by participation in staking
$last_activity = new \Bzzhh\Tzkt\Model\OneOfInt32Parameter(); // OneOfInt32Parameter | Filters accounts by last activity level (where the account was updated)
$select = new \Bzzhh\Tzkt\Model\OneOfSelectParameter(); // OneOfSelectParameter | 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\OneOfSortParameter(); // OneOfSortParameter | Sorts delegators by specified field. Supported fields: `id` (default), `balance`, `firstActivity`, `lastActivity`, `numTransactions`, `numContracts`.
$offset = new \Bzzhh\Tzkt\Model\OneOfOffsetParameter(); // OneOfOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
  $result = $apiInstance->accountsGet(
    $type,
    $kind,
    $delegate,
    $balance,
    $staked,
    $last_activity,
    $select,
    $sort,
    $offset,
    $limit
  );
  print_r($result);
} catch (Exception $e) {
  echo "Exception when calling AccountsApi->accountsGet: ",
    $e->getMessage(),
    PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.tzkt.io

Class Method HTTP request Description
AccountsApi accountsGet GET /v1/accounts Get accounts
AccountsApi accountsGetBalanceAtDate GET /v1/accounts/{address}/balance_history/{datetime} Get balance at date
AccountsApi accountsGetBalanceAtLevel GET /v1/accounts/{address}/balance_history/{level} Get balance at level
AccountsApi accountsGetBalanceHistory GET /v1/accounts/{address}/balance_history Get balance history
AccountsApi accountsGetBalanceReport GET /v1/accounts/{address}/report Get account report
AccountsApi accountsGetByAddress GET /v1/accounts/{address} Get account by address
AccountsApi accountsGetContracts GET /v1/accounts/{address}/contracts Get account contracts
AccountsApi accountsGetCount GET /v1/accounts/count Get accounts count
AccountsApi accountsGetDelegators GET /v1/accounts/{address}/delegators Get account delegators
AccountsApi accountsGetMetadata GET /v1/accounts/{address}/metadata Get account metadata
AccountsApi accountsGetOperations GET /v1/accounts/{address}/operations Get account operations
BigMapsApi bigMapsGetBigMapById GET /v1/bigmaps/{id} Get bigmap by Id
BigMapsApi bigMapsGetBigMapType GET /v1/bigmaps/{id}/type Get bigmap type
BigMapsApi bigMapsGetBigMapUpdates GET /v1/bigmaps/updates Get bigmap updates
BigMapsApi bigMapsGetBigMaps GET /v1/bigmaps Get bigmaps
BigMapsApi bigMapsGetBigMapsCount GET /v1/bigmaps/count Get bigmaps count
BigMapsApi bigMapsGetHistoricalKeys GET /v1/bigmaps/{id}/historical_keys/{level} Get historical keys
BigMapsApi bigMapsGetKey GET /v1/bigmaps/{id}/keys/{key} Get bigmap key
BigMapsApi bigMapsGetKey2 GET /v1/bigmaps/{id}/historical_keys/{level}/{key} Get historical key
BigMapsApi bigMapsGetKeyUpdates GET /v1/bigmaps/{id}/keys/{key}/updates Get bigmap key updates
BigMapsApi bigMapsGetKeys GET /v1/bigmaps/{id}/keys Get bigmap keys
BlocksApi blocksGet GET /v1/blocks Get blocks
BlocksApi blocksGetByHash GET /v1/blocks/{hash} Get block by hash
BlocksApi blocksGetByLevel GET /v1/blocks/{level} Get block by level
BlocksApi blocksGetCount GET /v1/blocks/count Get blocks count
CommitmentsApi commitmentsGet GET /v1/commitments/{address} Get commitment by blinded address
CommitmentsApi commitmentsGetAll GET /v1/commitments Get commitments
CommitmentsApi commitmentsGetCount GET /v1/commitments/count Get commitments count
ContractsApi contractsBuildEntrypointParameters GET /v1/contracts/{address}/entrypoints/{name}/build Build entrypoint parameters
ContractsApi contractsBuildEntrypointParameters2 POST /v1/contracts/{address}/entrypoints/{name}/build Build entrypoint parameters
ContractsApi contractsGet GET /v1/contracts Get contracts
ContractsApi contractsGetBigMapByName GET /v1/contracts/{address}/bigmaps/{name} Get bigmap by name
ContractsApi contractsGetBigMapByNameKeys GET /v1/contracts/{address}/bigmaps/{name}/keys Get bigmap keys
ContractsApi contractsGetBigMaps GET /v1/contracts/{address}/bigmaps Get contract bigmaps
ContractsApi contractsGetByAddress GET /v1/contracts/{address} Get contract by address
ContractsApi contractsGetCode GET /v1/contracts/{address}/code Get contract code
ContractsApi contractsGetCount GET /v1/contracts/count Get contracts count
ContractsApi contractsGetEntrypointByName GET /v1/contracts/{address}/entrypoints/{name} Get entrypoint by name
ContractsApi contractsGetEntrypoints GET /v1/contracts/{address}/entrypoints Get contract entrypoints
ContractsApi contractsGetHistoricalKeys GET /v1/contracts/{address}/bigmaps/{name}/historical_keys/{level} Get historical keys
ContractsApi contractsGetInterface GET /v1/contracts/{address}/interface Get JSON Schema [2020-12] interface for the contract
ContractsApi contractsGetKey GET /v1/contracts/{address}/bigmaps/{name}/keys/{key} Get bigmap key
ContractsApi contractsGetKey2 GET /v1/contracts/{address}/bigmaps/{name}/historical_keys/{level}/{key} Get historical key
ContractsApi contractsGetKeyUpdates GET /v1/contracts/{address}/bigmaps/{name}/keys/{key}/updates Get bigmap key updates
ContractsApi contractsGetRawStorage GET /v1/contracts/{address}/storage/raw Get raw contract storage
ContractsApi contractsGetRawStorageHistory GET /v1/contracts/{address}/storage/raw/history Get raw contract storage history
ContractsApi contractsGetRawStorageSchema GET /v1/contracts/{address}/storage/raw/schema Get raw contract storage schema
ContractsApi contractsGetStorage GET /v1/contracts/{address}/storage Get contract storage
ContractsApi contractsGetStorageHistory GET /v1/contracts/{address}/storage/history Get contract storage history
ContractsApi contractsGetStorageSchema GET /v1/contracts/{address}/storage/schema Get contract storage schema
CyclesApi cyclesGet GET /v1/cycles Get cycles
CyclesApi cyclesGetByIndex GET /v1/cycles/{index} Get cycle by index
CyclesApi cyclesGetCount GET /v1/cycles/count Get cycles count
DelegatesApi delegatesGet GET /v1/delegates Get delegates
DelegatesApi delegatesGetByAddress GET /v1/delegates/{address} Get delegate by address
DelegatesApi delegatesGetCount GET /v1/delegates/count Get delegates count
HeadApi headGet GET /v1/head Get indexer head
OperationsApi operationsGetActivationByHash GET /v1/operations/activations/{hash} Get activation by hash
OperationsApi operationsGetActivations GET /v1/operations/activations Get activations
OperationsApi operationsGetActivationsCount GET /v1/operations/activations/count Get activations count
OperationsApi operationsGetBaking GET /v1/operations/baking Get baking
OperationsApi operationsGetBakingCount GET /v1/operations/baking/count Get baking count
OperationsApi operationsGetBallotByHash GET /v1/operations/ballots/{hash} Get ballot by hash
OperationsApi operationsGetBallots GET /v1/operations/ballots Get ballots
OperationsApi operationsGetBallotsCount GET /v1/operations/ballots/count Get ballots count
OperationsApi operationsGetByHash GET /v1/operations/{hash} Get operations by hash
OperationsApi operationsGetByHashCounter GET /v1/operations/{hash}/{counter} Get operations by hash and counter
OperationsApi operationsGetByHashCounterNonce GET /v1/operations/{hash}/{counter}/{nonce} Get operations by hash, counter and nonce
OperationsApi operationsGetDelegationByHash GET /v1/operations/delegations/{hash} Get delegation by hash
OperationsApi operationsGetDelegations GET /v1/operations/delegations Get delegations
OperationsApi operationsGetDelegationsCount GET /v1/operations/delegations/count Get delegations count
OperationsApi operationsGetDoubleBaking GET /v1/operations/double_baking Get double baking
OperationsApi operationsGetDoubleBakingByHash GET /v1/operations/double_baking/{hash} Get double baking by hash
OperationsApi operationsGetDoubleBakingCount GET /v1/operations/double_baking/count Get double baking count
OperationsApi operationsGetDoubleEndorsing GET /v1/operations/double_endorsing Get double endorsing
OperationsApi operationsGetDoubleEndorsingByHash GET /v1/operations/double_endorsing/{hash} Get double endorsing by hash
OperationsApi operationsGetDoubleEndorsingCount GET /v1/operations/double_endorsing/count Get double endorsing count
OperationsApi operationsGetEndorsementByHash GET /v1/operations/endorsements/{hash} Get endorsement by hash
OperationsApi operationsGetEndorsements GET /v1/operations/endorsements Get endorsements
OperationsApi operationsGetEndorsementsCount GET /v1/operations/endorsements/count Get endorsements count
OperationsApi operationsGetMigrations GET /v1/operations/migrations Get migrations
OperationsApi operationsGetMigrationsCount GET /v1/operations/migrations/count Get migrations count
OperationsApi operationsGetNonceRevelationByHash GET /v1/operations/nonce_revelations/{hash} Get nonce revelation by hash
OperationsApi operationsGetNonceRevelations GET /v1/operations/nonce_revelations Get nonce revelations
OperationsApi operationsGetNonceRevelationsCount GET /v1/operations/nonce_revelations/count Get nonce revelations count
OperationsApi operationsGetOriginationByHash GET /v1/operations/originations/{hash} Get origination by hash
OperationsApi operationsGetOriginations GET /v1/operations/originations Get originations
OperationsApi operationsGetOriginationsCount GET /v1/operations/originations/count Get originations count
OperationsApi operationsGetProposalByHash GET /v1/operations/proposals/{hash} Get proposal by hash
OperationsApi operationsGetProposals GET /v1/operations/proposals Get proposals
OperationsApi operationsGetProposalsCount GET /v1/operations/proposals/count Get proposals count
OperationsApi operationsGetRevealByHash GET /v1/operations/reveals/{hash} Get reveal by hash
OperationsApi operationsGetReveals GET /v1/operations/reveals Get reveals
OperationsApi operationsGetRevealsCount GET /v1/operations/reveals/count Get reveals count
OperationsApi operationsGetRevelationPenalties GET /v1/operations/revelation_penalties Get revelation penalties
OperationsApi operationsGetRevelationPenaltiesCount GET /v1/operations/revelation_penalties/count Get revelation penalties count
OperationsApi operationsGetTransactionByHash GET /v1/operations/transactions/{hash} Get transaction by hash
OperationsApi operationsGetTransactionByHashCounter GET /v1/operations/transactions/{hash}/{counter} Get transaction by hash and counter
OperationsApi operationsGetTransactionByHashCounterNonce GET /v1/operations/transactions/{hash}/{counter}/{nonce} Get transaction by hash, counter and nonce
OperationsApi operationsGetTransactions GET /v1/operations/transactions Get transactions
OperationsApi operationsGetTransactionsCount GET /v1/operations/transactions/count Get transactions count
ProtocolsApi protocolsGet GET /v1/protocols Get protocols
ProtocolsApi protocolsGetByCode GET /v1/protocols/{code} Get protocol by code
ProtocolsApi protocolsGetByCycle GET /v1/protocols/cycles/{cycle} Get protocol by cycle
ProtocolsApi protocolsGetByHash GET /v1/protocols/{hash} Get protocol by hash
ProtocolsApi protocolsGetCount GET /v1/protocols/count Get protocols count
ProtocolsApi protocolsGetCurrent GET /v1/protocols/current Get current protocol
QuotesApi quotesGet GET /v1/quotes Get quotes
QuotesApi quotesGetCount GET /v1/quotes/count Get quotes count
QuotesApi quotesGetLast GET /v1/quotes/last Get last quote
RewardsApi rewardsGetBakerRewards GET /v1/rewards/bakers/{address} Get baker cycle rewards
RewardsApi rewardsGetBakerRewardsByCycle GET /v1/rewards/bakers/{address}/{cycle} Get baker cycle rewards by cycle
RewardsApi rewardsGetBakerRewardsCount GET /v1/rewards/bakers/{address}/count Get baker cycle rewards count
RewardsApi rewardsGetDelegatorRewards GET /v1/rewards/delegators/{address} Get delegator cycle rewards
RewardsApi rewardsGetDelegatorRewardsByCycle GET /v1/rewards/delegators/{address}/{cycle} Get delegator cycle rewards by cycle
RewardsApi rewardsGetDelegatorRewardsCount GET /v1/rewards/delegators/{address}/count Get delegator cycle rewards count
RewardsApi rewardsGetRewardSplit GET /v1/rewards/split/{address}/{cycle} Get reward split
RewardsApi rewardsGetRewardSplitDelegator GET /v1/rewards/split/{baker}/{cycle}/{delegator} Get reward split delegator
RightsApi rightsGet GET /v1/rights Get rights
RightsApi rightsGetCount GET /v1/rights/count Get rights count
SoftwareApi softwareGet GET /v1/software Get baker software
SoftwareApi softwareGetCount GET /v1/software/count Get software count
StatisticsApi statisticsGet GET /v1/statistics Get statistics
StatisticsApi statisticsGetCycles GET /v1/statistics/current Get current statistics
StatisticsApi statisticsGetCyclesAll GET /v1/statistics/cyclic Get cyclic statistics
StatisticsApi statisticsGetDaily GET /v1/statistics/daily Get daily statistics
SuggestApi suggestGetAccounts GET /v1/suggest/accounts/{search} Suggest accounts
SuggestApi suggestGetProposals GET /v1/suggest/proposals/{search} Suggest proposals
SuggestApi suggestGetProtocols GET /v1/suggest/protocols/{search} Suggest protocols
VotingApi votingGetCurrentEpoch GET /v1/voting/epochs/current Get current voting epoch
VotingApi votingGetCurrentPeriod GET /v1/voting/periods/current Get current voting period
VotingApi votingGetEpoch GET /v1/voting/epochs/{index} Get voting epoch by index
VotingApi votingGetEpochs GET /v1/voting/epochs Get voting epochs
VotingApi votingGetLatestVoting GET /v1/voting/epochs/latest_voting Get latest voting
VotingApi votingGetPeriod GET /v1/voting/periods/{index} Get voting period by index
VotingApi votingGetPeriodVoter GET /v1/voting/periods/{index}/voters/{address} Get period voter
VotingApi votingGetPeriodVoter2 GET /v1/voting/periods/current/voters/{address} Get current period voter
VotingApi votingGetPeriodVoters GET /v1/voting/periods/current/voters Get current period voters
VotingApi votingGetPeriodVotersAll GET /v1/voting/periods/{index}/voters Get period voters
VotingApi votingGetPeriods GET /v1/voting/periods Get voting periods
VotingApi votingGetProposalByHash GET /v1/voting/proposals/{hash} Get proposal by hash
VotingApi votingGetProposals GET /v1/voting/proposals Get proposals
VotingApi votingGetProposalsCount GET /v1/voting/proposals/count Get proposals count

Models

Authorization

All endpoints do not require authorization.

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

[email protected]

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: v1.5
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

tzkt-php-client's People

Contributors

der-alter avatar joelsaqara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.