-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AbigailDeng
authored and
AbigailDeng
committed
Dec 6, 2023
1 parent
a83c03c
commit 164db15
Showing
17 changed files
with
370 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,60 @@ | ||
import * as protobuf from '@aelfqueen/protobufjs/light'; | ||
import { RequestManager } from '../util/requestManage'; | ||
import { GenericFunction } from '../util/utils'; | ||
type TInputAddressFormatter = (address: any) => string; | ||
interface IChainMethodParams { | ||
type InputAddressFormatter = (address: any) => string; | ||
interface ChainMethodParams { | ||
name: string; | ||
call: string; | ||
method?: string; | ||
params?: Array<string | undefined>; | ||
inputFormatter?: Array<TInputAddressFormatter | undefined>; | ||
inputFormatter?: Array<InputAddressFormatter | undefined>; | ||
outputFormatter?: protobuf.Type | null; | ||
} | ||
|
||
export type TExtractArg = | ||
export type ExtractArg = | ||
| GenericFunction | ||
| { | ||
isSync: boolean; | ||
callback?: GenericFunction; | ||
[k: string]: any; | ||
}; | ||
|
||
export interface IExtractArgumentsIntoObjectResult { | ||
export interface ExtractArgumentsIntoObjectResult { | ||
method?: GenericFunction; | ||
requestMethod?: string; | ||
isSync: boolean; | ||
callback: GenericFunction; | ||
params?: { [k in string]: any }; | ||
} | ||
declare class ChainMethod { | ||
|
||
interface IChainMethod { | ||
formatInput(args: Array<any>): Array<any>; | ||
setRequestManager(manager: RequestManager): void; | ||
formatOutput(result: any): any; | ||
extractArgumentsIntoObject( | ||
args: ExtractArg[] | ||
): ExtractArgumentsIntoObjectResult; | ||
run( | ||
args: ExtractArg[] | ||
): { [k: string]: any } | Promise<{ [k: string]: any }>; | ||
} | ||
declare class ChainMethod implements IChainMethod { | ||
constructor({ | ||
name, | ||
call, | ||
method, | ||
params, | ||
inputFormatter, | ||
outputFormatter, | ||
}: IChainMethodParams); | ||
}: ChainMethodParams); | ||
public formatInput(args: Array<any>): Array<any>; | ||
public setRequestManager(manager: RequestManager): void; | ||
public formatOutput(result: any): any; | ||
public extractArgumentsIntoObject( | ||
args: TExtractArg[] | ||
): IExtractArgumentsIntoObjectResult; | ||
args: ExtractArg[] | ||
): ExtractArgumentsIntoObjectResult; | ||
public run( | ||
args: TExtractArg[] | ||
args: ExtractArg[] | ||
): { [k: string]: any } | Promise<{ [k: string]: any }>; | ||
} | ||
export default ChainMethod; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.