dop-stick
Version:
Source control tooling for versionable-upgradeable smart contracts
53 lines • 1.68 kB
TypeScript
import { ethers, BigNumber } from 'ethers';
export interface TransactionConfig {
maxRetries?: number;
minGasPrice?: string;
maxGasPrice?: string;
gasPriceMultiplier?: number;
timeout?: number;
confirmations?: number;
speedUp?: boolean;
nonce?: number;
}
export interface TransactionState {
status: 'pending' | 'confirmed' | 'failed' | 'replaced' | 'speedup';
hash: string;
nonce: number;
gasPrice: BigNumber;
gasLimit: BigNumber;
blockNumber?: number;
confirmations: number;
replacedBy?: string;
error?: string;
receipt?: ethers.providers.TransactionReceipt;
}
export declare class TransactionManager {
private pendingTransactions;
private provider;
private defaultConfig;
constructor(provider: ethers.providers.Provider, defaultConfig?: TransactionConfig);
/**
* Send a transaction with automatic management
*/
sendTransaction(tx: ethers.providers.TransactionRequest, signer: ethers.Signer, config?: TransactionConfig): Promise<TransactionState>;
/**
* Speed up a pending transaction
*/
speedUpTransaction(hash: string, signer: ethers.Signer, multiplier?: number): Promise<TransactionState>;
/**
* Check if a transaction can be sped up
*/
canSpeedUp(hash: string): Promise<boolean>;
private prepareTransaction;
private monitorTransaction;
private findReplacementTransaction;
/**
* Get current state of a transaction
*/
getTransactionState(hash: string): TransactionState | undefined;
/**
* Clear transaction history
*/
clearHistory(): void;
}
//# sourceMappingURL=transaction-manager.d.ts.map