Skip to content

Commit fe15a9e

Browse files
aldousalvarezTravis Paynejohnhomantaringjagpreetsinghsasanpetermetz
authored andcommitted
feat(quorum): private transaction support
----------------------------------------- - Added v2.3.0-deploy-contract-from-json-private.test.ts that would support private transaction test for Quorum. - Added a QuorumPrivateTransactionConfig on openapi.json - Added Web3JsQuorum on plugin-ledger-connector-quorum and added a transact private method to be able to proceed with the private transaction. - Currently the privateUrl in the test is being truely optional and we need to address this in the future. - We are just passing privateUrl in all the instances even though we don't need to do private transactions everywhere. Fixes hyperledger-cacti#951 Co-authored-by: Travis Payne <[email protected]> Co-authored-by: johnhomantaring <[email protected]> Co-authored-by: jagpreetsinghsasan <[email protected]> Co-authored-by: aldousalvarez [email protected] Co-authored-by: Peter Somogyvari <[email protected]> Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 8e565fd commit fe15a9e

File tree

9 files changed

+692
-30
lines changed

9 files changed

+692
-30
lines changed

packages/cactus-plugin-ledger-connector-quorum/src/main/json/openapi.json

+99-3
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,46 @@
301301
}
302302
}
303303
},
304+
"QuorumPrivateTransactionConfig" : {
305+
"type": "object",
306+
"required" : [
307+
"privateFor"
308+
],
309+
"properties" : {
310+
"privateFrom": {
311+
"type": "string",
312+
"nullable": false
313+
},
314+
"privateFor": {
315+
"type": "array",
316+
"default": [],
317+
"items": {},
318+
"nullable": false
319+
},
320+
"isPrivate": {
321+
"type": "boolean",
322+
"default": false,
323+
"nullable": false
324+
},
325+
"gasPrice": {
326+
"type": "number",
327+
"nullable": false
328+
},
329+
"gasLimit": {
330+
"type": "number",
331+
"nullable": false
332+
},
333+
"privateKey": {
334+
"type": "string",
335+
"nullable": false
336+
},
337+
"privacyGroupId": {
338+
"type": "string",
339+
"nullable": false
340+
}
341+
342+
}
343+
},
304344
"Web3TransactionReceipt": {
305345
"type": "object",
306346
"required": [
@@ -354,7 +394,33 @@
354394
"to": {
355395
"type": "string",
356396
"nullable": false
357-
}
397+
},
398+
"logs": {
399+
"type": "array",
400+
"default": [],
401+
"items": {},
402+
"nullable": false
403+
},
404+
"logsBloom": {
405+
"type": "string",
406+
"nullable": false
407+
},
408+
"revertReason": {
409+
"type": "string",
410+
"nullable": false
411+
},
412+
"output": {
413+
"type": "string",
414+
"nullable": false
415+
},
416+
"commitmentHash": {
417+
"type": "string",
418+
"nullable": false
419+
},
420+
"cumulativeGasUSed": {
421+
"type": "number",
422+
"nullable": false
423+
}
358424
}
359425
},
360426
"ContractJSON": {
@@ -436,6 +502,9 @@
436502
"minimum": 0,
437503
"default": 60000,
438504
"nullable": false
505+
},
506+
"privateTransactionConfig": {
507+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
439508
}
440509
}
441510
},
@@ -448,7 +517,7 @@
448517
"transactionReceipt": {
449518
"$ref": "#/components/schemas/Web3TransactionReceipt"
450519
}
451-
}
520+
}
452521
},
453522
"DeployContractSolidityBytecodeV1Request": {
454523
"type": "object",
@@ -466,10 +535,23 @@
466535
"maxLength": 100,
467536
"nullable": false
468537
},
538+
"contractAbi": {
539+
"description": "The application binary interface of the solidity contract",
540+
"type": "array",
541+
"items": {},
542+
"nullable": false
543+
},
469544
"web3SigningCredential": {
470545
"$ref": "#/components/schemas/Web3SigningCredential",
471546
"nullable": false
472547
},
548+
"bytecode": {
549+
"type": "string",
550+
"nullable": false,
551+
"minLength": 1,
552+
"maxLength": 24576,
553+
"description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode"
554+
},
473555
"keychainId": {
474556
"type": "string",
475557
"description": "The keychainId for retrieve the contracts json.",
@@ -482,7 +564,15 @@
482564
"nullable": false
483565
},
484566
"gasPrice": {
485-
"type": "string",
567+
"type": "number",
568+
"nullable": false
569+
},
570+
"nonce": {
571+
"type": "number",
572+
"nullable": false
573+
},
574+
"value": {
575+
"type": "number",
486576
"nullable": false
487577
},
488578
"timeoutMs": {
@@ -502,6 +592,9 @@
502592
"type": "array",
503593
"default": [],
504594
"items": {}
595+
},
596+
"privateTransactionConfig": {
597+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
505598
}
506599
}
507600
},
@@ -726,6 +819,9 @@
726819
"$ref": "#/components/schemas/ContractJSON",
727820
"description": "For use when not using keychain, pass the contract in as this variable",
728821
"nullable": false
822+
},
823+
"privateTransactionConfig": {
824+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
729825
}
730826
}
731827
},

packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/api.ts

+129-2
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,24 @@ export interface DeployContractSolidityBytecodeV1Request {
163163
* @memberof DeployContractSolidityBytecodeV1Request
164164
*/
165165
contractName: string;
166+
/**
167+
* The application binary interface of the solidity contract
168+
* @type {Array<any>}
169+
* @memberof DeployContractSolidityBytecodeV1Request
170+
*/
171+
contractAbi?: Array<any>;
166172
/**
167173
*
168174
* @type {Web3SigningCredential}
169175
* @memberof DeployContractSolidityBytecodeV1Request
170176
*/
171177
web3SigningCredential: Web3SigningCredential;
178+
/**
179+
* See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode
180+
* @type {string}
181+
* @memberof DeployContractSolidityBytecodeV1Request
182+
*/
183+
bytecode?: string;
172184
/**
173185
* The keychainId for retrieve the contracts json.
174186
* @type {string}
@@ -183,10 +195,22 @@ export interface DeployContractSolidityBytecodeV1Request {
183195
gas?: number;
184196
/**
185197
*
186-
* @type {string}
198+
* @type {number}
187199
* @memberof DeployContractSolidityBytecodeV1Request
188200
*/
189-
gasPrice?: string;
201+
gasPrice?: number;
202+
/**
203+
*
204+
* @type {number}
205+
* @memberof DeployContractSolidityBytecodeV1Request
206+
*/
207+
nonce?: number;
208+
/**
209+
*
210+
* @type {number}
211+
* @memberof DeployContractSolidityBytecodeV1Request
212+
*/
213+
value?: number;
190214
/**
191215
* The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.
192216
* @type {number}
@@ -205,6 +229,12 @@ export interface DeployContractSolidityBytecodeV1Request {
205229
* @memberof DeployContractSolidityBytecodeV1Request
206230
*/
207231
constructorArgs?: Array<any>;
232+
/**
233+
*
234+
* @type {QuorumPrivateTransactionConfig}
235+
* @memberof DeployContractSolidityBytecodeV1Request
236+
*/
237+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
208238
}
209239
/**
210240
*
@@ -315,6 +345,12 @@ export interface InvokeContractJsonObjectV1Request {
315345
* @memberof InvokeContractJsonObjectV1Request
316346
*/
317347
contractJSON: ContractJSON;
348+
/**
349+
*
350+
* @type {QuorumPrivateTransactionConfig}
351+
* @memberof InvokeContractJsonObjectV1Request
352+
*/
353+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
318354
}
319355
/**
320356
*
@@ -526,6 +562,55 @@ export interface InvokeRawWeb3EthMethodV1Response {
526562
*/
527563
errorDetail?: string;
528564
}
565+
/**
566+
*
567+
* @export
568+
* @interface QuorumPrivateTransactionConfig
569+
*/
570+
export interface QuorumPrivateTransactionConfig {
571+
/**
572+
*
573+
* @type {string}
574+
* @memberof QuorumPrivateTransactionConfig
575+
*/
576+
privateFrom?: string;
577+
/**
578+
*
579+
* @type {Array<any>}
580+
* @memberof QuorumPrivateTransactionConfig
581+
*/
582+
privateFor: Array<any>;
583+
/**
584+
*
585+
* @type {boolean}
586+
* @memberof QuorumPrivateTransactionConfig
587+
*/
588+
isPrivate?: boolean;
589+
/**
590+
*
591+
* @type {number}
592+
* @memberof QuorumPrivateTransactionConfig
593+
*/
594+
gasPrice?: number;
595+
/**
596+
*
597+
* @type {number}
598+
* @memberof QuorumPrivateTransactionConfig
599+
*/
600+
gasLimit?: number;
601+
/**
602+
*
603+
* @type {string}
604+
* @memberof QuorumPrivateTransactionConfig
605+
*/
606+
privateKey?: string;
607+
/**
608+
*
609+
* @type {string}
610+
* @memberof QuorumPrivateTransactionConfig
611+
*/
612+
privacyGroupId?: string;
613+
}
529614
/**
530615
*
531616
* @export
@@ -607,6 +692,12 @@ export interface RunTransactionRequest {
607692
* @memberof RunTransactionRequest
608693
*/
609694
timeoutMs?: number;
695+
/**
696+
*
697+
* @type {QuorumPrivateTransactionConfig}
698+
* @memberof RunTransactionRequest
699+
*/
700+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
610701
}
611702
/**
612703
*
@@ -1230,6 +1321,42 @@ export interface Web3TransactionReceipt {
12301321
* @memberof Web3TransactionReceipt
12311322
*/
12321323
to: string;
1324+
/**
1325+
*
1326+
* @type {Array<any>}
1327+
* @memberof Web3TransactionReceipt
1328+
*/
1329+
logs?: Array<any>;
1330+
/**
1331+
*
1332+
* @type {string}
1333+
* @memberof Web3TransactionReceipt
1334+
*/
1335+
logsBloom?: string;
1336+
/**
1337+
*
1338+
* @type {string}
1339+
* @memberof Web3TransactionReceipt
1340+
*/
1341+
revertReason?: string;
1342+
/**
1343+
*
1344+
* @type {string}
1345+
* @memberof Web3TransactionReceipt
1346+
*/
1347+
output?: string;
1348+
/**
1349+
*
1350+
* @type {string}
1351+
* @memberof Web3TransactionReceipt
1352+
*/
1353+
commitmentHash?: string;
1354+
/**
1355+
*
1356+
* @type {number}
1357+
* @memberof Web3TransactionReceipt
1358+
*/
1359+
cumulativeGasUSed?: number;
12331360
}
12341361

12351362
/**

0 commit comments

Comments
 (0)