Skip to content

Commit 3844682

Browse files
petermetzjohnhomantaring
authored andcommitted
feat(quorum): private transaction support
fixes hyperledger-cacti#951 Signed-off-by: johnhomantaring <[email protected]>
1 parent a9ce910 commit 3844682

File tree

37 files changed

+1402
-35
lines changed

37 files changed

+1402
-35
lines changed

examples/cactus-example-supply-chain-backend/src/main/typescript/infrastructure/supply-chain-app-dummy-infrastructure.ts

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export class SupplyChainAppDummyInfrastructure {
183183
const pluginRegistry = new PluginRegistry();
184184
pluginRegistry.add(this.keychain);
185185
const connector = new PluginLedgerConnectorQuorum({
186+
privateUrl: rpcApiHttpHost,
186187
instanceId: "PluginLedgerConnectorQuorum_Contract_Deployment",
187188
rpcApiHttpHost,
188189
logLevel: this.options.logLevel,

examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts

+1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ export class SupplyChainApp {
275275
});
276276

277277
const quorumConnector = new PluginLedgerConnectorQuorum({
278+
privateUrl: rpcApiHostB,
278279
instanceId: "PluginLedgerConnectorQuorum_B",
279280
rpcApiHttpHost: rpcApiHostB,
280281
logLevel: this.options.logLevel,

packages/cactus-plugin-ledger-connector-quorum/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
"prom-client": "13.2.0",
7878
"typescript-optional": "2.0.1",
7979
"web3": "1.5.2",
80-
"web3-eth-contract": "1.5.2"
80+
"web3-eth-contract": "1.5.2",
81+
"web3js-quorum": "21.7.0-rc1"
8182
},
8283
"devDependencies": {
8384
"@hyperledger/cactus-plugin-keychain-memory": "1.0.0-rc.3",

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

+58-1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,46 @@
292292
}
293293
}
294294
},
295+
"QuorumPrivateTransactionConfig" : {
296+
"type": "object",
297+
"required" : [
298+
"privateFor"
299+
],
300+
"properties" : {
301+
"privateFrom": {
302+
"type": "string",
303+
"nullable": false
304+
},
305+
"privateFor": {
306+
"type": "array",
307+
"default": [],
308+
"items": {},
309+
"nullable": false
310+
},
311+
"isPrivate": {
312+
"type": "boolean",
313+
"default": false,
314+
"nullable": false
315+
},
316+
"gasPrice": {
317+
"type": "number",
318+
"nullable": false
319+
},
320+
"gasLimit": {
321+
"type": "number",
322+
"nullable": false
323+
},
324+
"privateKey": {
325+
"type": "string",
326+
"nullable": false
327+
},
328+
"privacyGroupId": {
329+
"type": "string",
330+
"nullable": false
331+
}
332+
333+
}
334+
},
295335
"Web3TransactionReceipt": {
296336
"type": "object",
297337
"required": [
@@ -427,6 +467,9 @@
427467
"minimum": 0,
428468
"default": 60000,
429469
"nullable": false
470+
},
471+
"privateTransactionConfig": {
472+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
430473
}
431474
}
432475
},
@@ -473,7 +516,15 @@
473516
"nullable": false
474517
},
475518
"gasPrice": {
476-
"type": "string",
519+
"type": "number",
520+
"nullable": false
521+
},
522+
"nonce": {
523+
"type": "number",
524+
"nullable": false
525+
},
526+
"value": {
527+
"type": "number",
477528
"nullable": false
478529
},
479530
"timeoutMs": {
@@ -493,6 +544,9 @@
493544
"type": "array",
494545
"default": [],
495546
"items": {}
547+
},
548+
"privateTransactionConfig": {
549+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
496550
}
497551
}
498552
},
@@ -717,6 +771,9 @@
717771
"$ref": "#/components/schemas/ContractJSON",
718772
"description": "For use when not using keychain, pass the contract in as this variable",
719773
"nullable": false
774+
},
775+
"privateTransactionConfig": {
776+
"$ref": "#/components/schemas/QuorumPrivateTransactionConfig"
720777
}
721778
}
722779
},

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

+81-2
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,22 @@ export interface DeployContractSolidityBytecodeV1Request {
183183
gas?: number;
184184
/**
185185
*
186-
* @type {string}
186+
* @type {number}
187187
* @memberof DeployContractSolidityBytecodeV1Request
188188
*/
189-
gasPrice?: string;
189+
gasPrice?: number;
190+
/**
191+
*
192+
* @type {number}
193+
* @memberof DeployContractSolidityBytecodeV1Request
194+
*/
195+
nonce?: number;
196+
/**
197+
*
198+
* @type {number}
199+
* @memberof DeployContractSolidityBytecodeV1Request
200+
*/
201+
value?: number;
190202
/**
191203
* The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.
192204
* @type {number}
@@ -205,6 +217,12 @@ export interface DeployContractSolidityBytecodeV1Request {
205217
* @memberof DeployContractSolidityBytecodeV1Request
206218
*/
207219
constructorArgs?: Array<any>;
220+
/**
221+
*
222+
* @type {QuorumPrivateTransactionConfig}
223+
* @memberof DeployContractSolidityBytecodeV1Request
224+
*/
225+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
208226
}
209227
/**
210228
*
@@ -302,6 +320,12 @@ export interface InvokeContractJsonObjectV1Request {
302320
* @memberof InvokeContractJsonObjectV1Request
303321
*/
304322
contractJSON: ContractJSON;
323+
/**
324+
*
325+
* @type {QuorumPrivateTransactionConfig}
326+
* @memberof InvokeContractJsonObjectV1Request
327+
*/
328+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
305329
}
306330
/**
307331
*
@@ -401,6 +425,55 @@ export interface InvokeContractV1Response {
401425
*/
402426
success: boolean;
403427
}
428+
/**
429+
*
430+
* @export
431+
* @interface QuorumPrivateTransactionConfig
432+
*/
433+
export interface QuorumPrivateTransactionConfig {
434+
/**
435+
*
436+
* @type {string}
437+
* @memberof QuorumPrivateTransactionConfig
438+
*/
439+
privateFrom?: string;
440+
/**
441+
*
442+
* @type {Array<any>}
443+
* @memberof QuorumPrivateTransactionConfig
444+
*/
445+
privateFor: Array<any>;
446+
/**
447+
*
448+
* @type {boolean}
449+
* @memberof QuorumPrivateTransactionConfig
450+
*/
451+
isPrivate?: boolean;
452+
/**
453+
*
454+
* @type {number}
455+
* @memberof QuorumPrivateTransactionConfig
456+
*/
457+
gasPrice?: number;
458+
/**
459+
*
460+
* @type {number}
461+
* @memberof QuorumPrivateTransactionConfig
462+
*/
463+
gasLimit?: number;
464+
/**
465+
*
466+
* @type {string}
467+
* @memberof QuorumPrivateTransactionConfig
468+
*/
469+
privateKey?: string;
470+
/**
471+
*
472+
* @type {string}
473+
* @memberof QuorumPrivateTransactionConfig
474+
*/
475+
privacyGroupId?: string;
476+
}
404477
/**
405478
*
406479
* @export
@@ -482,6 +555,12 @@ export interface RunTransactionRequest {
482555
* @memberof RunTransactionRequest
483556
*/
484557
timeoutMs?: number;
558+
/**
559+
*
560+
* @type {QuorumPrivateTransactionConfig}
561+
* @memberof RunTransactionRequest
562+
*/
563+
privateTransactionConfig?: QuorumPrivateTransactionConfig;
485564
}
486565
/**
487566
*

0 commit comments

Comments
 (0)