Closed Olanetsoft closed 8 months ago
Yes, you can query the status of a General Message Passing (GMP) transaction using the AxelarJS SDK. The AxelarGMPRecoveryAPI
module in the AxelarJS SDK can be used to query the status of any GMP transaction on the gateway contract of a source chain and trigger a manual relay from source to destination if necessary.
To use the AxelarGMPRecoveryAPI
module, you first need to install the AxelarJS SDK and instantiate the module. Here's how you can do it:
// Install the AxelarJS SDK
npm i @axelar-network/axelarjs-sdk
// Instantiate the AxelarGMPRecoveryAPI module
import {
AxelarGMPRecoveryAPI,
Environment,
} from "@axelar-network/axelarjs-sdk";
const sdk = new AxelarGMPRecoveryAPI({
environment: Environment.TESTNET,
});
If you're getting a 'cannot_fetch_status' response, it might be due to an issue with the transaction or the network. You can try to manually relay the transaction through the Axelar network using the manualRelayToDestChain method:
const sourceTxHash = "0x..";
const provider = new ethers.providers.JsonRpcProvider(
"<https://goerli.infura.io/v3/projectId">
);
// Optional
// By default, The sdk uses `window.ethereum` wallet as a sender wallet e.g. Metamask.
// This option allows caller to pass `privateKey` or `provider` to the sdk directly
const senderOptions = { privateKey: "0x", provider };
const response = await sdk.manualRelayToDestChain(
sourceTxHash,
senderOptions /* can be skipped */
);
For the last question about querying non-GMP, The AxelarGMPRecoveryAPI
functions are specific to GMP, but you can try the lower level API documented on the Axelarscan docs to get GMP or token transfer statuses : https://docs.axelarscan.io/cross-chain/transfers-status.
Hi, is there a way to query the status of Polygon->Osmosis transfer with axelarjs-sdk? axelarscan.io seems to show transfer status when querying with tx-hash of the initial polygon transfer. AxlearGMPRecoveryAPI.queryTransactionStatus returns 'cannot_fetch_status' - haven't figured out what is the difference between GMP- and 'traditional' transfer. Any tips?
Also, can I query non-GMP txn?