feat: `AssembleTx` query (#2769)
Closes https://github.com/FuelLabs/fuel-core/issues/2757
Added a new `assembleTx` GraphQL endpoint.
The endpoint can be used to assemble the transaction based on the
provided requirements.
The returned transaction contains:
- Input coins to cover `required_balances`
- Input coins to cover the fee of the transaction based on the gas price
from `block_horizon`
- `Change` or `Destroy` outputs for all assets from the inputs
- `Variable` outputs in the case they are required during the execution
- `Contract` inputs and outputs in the case they are required during the
execution
- Reserved witness slots for signed coins filled with `64` zeroes
- Set script gas limit(unless `script` is empty)
- Estimated predicates, if `estimate_predicates == true`
Returns an error if:
- The number of required balances exceeds the maximum number of inputs
allowed.
- The fee address index is out of bounds.
- The same asset has multiple change policies(either the receiver of
the change is different, or one of the policies states about the
destruction
of the token while the other does not). The `Change` output from the
transaction
also count as a `ChangePolicy`.
- The number of excluded coin IDs exceeds the maximum number of inputs
allowed.
- Required assets have multiple entries.
- If accounts don't have sufficient amounts to cover the transaction
requirements in assets.
- If a constructed transaction breaks the rules defined by consensus
parameters.
Remaining work do be done:
- [x] Client implementation.
- [ ] Integration tests
---------
Co-authored-by: green <xgreenx9999@gmail.com>
Co-authored-by: AurelienFT <aurelien.foucault@epitech.eu>
Co-authored-by: Aaryamann Challani <43716372+rymnc@users.noreply.github.com> M
Mårten Blankfors committed
88567d40076972e775ffcda33d55e1e03ec19f78
Parent: 9a4693c
Committed by GitHub <noreply@github.com>
on 3/11/2025, 7:10:39 PM