Ejemplo n.º 1
0
        public override string GenerateClass()
        {
            var functionABI = Model.FunctionABI;
            var header      = "";

            if (_functionABIModel.IsMultipleOutput())
            {
                header = $@"{SpaceUtils.OneTab}[<Function(""{functionABI.Name}"", typeof<{_functionOutputDTOModel.GetTypeName()}>)>]";
            }

            if (_functionABIModel.IsSingleOutput())
            {
                header = $@"{SpaceUtils.OneTab}[<Function(""{functionABI.Name}"", ""{_functionABIModel.GetSingleAbiReturnType()}"")>]";
            }

            if (_functionABIModel.HasNoReturn())
            {
                header = $@"{SpaceUtils.OneTab}[<Function(""{functionABI.Name}"")>]";
            }

            return($@"{header}
{SpaceUtils.OneTab}type {Model.GetTypeName()}() = 
{SpaceUtils.TwoTabs}inherit FunctionMessage()
{SpaceUtils.OneTab}
{_parameterAbiFunctionDtoFSharpTemplate.GenerateAllProperties(functionABI.InputParameters)}
{SpaceUtils.OneTab}");
        }
        public override string GenerateClass()
        {
            var typeName = Model.GetTypeName();

            return
                ($@"{SpaceUtils.OneTab}type {typeName}(byteCode: string) =
{SpaceUtils.TwoTabs}inherit ContractDeploymentMessage(byteCode)
{SpaceUtils.TwoTabs}
{SpaceUtils.TwoTabs}static let BYTECODE = ""{Model.ByteCode}""
{SpaceUtils.TwoTabs}
{SpaceUtils.TwoTabs}new() = {typeName}(BYTECODE)
{SpaceUtils.TwoTabs}
{_parameterAbiFunctionDtoFSharpTemplate.GenerateAllProperties(Model.ConstructorABI.InputParameters)}
{SpaceUtils.OneTab}");
        }