@@ -70,8 +70,28 @@ const models: TsoaRoute.Models = {
7070 "storage" : { "dataType" : "any" , "default" : { } } ,
7171 } ,
7272 } ,
73+ "DeployContractRequest" : {
74+ "properties" : {
75+ "from" : { "dataType" : "string" } ,
76+ "gas" : { "dataType" : "double" } ,
77+ "gasPrice" : { "dataType" : "double" } ,
78+ "value" : { "dataType" : "double" } ,
79+ "blockchainHost" : { "dataType" : "string" } ,
80+ "blockchainProtocol" : { "dataType" : "string" } ,
81+ "blockchainBasicAuthUsername" : { "dataType" : "string" } ,
82+ "blockchainBasicAuthPassword" : { "dataType" : "string" } ,
83+ } ,
84+ } ,
7385 "RunContractFunctionRequest" : {
7486 "properties" : {
87+ "from" : { "dataType" : "string" } ,
88+ "gas" : { "dataType" : "double" } ,
89+ "gasPrice" : { "dataType" : "double" } ,
90+ "value" : { "dataType" : "double" } ,
91+ "blockchainHost" : { "dataType" : "string" } ,
92+ "blockchainProtocol" : { "dataType" : "string" } ,
93+ "blockchainBasicAuthUsername" : { "dataType" : "string" } ,
94+ "blockchainBasicAuthPassword" : { "dataType" : "string" } ,
7595 "abi" : { "dataType" : "any" , "required" : true } ,
7696 "params" : { "dataType" : "array" , "array" : { "dataType" : "string" } , "required" : true } ,
7797 } ,
@@ -282,15 +302,33 @@ export function RegisterRoutes(app: any) {
282302 const promise = controller . getAbi . apply ( controller , validatedArgs ) ;
283303 promiseHandler ( controller , promise , response , next ) ;
284304 } ) ;
305+ app . post ( '/contract/deploy' ,
306+ function ( request : any , response : any , next : any ) {
307+ const args = {
308+ deployRequest : { "in" : "body" , "name" : "deployRequest" , "required" : true , "ref" : "DeployContractRequest" } ,
309+ } ;
310+
311+ let validatedArgs : any [ ] = [ ] ;
312+ try {
313+ validatedArgs = getValidatedArgs ( args , request ) ;
314+ } catch ( err ) {
315+ return next ( err ) ;
316+ }
317+
318+ const controller = iocContainer . get < ContractController > ( ContractController ) ;
319+ if ( typeof controller [ 'setStatus' ] === 'function' ) {
320+ ( < any > controller ) . setStatus ( undefined ) ;
321+ }
322+
323+
324+ const promise = controller . deploy . apply ( controller , validatedArgs ) ;
325+ promiseHandler ( controller , promise , response , next ) ;
326+ } ) ;
285327 app . post ( '/contract/run/:contractAddress' ,
286328 function ( request : any , response : any , next : any ) {
287329 const args = {
288330 contractAddress : { "in" : "path" , "name" : "contractAddress" , "required" : true , "dataType" : "string" } ,
289331 runFunction : { "in" : "body" , "name" : "runFunction" , "required" : true , "ref" : "RunContractFunctionRequest" } ,
290- blockchainHost : { "in" : "query" , "name" : "blockchainHost" , "dataType" : "string" } ,
291- blockchainProtocol : { "in" : "query" , "name" : "blockchainProtocol" , "dataType" : "string" } ,
292- blockchainBasicAuthUsername : { "in" : "query" , "name" : "blockchainBasicAuthUsername" , "dataType" : "string" } ,
293- blockchainBasicAuthPassword : { "in" : "query" , "name" : "blockchainBasicAuthPassword" , "dataType" : "string" } ,
294332 } ;
295333
296334 let validatedArgs : any [ ] = [ ] ;
0 commit comments