Skip to content

Commit

Permalink
Added privacy group methods for web3.js-eea (PegaSysEng#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadelineMurray committed Jul 28, 2019
1 parent dc5ca37 commit 0ea1e9b
Showing 1 changed file with 80 additions and 7 deletions.
87 changes: 80 additions & 7 deletions docs/Reference/web3js-eea-Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ private transactions](../Privacy/How-To/Creating-Sending-Private-Transactions.md

## Options Parameter

The Options parameter is used by:

* [`generatePrivacyGroup`](#generateprivacygroup)
* [`getTransactionCount`](#gettransactioncount)
* [`sendRawParameter`](#sendrawtransaction)

The Options parameter has the following properties:

* `privateKey`: Ethereum private key with which to sign the transaction
Expand All @@ -23,9 +17,88 @@ The Options parameter has the following properties:
* `to` : Optional. Contract address to send the transaction to. Do not specify for contract deployment transactions
* `data` : Transaction data

## createPrivacyGroup

Creates privacy group for Pantheon privacy.

**Parameters**

[Transaction options](#options-parameter)

**Returns**

`string` : Privacy group ID

!!! example
```bash
const createPrivacyGroup = () => {
const contractOptions = {
addresses: [orion.node1.publicKey, orion.node2.publicKey],
privateFrom: orion.node1.publicKey,
name: "Privacy Group A",
description: "Members of Group A"
};
return web3.eea.createPrivacyGroup(contractOptions).then(result => {
console.log(`The privacy group created is:`, result);
return result;
});
};
```

## deletePrivacyGroup

Deletes privacy group.

**Parameters**

[Transaction options](#options-parameter)

**Returns**

`string` : Privacy group ID

!!! example
```bash
const deletePrivacyGroup = givenPrivacyGroupId => {
const contractOptions = {
privacyGroupId: givenPrivacyGroupId,
privateFrom: orion.node1.publicKey
};
return web3.eea.deletePrivacyGroup(contractOptions).then(result => {
console.log(`The privacy group deleted is:`, result);
return result;
});
};
```

## findPrivacyGroup

Finds privacy groups containing only the specified members.

**Parameters**

[Transaction options](#options-parameter)

**Returns**

`array of objects` : Privacy groups containing only the specified members.

!!! example
```bash
const findPrivacyGroup = () => {
const contractOptions = {
addresses: [orion.node1.publicKey, orion.node2.publicKey]
};
return web3.eea.findPrivacyGroup(contractOptions).then(result => {
console.log(`The privacy groups found are:`, result);
return result;
});
};
```

## generatePrivacyGroup

Generates the privacy group ID. The privacy group ID is the RLP-encoded `privateFor` and `privateFrom` keys.
Generates the privacy group ID for EEA privacy. The privacy group ID is the RLP-encoded `privateFor` and `privateFrom` keys.

**Parameters**

Expand Down

0 comments on commit 0ea1e9b

Please sign in to comment.