exchange.IO("speedUp", ...)
Resends a stuck transaction (one that has not been mined for a long time) with a higher fee: the recipient address, amount, call data, and gas limit remain unchanged, and only the fee is increased.
exchange.IO(k, txHash)
exchange.IO(k, txHash, options)Examples
Resend a transaction with a higher fee when it has not been mined within a certain period of time.
javascript
function main() {
var USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
var spender = "0x1111111254EEB25477B68fb85Ed929f73A960582"
var txHash = exchange.IO("api", USDC, "approve", spender, "1000000")
Log("Sent:", txHash)
var rec = exchange.IO("waitReceipt", txHash, { timeout: 30000 })
if (!rec) {
// Still not mined after 30 seconds: resend with a higher fee using the same nonce (tip and
// maxFee increased by at least 12.5%)
txHash = exchange.IO("speedUp", txHash)
Log("Sped up:", txHash)
rec = exchange.IO("waitReceipt", txHash, { timeout: 30000 })
}
Log(rec ? "Mined, status: " + rec.status : "Still not mined: " + GetLastError())
}Returns
| Type | Description |
string / object | Returns the hash of the replacement transaction; when |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Function of the |
txHash | string | Yes | Hash of the pending (not yet mined) transaction to be replaced. The transaction must have been sent from the current wallet. |
options | object | No | Optional settings: |
See Also
Remarks
The replacement transaction reuses the nonce of the original transaction. The fee is scaled up by multiplier (default value is 1.125, minimum value is 1.1; nodes require both the tip and maxFee of a replacement transaction to increase by at least 10%), and will not be lower than the current network's suggested value.
When the original transaction has already been mined, the node cannot find the original transaction (for example, it was sent through a private channel), or the original transaction was not sent from the current wallet, the function returns a null value and reports an error.
Currently only Ethereum (EVM) chains are supported; TRON is not supported yet.
Fee calculation: if the original is an EIP-1559 transaction, the tip is the larger of the original tip × multiplier and the current suggested tip, and the max fee is the larger of the original max fee × multiplier and 2 × baseFee + tip; if the original is a legacy transaction, the gas price is the larger of the original gas price × multiplier and the node's eth_gasPrice. The recipient, amount, call data and gas limit are the same as the original's.
The original transaction is looked up on the node configured on the exchange object; when exchange.IO("sendBase", ...) is set, the replacement is broadcast through that node.