Forms
- class polaris.integrations.TransactionForm[source]
A base class for collecting transaction information. Developers must define subclasses to collect additional information and apply additional validation.
This form assumes the amount collected is in units of a Stellar
Asset
. If the amount of anOffChainAsset
must be collected, create a different form.Note that Polaris’ base UI treats the amount field on this form and its subclasses differently than other forms. Specifically, Polaris automatically adds the asset’s symbol to the input field, adds a placeholder value of 0, makes the fee table visible (by default), and uses the amount entered to update the fee table on each change.
If you do not want the fee table to be displayed when
TransactionForm
is rendered, set"show_fee_table"
toFalse
in the dict returned fromcontent_for_template()
.Fee calculation within the UI is done using the asset’s fixed and percentage fee values saved to the database. If those values are not present, Polaris makes calls to the anchor’s /fee endpoint and displays the response value to the user. If your /fee endpoint requires a type parameter, add a
TransactionForm.type
attribute to the form. Polaris will detect the attribute’s presence on the form and include it in /fee requests.The amount field is validated with the
clean_amount()
function, which ensures the amount is within the bounds for the asset type.