@gluwa/transaction-retry-tool
_ _ _ _ _ _
| | | | (_) | | | | | |
| |_ _ __ __ _ _ __ ___ __ _ ___| |_ _ ___ _ __ ______ _ __ ___| |_ _ __ _ _ ______| |_ ___ ___ | |
| __| '__/ _' | '_ \/ __|/ _' |/ __| __| |/ _ \| '_ \______| '__/ _ \ __| '__| | | |______| __/ _ \ / _ \| |
| |_| | | (_| | | | \__ \ (_| | (__| |_| | (_) | | | | | | | __/ |_| | | |_| | | || (_) | (_) | |
\__|_| \__,_|_| |_|___/\__,_|\___|\__|_|\___/|_| |_| |_| \___|\__|_| \__, | \__\___/ \___/|_|
__/ |
|___/
This Hardhat plugin provides two tasks and two functions to help you manage and optimize your transactions on Ethereum compatible blockchain. The two tasks include the ability to retry a transaction and retrieve the current gas cost.
Install Transaction-Retry-Tool
To install the Hardhat Transaction-Retry-Tool Plugin, run the following command in your project directory:
npm i transaction-retry-tool
Next, add the plugin to your hardhat.config.js file:
require("transaction-retry-tool");
And that's it! You can now use the two tasks and functions provided by this plugin to manage and optimize your transactions.
Directories
Tasks
The plugin adds two tasks to the Hardhat CLI:
npx hardhat retry
Task: retry
This task is used to retry a transaction with the current gas price or a specified one.
Usage: hardhat [GLOBAL OPTIONS] retry --tx-hash --signer-key [--gas-price ]
OPTIONS:
- --tx-hash The transaction hash of the transaction to retry
- --signer-key The signer private key (or type hardhat to use hardhat.config private key)
- --gas-price Specify a gas price to retry the transaction with (default: current network gas price) (default: "")
retry: Retry a transaction with the current gas price or specify one
Task: gas-cost
This task is used to retrieve the current gas price on the selected network in wei.
Usage: hardhat [GLOBAL OPTIONS] gas-cost
gas-cost: Get the current gas price on the selected network in wei
Functions
Function allow you to use the transaction retry tool OR get the current gas cost.
const { transactionRetry } = require('hardhat');
transactionRetry.retry(
txHash: string,
signerKey: string,
gasPrice?: string
)
transactionRetry.gasCost()
Directory Tree
@gluwa/transaction-retry-tool/
│ .eslintrc.js
│ .npmignore
│ .prettierrc
│ awesome-readme.config.js
│ CONTRIBUTING.md
│ LICENSE
│ package-lock.json
│ package.json
│ README.md
│ tsconfig.json
│ tsconfig.prod.json
│ tslint.json
└─── src/
│ getGasCost.ts
│ index.ts
│ README.md
│ retryTransaction.ts
│ serveTasks.ts
│ TransactionRetry.ts
│ type-extensions.ts
│ utils.ts