nfthistory/nfthistorylogs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nfthistory/nfthistorylogs

最新稳定版本:v0.0.3

Composer 安装命令:

composer require nfthistory/nfthistorylogs

包简介

Multinetworks Ethereum Interface to manage NFT history transactions logs

README 文档

README

header.webp

⚙️ NFT History Logs

NFT History Logs is the Ethereum PHP API which connects to JSON RPC specs to get the desired logs of an nft contract address or specific nft with id on Ethereum Chain.

Supported Chain: just Ethereum Chain for now!

You need to run a local or remote Ethereum node to use this library.

You could also use testnet like Ganache or Cloudflare ETH network.

You could also set any network endpoints like Alchemy or Infura or anything you want.

Installation

 composer require nfthistory/nfthistorylogs

Usage

New instance

<?php

require "vendor/autoload.php";

use Nft\History\nftHistory;

$contractAddress = "CONTRACT ADDRESS";
$provider = "http://localhost:8545";

$NftHistory  = new nftHistory($contractAddress, $provider);

print_r($NftHistory );
    
// Output:
(
    [contractAddress:protected] => contract address
    [provider] => http://localhost:8545
)

the contract address and provider must be string type.

transferTrxById

You can get and filter all transfer transactions of an specific nft by using Token ID. The majority of the NFT market provided this token ID, but if they did not, you could still obtain it on Etehscan.io

$NftHistory->transferTrxById($tokenId, $fromBlock, $toBlock);

$tokenId must be string number, $fromBlock and $toBlock must be string of hex type (you could set "0x0" as a first block and "latest" as the final block)

allTransferTrx

you can filter transactions history based on transfer event.

$NftHistory->allTransferTrx($fromBlock, $toBlock);

$fromBlock and $toBlock must be string of hex type (you could set "0x0" as a first block and "latest" as the final block)

allTransferTrxHashAndIds

You can get all transfer information arranged and categorized by token ids. It returns an object.

$nfthistory->allTransferTrxHashAndIds();

trxByHash

You can get information of an specific transaction by passing transaction hash. it returns an Object. the trxHash variable is necessary.

 $nfthistory->trxByHash($trxHash);

allTrx

You can get all transaction of an nft contract address without any filter. Be aware that most networks will throw an exception in this situation due to a limitation in log output. You must set a specific block number instead of "latest" for the $toBlock variable.

$NftHistory->allTrx($fromBlock, $toBlock);

receiptByTrxHash

You can get the information of receipt transaction by using this function. pass transaction hash to this function. it returns an object of transaction.

$NftHistory->receiptByTrxHash($trxHash);

topSellNfts

showing the top selling nfts to the lowest prices. be aware of rate limit of the destination server. $countRank is the numbers of the values you want to obtain. it is optional and must not exceed the numbers of tokens of an contract address. it must be in decimal format. $fromBlock and $toBlock are optional.

$NftHistory->topSellNfts($countRank, $fromBlock, $toBlock);

nftTrxWei

every transaction has a property called "data". this section is a hexadecimal number in Wei format. you must pass transaction hash to return an array of data. you can also filter by using $eventName. $eventName is optional.

$NftHistory->nftTrxWei($transactionHash, $eventName);

weiToEther

convert WEI values of token to Ether format _ if its hex format, will be converted to decimal.

$NftHistory->weiToEther($weiValue);

eventSig

You could also get a 256-bit hashed event signature. event signatures supported at this time: "Transfer" , "Approval" and "ApprovalForAll".

$NftHistory->eventSig("Transfer");

event name could be this 3 option as string type: "Transfer" , "Approval" and "ApprovalForAll"

fromAddress

if you get specific nft transaction and you want identify the sender address of the transaction, pass transaction hash. $eventName is optional:

$NftHistory->fromAddress($trxHash, $eventName);

toAddress

If you receive a specific nft transaction and want to identify the recipient address, pass transaction hash. $eventName is optional:

$NftHistory->toAddress($trxHash, $eventName);

tokenId

I assume you have topics for desired transaction objects and you want to know the tokenid of an nft.

$NftHistory->tokenId($topics);

genesisBlock

The Genesis Block is the birth block of an nft. so:

$NftHistory->genesisBlock();

docker-compose

this library is tested on php version 8.1, to test it just try this command:

docker-compose up

contribution

If you are interested in contributing to this project, I will be very glad ^__^

My Social Networks

You can get in contact with me by:
Hackernoon
Linkedin

License

MIT

nfthistory/nfthistorylogs 适用场景与选型建议

nfthistory/nfthistorylogs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 nfthistory/nfthistorylogs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nfthistory/nfthistorylogs 我们能提供哪些服务?
定制开发 / 二次开发

基于 nfthistory/nfthistorylogs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-28