# 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/d8/69/e3636f6bc681c52baeae4b455855b33b6b7a5d22eab7b2fd2d9281b2b58f/xrpl-plugin-0.2.4.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.4",
"project_urls": {
"Homepage": "https://github.com/mvadari/xrpl-plugin"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e5eafb5cf0d7b5517cca7ad0e00f65eca289405fa37b4bd9b8cfccbfeb3d68c3",
"md5": "2973d39b72520dbf787daa9f079305e8",
"sha256": "7c7feb56043feeb8a526d9ffc50c4a26e82086d3a6a8a9a4430c36b0d9350461"
},
"downloads": -1,
"filename": "xrpl_plugin-0.2.4-cp311-cp311-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "2973d39b72520dbf787daa9f079305e8",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 17704638,
"upload_time": "2024-05-15T21:25:49",
"upload_time_iso_8601": "2024-05-15T21:25:49.686814Z",
"url": "https://files.pythonhosted.org/packages/e5/ea/fb5cf0d7b5517cca7ad0e00f65eca289405fa37b4bd9b8cfccbfeb3d68c3/xrpl_plugin-0.2.4-cp311-cp311-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d869e3636f6bc681c52baeae4b455855b33b6b7a5d22eab7b2fd2d9281b2b58f",
"md5": "919f60b7cbe52a5875be837fef744c16",
"sha256": "67c5b5bf9cdbd8c64f398569ba339455548932a8ff3af3ed2f3102eb805d19ad"
},
"downloads": -1,
"filename": "xrpl-plugin-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "919f60b7cbe52a5875be837fef744c16",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7613342,
"upload_time": "2024-05-15T21:25:57",
"upload_time_iso_8601": "2024-05-15T21:25:57.039720Z",
"url": "https://files.pythonhosted.org/packages/d8/69/e3636f6bc681c52baeae4b455855b33b6b7a5d22eab7b2fd2d9281b2b58f/xrpl-plugin-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-15 21:25:57",
"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"
}