# Python Plugins
This folder contains everything needed to build and run a Python plugin (other than the rippled code).
## Build & Run
```bash
pip install xrpl-plugin
plugin-build path/to/plugin.py
# edit rippled.cfg to include the plugin.xrplugin in a [plugins] stanza
# run rippled with the `plugin` branch and submit plugin transactions to it
```
## Concepts
### Keylet
A Keylet identifies a key in the state map and its ledger entry type. Keylet is a portmanteau of the key and LET, an acronym for LedgerEntryType.
### LedgerEntryType
Each ledger object requires a unique type identifier, which is stored within the object itself; this makes it possible to iterate the entire ledger, determine each object's type and verify that the object you retrieved from a given hash matches the expected type.
## Notes
pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.
The plugin exposes the code in [main.cpp](./src/main.cpp) as python bindings.
Then we can use in our plugin the following:
- **models** (classes):
- Transactor
- SType (it has a parse_value method)
- TERCode
- LedgerObject
- InvariantCheck
- InnerObject
- **sfields** (ST fields, serialized fields that can be included in transactions and ledger objects):
- SF_ACCOUNT
- SF_AMOUNT
- SF_UINT8
- ...
- **stypes** (all STObjects, serialized types):
- STAmount
- STObject
- STArray
- ...
- **return_codes** (Existing TER return codes):
- tesSUCCESS
- temMALFORMED
- ...
- **basic_types** (basic/fundamental types):
- AccountID
- XRPAmount
- Seed
- IOUAmount
- ...
- **keylets** (as per definition above):
- account_keylet
- escrow_keylet
- trustline_keylet
- offer_keylet
- ...
- **ledger_objects** (for ledger object manipulation):
- LedgerEntryType
- LedgerSpecificFlags
- **transactors** (contexts and other classes used in transaction processing):
- Rules
- Fees
- TimePoint
- LedgerInfo
- **build** (for the build process)
- **nfts** (utility methods for working with NFTs)
Raw data
{
"_id": null,
"home_page": "https://github.com/mvadari/xrpl-plugin",
"name": "xrpl-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Mayukha Vadari",
"author_email": "mvadari@ripple.com",
"download_url": "https://files.pythonhosted.org/packages/4e/69/9accfb7599b9ee6e0379eebbb3f61981c839cf9b9f48a593bd84b5d39fae/xrpl-plugin-0.2.5.tar.gz",
"platform": null,
"description": "# Python Plugins\n\nThis folder contains everything needed to build and run a Python plugin (other than the rippled code).\n\n## Build & Run\n\n```bash\npip install xrpl-plugin\nplugin-build path/to/plugin.py\n# edit rippled.cfg to include the plugin.xrplugin in a [plugins] stanza\n# run rippled with the `plugin` branch and submit plugin transactions to it\n```\n\n## Concepts\n\n### Keylet\n\nA Keylet identifies a key in the state map and its ledger entry type. Keylet is a portmanteau of the key and LET, an acronym for LedgerEntryType.\n\n### LedgerEntryType\n\nEach ledger object requires a unique type identifier, which is stored within the object itself; this makes it possible to iterate the entire ledger, determine each object's type and verify that the object you retrieved from a given hash matches the expected type.\n\n## Notes\n\npybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.\nThe plugin exposes the code in [main.cpp](./src/main.cpp) as python bindings.\n\nThen we can use in our plugin the following:\n\n- **models** (classes):\n\n - Transactor\n - SType (it has a parse_value method)\n - TERCode\n - LedgerObject\n - InvariantCheck\n - InnerObject\n\n- **sfields** (ST fields, serialized fields that can be included in transactions and ledger objects):\n\n - SF_ACCOUNT\n - SF_AMOUNT\n - SF_UINT8\n - ...\n\n- **stypes** (all STObjects, serialized types):\n\n - STAmount\n - STObject\n - STArray\n - ...\n\n- **return_codes** (Existing TER return codes):\n\n - tesSUCCESS\n - temMALFORMED\n - ...\n\n- **basic_types** (basic/fundamental types):\n\n - AccountID\n - XRPAmount\n - Seed\n - IOUAmount\n - ...\n\n- **keylets** (as per definition above):\n\n - account_keylet\n - escrow_keylet\n - trustline_keylet\n - offer_keylet\n - ...\n\n- **ledger_objects** (for ledger object manipulation):\n\n - LedgerEntryType\n - LedgerSpecificFlags\n\n- **transactors** (contexts and other classes used in transaction processing):\n\n - Rules\n - Fees\n - TimePoint\n - LedgerInfo\n\n- **build** (for the build process)\n- **nfts** (utility methods for working with NFTs)\n",
"bugtrack_url": null,
"license": null,
"summary": "XRPL Plugins",
"version": "0.2.5",
"project_urls": {
"Homepage": "https://github.com/mvadari/xrpl-plugin"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e4a6a625125a3e04fb6a2e440e80da9155853df1b28d47ce1d1225072a51ab3d",
"md5": "b7defa5b101c2e981ddc0bf383c398d6",
"sha256": "0788ebca05033b040609dfc5581f8f2c10be7534298cfaaac2d9ec572dc202e2"
},
"downloads": -1,
"filename": "xrpl_plugin-0.2.5-cp311-cp311-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "b7defa5b101c2e981ddc0bf383c398d6",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 17720651,
"upload_time": "2024-06-07T15:47:44",
"upload_time_iso_8601": "2024-06-07T15:47:44.906430Z",
"url": "https://files.pythonhosted.org/packages/e4/a6/a625125a3e04fb6a2e440e80da9155853df1b28d47ce1d1225072a51ab3d/xrpl_plugin-0.2.5-cp311-cp311-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4e699accfb7599b9ee6e0379eebbb3f61981c839cf9b9f48a593bd84b5d39fae",
"md5": "4e46dcdf0fd67677bec335e4b0811967",
"sha256": "1cbde4cdb52b64e8d76734a89c96eff467ec87176de4e8b2dd304184de01e691"
},
"downloads": -1,
"filename": "xrpl-plugin-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "4e46dcdf0fd67677bec335e4b0811967",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7623207,
"upload_time": "2024-06-07T15:48:06",
"upload_time_iso_8601": "2024-06-07T15:48:06.074308Z",
"url": "https://files.pythonhosted.org/packages/4e/69/9accfb7599b9ee6e0379eebbb3f61981c839cf9b9f48a593bd84b5d39fae/xrpl-plugin-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-07 15:48:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mvadari",
"github_project": "xrpl-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "xrpl-plugin"
}