{"id":22302986,"url":"https://github.com/xrplwin/xrpl-hookparser","last_synced_at":"2025-07-29T03:33:28.090Z","repository":{"id":206061210,"uuid":"715537961","full_name":"XRPLWin/XRPL-HookParser","owner":"XRPLWin","description":"Transaction Hook parser for hook-enabled XRPL/Xahau networks.","archived":false,"fork":false,"pushed_at":"2024-03-10T21:44:51.000Z","size":109,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-24T23:46:02.973Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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":".github/FUNDING.yml","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},"funding":{"github":["zgrguric"]}},"created_at":"2023-11-07T10:48:19.000Z","updated_at":"2024-11-09T01:10:20.000Z","dependencies_parsed_at":"2024-02-09T10:43:02.766Z","dependency_job_id":null,"html_url":"https://github.com/XRPLWin/XRPL-HookParser","commit_stats":null,"previous_names":["xrplwin/xrpl-hookparser"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-HookParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-HookParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-HookParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLWin%2FXRPL-HookParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRPLWin","download_url":"https://codeload.github.com/XRPLWin/XRPL-HookParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227978217,"owners_count":17850540,"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":[],"created_at":"2024-12-03T18:42:22.067Z","updated_at":"2025-07-29T03:33:28.079Z","avatar_url":"https://github.com/XRPLWin.png","language":"PHP","funding_links":["https://github.com/sponsors/zgrguric"],"categories":[],"sub_categories":[],"readme":"![main workflow](https://github.com/XRPLWin/XRPL-HookParser/actions/workflows/main.yml/badge.svg)\n[![GitHub license](https://img.shields.io/github/license/XRPLWin/XRPL-HookParser)](https://github.com/XRPLWin/XRPL-HookParser/blob/main/LICENSE)\n[![Total Downloads](https://img.shields.io/packagist/dt/xrplwin/xrpl-hookparser.svg?style=flat)](https://packagist.org/packages/xrplwin/xrpl-hookparser)\n\n# HookParser\nTransaction Hook parser for hook-enabled XRPL/Xahau networks.\n\nThis package takes single transaction, parses metadata and provides info about HookHash-es and accounts.\n\n\n## Requirements\n- PHP 8.1 or higher\n- [Composer](https://getcomposer.org/)\n\n## Installation\n```\ncomposer require xrplwin/xrpl-hookparser\n```\n\n## Usage\n\n### Transaction parser\n\n```PHP\nuse XRPLWin\\XRPLHookParser\\TxHookParser;\n\n$tx = (object)[ // Full transaction, containing Account, Destination, meta, ...\n    \"Account\": \"rA...\",\n    \"Amount\": \"100300000\",\n    \"Destination\": \"rD....\",\n    \"Fee\": \"10000\",\n    ...\n    \"meta\" =\u003e [ ... ],\n    ...\n];\n\n$TxHookParser = new TxHookParser($tx);\n\n// All examples below return array:\n\n# List of all hooks in transaction\n$hooks = $TxHookParser-\u003ehooks();\n# List of all accounts that are affected by hooks in transaction\n$accounts = $TxHookParser-\u003eaccounts();\n# List of hooks by account*\n$accountHooks = $TxHookParser-\u003eaccountHooks('raddress...');\n# List of accounts by hook\n$hookAccounts = $TxHookParser-\u003ehookAccounts('5EDF6...2DC77');\n\n# List of newly created hooks (new HookDefinition created)\n$createdHooks = $TxHookParser-\u003ecreatedHooks();\n# List of newly created hooks - detailed\n$createdHooksDetails = $TxHookParser-\u003ecreatedHooksDetailed();\n# Array key-value parameters contained in created hook\n$hookInitialParams = TxHookParser::toParams($createdHooksDetails['5EDF6...2DC77']);\n# Check if specific hook is created\n$isCreated = $TxHookParser-\u003eisHookCreated('5EDF6...2DC77');\n\n# List of destroyed hooks (HookDefinition deleted)\n$destroyedHooks = $TxHookParser-\u003edestroyedHooks();\n# Check if specific hook is destroyed\n$isDestroyed = $TxHookParser-\u003eisHookDestroyed('5EDF6...2DC77');\n\n# List of uninstalled hooks* (eg. SetHook transaction)\n$uninstalledHooks = $TxHookParser-\u003euninstalledHooks();\n# List of uninstalled hooks with positions*\n$uninstalledHooksPos = $TxHookParser-\u003euninstalledHooksPos();\n# List of uninstalled hooks with num uninstalls\n$uninstalledHooksStats = $TxHookParser-\u003euninstalledHooksStats();\n# List of installed hooks* (eg. SetHook transaction)\n$installedHooks = $TxHookParser-\u003einstalledHooks();\n# List of installed hooks with positions*\n$installedHooksPos = $TxHookParser-\u003einstalledHooksPos();\n# List of installed hooks with num installs\n$installedHooksStats = $TxHookParser-\u003einstalledHooksStats();\n# List of modified hooks*\n$modifiedHooks = $TxHookParser-\u003emodifiedHooks();\n# List of modified hooks with positions*\n$modifiedHooksPos = $TxHookParser-\u003emodifiedHooksPos();\n# List of unmodified hooks*\n$unmodifiedHooks = $TxHookParser-\u003eunmodifiedHooks();\n# List of unmodified hooks with positions*\n$unmodifiedHooksPos = $TxHookParser-\u003eunmodifiedHooksPos();\n# Manual data lookup (lookup any combination of mapped data)\n$lookup = $TxHookParser-\u003elookup('raddress...','Hook','installed');\n\n\n# * Methods that can return multiple same hook hashes, for example if\n#   account has same hook on two or more positions installed, it is \n#   important to differentiate hook \"instance\" on account vs hook \n#   create and destroy actions. List of hooks always returns unique hashes.\n```\n\n### HookOn/HookCanEmit field\nSee https://richardah.github.io/xrpl-hookon-calculator/ for reference.\n\nDecode HookOn or HookCanEmit String\n```PHP\nuse XRPLWin\\XRPLHookParser\\HookOn;\n\n$triggered = HookOn::decode('0xfffffffffffffffffffffffffffffffffffffff7fffffffffffc1fffffc00a40'); //array\n/*\n$triggered = array:26 [\n  0 =\u003e \"ttPAYMENT\"\n  1 =\u003e \"ttESCROW_CREATE\"\n  ...\n]\n*/\n//No triggers in this sample:\nHookOn::decode('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff');\n//Works without prefix:\nHookOn::decode('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff');\n//Works with uppercase and lowercase:\nHookOn::decode('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');\nHookOn::decode('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');\nHookOn::decode('0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');\n```\n\nEncode HookOn or HookCanEmit String\n```PHP\nuse XRPLWin\\XRPLHookParser\\HookOn;\n\nHookOn::encode([HookOn::ttACCOUNT_DELETE]);\n//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9fffff'\n\nHookOn::encode([]);\n//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff'\n\nHookOn::encode([HookOn::ttACCOUNT_DELETE,HookOn::ttACCOUNT_SET]);\n//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9ffff7'\n```\n\n## What is new in version 2.x\nVersion 2.x brings overhaul of hook detection code and now\npositions are tracked, which in return allows new methods\nlisted below. For each installed, modified and uninstalled\nhook on account it is possible to get position in which change\nwas occurred. Modified Hooks method now does not return hooks\nwhich was reinstalled but contents are not changed (Flag=0 is normalized),\nthose are now available in `unmodifiedHooks` and `unmodifiedHooksPos` methods.\n\n- Added `uninstalledHooksPos()` method\n- Added `installedHooksPos()` method\n- Changed `modifiedHooks()` method\n- Added `modifiedHooksPos()` method\n- Added `unmodifiedHooks()` method\n- Added `unmodifiedHooksPos()` method\n\n## Running tests\nRun all tests in \"tests\" directory.\n```\ncomposer test\n```\nor\n```\n./vendor/bin/phpunit --testdox\n```\n\n## References\n\nhttps://docs.xahau.network/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplwin%2Fxrpl-hookparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrplwin%2Fxrpl-hookparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplwin%2Fxrpl-hookparser/lists"}