Skip to content

Instantly share code, notes, and snippets.

@jaswinder6991
Created November 25, 2024 06:30
Show Gist options
  • Save jaswinder6991/ec6a4bbae47418ea85d7c408df1357f8 to your computer and use it in GitHub Desktop.
Save jaswinder6991/ec6a4bbae47418ea85d7c408df1357f8 to your computer and use it in GitHub Desktop.
Near time out example
try {
const result = await nearAccount.functionCall({
contractId: CONTRACT_ID,
methodName: "claim",
args: {
eth_address: etheriumAddress.replace("0x", ""),
network_details: networkDetails,
},
gas: BigInt(utils.format.parseNearAmount("0.0000000003") || ""),
});
//do whatever
} catch (e) {
if (e.context?.transactionHash) {
console.log(
`Transaction submitted but timed out. Hash: ${e.context.transactionHash}`,
);
await sleep("15000");
const result = await nearAccount.connection.provider.txStatus(
e.context.transactionHash,
CONTRACT_ID,
"FINAL",
);
//do the same whatever
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment