2018-11-01 08:31:21 +01:00
|
|
|
import MethodReflection from "../models/MethodReflection"
|
|
|
|
import GenericContract from "./contracts/GenericContract"
|
|
|
|
|
|
|
|
export default class ContractReflector {
|
|
|
|
|
2018-11-20 09:13:03 +01:00
|
|
|
public static async reflectContractMethod(contractName: string, methodName: string): Promise<MethodReflection> {
|
|
|
|
const contract = await GenericContract.getInstance(contractName)
|
2018-11-01 08:31:21 +01:00
|
|
|
return {
|
2018-11-20 09:13:03 +01:00
|
|
|
contractName,
|
|
|
|
methodName,
|
2018-11-01 08:31:21 +01:00
|
|
|
address: contract.getAddress(),
|
2018-11-20 09:13:03 +01:00
|
|
|
signature: contract.getSignatureOfMethod(methodName),
|
|
|
|
inputs: contract.getInputsOfMethod(methodName),
|
2018-11-01 08:31:21 +01:00
|
|
|
} as MethodReflection
|
|
|
|
}
|
|
|
|
}
|