|
1 | 1 | declare module 'aelf-sdk' { |
2 | | - const AElf: any; |
| 2 | + export interface AelfWallet { |
| 3 | + address: string; |
| 4 | + [key: string]: unknown; |
| 5 | + } |
| 6 | + |
| 7 | + export interface AelfTxResult { |
| 8 | + Status?: string; |
| 9 | + [key: string]: unknown; |
| 10 | + } |
| 11 | + |
| 12 | + export interface AelfContractMethod { |
| 13 | + (params?: Record<string, unknown>): Promise<unknown>; |
| 14 | + call?: (params?: Record<string, unknown>) => Promise<unknown>; |
| 15 | + getSignedTx?: (params?: Record<string, unknown>) => string; |
| 16 | + } |
| 17 | + |
| 18 | + export interface AelfContract { |
| 19 | + [methodName: string]: AelfContractMethod | unknown; |
| 20 | + } |
| 21 | + |
| 22 | + export interface AelfChainApi { |
| 23 | + contractAt(contractAddress: string, wallet: AelfWallet): Promise<AelfContract>; |
| 24 | + getTxResult(transactionId: string): Promise<AelfTxResult>; |
| 25 | + calculateTransactionFee(rawTransaction: string): Promise<unknown>; |
| 26 | + } |
| 27 | + |
| 28 | + export interface AelfInstance { |
| 29 | + chain: AelfChainApi; |
| 30 | + } |
| 31 | + |
| 32 | + export interface HttpProviderConstructor { |
| 33 | + new (rpcUrl: string, timeoutMs?: number): unknown; |
| 34 | + } |
| 35 | + |
| 36 | + export interface AelfWalletApi { |
| 37 | + createNewWallet(): AelfWallet; |
| 38 | + getWalletByPrivateKey(privateKey: string): AelfWallet; |
| 39 | + } |
| 40 | + |
| 41 | + export interface AelfStaticApi { |
| 42 | + providers: { |
| 43 | + HttpProvider: HttpProviderConstructor; |
| 44 | + }; |
| 45 | + wallet: AelfWalletApi; |
| 46 | + } |
| 47 | + |
| 48 | + export interface AelfConstructor { |
| 49 | + new (provider: unknown): AelfInstance; |
| 50 | + } |
| 51 | + |
| 52 | + const AElf: AelfConstructor & AelfStaticApi; |
| 53 | + |
3 | 54 | export default AElf; |
4 | 55 | } |
0 commit comments