Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper: prettify setApp() descriptions #284

Merged
merged 8 commits into from
Apr 17, 2019
30 changes: 30 additions & 0 deletions packages/aragon-wrapper/src/core/apm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { makeProxy } from '../../utils'

export async function makeRepoProxy (appId, apm, web3) {
const repoAddress = await apm.ensResolve(appId)
return makeProxy(repoAddress, 'Repo', web3)
}

export async function getAllRepoVersions (repoProxy) {
const versions = []
const versionCount = await repoProxy.call('getVersionsCount')

// Versions index starts at 1
for (let versionId = 1; versionId <= versionCount; ++versionId) {
versions.push(await getRepoVersionById(repoProxy, versionId))
}

return Promise.all(versions)
}

export function getRepoVersionById (repoProxy, versionId) {
return repoProxy
.call('getByVersionId', versionId)
.then(({ contentURI, contractAddress, semanticVersion }) => ({
contentURI,
contractAddress,
version: semanticVersion.join('.'),
// Keeping this as a string makes comparisons a bit easier down the line
versionId: versionId.toString()
}))
}
10 changes: 9 additions & 1 deletion packages/aragon-wrapper/src/core/aragonOS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ function getKernelNamespace (hash) {
}
}

export { getAragonOsInternalAppInfo, getKernelNamespace }
function isAragonOsInternalApp (appId) {
return APP_MAPPINGS.has(appId)
}

export {
getAragonOsInternalAppInfo,
getKernelNamespace,
isAragonOsInternalApp
}
Loading