-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: getPersonas and callAsPersona (#98)
* feat: getPersonas and callAsPersona * fix: clean up tests * fix: move infura key to env variable * fix: clean up tests * fix: more clean up
- Loading branch information
1 parent
6b0c0a1
commit ae27fec
Showing
20 changed files
with
547 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
.nvmrc | ||
dist | ||
env.json | ||
.env |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type Pod from './Pod'; | ||
|
||
// Functions are put here so that they can be mocked for testing purposes. | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export async function getPersonas( | ||
pod: Pod, | ||
address: string, | ||
): Promise<Array<{ type: string; address: string }>> { | ||
const personas = []; | ||
if (pod.isAdmin(address)) personas.push({ type: 'admin', address }); | ||
if (await pod.isAdminPodMember(address)) | ||
personas.push({ type: 'adminPodMember', address: pod.admin }); | ||
if (await pod.isMember(address)) personas.push({ type: 'member', address }); | ||
|
||
const memberSubPods = await pod.getSubPodsByMember(address); | ||
memberSubPods.forEach(subPod => { | ||
personas.push({ type: 'subPodMember', address: subPod.safe }); | ||
}); | ||
return personas; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.