/
TLProvider.ts
38 lines (37 loc) · 1.24 KB
/
TLProvider.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
33
34
35
36
37
38
import {
Amount,
MetaTransaction,
MetaTransactionFees,
MetaTransactionStatus,
ReconnectingWSOptions,
TransactionStatusObject,
TxInfos
} from '../typings'
/**
* Interface for different provider strategies which extends the given
* abstract class of `ethers.js`.
*/
export interface TLProvider {
ApiUrl: string
WsApiUrl: string
fetchEndpoint<T>(endpoint: string, options?: object): Promise<T>
postToEndpoint<T>(endpoint: string, data: any): Promise<T>
createWebsocketStream(
endpoint: string,
functionName: string,
args: object,
reconnectingOptions?: ReconnectingWSOptions
): any
getTxInfos(userAddress: string): Promise<TxInfos>
getTxStatus(txHash: string): Promise<TransactionStatusObject>
getIdentityNonce(userAddress: string): Promise<number>
getIdentityImplementationAddress(userAddress: string): Promise<string>
getMetaTxFees(metaTransaction: MetaTransaction): Promise<MetaTransactionFees>
getMetaTxStatus(
identityAddress: string,
metaTransactionHash: string
): Promise<MetaTransactionStatus>
getBalance(userAddress: string): Promise<Amount>
sendSignedTransaction(signedTransaction: string): Promise<string>
sendSignedMetaTransaction(metaTransaction: MetaTransaction): Promise<string>
}