{"id":22302992,"url":"https://github.com/xrplwin/xrpl-nfttxmutationparser","last_synced_at":"2025-03-26T00:32:12.375Z","repository":{"id":122397923,"uuid":"608776074","full_name":"XRPLWin/XRPL-NFTTxMutationParser","owner":"XRPLWin","description":"Parse NFT and URI transaction to context aware object providing direction, token id and roles.","archived":false,"fork":false,"pushed_at":"2024-05-17T06:40:27.000Z","size":130,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-04T20:39:13.174Z","etag":null,"topics":["nft","nftoken","parser","php","uri","uritoken","xahau","xrpl"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XRPLWin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-02T18:00:40.000Z","updated_at":"2024-11-30T21:15:18.000Z","dependencies_parsed_at":"2024-12-03T18:43:08.724Z","dependency_job_id":"d7f28bdc-38b5-4e6c-a9e4-af4900e42c03","html_url":"https://github.com/XRPLWin/XRPL-NFTTxMutationParser","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"406254cebcdbd1ea0c14cd907d6941776345c804"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-NFTTxMutationParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-NFTTxMutationParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-NFTTxMutationParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-NFTTxMutationParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRPLWin","download_url":"https://codeload.github.com/XRPLWin/XRPL-NFTTxMutationParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245566098,"owners_count":20636390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nft","nftoken","parser","php","uri","uritoken","xahau","xrpl"],"created_at":"2024-12-03T18:42:22.631Z","updated_at":"2025-03-26T00:32:12.345Z","avatar_url":"https://github.com/XRPLWin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI workflow](https://github.com/XRPLWin/XRPL-NFTTxMutationParser/actions/workflows/main.yml/badge.svg)](https://github.com/XRPLWin/XRPL-NFTTxMutationParser/actions/workflows/main.yml)\r\n[![GitHub license](https://img.shields.io/github/license/XRPLWin/XRPL-NFTTxMutationParser)](https://github.com/XRPLWin/XRPL-NFTTxMutationParser/blob/main/LICENSE)\r\n[![Total Downloads](https://img.shields.io/packagist/dt/xrplwin/xrpl-nfttxmutationparser.svg?style=flat)](https://packagist.org/packages/xrplwin/xrpl-nfttxmutationparser)\r\n\r\n# XRPL NFT Transaction Mutation Parser for PHP\r\n\r\n## Supporting networks\r\n\r\n- XRPL\r\n- Xahau\r\n\r\n## Description\r\n\r\nParses 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.\r\n\r\nWith 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.\r\n\r\n**Remit (XLS-55)**  \r\nRemit 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'.\r\n  \r\nWhat is checked:\r\n\r\n- **Token id** - affected token ID in question\r\n- **Token direction** - minted - IN, burned, OUT, sold - OUT, bought - IN\r\n- **Roles** - role of referencing account in this transaction, is it minter, burner, seller, buyer, broker, or issuer\r\n- **Remitted URITokens** - list of tokens transferred in `Remit` transaction type\r\n\r\nNote about NFToken (XLS-20) issuer:  \r\nIssuer 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.\r\n\r\n### Note\r\n\r\nThis package is provided as is, please test it yourself first.  \r\nFound a bug? [Report issue here](https://github.com/XRPLWin/XRPL-NFTTxMutationParser/issues/new)\r\n\r\n## Requirements\r\n- PHP 8.1 or higher\r\n- [Composer](https://getcomposer.org/)\r\n\r\n## Installation\r\nTo install run\r\n\r\n```\r\ncomposer require xrplwin/xrpl-nfttxmutationparser\r\n```\r\n\r\n## Usage\r\n```PHP\r\nuse XRPLWin\\XRPLNFTTxMutatationParser\\NFTTxMutationParser;\r\n\r\n$txResult = [\r\n  \"Account\" =\u003e \"rBcd...\" \r\n  \"Fee\" =\u003e \"1000\",\r\n  //...\r\n];\r\n$parser = new NFTTxMutationParser(\r\n  \"rAbc...\", //This is reference account\r\n  (object)$txResult //This is transaction result\r\n);\r\n$parsedTransaction = $parser-\u003eresult();\r\n\r\nprint_r($parsedTransaction);\r\n\r\n/*\r\n┐\r\n├ Output for $parsedTransaction:\r\n├ Array (\r\n├     [nft] =\u003e 00082710...\r\n├     [nfts] =\u003e []\r\n├     [context] =\u003e null  \r\n├     [ref] =\u003e Array\r\n├         (\r\n├             [account] =\u003e rAbc...  \r\n├             [nft] =\u003e 00082710...\r\n├             [nfts] =\u003e []\r\n├             [direction] =\u003e IN\r\n├             [roles] =\u003e Array\r\n├                 (\r\n├                     [0] =\u003e OWNER\r\n├                 )\r\n├         )\r\n├ )\r\n┴\r\n*/\r\n```\r\n\r\n## Response\r\n\r\n| Key  | Type | Description |\r\n| ------------- | ------------- | ------------- |\r\n| nft  | ?String  | NFToken or URIToken always present in types: `NFTokenMint`, `NFTokenBurn`, `NFTokenAcceptOffer`, `NFTokenCreateOffer`, `URI*`, null in `Remit` if there is no token minted   |\r\n| nfts  | Array  | NFTokens transferred in Remit transaction type (not including Minted token)  |\r\n| context  | ?String  | Context of transaction (specifically offers). One of: `null`,`\"BUY\"`,`\"SELL\"`,`\"BROKERED\"` |\r\n| ref.account  | String  | Reference account |\r\n| ref.nft  | ?String  | NFTokenID or URIToken which changed ownership depending on direction for reference account including minted URIToken in Remit |\r\n| 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) |\r\n| ref.direction  | String  | One of: `\"IN\"`,`\"OUT\"`,`\"UNKNOWN\"` |\r\n| ref.roles  | Array  | Array of roles reference account has in this transaction, possible roles: `\"UNKNOWN\"`, `\"OWNER\"`, `\"MINTER\"`, `\"BURNER\"`, `\"BUYER\"`, `\"SELLER\"`, `\"BROKER\"`, `\"ISSUER\"`  |\r\n\r\n## Running tests\r\nRun all tests in \"tests\" directory.\r\n```\r\ncomposer test\r\n```\r\nor\r\n```\r\n./vendor/bin/phpunit --testdox\r\n```\r\n\r\n## Demo\r\n\r\nSee this in action on [XRPLWin Playground](https://playground.xrpl.win/play/xrpl-nft-transaction-mutation-parser)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplwin%2Fxrpl-nfttxmutationparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrplwin%2Fxrpl-nfttxmutationparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplwin%2Fxrpl-nfttxmutationparser/lists"}