Skip to main content

GatewayTransaction Class

Reference

GatewayTransaction (TypeDoc)​

When a new transaction is detected on a Gateway instance (either from a user sending funds to a gateway address or from the user submitting a transaction), a new GatewayTransaction instance is returned. Alternatively, renJS.gatewayTransaction can also be used directly - this will usually only be used to recover existing transactions that have already been emitted by a Gateway instance.

interface TransactionParams<
ToPayload extends { chain: string; txConfig?: any } = {
chain: string;
}
> {
/**
* The asset being minted or burned - e.g. `"BTC"`.
*/
asset: string;

/**
* A payload for the chain being bridged to.
*
* @example
* bitcoin.Address("miMi...")
*/
to: ToPayload;

/**
* A gateway transaction always has a input transaction on the origin-chain.
*/
fromTx: InputChainTransaction;

/**
* See GatewayParams["shard"].
*/
shard?: GatewayParams["shard"];

/**
* See GatewayParams["nonce"].
*/
nonce?: GatewayParams["nonce"];
}

The main difference between the parameters for the Gateway and GatewayTransaction objects is the fromTx field of type InputChainTransaction instead of the from payload.

The parameters of an existing GatewayTransaction are available from gatewayTransaction.params. They can be serialized and deserialized using JSON.stringify and JSON.parse, and the transaction recreated using renJS.gatewayTransaction(JSON.parse(serializedParams)).

There are several fields on a GatewayTransaction instance that may be useful:

Properties

params - the parameters that can be used to recreate the GatewayTransaction

hash - the RenVM hash of the transaction

selector - the transaction's RenVM method selector

provider - the connected RenVM provider

fromChain - access the from transaction's chain instance that was passed intorenJS.withChains

toChain - access the to-payload's chain instance that was passed into renJS.withChains

nHash - the nonce hash of the RenVM transaction

pHash - the payload hash of the RenVM transaction

gHash - the gateway hash of the RenVM transaction

in - the TxWaiter instance for the input transaction

renVM - the TxSubmitter instance for the RenVM transaction

outSetup - the setup transactions required to be submitted before out - e.g. for creating SPL token accounts on Solana

out - the TxSubmitter/TxWaiter instance for the output transaction

inputType - the input type of the transaction (one of "lock" or "burn")

outputType - the output type of the transaction (one of "mint" or "release")