Query and recover GMP transactions
Occasionally, transactions can get “stuck” in the pipeline from a source to destination chain (e.g. due to one-off issues that arise with relayers that operate on top of the network).
The AxelarGMPRecoveryAPI
module in the AxelarJS SDK can be used by your dApp to query the status of any General Message Passing (GMP) transaction (triggered by either callContract
or callContractWithToken
) on the gateway contract of a source chain and trigger a manual relay from source to destination if necessary. - The GMP status tracker on Axelarscan makes use of this feature.
Install the AxelarJS SDK module (AxelarGMPRecoveryAPI
)
Install the AxelarJS SDK:
Instantiate the AxelarGMPRecoveryAPI
module:
Query transaction status by txHash
Invoke queryTransactionStatus
:
Possible status responses for txStatus are outlined below:
Trigger manual relay of transaction through the Axelar network
The following method, once invoked, will:
- Query the current status of the transaction to be in one of the states above.
- Recover from source to destination if needed.
Possible response values are:
If success == false
in the response above, there are two options to remediate (below).
Execute manually OR increase gas payment
1. Execute manually
When invoking this method, you will manually execute (and pay for) the executable method on your specified contract on the destination chain of your cross-chain transaction.
Possible response values are:
2. Increase gas payment
There are two different functions to increase gas payment depending on type of the token.
2.1 Native gas payment
Invoking this method will execute the addNativeGas
method on the Gas Receiver contract on the source chain of your cross-chain transaction to increase the amount of the gas payment, in the source chain native token. The amount to be added is automatically calculated based on many factors e.g. token price of the destination chain, token price of the source chain, current gas price at the destination chain, etc. However, it can be overridden by specifying amount in the options
.
Possible response values are:
2.2 ERC-20 Gas Payment
This is similar to native gas payment except using ERC-20 token for gas payment. However, the supported ERC-20 tokens are limited. See the list of supported tokens here: [Mainnet | Testnet]
Possible response values are: