Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/beta' into fix/test-throws
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Wiebe committed Nov 18, 2019
2 parents 3ec4ab6 + d81d24b commit ebefc4b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polymathnetwork/sdk",
"version": "2.0.1-beta.51",
"version": "2.0.1-beta.52",
"description": "A Javascript SDK for interacting with the Polymath network for the browser and Node.js",
"bugs": {
"url": "https://github.com/PolymathNetwork/polymath-sdk/issues"
Expand Down Expand Up @@ -50,7 +50,7 @@
"@0x/subproviders": "^3.0.2",
"@babel/polyfill": "^7.0.0",
"@babel/runtime": "^7.2.0",
"@polymathnetwork/contract-wrappers": "3.0.0-beta.54",
"@polymathnetwork/contract-wrappers": "3.0.0-beta.56",
"@types/sinon": "^7.5.0",
"bluebird": "^3.5.5",
"ethereum-address": "^0.0.4",
Expand Down
27 changes: 22 additions & 5 deletions src/entities/SecurityToken/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class Permissions extends SubModule {
};

/**
* Returns the list of delegate addresses that hold a specific role
* Returns the list of delegate addresses and details that hold a specific role
*
* @param role role for which delegates must be fetched
*/
Expand Down Expand Up @@ -217,14 +217,25 @@ export class Permissions extends SubModule {
{ unarchived: true }
))[0];

return generalPermissionManager.getAllDelegatesWithPerm({
const delegatesWithPerm = await generalPermissionManager.getAllDelegatesWithPerm({
module: moduleAddress,
perm: permission,
});

return P.map(delegatesWithPerm, async delegateAddress => {
const description = await generalPermissionManager.delegateDetails({
delegate: delegateAddress,
});

return {
address: delegateAddress,
description,
};
});
};

/**
* Returns a list of all delegates with their respective roles
* Returns a list of all delegates with their respective details and roles
*/
public getAllDelegates = async () => {
const {
Expand All @@ -248,11 +259,17 @@ export class Permissions extends SubModule {
const delegates = await generalPermissionManager.getAllDelegates();

return P.map(delegates, async delegateAddress => {
const roles = await this.getAssignedRoles({ delegateAddress });
const [roles, description] = await Promise.all([
this.getAssignedRoles({ delegateAddress }),
generalPermissionManager.delegateDetails({
delegate: delegateAddress,
}),
]);

return {
delegateAddress,
address: delegateAddress,
roles,
description,
};
});
};
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1335,10 +1335,10 @@
lodash "^4.17.15"
typescript "3.5.3"

"@polymathnetwork/contract-wrappers@3.0.0-beta.54":
version "3.0.0-beta.54"
resolved "https://registry.yarnpkg.com/@polymathnetwork/contract-wrappers/-/contract-wrappers-3.0.0-beta.54.tgz#07508de716bcaa78b7c9ffc4c5b12fee9622ecef"
integrity sha512-nSc7PIjg+aGFSacvSGnCmZfR5u2OHmgL1kH2nIi3ySvdlF9KoBWb5yz0QAZIUyTOZPfW72reKyVcEco6lA7ZOA==
"@polymathnetwork/contract-wrappers@3.0.0-beta.56":
version "3.0.0-beta.56"
resolved "https://registry.yarnpkg.com/@polymathnetwork/contract-wrappers/-/contract-wrappers-3.0.0-beta.56.tgz#bc76dbb9939f90beb75da4969c3046af9c0d922f"
integrity sha512-LX/o2Gp7ZR77XOZtfeR8t5QFZ6syXeXNQgKWzuwAxC0tJCLlb7c93xU3sxq0UWgHgMfnChI29ZIq1mGVkf8Q2Q==
dependencies:
"@0x/assert" "2.1.6"
"@0x/json-schemas" "4.0.2"
Expand Down

0 comments on commit ebefc4b

Please sign in to comment.