Description
Linked transactions to sign single depended transactions at once where possible.
Example:
const txns = [
{
description: "Opt-into USDCa.",
blob: "",
txID: "BHGYUJ6URPNUXIKKWCCF4GSDHOLEZENF5DL3MZUXF3OGX45GWZBA",
signers: [
"E3GZF5GUOQDW52TZ4X3PU5YR34447BOTVL6X3OOW3CB5EPHWIEISXK5BCI"
],
dependsOn: null,
sSignature: ""
},
{
description: "Claim USDCa from the revenue sink.",
blob: "",
txID: "KHBRJZ2LLIJOUOG6EC7OCIRZFWIPUJ6S55TAZCAOQS2I7V367SIQ",
signers: [
"E3GZF5GUOQDW52TZ4X3PU5YR34447BOTVL6X3OOW3CB5EPHWIEISXK5BCI"
],
dependsOn: "BHGYUJ6URPNUXIKKWCCF4GSDHOLEZENF5DL3MZUXF3OGX45GWZBA",
sSignature: ""
}
]
This way the frontend can be programmed based on the transaction array, dynamically creating an interface with two stages instead of one. In some cases transactions can not be grouped, but can be created already, like with this opt-in example.
We already know what the claim transaction format will be, we just can not send this as a group since the claim transaction can not be send in a round that the user is not opted into yet. So we make the transaction depended and now we know to wait with sending the second until after the first one went trough. (in this case it would not have mattered for signing, only for submitting)
To make the dependency system east to use we probably want to provide a submit transactions function that handles this.
Tasks:
- add
dependsOn
property to transaction return format - implement a
submitTransactions
function, which takes into account the dependency order.