Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "@concero/operator-utils",
"dependencies": {
"async-mutex": "0.5.0",
"axios": "1.11.0",
"axios": "1.12.0",
"p-queue": "9.0.0",
"uuid": "11.1.0",
"viem": "2.37.6",
Expand Down
2 changes: 1 addition & 1 deletion dist/.tsbuildinfo

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './constants';
export * from './managers';
export * from './types';
export * from './utils';
export * from './stores';
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,051 changes: 585 additions & 466 deletions dist/index.js

Large diffs are not rendered by default.

1,050 changes: 584 additions & 466 deletions dist/index.mjs

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions dist/managers/TxMonitor.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import { Hash } from 'viem';
import { IBlockManagerRegistry, IConceroNetworkManager, ILogger, ITxMonitor, IViemClientManager, TxMonitorConfig } from '../types';
import { ITxMonitorStore } from '../types/managers';
export declare class TxMonitor implements ITxMonitor {
private static instance;
private monitors;
private viemClientManager;
private logger;
private config;
private networkSubscriptions;
private blockManagerRegistry;
private networkManager;
constructor(logger: ILogger, viemClientManager: IViemClientManager, blockManagerRegistry: IBlockManagerRegistry, networkManager: IConceroNetworkManager, config: TxMonitorConfig);
static createInstance(logger: ILogger, viemClientManager: IViemClientManager, blockManagerRegistry: IBlockManagerRegistry, networkManager: IConceroNetworkManager, config: TxMonitorConfig): TxMonitor;
private store;
private hub;
constructor(logger: ILogger, viemClientManager: IViemClientManager, blockManagerRegistry: IBlockManagerRegistry, networkManager: IConceroNetworkManager, config: TxMonitorConfig, store?: ITxMonitorStore);
static createInstance(logger: ILogger, viemClientManager: IViemClientManager, blockManagerRegistry: IBlockManagerRegistry, networkManager: IConceroNetworkManager, config: TxMonitorConfig, store?: ITxMonitorStore): TxMonitor;
static getInstance(): TxMonitor;
ensureTxFinality(txHash: Hash, chainName: string, onFinalityCallback: (txHash: string, chainName: string, isFinalized: boolean) => void): void;
ensureTxInclusion(txHash: Hash, chainName: string, onTxIncluded: (txHash: Hash, networkName: string, blockNumber: bigint, isIncluded: boolean) => void, confirmations?: number): void;
private checkTransactionStatus;
private notifyFinalitySubscribers;
private notifyInclusionSubscribers;
trackTxFinality(txHash: Hash, chainName: string, subscriberId: string): void;
trackTxInclusion(txHash: Hash, chainName: string, subscriberId: string, confirmations?: number): void;
cancel(txHash: Hash, subscriberId?: string): Promise<void>;
private upsertMonitor;
private checkNetworkTransactions;
private checkTransactionStatus;
private notifySubscribers;
private subscribeToNetwork;
private removeMonitor;
}
//# sourceMappingURL=TxMonitor.d.ts.map
2 changes: 1 addition & 1 deletion dist/managers/TxMonitor.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/managers/TxReader.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions dist/managers/TxWriter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ import { TxWriterConfig } from '../types';
import { ConceroNetwork } from '../types/ConceroNetwork';
import { INonceManager, ITxMonitor, IViemClientManager } from '../types/managers';
import { ILogger } from '../types/managers/ILogger';
import { ITxResultSubscriber } from '../types/managers/ITxResultSubscriber';
import { ITxWriter } from '../types/managers/ITxWriter';
export declare class TxWriter implements ITxWriter {
export declare class TxWriter implements ITxWriter, ITxResultSubscriber {
private static instance;
private viemClientManager;
private txMonitor;
private logger;
private config;
private nonceManager;
private readonly ctxByTx;
readonly id = "tx-writer";
private static readonly BACKOFF_SECONDS;
private constructor();
static createInstance(logger: ILogger, viemClientManager: IViemClientManager, txMonitor: ITxMonitor, nonceManager: INonceManager, config: TxWriterConfig): TxWriter;
static getInstance(): TxWriter;
get name(): string;
initialize(): Promise<void>;
callContract(network: ConceroNetwork, params: SimulateContractParameters, ensureTxFinality?: boolean): Promise<Hash>;
private callContractWithMonitoring;
private createRetryCallback;
notifyTxResult({ txHash, chainName, type, success }: any): Promise<void>;
private send;
private nextDelaySeconds;
}
//# sourceMappingURL=TxWriter.d.ts.map
2 changes: 1 addition & 1 deletion dist/managers/TxWriter.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions dist/stores/InMemoryRetryStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IRetryStore } from '../types/managers/IRetryStore';
export declare class InMemoryRetryStore implements IRetryStore {
private store;
private key;
saveRetryAttempt(key: string, chainName: string, attempt: number, nextTryAt: Date): Promise<void>;
getRetryState(key: string, chainName: string): Promise<{
attempt: number;
nextTryAt: Date;
} | null>;
clearRetry(key: string, chainName: string): Promise<void>;
}
//# sourceMappingURL=InMemoryRetryStore.d.ts.map
1 change: 1 addition & 0 deletions dist/stores/InMemoryRetryStore.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/stores/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { InMemoryRetryStore } from './InMemoryRetryStore';
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/stores/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dist/types/managers/IRetryStore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface IRetryStore {
saveRetryAttempt(key: string, chainName: string, attempt: number, nextTryAt: Date): Promise<void>;
getRetryState(key: string, chainName: string): Promise<{
attempt: number;
nextTryAt: Date;
} | null>;
clearRetry(key: string, chainName: string): Promise<void>;
}
//# sourceMappingURL=IRetryStore.d.ts.map
1 change: 1 addition & 0 deletions dist/types/managers/IRetryStore.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/types/managers/ITxMonitor.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Hash } from 'viem';
export interface ITxMonitor {
ensureTxFinality(txHash: Hash, chainName: string, onFinalityCallback: (txHash: Hash, chainName: string, isFinalized: boolean) => void): void;
ensureTxInclusion(txHash: Hash, chainName: string, onTxIncluded: (txHash: Hash, networkName: string, blockNumber: bigint, isIncluded: boolean) => void, confirmations?: number): void;
trackTxInclusion(txHash: Hash, chainName: string, subscriberId: string, confirmations?: number): void;
trackTxFinality(txHash: Hash, chainName: string, subscriberId: string): void;
cancel(txHash: Hash, subscriberId?: string): Promise<void>;
}
/** Configuration for TxMonitor */
export interface TxMonitorConfig {
maxInclusionWait?: number;
maxFinalityWait?: number;
Expand Down
2 changes: 1 addition & 1 deletion dist/types/managers/ITxMonitor.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading