diff --git a/packages/aragon-wrapper/abi/apm/APMRegistry.json b/packages/aragon-wrapper/abi/apm/APMRegistry.json deleted file mode 100644 index 2872e4d4..00000000 --- a/packages/aragon-wrapper/abi/apm/APMRegistry.json +++ /dev/null @@ -1,394 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "REPO_APP_NAME", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "APM_APP_NAME", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ENS_SUB_APP_NAME", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "registrar", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_name", - "type": "string" - }, - { - "name": "_dev", - "type": "address" - }, - { - "name": "_initialSemanticVersion", - "type": "uint16[3]" - }, - { - "name": "_contractAddress", - "type": "address" - }, - { - "name": "_contentURI", - "type": "bytes" - } - ], - "name": "newRepoWithVersion", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CREATE_REPO_ROLE", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "EVMSCRIPT_REGISTRY_APP_ID", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "appId", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getInitializationBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "EVMSCRIPT_REGISTRY_APP", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_sender", - "type": "address" - }, - { - "name": "_role", - "type": "bytes32" - }, - { - "name": "params", - "type": "uint256[]" - } - ], - "name": "canPerform", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_name", - "type": "string" - }, - { - "name": "_dev", - "type": "address" - } - ], - "name": "newRepo", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_registrar", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kernel", - "type": "address" - }, - { - "name": "_appId", - "type": "bytes32" - }, - { - "name": "_initializePayload", - "type": "bytes" - } - ], - "name": "newAppProxyPinned", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kernel", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kernel", - "type": "address" - }, - { - "name": "_appId", - "type": "bytes32" - } - ], - "name": "newAppProxy", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kernel", - "type": "address" - }, - { - "name": "_appId", - "type": "bytes32" - }, - { - "name": "_initializePayload", - "type": "bytes" - } - ], - "name": "newAppProxy", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_script", - "type": "bytes" - } - ], - "name": "getExecutor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kernel", - "type": "address" - }, - { - "name": "_appId", - "type": "bytes32" - } - ], - "name": "newAppProxyPinned", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "id", - "type": "bytes32" - }, - { - "indexed": false, - "name": "name", - "type": "string" - }, - { - "indexed": false, - "name": "repo", - "type": "address" - } - ], - "name": "NewRepo", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "proxy", - "type": "address" - } - ], - "name": "NewAppProxy", - "type": "event" - } -] \ No newline at end of file diff --git a/packages/aragon-wrapper/abi/apm/Repo.json b/packages/aragon-wrapper/abi/apm/Repo.json deleted file mode 100644 index c9588066..00000000 --- a/packages/aragon-wrapper/abi/apm/Repo.json +++ /dev/null @@ -1,311 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_semanticVersion", - "type": "uint16[3]" - } - ], - "name": "getBySemanticVersion", - "outputs": [ - { - "name": "semanticVersion", - "type": "uint16[3]" - }, - { - "name": "contractAddress", - "type": "address" - }, - { - "name": "contentURI", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "EVMSCRIPT_REGISTRY_APP_ID", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_newSemanticVersion", - "type": "uint16[3]" - }, - { - "name": "_contractAddress", - "type": "address" - }, - { - "name": "_contentURI", - "type": "bytes" - } - ], - "name": "newVersion", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_versionId", - "type": "uint256" - } - ], - "name": "getByVersionId", - "outputs": [ - { - "name": "semanticVersion", - "type": "uint16[3]" - }, - { - "name": "contractAddress", - "type": "address" - }, - { - "name": "contentURI", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "appId", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getInitializationBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_contractAddress", - "type": "address" - } - ], - "name": "getLatestForContractAddress", - "outputs": [ - { - "name": "semanticVersion", - "type": "uint16[3]" - }, - { - "name": "contractAddress", - "type": "address" - }, - { - "name": "contentURI", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "EVMSCRIPT_REGISTRY_APP", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_sender", - "type": "address" - }, - { - "name": "_role", - "type": "bytes32" - }, - { - "name": "params", - "type": "uint256[]" - } - ], - "name": "canPerform", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_oldVersion", - "type": "uint16[3]" - }, - { - "name": "_newVersion", - "type": "uint16[3]" - } - ], - "name": "isValidBump", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "CREATE_VERSION_ROLE", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLatest", - "outputs": [ - { - "name": "semanticVersion", - "type": "uint16[3]" - }, - { - "name": "contractAddress", - "type": "address" - }, - { - "name": "contentURI", - "type": "bytes" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getVersionsCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kernel", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_script", - "type": "bytes" - } - ], - "name": "getExecutor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "versionId", - "type": "uint256" - }, - { - "indexed": false, - "name": "semanticVersion", - "type": "uint16[3]" - } - ], - "name": "NewVersion", - "type": "event" - } -] \ No newline at end of file diff --git a/packages/aragon-wrapper/package-lock.json b/packages/aragon-wrapper/package-lock.json index a45d9fc6..f5bfa5ab 100644 --- a/packages/aragon-wrapper/package-lock.json +++ b/packages/aragon-wrapper/package-lock.json @@ -4,6 +4,74 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@aragon/apm": { + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@aragon/apm/-/apm-1.0.0-beta.6.tgz", + "integrity": "sha512-/fBq0HfyFkq+1rCENdqZpLfVpG4R9WtTuS0VxkNHjQkyobzCavrW5/LV3+2crrNIWpQfSYwooW+B5Sqqd/vYeA==", + "requires": { + "ethjs-ens": "2.0.1", + "got": "8.3.0", + "ipfs-api": "17.5.0", + "semver": "5.5.0" + }, + "dependencies": { + "got": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.0.tgz", + "integrity": "sha512-kBNy/S2CGwrYgDSec5KTWGKUvupwkkTVAjIsVFF2shXO13xpZdFP4d4kxa//CLX2tN/rV0aYwK8vY6UKWGn2vQ==", + "requires": { + "@sindresorhus/is": "0.7.0", + "cacheable-request": "2.1.4", + "decompress-response": "3.3.0", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "into-stream": "3.1.0", + "is-retry-allowed": "1.1.0", + "isurl": "1.0.0", + "lowercase-keys": "1.0.0", + "mimic-response": "1.0.0", + "p-cancelable": "0.4.0", + "p-timeout": "2.0.1", + "pify": "3.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "url-parse-lax": "3.0.0", + "url-to-options": "1.0.1" + } + }, + "p-cancelable": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.0.tgz", + "integrity": "sha512-/AodqPe1y/GYbhSlnMjxukLGQfQIgsmjSy2CXCNB96kg4ozKvmlovuHEKICToOO/yS3LLWgrWI1dFtFfrePS1g==" + }, + "p-timeout": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", + "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "requires": { + "p-finally": "1.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "2.0.0" + } + } + } + }, "@aragon/apps-finance": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@aragon/apps-finance/-/apps-finance-1.0.0.tgz", @@ -134,6 +202,11 @@ "arrify": "1.0.1" } }, + "@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==" + }, "JSONStream": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", @@ -2362,6 +2435,20 @@ } } }, + "cacheable-request": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", + "requires": { + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" + } + }, "caching-transform": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz", @@ -2753,6 +2840,14 @@ "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", "dev": true }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "1.0.0" + } + }, "clone-stats": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", @@ -3184,8 +3279,7 @@ "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, "decompress": { "version": "4.2.0", @@ -5227,6 +5321,15 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3" + } + }, "fs-extra": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", @@ -6709,6 +6812,11 @@ "integrity": "sha1-nSLgyjKsyVs/RbjVtPb73AWv/VU=", "dev": true }, + "http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==" + }, "http-errors": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", @@ -6985,6 +7093,15 @@ "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, + "into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", + "requires": { + "from2": "2.3.0", + "p-is-promise": "1.1.0" + } + }, "invariant": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", @@ -7653,6 +7770,11 @@ "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, "json-parse-better-errors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", @@ -7763,6 +7885,14 @@ "resolved": "https://registry.npmjs.org/keypair/-/keypair-1.0.1.tgz", "integrity": "sha1-dgNxknCvtlZO04oiCHoG/Jqk6hs=" }, + "keyv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "requires": { + "json-buffer": "3.0.0" + } + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -8973,6 +9103,33 @@ "remove-trailing-separator": "1.1.0" } }, + "normalize-url": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "requires": { + "prepend-http": "2.0.0", + "query-string": "5.1.1", + "sort-keys": "2.0.0" + }, + "dependencies": { + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "0.2.0", + "object-assign": "4.1.1", + "strict-uri-encode": "1.1.0" + } + } + } + }, "now-and-later": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.0.tgz", @@ -10884,6 +11041,11 @@ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=" + }, "p-limit": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", @@ -12114,6 +12276,14 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "1.0.0" + } + }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -12835,7 +13005,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", - "dev": true, "requires": { "is-plain-obj": "1.1.0" } diff --git a/packages/aragon-wrapper/package.json b/packages/aragon-wrapper/package.json index 47783859..03d90891 100644 --- a/packages/aragon-wrapper/package.json +++ b/packages/aragon-wrapper/package.json @@ -59,6 +59,7 @@ "babel": "inherit" }, "dependencies": { + "@aragon/apm": "^1.0.0-beta.6", "@aragon/messenger": "^1.0.0-beta.3", "@aragon/templates-beta": "^1.1.3", "date-fns": "^2.0.0-alpha.7", diff --git a/packages/aragon-wrapper/src/apm/index.js b/packages/aragon-wrapper/src/apm/index.js deleted file mode 100644 index 236a0ab5..00000000 --- a/packages/aragon-wrapper/src/apm/index.js +++ /dev/null @@ -1,135 +0,0 @@ -import ipfs from './providers/ipfs' -import * as ens from '../ens' - -module.exports = (web3, opts = { - ensRegistryAddress: null -}) => { - // Set up providers - const providers = { - ipfs: ipfs(opts.ipfs) - } - - const readFileFromApplication = (contentURI, path) => { - const [contentProvider, contentLocation] = contentURI.split(':') - - if (!contentProvider || !contentLocation) { - throw new Error(`Invalid content URI (expected format was ":")`) - } - - if (!providers[contentProvider]) { - throw new Error(`The storage provider "${contentProvider}" is not supported`) - } - - return providers[contentProvider].getFile(contentLocation, path) - } - - const getApplicationInfo = (contentURI) => { - return Promise.all([ - readFileFromApplication(contentURI, 'manifest.json'), - readFileFromApplication(contentURI, 'artifact.json') - ]) - .then((files) => files.map(JSON.parse)) - .then( - ([ manifest, module ]) => { - const [provider, location] = contentURI.split(':') - - return Object.assign( - manifest, - module, - { content: { provider, location } } - ) - } - ) - } - - function returnVersion (web3) { - return (version) => { - return getApplicationInfo(web3.utils.hexToAscii(version.contentURI)) - .then((info) => - Object.assign(info, { - contractAddress: version.contractAddress - })) - } - } - - return { - /** - * Get the APM repository registry contract for `appId`. - * - * @param {string} appId - * @return {Promise} A promise that resolves to the Web3 contract - */ - getRepoRegistry (appId) { - const repoId = appId.split('.').slice(1).join('.') - - return ens.resolve(repoId, opts) - .then( - (address) => new web3.eth.Contract( - require('../../abi/apm/APMRegistry.json'), - address - ) - ) - }, - /** - * Get the APM repository contract for `appId`. - * - * @param {string} appId - * @return {Promise} A promise that resolves to the Web3 contract - */ - getRepository (appId) { - return ens.resolve(appId, opts) - .then( - (address) => new web3.eth.Contract( - require('../../abi/apm/Repo.json'), - address - ) - ) - }, - getVersion (appId, version) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getBySemanticVersion(version).call() - ) - .then(returnVersion(web3)) - }, - getVersionById (appId, versionId) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getByVersionId(versionId).call() - ) - .then(returnVersion(web3)) - }, - getLatestVersion (appId) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getLatest().call() - ) - .then(returnVersion(web3)) - }, - - getLatestVersionContract (appId) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getLatest().call() - ) - .then(({ contractAddress }) => contractAddress) - }, - getLatestVersionForContract (appId, address) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getLatestForContractAddress(address).call() - ) - .then(returnVersion(web3)) - }, - getAllVersions (appId) { - return this.getRepository(appId) - .then((repository) => - repository.methods.getVersionsCount().call() - ) - .then((versionCount) => Promise.all( - Array(versionCount).fill().map((_, versionId) => - this.getVersionById(appId, versionId)) - )) - } - } -} diff --git a/packages/aragon-wrapper/src/apm/providers/ipfs.js b/packages/aragon-wrapper/src/apm/providers/ipfs.js deleted file mode 100644 index 23086e40..00000000 --- a/packages/aragon-wrapper/src/apm/providers/ipfs.js +++ /dev/null @@ -1,31 +0,0 @@ -import ipfsAPI from 'ipfs-api' - -module.exports = (opts = {}) => { - const ipfs = ipfsAPI(opts.rpc) - - return { - /** - * Gets the file at `path` from the content URI `hash`. - * - * @param {string} hash The content URI hash - * @param {string} path The path to the file - * @return {Promise} A promise that resolves to the contents of the file - */ - getFile (hash, path) { - return ipfs.files.cat(`${hash}/${path}`) - .then((file) => file.toString('utf8')) - }, - /** - * Uploads all files from `path` and returns the content URI for those files. - * - * @param {string} path The path that contains files to upload - * @return {Promise} A promise that resolves to the content URI of the files - */ - async uploadFiles (path) { - const hashes = await ipfs.util.addFromFs(path, { recursive: true }) - const { hash } = hashes.pop() - - return `ipfs:${hash}` - } - } -} diff --git a/packages/aragon-wrapper/src/index.js b/packages/aragon-wrapper/src/index.js index 1c4466fc..6bf374cb 100644 --- a/packages/aragon-wrapper/src/index.js +++ b/packages/aragon-wrapper/src/index.js @@ -8,7 +8,7 @@ import radspec from 'radspec' // APM import { keccak256 } from 'js-sha3' -import apm from './apm' +import apm from '@aragon/apm' // RPC import Messenger from '@aragon/messenger' @@ -73,7 +73,7 @@ export default class Aragon { // Set up APM this.apm = apm(this.web3, Object.assign(options.apm, { - registryAddress: options.ensRegistryAddress, + ensRegistryAddress: options.ensRegistryAddress, provider: options.provider }))