Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Winkler committed Oct 18, 2018
2 parents 2ee1835 + c9eca46 commit 63022be
Show file tree
Hide file tree
Showing 16 changed files with 670 additions and 16 deletions.
11 changes: 11 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
### Fixes
### Deprecations

## Version 1.3.0
### Features
- add `getKeyHistory` to `sharings` to retrieve all keys for an account and a section
- add `bumpSharings` to `sharings`, that adds a new key for all given accounts for given section
- add `removeBcContract` to `profile` to remove profile entries that were writte using `addBcContract`
- export `crypto` library, `DBCP Vaildator`, `DBCP Envelop`
- export `createDefaultRuntime` within the `bcc frontend bundle` + adjust it for frontend smartcontracts usage

### Fixes
- fix `ipld` deleting issue, that occurred when deleting linked nodes in linked subtrees

## Version 1.2.2
### Fixes
- move require(`@evan.network/smart-contracts-core`) within `createDefaultRuntime` to capsuled scope, to be able to require it only in backend scope
Expand Down
58 changes: 58 additions & 0 deletions docs/contracts/base-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,64 @@ To check if an account is a member of a contract, the contract function ``isMemb
// true
--------------------------------------------------------------------------------

.. _base-contract_removeFromContract:

removeFromContract
================================================================================

.. code-block:: javascript
baseContract.removeFromContract(businessCenterDomain, contract, accountId, idToBeRemoved);
Remove user from contract.
To deny previously invited accounts to work with contract resources, they have to be removed as members from the contract. This function does exactly that.


----------
Parameters
----------

#. ``businessCenterDomain`` - ``string`` : ENS domain name of the business center the contract was created in; use null when working without business center
#. ``contract`` - ``string`` : Ethereum id of the contract
#. ``accountId`` - ``string`` : account id of executing user
#. ``idToBeRemoved`` - ``string`` : account id which should be removed

-------
Returns
-------

``Promise`` returns ``void``: resolved when done

-------
Example
-------

.. code-block:: javascript
const contractOwner = '0x0000000000000000000000000000000000000001';
const idToBeRemoved = '0x0000000000000000000000000000000000000002';
const businessCenterDomain = 'testbc.evan';
const contract = loader.loadContract('BaseContractInterface', contractId);
await baseContract.removeFromContract(
businessCenterDomain,
contractId,
contractOwner,
idToBeRemoved,
);
To check if an account is a member of a contract, the contract function ``isMember`` can be used:

.. code-block:: typescript
const isMember = await executor.executeContractCall(contract, 'isConsumer', idToBeRemoved);
console.log(isMember);
// Output:
// false
--------------------------------------------------------------------------------

.. _base-contract_changeConsumerState:
Expand Down
90 changes: 90 additions & 0 deletions docs/contracts/sharing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,55 @@ Example
--------------------------------------------------------------------------------

.. _sharing_bumpSharings:

bumpSharings
================================================================================

.. code-block:: typescript
sharing.bumpSharings(address, originator, partners, section, block, sharingKey);
Bump keys for given accounts by adding given key to their sharings. This is basically a shorthand
version for adding the new key for every account in the ``partners`` array in a single transaction.

``context``, ``hashKeys`` and ``sharingId`` are currently not supported.

----------
Parameters
----------

#. ``address`` - ``string``: contract address or ENS address
#. ``originator`` - ``string``: Ethereum account id of the sharing user
#. ``partner`` - ``string``: Ethereum account id for which key shall be added
#. ``section`` - ``string``: data section the key is intended for or '*'
#. ``block`` - ``number|string``: starting with this block, the key is valid
#. ``sharingKey`` - ``string``: key to share

-------
Returns
-------

``Promise`` returns ``void``: resolved when done

-------
Example
-------

.. code-block:: typescript
// two sample users, user1 wants to bump keys for user2 and user3
const user1 = '0x0000000000000000000000000000000000000001';
const user2 = '0x0000000000000000000000000000000000000002';
const user3 = '0x0000000000000000000000000000000000000003';
// assume we have a contract with sharings for those accounts
const contractId = '0x00000000000000000000000000000000c027rac7';
await sharing.bumpSharings(contractId, user1, [ user2, user3 ], '*', 0, 'i am a bump key');
--------------------------------------------------------------------------------

.. _sharing_extendSharing:
Expand Down Expand Up @@ -308,6 +357,47 @@ Example
--------------------------------------------------------------------------------

.. _sharing_getKeyHistory:

getKeyHistory
================================================================================

.. code-block:: typescript
sharing.getKeyHistory(address, partner, section[, sharingId]);
Get history of keys for an account and a section.

----------
Parameters
----------

#. ``address`` - ``string``: contract address or ENS address
#. ``partner`` - ``string``: Ethereum account id for which key shall be retrieved
#. ``section`` - ``string``: data section the key is intended for or '*'
#. ``sharingId`` - ``string`` (optional): id of a sharing (when multi-sharings is used), defaults to ``null``

-------
Returns
-------

``Promise`` returns ``any``: object with key: blockNr, value: key

-------
Example
-------

.. code-block:: typescript
// a sample user
const user2 = '0x0000000000000000000000000000000000000002';
// user2 wants to retrieve all keys for '*'
const keyHistory = await sharing.getKeyHistory(contract.options.address, user2, '*');
--------------------------------------------------------------------------------

.. _sharing_ensureHashKey:
Expand Down
41 changes: 40 additions & 1 deletion docs/profile/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -873,14 +873,15 @@ addContract

.. code-block:: typescript
profile.addContract(address, data);
profile.addContract(bc, address, data);
Add a contract to the current profile.

----------
Parameters
----------

#. ``bc`` - ``string``: business center ens address or contract address
#. ``address`` - ``string``: contact address
#. ``data`` - ``any``: bookmark metadata

Expand All @@ -900,6 +901,44 @@ Example
------------------------------------------------------------------------------



.. _profile_removeContract:

removeContract
================================================================================

.. code-block:: typescript
profile.removeContract(address, data);
removes a contract (task contract etc. ) from a business center scope of the current profile

----------
Parameters
----------

#. ``bc`` - ``string``: business center ens address or contract address
#. ``address`` - ``any``: contact address

-------
Returns
-------

``Promise`` returns ``void``: resolved when done

-------
Example
-------

.. code-block:: typescript
await profile.removeBcContract('testbc.evan', '0x');
------------------------------------------------------------------------------


Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"author": "evan GmbH",
"dependencies": {
"@evan.network/dbcp": "1.3.0",
"@evan.network/smart-contracts-core": "1.1.1",
"@evan.network/dbcp": "^1.3.1",
"@evan.network/smart-contracts-core": "^1.1.2",
"@types/node": "8.0.53",
"ajv": "^5.5.1",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
Expand Down Expand Up @@ -97,5 +97,5 @@
"testunitbrk": "env-cmd ./.env.local npm run build && mocha --inspect-brk -r ts-node/register $*"
},
"types": "./dist/index.d.ts",
"version": "1.2.2"
"version": "1.3.0"
}
5 changes: 4 additions & 1 deletion src/bundles/bcc/bcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import keystore = require('eth-lightwallet/lib/keystore');
import Mnemonic = require('bitcore-mnemonic');
import Web3 = require('web3');
import prottle = require('prottle');
import crypto = require('crypto');

// used for building bundle
import {
Expand Down Expand Up @@ -655,10 +656,12 @@ export {
createBC,
createCore,
createDefaultRuntime,
crypto,
CryptoProvider,
DataContract,
Description,
DfsInterface,
Envelope,
EventHub,
Executor,
ExecutorAgent,
Expand Down Expand Up @@ -686,6 +689,6 @@ export {
SignerExternal,
SignerInternal,
Unencrypted,
Validator,
Web3,

};
9 changes: 5 additions & 4 deletions src/bundles/bcc/dbcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"author": "evan GmbH",
"dapp": {
"dependencies": {
"smartcontracts": "^1.0.3"
"smartcontracts": "^1.1.2"
},
"entrypoint": "bcc.js",
"files": [
"bcc.js"
],
"origin": "QmS7s1dwp9pXnkQbmKQADrZXtrib1PAu3NnhaA71PskNfs",
"origin": "QmNPBSyAggFpLJDVj3snwRVr1Qarqrgv5uL6BusCyJpYgL",
"type": "library"
},
"description": "Contractus for loading ens entries and it's data...",
Expand All @@ -19,7 +19,7 @@
"contractus",
"library"
],
"version": "1.2.1",
"version": "1.3.0",
"versions": {
"0.1.0": "QmTsY7ASbvxATLnEemHZQ8oQha64ujYe9VXbDCouDk7Xtp",
"0.9.0": "Qmbw3yX82TVN9WhsRyeaRpd89M9XXL1pds9GgqJL29ohar",
Expand All @@ -28,7 +28,8 @@
"1.0.2": "QmdC3NTNRPCs2VTrEQx1RNL6LoaDzhQLpa4nsAMA61sM7i",
"1.1.0": "QmeXw3ytsm7WWH71R1LEG1ocLbrVnGMzVLk4Wfx7FqQr6v",
"1.2.0": "QmSqC4ZP3yAncMKB31KBx6UqBzcxUg1wK4vT6Ku6dsQcBH",
"1.2.1": "QmdVyU3a4tnZtWibggZcUEDZyvBQ39HfxJhuSejheNKsAk"
"1.2.1": "QmWVFRDQvxJYGxYtBwkZZq7eG6A3XGYBvJp8s1YF8eiXWw",
"1.3.0": "Qmby7yc72ZyXJVnL4ijqEGpSokz5RFvThwR9qmn2zAnNWG"
},
"dbcpVersion": 1
}
Expand Down
Loading

0 comments on commit 63022be

Please sign in to comment.