-
Notifications
You must be signed in to change notification settings - Fork 4
/
wallet.ts
32 lines (29 loc) · 930 Bytes
/
wallet.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {utils, providers} from "ethers";
export type SavedTransactionResponse = providers.TransactionResponse & {
submitTime: number;
hash: string;
};
export interface IWalletSourceStorage {
/**
* Assigns wallet and removes it from available pool of wallets.
*/
assignWallet(): Promise<utils.SigningKey | undefined>;
/**
* Releases assigned wallet and returns it to pool of available wallets.
*/
releaseWallet(address: string): Promise<void>;
}
export interface IWalletTransactionStorage {
/**
* Returns transactions from storage filtered by address and sorted by nonce ASC.
*/
getTransactions(address: string): Promise<SavedTransactionResponse[]>;
/**
* Saves transaction to storage with submit time.
*/
saveTransaction(tx: providers.TransactionResponse): Promise<void>;
/**
* Deletes transaction from storage by hash.
*/
deleteTransaction(hash: string): Promise<void>;
}