Setup Transactions
Some chains require additional transactions to be submitted besides the usual lock, mint, burn or release transactions. Examples include "approve" transactions for ERC20s on Ethereum, or creating associated token accounts on Solana.
If required, these transactions will be available in gateway.inSetup
on gateways and on gatewayTransaction.outSetup
for Gateways and GatewayTransactions.
inSetup
and outSetup
are objects with the field names containing a simple description, and the value being a TxSubmitter or TxWater.
Example of handling setup transactions​
inSetup:​
inSetup
transactions should be submitted before gateway.in
:
- JS
- React
// Before calling gateway.in.submit()`
for (const setupTx of Object.values(gateway.inSetup)) {
await setupTx.submit?.();
await setupTx.wait();
}
For the RenJS v3 tutorial, add this to CreateGateway.tsx
before <ChainTx chainTx={gateway.in} />
:
<>
{Object.keys(gateway.inSetup).map((setupKey) => {
<p key={setupKey}>
{setupKey}: <ChainTx chainTx={gateway.inSetup[setupKey]} />
</p>;
})}
</>
outSetup:​
outSetup
transactions should be submitted before
- JS
- React
// Before calling gatewayTx.out.submit()`
for (const setupTx of Object.values(gatewayTx.outSetup)) {
await setupTx.submit?.();
await setupTx.wait();
}
For the RenJS v3 tutorial, add this to GatewayTx.tsx
before the gatewayTx.out
section:
<>
{Object.keys(gatewayTx.outSetup).map((setupKey) => {
<p key={setupKey}>
{setupKey}: <ChainTx chainTx={gatewayTx.outSetup[setupKey]} />
</p>;
})}
</>