Skip to content

Commit

Permalink
Feat: Add overrides for apps without aragonPM repos (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xGabi authored Jul 5, 2020
1 parent 84d8f02 commit 8011766
Show file tree
Hide file tree
Showing 17 changed files with 3,577 additions and 7 deletions.
22 changes: 17 additions & 5 deletions packages/connect-core/src/entities/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import {
} from '../types'
import { resolveMetadata } from '../utils/metadata'
import { ConnectorInterface } from '../connections/ConnectorInterface'
import {
getApmInternalAppInfo,
getAragonOsInternalAppInfo,
} from '../utils/overrides/index'
import { hasAppInfo } from '../utils/overrides/interfaces'

// TODO:
// [ ] (ipfs) contentUrl String The HTTP URL of the app content. Uses the IPFS HTTP provider. E.g. http://gateway.ipfs.io/ipfs/QmdLEDDfi…/ (ContentUri passing through the resolver)
Expand Down Expand Up @@ -73,11 +78,18 @@ export default class App extends CoreEntity {
data: AppData,
connector: ConnectorInterface
): Promise<App> {
const artifact: AragonArtifact = await resolveMetadata(
'artifact.json',
data.contentUri || undefined,
data.artifact
)
let artifact: AragonArtifact
if (hasAppInfo(data.appId, 'apm')) {
artifact = getApmInternalAppInfo(data.appId)
} else if (hasAppInfo(data.appId, 'aragon')) {
artifact = getAragonOsInternalAppInfo(data.appId)
} else {
artifact = await resolveMetadata(
'artifact.json',
data.contentUri || undefined,
data.artifact
)
}

const manifest: AragonManifest = await resolveMetadata(
'manifest.json',
Expand Down
3 changes: 3 additions & 0 deletions packages/connect-core/src/utils/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { AppIntent } from '../types'
import App from '../entities/App'
import { TransactionRequestData } from '../transactions/TransactionRequest'

export const apmAppId = (appName: string): string =>
ethers.utils.namehash(`${appName}.aragonpm.eth`)

// Is the given method a full signature, e.g. 'foo(arg1,arg2,...)'
export const isFullMethodSignature = (methodSignature: string): boolean => {
return (
Expand Down
Loading

0 comments on commit 8011766

Please sign in to comment.