mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-26 22:55:49 +00:00
Migrate content syntax via script
The changes in this commit were auto-generated by running tool/migrate.sh Following this commit, the Dactyl build no longer works but the Redocly build (mostly) should.
This commit is contained in:
@@ -8,7 +8,7 @@ labels:
|
||||
---
|
||||
# Create Custom Transactors
|
||||
|
||||
A _transactor_ is code that processes a transaction and modifies the XRP Ledger. Creating custom transactors enables you to add new functionality to `rippled`. This tutorial walks through coding transactors, but you'll have to go through the amendment process to add it to XRPL. See: [Contribute Code to the XRP Ledger](contribute-code.html).
|
||||
A _transactor_ is code that processes a transaction and modifies the XRP Ledger. Creating custom transactors enables you to add new functionality to `rippled`. This tutorial walks through coding transactors, but you'll have to go through the amendment process to add it to XRPL. See: [Contribute Code to the XRP Ledger](contribute-code.md).
|
||||
|
||||
Transactors follow a basic order of operations:
|
||||
|
||||
@@ -69,8 +69,10 @@ The `preflight` function checks for errors in the transaction itself before acce
|
||||
- `PreflightContext` doesn't have a view of the ledger.
|
||||
- Use bracket notation to retrieve fields from ledgers and transactions:
|
||||
|
||||
auto const curExpiration = (*sle*)[~sfExpiration];
|
||||
(*sle)[sfBalance] = (*sle)[sfBalance] + reqDelta;
|
||||
```
|
||||
auto const curExpiration = (*sle*)[~sfExpiration];
|
||||
(*sle)[sfBalance] = (*sle)[sfBalance] + reqDelta;
|
||||
```
|
||||
|
||||
**Note:** The `~` symbol returns an optional type.
|
||||
|
||||
@@ -78,7 +80,7 @@ The `preflight` function checks for errors in the transaction itself before acce
|
||||
- [`LedgerFormats.cpp`](https://github.com/XRPLF/rippled/blob/master/src/ripple/protocol/impl/LedgerFormats.cpp)
|
||||
- [`TxFormats.cpp`](https://github.com/XRPLF/rippled/blob/master/src/ripple/protocol/impl/TxFormats.cpp)
|
||||
|
||||
- `rippled` summarizes transaction results with result codes. See: [Transaction Results](transaction-results.html)
|
||||
- `rippled` summarizes transaction results with result codes. See: [Transaction Results](../../references/protocol/transactions/transaction-results/transaction-results.md)
|
||||
|
||||
```c++
|
||||
CreateCheck::preflight(PreflightContext const& ctx)
|
||||
@@ -319,7 +321,7 @@ You can add more helper functions to your custom transactor as necessary. There
|
||||
|
||||
### `calculateBaseFee`
|
||||
|
||||
Most transactions inherit the default [reference transaction cost](transaction-cost.html). However, if your transactor needs to define a non-standard transaction cost, you can replace the transactor's `calculateBaseFee` method with a custom one.
|
||||
Most transactions inherit the default [reference transaction cost](../../concepts/transactions/transaction-cost.md). However, if your transactor needs to define a non-standard transaction cost, you can replace the transactor's `calculateBaseFee` method with a custom one.
|
||||
|
||||
The following example shows how `EscrowFinish` transactions charge an additional cost on conditional escrows based on the size of the fulfillment:
|
||||
|
||||
@@ -353,7 +355,7 @@ The `makeTxConsequences` function enables you to create custom consequences for
|
||||
- Tickets consuming more than one sequence number.
|
||||
- Transactions that are normal or blockers, depending on flags or fields set.
|
||||
|
||||
**Note:** `TxConsequences` only affects the [transaction queue](transaction-queue.html). If a transaction is likely to claim a fee when applied to the ledger, it will be broadcast to peers. If it's not likely to claim a fee, or that can't be determined, it won't be broadcast.
|
||||
**Note:** `TxConsequences` only affects the [transaction queue](../../concepts/transactions/transaction-queue.md). If a transaction is likely to claim a fee when applied to the ledger, it will be broadcast to peers. If it's not likely to claim a fee, or that can't be determined, it won't be broadcast.
|
||||
|
||||
|
||||
```c++
|
||||
@@ -386,4 +388,4 @@ SetAccount::makeTxConsequences(PreflightContext const& ctx)
|
||||
|
||||
## Next Steps
|
||||
|
||||
Re-compile the server with your new transactor and test it in [stand-alone mode](use-stand-alone-mode.html). If you coded the transactor behind an amendment, you can [force-enable](test-amendments.html) the feature using the config file.
|
||||
Re-compile the server with your new transactor and test it in [stand-alone mode](../../infrastructure/testing-and-auditing/index.md). If you coded the transactor behind an amendment, you can [force-enable](../../infrastructure/testing-and-auditing/test-amendments.md) the feature using the config file.
|
||||
|
||||
Reference in New Issue
Block a user