xrplwin/xrpl-nfttxmutationparser 问题修复 & 功能扩展

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

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

xrplwin/xrpl-nfttxmutationparser

Composer 安装命令:

composer require xrplwin/xrpl-nfttxmutationparser

包简介

Parse XRPL NFT transaction to context aware object providing direction, token id and roles.

README 文档

README

CI workflow GitHub license Total Downloads

XRPL NFT Transaction Mutation Parser for PHP

Supporting networks

  • XRPL
  • Xahau

Description

Parses NFToken and URIToken (referred as NFT) Transactions (NFTokenMint, URITokenMint, NFTokenBurn, URITokenBurn, NFTokenAcceptOffer, URITokenBuy, NFTokenCancelOffer, URITokenCancelSellOffer, NFTokenCreateOffer, URITokenCreateSellOffer, Remit) with account context and returns affected NFT, direction that NFT was transferred, minted or destroyed, and outputs roles referencing account has in specific transaction.

With this parser you can find out what has happened with referencing account after transaction was executed. For example when token is minted - parser will output token ID and direction IN, this means referenced account was minter and new token is added to reference account ownership.

Remit (XLS-55)
Remit Transaction Type can mint a single URIToken which is present in this transaction like any other NFT. Additionally Remit can transfer none, one or more existing URIToken-s from Account to Destination, those tokens are present in nfts and ref.nfts array key, sending Account has role 'SELLER' and receiver Destination has role 'OWNER'.

What is checked:

  • Token id - affected token ID in question
  • Token direction - minted - IN, burned, OUT, sold - OUT, bought - IN
  • Roles - role of referencing account in this transaction, is it minter, burner, seller, buyer, broker, or issuer
  • Remitted URITokens - list of tokens transferred in Remit transaction type

Note about NFToken (XLS-20) issuer:
Issuer can only happen in NFTokenAcceptOffer transaction type, it is extracted from modified AccountRoot node by checking if balance has been changed. If yes then this account gained percentage of sale, and it is issuer of NFToken.

Note

This package is provided as is, please test it yourself first.
Found a bug? Report issue here

Requirements

Installation

To install run

composer require xrplwin/xrpl-nfttxmutationparser

Usage

use XRPLWin\XRPLNFTTxMutatationParser\NFTTxMutationParser;

$txResult = [
  "Account" => "rBcd..." 
  "Fee" => "1000",
  //...
];
$parser = new NFTTxMutationParser(
  "rAbc...", //This is reference account
  (object)$txResult //This is transaction result
);
$parsedTransaction = $parser->result();

print_r($parsedTransaction);

/*

├ Output for $parsedTransaction:
├ Array (
├     [nft] => 00082710...
├     [nfts] => []
├     [context] => null  
├     [ref] => Array
├         (
├             [account] => rAbc...  
├             [nft] => 00082710...
├             [nfts] => []
├             [direction] => IN
├             [roles] => Array
├                 (
├                     [0] => OWNER
├                 )
├         )
├ )

*/

Response

Key Type Description
nft ?String NFToken or URIToken always present in types: NFTokenMint, NFTokenBurn, NFTokenAcceptOffer, NFTokenCreateOffer, NFTokenModify, URI*, null in Remit if there is no token minted
nfts Array NFTokens transferred in Remit transaction type (not including Minted token)
context ?String Context of transaction (specifically offers). One of: null,"BUY","SELL","BROKERED"
ref.account String Reference account
ref.nft ?String NFTokenID or URIToken which changed ownership depending on direction for reference account including minted URIToken in Remit
ref.nfts Array URITokens which changed ownership depending on direction for reference account in Remit transaction only, NFTokens transferred in Remit transaction type (not including Minted token)
ref.direction String One of: "IN","OUT","UNKNOWN"
ref.roles Array Array of roles reference account has in this transaction, possible roles: "UNKNOWN", "OWNER", "MINTER", "BURNER", "BUYER", "SELLER", "BROKER", "ISSUER"

Running tests

Run all tests in "tests" directory.

composer test

or

./vendor/bin/phpunit --testdox

Demo

See this in action on XRPLWin Playground

xrplwin/xrpl-nfttxmutationparser 适用场景与选型建议

xrplwin/xrpl-nfttxmutationparser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 197 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「parser」 「composer」 「transaction」 「ripple」 「mutation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 xrplwin/xrpl-nfttxmutationparser 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 197
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-07