/LiskPHP

A PHP client for the LISK API

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

LiskPhp - A PHP wrapper for the LISK API

This is php wrapper for LISK API written in OOP style.

It’s supposed to be a full implementation of the API.

Included in here is a CLI Parser which makes it possible to call all actions from command line. e.g.:

php api.php getBlocks --height=2967414

API compatibility

Currently supports Lisp API Version 0.8 The following sections from the lisk api are available:

  • [x] Accounts
  • [x] Loader
  • [x] Transactions
  • [x] Peers
  • [x] Blocks
  • [x] Signatures
  • [x] Delegates
  • [x] Apps
  • [x] Multi-signature

For more infos see https://docs.lisk.io/docs/lisk-api

Installation

It’s a composer based package. \ Installation is as easy as:

composer require cb0/lisk-php-api

Usage:

General

To start communicating with a lisk server you need to instanciate lisk client and specify the servers ip and port.

This would connect to the official lisk testnet.

$client = new \Lisk\Client('http://testnet.lisk.io:7000');

Accounts

Get Account Balance

Request the balance of an account.

$client->getBalance($address);

Get Public Key

Get the public key of an account. If the account does not exist the API call will return an error.

$client->getPublicKey($secret);

Open Account

Request information about an account. If account with secret does not exist, account will be created.

$client->openAccount($secret);

Generate Public Key

Returns the public key of the provided secret key.

$client->generatePublicKey($secret);

Get Account Information from Address

Returns account information of an address.

$client->getAccountInfo($address);

Get Delegates

Returns delegate accounts by address.

$client->getDelegates($address);

Vote Delegates

Vote for the selected delegates. Maximum of 33 delegates at once. (Note: This is currently not working with lisk api. Exception: “a.asset.votes.join is not a function”)

$client->voteDelegates($delegates, $secret, $secondSecret = null, $publicKey = null);

Loader

Get Loading Status

$client->getLoadingStatus();

Get Synchronization Status

Get the synchronization status of the client.

$client->getSynchronizationStatus();

Get Block Receipt Status

Get the status of last received block. Returns true if block was received in the past 120 seconds.

$client->getBlockStatus();

Transactions

Get List of Transactions

List of transactions matched by provided parameters.

$client->listTransactions($blockId, $senderId, $recipientId, $limit, $offset, $orderBy);

Send Transaction

Send transaction to broadcast network.

$client->sendTransaction($secret, $amount, $recipientId, $publicKey, $secondSecret);

Get Transaction

Get transaction that matches the provided id.

$client->getTransaction($id);

Get Unconfirmed Transaction

Get unconfirmed transaction that matches the provided id.

$client->getUnconfirmedTransaction($id);

Get List of Unconfirmed Transactions

Gets a list of unconfirmed transactions.

$client->listUnconfirmedTransactions();

Get List of Queued Transactions

Gets a list of queued transactions.

$client->listQueuedTransactions();

Get Specific Queued Transaction

Get queued transaction that matches the provided id.

$client->getQueuedTransaction($id);

Peers

Get Peers List

Gets list of peers from provided filter parameters.

$client->getPeerList($state, $os, $version, $limit, $offset, $orderBy);

Get Peer Version/Build Time

Gets a list peer versions and build times

$client->getPeerVersion();

Get Peer

Gets peer by IP address and port.

$client->getPeer($ip, $port);

Blocks

Get Blocks

Gets all blocks by provided filter(s).

$client->getBlocks($totalFee, $totalAmount, $previousBlock, $height, $generatorPublicKey, $limit, $offset, $orderBy);

Get Block

Gets block by provided id.

$client->getBlock($id);

Get Blockchain Fee

Get transaction fee for sending “normal” transactions.

$client->getBlockchainFee();

Get Blockchain Fees Schedule

Get transaction fee for all types of transactions.

$client->getBlockchainFees();

Get Blockchain Reward Schedule

Gets the forging reward for blocks.

$client->getBlockchainReward();

Get Total Supply of Lisk Tokens (LSK)

Gets the total amount of Lisk in circulation

$client->getTotalSupply();

Get Blockchain Height

Gets the blockchain height of the client.

$client->getBlockchainHeight();

Get Status of Height, Fee, Milestone, Blockreward and Supply

Gets status of height, fee, milestone, blockreward and supply

$client->getStatusInfos();

Get Blockchain Nethash

Gets the nethash of the blockchain on a client.

$client->getBlockchainNethash();

Get Blockchain Milestone

Gets the milestone of the blockchain on a client.

$client->getBlockchainMilestone();

Signatures

Get Signature Fees

Gets the second signature status of an account.

$client->getSignatureFee();

Add Second Signature

Add a second signature to an account.

$client->addSecondSignature($secret, $secondSecret, $publicKey);

Delegates

Enable Delegate on Account

Puts request to create a delegate.

$client->createDelegate($secret, $username, $secondSecret);

Get Delegates List

Gets list of delegates by provided filter.

$client->getDelegateList($limit, $offset, $orderBy);

Get Delegate

Gets delegate by public key or username.

$client->getDelegate($publicKey, $username);

Search for Delegates

Search for Delegates by “fuzzy” username.

$client->searchDelegate($username, $orderBy);

Get Delegates Count

Get total count of registered delegates.

$client->getDelegateCount();

Get votes of account

Get votes by account wallet address.

$client->getDelegateVotes($address);

Get Voters

Get voters of delegate.

$client->getDelegateVoters($publicKey);

Enable Forging on Delegate

Enables forging for a delegate on the client node.

$client->enableForging($secret);

Disable Forging on Delegate

Disables forging for a delegate on the client node.

$client->disableForging($secret);

Get Forged by Account

Get amount of Lisk forged by an account.

$client->getForgedByAccount($generatorPublicKey, $start, $end);

Get Next Forgers

Get next delegate lining up to forge.

$client->getNextForger($limit);

Apps

Registers Apps

Registers a Blockchain Application.

$client->registerApp($secret, $category, $name, $type, $link, $secondSecret, $publicKey, $description, $tags, $icon);

Get Apps

Gets a list of Blockchain Applications registered on the network.

$client->getApps($category, $name, $appType, $link, $limit, $offset, $orderBy);

Get App

Gets a specific Blockchain Application by registered id.

$client->getApp($id);

Search for Apps

Searches for Blockchain Applications by filter(s) on a node.

$client->searchApps($q, $category, $installed);

Install App

Installs a app by id on the node.

$client->installApp($id);

Installed Apps

Returns a list of installed apps on the requested node.

$client->getInstalledApps();

Installed Apps Ids

Returns a list of installed app ids on the requested node.

$client->getAllInstalledApps();

Uninstall Apps

Uninstalls a app by id from the requested node.

$client->uninstallApp($id);

Launch App

Launches a app by id on the requested node.

$client->launchApp($id, $params);

Installing

Returns a list of app ids currently being installed on the requested node.

$client->installingApp();

Uninstalling

Returns a list of app ids currently being uninstalled on the client node.

$client->uninstallingApp();

Launched

Returns a list of app ids which are currently launched on the client node.

$client->launchedApps();

Categories

Returns a full list of app categories.

$client->getCategories();

Stop App

Stops a app by id on the requested node.

$client->stopApp($id);

Multi-signature

Create Multi-signature Account

Create a multi-signature account.

$client->createMultiSignatureAccount($secret, $lifetime, $min, $keysgroup, $secondSecret);

Get Multi-signature Accounts

Gets a list of accounts that belong to a multi-signature account.

$client->getMultiSignatureAccounts($publicKey);

Sign Multi-signature Transaction

Signs a transaction that is awaiting signature.

$client->getPendingTransactions($publicKey);

Get Pending Multi-signature Transactions

Returns a list of multi-signature transactions that waiting for signature by publicKey.

$client->signPendingTransaction($secret, $transactionId, $publicKey);

ToDo:

  • [x] [1] complete API
  • [ ] [2] complete documentation
  • [ ] [3] put package on packagist
  • [ ] […] more

Support

If you want to support me please consider voting for my lisk delegate

  • pelops (6669300595452632273L) on MainNet
  • pelops_testnet (3697531586899904038L) on TestNet

Development

If you want to support the development just create a pull request or fork this project. I’ll try to merge everything into the projects asap.

Project Supporters

These people have contributed to this project:

Thanks you very much!

License

License under GNU General Public License v3.0

Copyright (c) 2017 Marcus Puchalla <cb0@0xcb0.com>

LiskPhp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

LiskPhp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with LiskPhp. If not, see http://www.gnu.org/licenses/.