kilvn/geth-token-jsonrpc-php-client
Composer 安装命令:
composer require kilvn/geth-token-jsonrpc-php-client
包简介
token API client lib for communication with geth (go-ethereum) node.
README 文档
README
forked from wax-api
This class allows anyone to send or receive WAX easily from PHP. It can be used either on the command line, or in a web server. It will work on PHP 5.6 or higher.
To get started, you will need these PHP modules:
- bcmath
- curl
You will also need to install Geth and enable its JSON-RPC API.
Due to precision concerns, all amounts are represented as strings. For example, 1.2345 WAX will be returned as "1.2345".
Install
composer require kilvn/geth-token-jsonrpc-php-client
Demos
There are some demos available under demo/
Usage
use Kilvn\GethTokenJsonRpcPhpClient; $wax = new Wax($rpcHost, $rpcPort [, $trimTrailingZeroes, $timeout]); $wax->setContract($contract_address, $contract_decimals);
$rpcHost- This should be the host where your Geth JSON-RPC is available, e.g."127.0.0.1", Or you can use someone else's node, such as:https://mainnet.infura.io/v3/xxxx, In this case, you need to pass in an empty string as$rpcPort, because this method does not need to tell what the interface port is$rpcPort- This should be the port where your Geth JSON-RPC is available. This is optional and defaults to8545or empty string$contract_addressContract address, you must tell the contract location to make the api work properly$contract_decimalsThe number of decimal places when the contract is released, The type must be of type int$trimTrailingZeroes- If true, then WAX balances and amounts will have trailing zeroes removed$timeoutThe time for curl to send request timeout, the default is 60 seconds
Instantiates a new Wax instance.
getChecksumAddress($address)
$address- The WAX address that you wish to checksum
Returns the address you input, with capitalization in the standard EIP-55 format.
verifyAddressValid($address)
$address- The WAX address that you wish to validate
Verifies that the address you input is valid by making sure its checksum checks out. If it does not have a
case-checksum, simply returns true. Returns true or false.
getPeerCount()
Gets and returns the number of peers connected to your Geth.
getSyncStatus()
Gets and returns an array containing your Geth's sync status, or null if it's not syncing.
getBlockNumber()
Gets and returns the number of the highest block your Geth has.
getAddresses()
Gets and returns an array of all addresses with private keys stored by your Geth.
getWaxBalance($address)
$address- The address whose WAX balance you're interested in
Gets and returns the WAX balance of a particular address, which doesn't need to be your own. The return is a string.
sendWax($fromAddress, $toAddress, $amount)
$fromAddress- The address from which you want to send WAX$toAddress- The address to which you want to send WAX$amount- The amount of WAX you want to send, as a string (e.g. "1.23456")
Sends some WAX from an address you control to another address immediately. Returns the hash of the resulting transaction.
The address must be unlocked. You can automatically unlock addresses using the Geth command line.
createNewPendingTransactionFilter()
Creates a new filter in Geth for pending transactions. Get the new transactions using getNewWaxTransactions.
Returns a string containing the filter's ID.
getNewWaxTransactions($filterId)
$filterId- The ID of the filter you wish to receive data from
Returns an array containing transaction data for every new WAX transaction that has been broadcast since you last called
getNewWaxTransactions for this $filterId. Each array element contains the same elements as getTransactionByHash.
getTransactionByHash($hash)
$hash- The hash of the transaction you want details for
Returns an array containing these elements:
fromAddress- The address which sent the WAXtoAddress- The address which received the WAXamount- The amount of WAX transactedhash- The hash of the transactionblockHash- The hash of the block in which the transaction was includedblockNumber- The number of the block in which the transaction was includedgas- The amount of gas used to send this transactiongasPrice- The price in wei of gas for this transactionconfirmations- How many confirmations this transaction has
kilvn/geth-token-jsonrpc-php-client 适用场景与选型建议
kilvn/geth-token-jsonrpc-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 09 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kilvn/geth-token-jsonrpc-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kilvn/geth-token-jsonrpc-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-28