diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c21afd --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# discover +A subgraph for dapps which are put on https://dap.ps to be curated by community. Currently hosted at https://thegraph.com/explorer/subgraph/nanspro/discover + +## Installation +``` +yarn install +yarn codegen +yarn deploy +``` + +## Example Query +Get metadata of latest 5 dapps +``` graphql +{ + dappMetas(first: 5) { + id + ipfsHash + hash + status + details { + id + name + description + url + uploader + image + category + dateAdded + } + } +} +``` + + +Get first 10 dapps +``` graphql +{ +dappMetas(first: 10) { + id + ipfsHash + hash + details { + id + } + } +} +``` + +Get first 10 dapp's details (not all just few like name, uploader, id) +``` graphql +{ +details(first: 5) { + id + identifier { + id + } + name + uploader + } +} \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index b52f4f1..dce6d74 100644 --- a/schema.graphql +++ b/schema.graphql @@ -3,6 +3,7 @@ type DappMeta @entity { ipfsHash: String! hash: String! details: Detail! @derivedFrom(field: "identifier") + # email: String! status: Status! } @@ -32,4 +33,4 @@ enum DAppCategories { SOCIAL_NETWORKS UTILITIES OTHER -} \ No newline at end of file +} diff --git a/src/ipfsHashMap.ts b/src/ipfsHashMap.ts new file mode 100644 index 0000000..06071b5 --- /dev/null +++ b/src/ipfsHashMap.ts @@ -0,0 +1,110 @@ +export var hashMap = new Map() + +hashMap.set("QmSWxFAHpjRiydEBZdeQfzWmpLuc3YHBTnvYSkxZyM6Bj5", "QmZJnjgbH8z5QbLzNcPaCK4bMzvye5MpPTS4vSpB55XBfm") +hashMap.set("QmNgNAvHccH7jAbvpCZFLKGNJ8pCZm7Jepmibg3tCSCBPC", "QmVoryjXtawJVRjELzRfmpXgGkzR6U2RJvXLjMXnDWUQrT") +hashMap.set("QmRFdYmKphoKHh1TocKdqDiY8D1RomRx3mS55fhwY1jM2H", "QmRCXSJLNfJpWzC7hZBQoLMCdbzuSrs8PNR3sJsKREiRSV") +hashMap.set("QmWXKBHcWqwyTM7hxWXSqVcTV2FVdb6NstsuUb9UVSjrWZ", "QmQFMrVpHweydbCYXwHq835egvjyTJDGJwMjgsopCJaHvz") +hashMap.set("QmVmY5K5KffCCzNmMsZp7iDefNPjtQomh4eGERso7ShSFk", "Qme7uzZ7V66n93hKJWWaWs3RhH5oHWJqPtsS8DrvGRZZu6") +hashMap.set("QmNxiRWB2pEt8PxZcqSk31rrf1Q2wJ6bwNqpgCNc5Yofnx", "QmYySAayyAGBheZR5bwZ6EnbhpZWLiTyym5Hziba8d2LTf") +hashMap.set("QmQ8WdvGhByH3EeTLGVgApJMNjs8TD3Qb9wonVbtU9EYD6", "QmSNAtyoGsYL6tjV6STp3UJpsAd27CLpePxLjpBqR5AThy") +hashMap.set("QmSrNSRfvAiP2WFkEjsW1zz3GqSGiAz9Ntpz8EqzHiiFRq", "QmSeuh6Q75iapu267SSvv1HRHRVRvymxfjCCtEhGWYzL7Y") +hashMap.set("QmVYNinXCBt1sp44gP6HcAWKm9A8x2cb8zgenpGnjEorEo", "QmXEp49VDGUE8eZ7w8yieLTjZkZxeibuMQhw6EyYnLxwxv") +hashMap.set("QmeAFcdsTnv99HL8TyJy67EBd4q2ySozfib9r1sqXY2cFQ", "QmW2acGmp67kUNBpWxmbezip4JHKWNn1pssSCSzb9RqY2r") +hashMap.set("QmZ3AuUzzGGpj5UQGvzUMLmYZZGXNdsHT9zjzUHpqwXdzD", "Qmb5u8troe3UhJH8Q9F8bagYTcGhxKt2ivHj5Hkof3UeEc") +hashMap.set("QmbT6uocNrWAp5sqWu91wPvpgMXMrQv3PjuV4KKjQJUGH6", "QmdQXHhgbfBVa3HyUgSJR1s5EHketoP5Lws3CHRSbvBM1w") +hashMap.set("Qmb5Jb3csfbKy9iRYapwgNZy75Yksxc61EnejhkF32N86T", "QmWHFmq7uXtAyZ9nZMXLeHmQE4CiL8Yd7iCJVFAHN6eRms") +hashMap.set("QmXs2mbtxXc2adgdMEPZAKtX3P5gKYb7K6xi6LYQb2cLNt", "QmPh6gWRmY5UpmGTp57dcqTbxSPazKPizXzLK7rbPciDNf") +hashMap.set("QmcKvhopbFurMi86E2Yshu72PNiZQnjw6SQdZLNk7s2LyK", "QmdDmHJsPHLAq3QyVe8Ar27FGN1oxXzxfhT8HiKGs51jAm") +hashMap.set("QmPj2zUjwUzpVMKnwA2Joz21Y6K1NUXAjx1NkAwYLwZnvm", "QmWzFbyTZXuDTJiLgPfUrX5VHiN4zZq5coDECcJuTEkvjZ") +hashMap.set("QmbfzXq3wenLYj6rGnoD1sJHm6tX6JeukY6pa84Bxu8tG1", "QmcfemZCnsnMug59qbz82m1SeNPEvkhUkf42aabJpXqLzq") +hashMap.set("QmP9M7YBGqzQCVcf18DRV44fyEMiwz3ZBjzUngXeggLuPc", "QmUJ8XqUSdoQhWmh9YfWDZF9S2rasCWQwT26KuZ83Dhpzk") +hashMap.set("QmV1ZHXEZV9iESmgWBUi175RywDh4tzsEU2NJqUs7ryyC9", "QmVXxU4DstnEUNvXmWD1ESzErktaRunPu9xs9zjNsseA8n") +hashMap.set("QmekoD5mio7yqFapSDeND2Z4vMAFMmRrMzj7NHugHbswo9", "QmbWhw2joxAZp6wiSBnirF9KJdFAyhwcduRWTZTBigyWrB") +hashMap.set("QmYrCFQXQvdJNbhc6nLfrNtjptSo3hj3oGbrvuQVNxGmM9", "QmbTDZBWmKqm66u9rrgJjwSoEVUpy5nJ7iYKfS3VS65JAt") +hashMap.set("QmNQvijmuy4sL3GcbfvWBDkpBwZrVycX4b7jQzWJzKmPKF", "Qmczeu79iWoiapkM1ECWj3vFpLoE7NV3RgZV6GpasijeoY") +hashMap.set("QmXCAtPQXkad4bMvJGxBqQbELsDNtfijUfgR4XvFxzJiks", "QmPjFeCnUWeBziNKSup9Vni9cC5VnxkJscbx28qkM1LkVv") +hashMap.set("QmZPcSaeuaivRku3y2oHF9nRiiKKKpVsf7YSywoKg1SbBB", "QmaxEpfecsvPuTJntaPj1qyScKFhqZ8HtoFPG41eR9mQx8") +hashMap.set("QmRJ96ekqxRXwk8w3rvQc8N5H5Z5iZa2NasRxiSujU7hrA", "QmfGRdBjNHAvvsgw1LADfsGDevQNmN6eujSALDP3FsPy6K") +hashMap.set("QmYR43ZJKosov9zJaR5AGGPDzutiBdJj5BZUzRLDT5aqvF", "Qmbp6ifp6Kc4pQTF1cUvRhtNuFMM182r4PDiveHQ9nqRN6") +hashMap.set("QmTZUnkhgnHWA4mzzuQKKd8z4tS4i1HnV9DRBmSemKfE8W", "QmXQZYMQZvRGMEqLvSorM4W9pLXsCUTG63dmZghPaT4gve") +hashMap.set("QmPztoif34FPoaKQSdUYU3ZYjgV9LTWnBAujSJhi1koGLa", "QmZKRis5BmdwuTP3DyiFmc3XpZUrQh4tC1v89AAoKsSZ4y") +hashMap.set("QmbcYdyN5bwDtyMzjogWDZQGytuh6QKs3YVoXGGi7s3TqF", "QmRJbgESSnCEt11JWWntWCsUCBVPtmXiqh4dcB81J53a3c") +hashMap.set("QmWf2xsLZHbkMiJaeQPm3WPJnd2fFgD5zqVVaRksuJ1sFW", "QmdtdkygRUd6vy3278bLVebjKtp1f3wzib2D1rEFQAAW3S") +hashMap.set("QmNvK29PTctNCmpP1GndSfYezvPMms85Vpw8LL24WiWaae", "QmYARSXQqVWjRN1pEqbvYv9Pva5sCUW6vYxJieo7VBcZYV") +hashMap.set("QmYZo2NhNTgsZD16gBWcfjhRdq7EVfJ5wtdVxtxeKbcLZR", "QmaKWq5JbDFwzaNmPjk95bn9ggYCzivC8sLmMZGZthfpQL") +hashMap.set("Qmbf7iHmFJa561n8y1j7Uve8sGamN7u6BhAHhYcStEVUZ8", "QmbVJQhgmhouzd3kZJ2SHQu6AjdvAKFxiEmB8wEGYxDfQi") +hashMap.set("QmYnw1CrkUxZiVkc7QECKcVouNQjiijCgPsVWMW2JKAY2D", "QmVfQDgT6NPN5ok8ogYQcAJii4JKujfho2w6GddaRGBJvb") +hashMap.set("QmeXiKtmb4Z1kwRy5wtKwBQKWgfh1jegZ6npZ5pWXqFhXU", "QmXnLiueXzFUW1NpFuWDgwNSsMge2fusj5SMhbae8QFvNn") +hashMap.set("QmdDQfeADsa1BMxSdhvrpsQHq2cVvHWkx1L4Qyn3m8mB9Q", "QmTBhmDBHQqYqVvEq2419qGbeixHouQwcZLiJpxHLzJy8F") +hashMap.set("QmbXZwhMqnQEojqekAJe2MnQ8DqNuefEabqmtja2LoNs3t", "QmagDaFB3C2dJydgaN6uNZmGQuZTXFE43Ux51YtBepyRjg") +hashMap.set("QmVpbg1vcVMHpEdk3w2CedUJnTVK9WsAALVMjjUud5EzD2", "QmdCmWa4HypZxWY1HzXb4WsSbFjiY3DnxvoEamRqu1r5y6") +hashMap.set("QmTtmwuvJzx8FhiXZnZU5jAwhdMFK8Hrv8evhsQ2Hhv4ac", "QmWkmVpi4UQDhEefsWrM7xARMC44Q9UKpjhPsbGcVcN26j") +hashMap.set("Qmf36hFNXxmnJ7GSGcLXjWcLsk9zmFQJjjbde4Q3earkZx", "QmehsGAngZVExvLcYVsDE9ag8o9CK5TPvj8mdL2NeFXg1X") +hashMap.set("QmWbQkPZ99xtpWyZVt6YyFN9WacFBViVF9ad5owxqjo3Yn", "QmWx7VuzrkpT7abYwyQcc94Yj5muxpfnif2g3J8ckqr7un") +hashMap.set("Qme4PTPndYfm9JsoTZAhfQYgnkkogyhugFwAzuQSwJgQfN", "QmeZ2HcsufWP9d5V6AFE2Fz5gSmZZ5gDJjYNwCTYPvh6Qo") +hashMap.set("Qmd4z9ZyT9deeGsQeWg3NqNX5eG2aoR9MyopNKZeyYcm5d", "QmPKo3CA7kMWVrv4SauEcvupoKiwRHEzs42HsxZvsC81ne") +hashMap.set("QmUYbAfTEZn9XkAhzyskjPfdxcUUZoGT6pNzSSpkgMToSL", "QmXRCT6ADyhWcZQLXv1xiR7WjwTmdzYBKFQn4m5mdVnKQo") +hashMap.set("QmVWrJv8HVR94CtSbKj2zYjuFQVFS4a6ywCfrmTVqMLaSV", "Qma7cWPHunzkduAMoAnBmY621dDWT257tMTRgmTuAq9f4T") +hashMap.set("QmfXR9TdV55K7pYaKwWBkAdJkBkRFbWcRqmpx48ZFgqHKb", "QmWz1BmgBQc1k3KnF4mbU8sXPgfAU48EbuFS719HN9kznx") +hashMap.set("QmNimXTHcj4KDmzNTbkAqnwZ61B4DmMq82ksMb6QkfPrwy", "QmUHyGvEdWXNyWG7nREH4YhUq2viMpDWV444ykQspmWkzk") +hashMap.set("QmQpuUyzUKGa1MvE8vNFi5QLYFE71Wvc3QTCDAEGBA6WN1", "QmZhpqn2gV9WcFxvsBaYy8f8deE6uxN1rvwMmjSvtUkkM8") +hashMap.set("QmbMbWKLieLU2pHv9WpAvtvDE1gnAVvWnsTJF2Zt2gyvto", "QmX6XiCfUXUagVaRY5MMyHcs4jnUwTyYiZPMVwCabQEKUo") +hashMap.set("QmaFHmihXgvXx4TtSsbZjvLaqpTYAY6KC5QopNCPUHXWGf", "QmQFGEQMVciV5NBrhwUJGoSRzPhG92KYBUFFTDosyQjdYm") +hashMap.set("QmeLTV2er7TZiK428HNxqG8HX5Bxf9T8AGG2grYUirDsfx", "QmYG24CEtwwijjzHPNhgHoRGkzVVDmTyDEX3we3tLWPpZu") +hashMap.set("QmYnZm9DCL45sF79CQEV2oH8KSCb6LAcp3wMaLFYfsnQXw", "QmVfTteD71nNAtvC6PY7rhsGnkBjzXePdiPah8zFC644CL") +hashMap.set("QmZC968epuFZAosHSjn9RChNffKM62dj3Ep1dEt9WCQbN8", "QmdMPeTTe9zJ41KsNsRmPt3Pvrj9o7DaqaxYrFfL6VBRHA") +hashMap.set("QmZc1CrvzHhy8YHDZ7TsMND8G3MNJU3od7ZQLKbg83XzQR", "QmeqsfxnkWjU1u8nTuoFRAFKHRg1ycyWFbN1HgDYW1TXPa") +hashMap.set("QmT539JzQK81RnYaDTF9JDto1TedKFairBMRPyAwyXU34p", "QmTp6MAJC13mBHTKY2rjJGkst12uuqyT6Z8uqY3vEhLrpt") +hashMap.set("QmR5aVSZzyNjuS18kpXrzk3dhxW1ZWRaxaZ6TGMzWfeQ32", "QmRjfgpaFtkqA9bn7AHVuaCSdqdgQLCd9JjEkPaPJgoRKE") +hashMap.set("QmS6a72GnPvUCMwKKrVGE41yY8RYwVVoBTrEbW6XWDu1EY", "QmaY9NPShDqWnGuBH9kCmmsvSkizRBqT5FMiZnRKxVQ1hR") +hashMap.set("QmRLtSXtrnauap1ge4gse9zSTh88CjattF6qUkzsqo3oKV", "Qmd7sQGXStxb9FxPbnD8tkiboReLYFpK5pVz62jLe6xKrw") +hashMap.set("Qmdps3h4oMVSbe7xst6fmY2VXQMQYUeee7SEc3tsbdvqZ1", "QmfBVsUtsVjxTtqg8FaEX3hCx2sUCYgE6HTqFahTFwVHeb") +hashMap.set("QmatKtV8fRCYv4tnxSugxJ1tBU6z7MzjADMav2MnxzKPe6", "QmYNi1B2KRf4ecPMDJP4HFtyLZNthwVQsub3tekjP5b8U9") +hashMap.set("QmUmp9WaFYqD1Wh5aBLVUqD4QpqgPPzNN3hohuMu5WypE8", "QmYHVVGNv5Gf881Ben892QrdAsAJbNuPMYYBFCAmVxSwJf") +hashMap.set("Qmf7RGnF2fPgfxmKS5yQUkaTn3Y2B8hL9CeAeWQP9vL67e", "QmPEKSNcNfnA41s3zAostcAXy62D7KfBvgQZhw7YWphqqn") +hashMap.set("QmScfYhgdWfwNf4SvtYwmrm5HW23EXExGxRStZaUTzuk2R", "QmY1gFKDujaQ2DcbAc9bv17DtXEGCqvpBVrwFAHj59NSJH") +hashMap.set("QmSe91Tqe9AUnmGXtZxX6F8rzJAzurie3eKgVG6APNQ4TC", "QmRRxW4XdTt5JVNDGEEwWZvF8W7XogbuBK6evXHKNZH53d") +hashMap.set("QmNwq9yGZcqbdC8Q9EDMB3Xnm6afaFBpcTcqwaHkLuo3Ez", "QmPtJKbE6JvgnbsVzKPw3pkL4zc49Si4rzom24cs82dvke") +hashMap.set("QmU3d1p9wZrT9j9CjWRTySeBJHwQfdkewHM9yQ4jMvCXGj", "QmT9iridTfiPTiEyJZRYQvdHuZ7tKiTFrr32aSniiM5u5v") +hashMap.set("QmdkTS8UMXBwGFFFfR9Rb6oADwGgnC6p8x45fnPqaqtV1r", "QmSTRRgTSHEg9w7biuj7fQTyY163ym4gXFoeHcqqfC3Zph") +hashMap.set("QmNToZXuc7TQjQSkLZuGQmgvZqDN7xLHdz5RFF6UM7sBaw", "QmZCKogrRmqT8wxf4d2n6bmY5mbn8g7YiYXX65yXQ16xvr") +hashMap.set("QmfCbEDwZ7sVSzcmivp3WvKd9pcKHhmCXiFwFuuQJmhPhs", "QmNR2JwRpB2ZwUyPco7zf2KbGSUni1fEUS65hR9GUpNxCr") +hashMap.set("QmfMx6kvs4bandCC76NLUgWJ63PaA5GyZ3w1PzpXxE1PVc", "QmaJgH7gwsCwCFFZD9DXNpsZAv8ZcjRnNXcF5J9XmoKgH1") +hashMap.set("QmTTDtuxzo5mrMEembbTQmaZmvz83xigwsGgYrUSNoBghv", "QmNpEccwwv3ddDfFqsbqDohL3AepSw6LRV7UjbKUb7PKka") +hashMap.set("QmaoqSiEWV3GyPuJKtH9VSg3jQ7kYej6s8hLVLWaJi9S3r", "QmZp4SMu1gkTxvEZBtvrdt4FCPRDFffyEQ3AZcd9jmERng") +hashMap.set("QmU3tWix5GyLruwbq4tYk8hpTBZsjcKN6vufQYGxUPw2d5", "QmcN1iG3h8TSSxtBadmJRRhEuSLitn2g1BgqXC4xkxYMEP") +hashMap.set("QmQKbCiixs9poJxT2vB7yZeURfXsiDhuBoCLKwZfRC2Qdp", "QmdrdGUTvP8ykUKzBjWNXKPJQ7NZGkijKbSJvRY8msaZcH") +hashMap.set("QmXkebq3CUj6aazZZoTU6qSKMPzgiT4wHjfnQmHC5zyFwB", "QmSAqgDgnFxXdZUvDJwXAMhFpGo7HdWdBjdoLBG4zmqZdN") +hashMap.set("QmNcEBrXmp3mwZxrrYzK7eBuu7eiucrWH5SidbU136yp3q", "QmdpaFn83vY5nWPTMQdwkyNpSzHbGaQHkYwAr1PZD3WAyZ") +hashMap.set("QmQYTvxVQZhvhvFtenwRVDoE5LJe4qcwRn9EhbsaquiBpR", "QmZwyjHfXosYfzqydYHHQYbqUtSPWAge8D2bpMLrxkKNM8") +hashMap.set("Qmb73oBdK7AvJTtWxCjLKYhHoyoiond9S3jLp14b6LyxaT", "QmevUYx5ZAVyRktvA6EbRSXnswK7cTYyFY61CGBNqA3EAj") +hashMap.set("QmXTh32g3BeqNmArQaN6MnniGE59xjcwfzpzEBdAVGPAvD", "QmcgnhNyXTUPKRwhm2AbcyPK191QioihPT7ePju42CxQXz") +hashMap.set("QmNdCTX5sRGSc7q2Fix4VAXiU7Nf5QuwA7qyJ4LKxdwwsU", "QmSHkcmpa52intrHhfmX9vPS4xBJcSrkpm531BQEjXGMFf") +hashMap.set("QmaAQeGsnBf8Ywdi8brnav5yv32ngQBD66UKJPmFUH848N", "QmP8R1y2xSN4LRrbnMGHyx61jmDL2oNKqVuFH7Bm8YMH1Q") +hashMap.set("QmcRBPUkvHg8AKizajhjXaACDWThYC8pgnqLjdxDVfmWez", "QmYBHr6uktryYCJT3txxXhqovwiVVDZDAwJTyz7FryG4sN") +hashMap.set("QmQQTKV4Yk3TNko2CjGcrBKEhrhVz5Cex3S3tvg3CAG8Cn", "Qmf1AWNpSPTQybWXbgVPkM8tVpGeBKSVxi8vWwf35b6Rrf") +hashMap.set("QmaQJeWYmrkQJ9B9N9sszcDR3TkDZtZb3MpQFQ2AtKudpb", "QmR4Lpj83z4Hkh7RQ8pzBwsiGmgXmnUp97Sppgsnre4hNn") +hashMap.set("QmYrK3MUsWwo3ZNMkLuM1KTrkXhntiSfctCdtJu3nwzam7", "QmRUZSYcLQVA3SYbUYs54Hzb84spC5nidATBwhvTKXtHHw") +hashMap.set("QmNpwzP39KLAysY9Y1icAeb8J6m4W62MvqnqooiKoRFa1g", "QmYpBrcq9tcmQTWjh8hyZ4ZhdzuCkQhRqMA5Z4hYA73NdA") +hashMap.set("QmNTKajAYjBGYZwnsxP9dhsPj5t2VJYQD25c6yREnWVRSn", "QmW56ZP3aBLJJNQAcNPu1Wj1vg85o5UDxpuN1M7Kv3RQpL") +hashMap.set("QmPnNhykth6ohTBXAHsRE1Kr2T89gJCHDcMBduwT99W3RS", "QmXPQN3GxuXZsTBh1NpLnANuz1kQTteh3oD8v9y17NQEs5") +hashMap.set("QmSQpfwhPJ3PZ4JyK7kizMp7U9vESLq4DCg58oarS9ZXpj", "QmfQFcWkSK8NN5cwpKDwbMpkuLyo4B9vTheJ3oP27KUUz1") +hashMap.set("QmWWBUmXFmg8HrNMhd7WvoDCXccoYj1JzhdDm9tiJ4oXk2", "QmV3ZDuURdW1nTUr9JgVpUW3afQcn44ZwB4TgZs33psjUg") +hashMap.set("QmQWbPaNcvVK6XWfWoSBZw81nK3KggiuSibTdsdfUgyhk7", "QmQnimUgxNsi6smudM2D8UbHq7tHxeeMkhaNVBRuQnNdWh") +hashMap.set("QmRFyNpoQxEhoh34MADCcRZ8g96GWDLL7X3Q9M5EMFgU5L", "QmfBjCiVCtXJVZCJBfUZLt6AB8raEawQ5udLrUCaGa2D76") +hashMap.set("QmR5zrF1RNhgf8R9iDp4RteWc12nFaAQZFLn14Csdg6RVw", "QmderzNVr1vSBpJp9qKPDDASwWBfBGeUrWuvb8apHwxJq2") +hashMap.set("QmS45d4nqP27JzUjtfUK1Zc3rAX1NamxZ5CskmeshPr2xF", "QmRkyeNdDRrJySG3cpsqcxgP47gmapB98VYrN9MwA4Qp1m") +hashMap.set("QmcjduC3LCWiQRqg9UZpccbPZuuTAWn7oC8WYQiHu8Toko", "QmYW3LU1U3xqQhrUSkDaxAxFxf41QnsVKfmW3FXDdgDqKx") +hashMap.set("QmTGYkG8mdgJNPANPFjsNBGehnX2QNDuAqJoDswF6gaTC4", "QmR3wVWbNqYTUUsDFR5W7Srpmatv4EPed8gUXSSYYh2a2f") +hashMap.set("QmZhW1DwdSqss9aRwLxFre1L8NYnKgq9haNPKTbXBMx6Nj", "QmbsjngTGEyXLfoHb9qr1JZui35mtF3tGJNuoPUu455LXw") +hashMap.set("Qmavbxqv2MfPVt3pDmsDzCXpNefYyEUUkf4KCXELdUpY5P", "QmSCMMnzXZhi1ncMXcXifXVGwgU41HS34wuWuXHgif2FR4") +hashMap.set("QmVAioSeceg38niXimpKXsdgoqQrW7AW1ML4gUBcqAERZx", "QmPe8BdhXf1HqkWELcoQv5mvVyQiDXQGUx8hpQpzjASVoC") +hashMap.set("QmaxH49wtXuQHjjWNnKi9M1bNTVEXTbACe3CiT2kZ8rq37", "QmWakkwQm1odp1tJ1FR3qwjJpjd8D8GCSKrH3PeUyQA2Yd") +hashMap.set("QmWFZuSm7V3ccRyAL5se8xBkdfWs6ZQWDdj1jkAb73VE2o", "QmecUJQkpYanceo1u3AwRH2dVBam6s1t7Dr9wGCEp2DPSr") +hashMap.set("QmVqZyp71xxx611LjbQnqfJn6FrGppUACMJuqqd4Q5QtSp", "QmeCsyPgCX55GecRpm8MY5TSdmm1Mi7Wz7nuYsQw8VcGr7") +hashMap.set("QmZHx3uu2S54WSrgU8uDDZVYwPS3r3ECMNVUQKykk46H9r", "Qma3LkonWZcZcn9pqjrGyHsnqB7vKPNhXfahz1FD16i8Yn") +hashMap.set("QmQspza5ms55NaLyoHnHZgewySDgxjV7nLwrChga5FAS8R", "QmR6t8MhsBPAfUXEsUShq5pb1wsX8TowDu2ko5EnhWQCw1") +hashMap.set("QmaLktR6x8Ye7htYgVWzGBFrwwLPWqxtHawV6CfwpML6cv", "QmbijWDvwkTQtQzMjDGrSAxG9JJN7zmLsJjUDfW4y9Vdnq") +hashMap.set("QmPUEoCQXYB7k6sWsyecKn2vgCqYmtatnuVAjtuzHRi9Zt", "QmUjKQC9yWAN4YWyLSYWMS7TbAeRLUcmE5eCU8wX5vfsg2") +hashMap.set("QmfTABxDjZNrgeoGLuCSK44cNEWFmXPaKh2iBMPoMBqgPa", "Qmc7pVDcu2GpgGsHfCxwDPYjBYvmCYK9DVwxpnctTs4A12") +hashMap.set("QmPuaNa7goXwHkQFw5UDEqkJihBAV55ACzxV97EG8tPBD8", "Qmc5BaFGjeR6Jps7NgeGfHreKR9jMnhf2dpM8CBzYwnLu7") diff --git a/src/mapping.ts b/src/mapping.ts index 0872896..953c49f 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -9,18 +9,11 @@ import { import { log, - ipfs, - json, - TypedMap, - JSONValue, - Bytes, - Value, - BigDecimal, - ByteArray, - BigInt } from '@graphprotocol/graph-ts' + Bytes } from '@graphprotocol/graph-ts' import { loadFromIpfs } from "./ipfs"; -import { TransactionInfo, State } from "./transaction"; +import { getNewHash } from "./oldToNewHash"; +import { TransactionInfo } from "./transaction"; export function handleDAppCreated(event: DAppCreatedEvent): void { @@ -58,12 +51,16 @@ export function handleDAppCreated(event: DAppCreatedEvent): void { tx.from = event.transaction.from tx.hash = event.transaction.hash tx.state.ipfsReqs = 0 + + // get new hash if the curret ipfsHash legacy hash + ipfsHash = getNewHash(ipfsHash) + + log.info("NEW IPFS HASH: {}", [ipfsHash]) - if (ipfsHash != 'QmS6a72GnPvUCMwKKrVGE41yY8RYwVVoBTrEbW6XWDu1EY' && ipfsHash != 'QmfCbEDwZ7sVSzcmivp3WvKd9pcKHhmCXiFwFuuQJmhPhs') { - let ipfsData = loadFromIpfs(ipfsHash, tx) + let ipfsData = loadFromIpfs(ipfsHash, tx) log.debug("Transaction (Tx): {}", [tx.toString()]) - log.debug("IPFS DATA is {}", [ipfsData.get("name").toString()]) + log.info("IPFS DATA is {}", [ipfsData.get("name").toString()]) entity2.name = ipfsData.get("name").toString() entity2.url = ipfsData.get("url").toString() @@ -79,12 +76,4 @@ export function handleDAppCreated(event: DAppCreatedEvent): void { entity.hash = event.transaction.hash.toHex() entity.status = "NEW" entity.save() - } - // entity.compressedMetadata = web3Utils.keccak256( - // JSON.stringify(metadata), - // ) - // entity.status = "NEW" - - // entity.id = event.params.id - // entity.newEffectiveBalance = event.params.newEffectiveBalance -} \ No newline at end of file +} diff --git a/src/oldToNewHash.ts b/src/oldToNewHash.ts new file mode 100644 index 0000000..52eb9f5 --- /dev/null +++ b/src/oldToNewHash.ts @@ -0,0 +1,15 @@ +import { hashMap } from "./ipfsHashMap"; + +/** + * This method is required due to a bug in uploading Dapp metadata to IPFS. + * Old content hashes are retained and cannot be changed due to how contract was written. + * This maps old invalid hashes to new valid contents hashes for IPFS. + * For more details see: https://github.com/status-im/infra-ipfs/issues/4 + **/ + +export function getNewHash(ipfsHash: string): string { + if (hashMap.has(ipfsHash)) { + return hashMap.get(ipfsHash) + } + return ipfsHash +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index fad64d9..65ff6b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -230,9 +230,9 @@ asn1@~0.2.3: dependencies: safer-buffer "~2.1.0" -"assemblyscript@git+https://github.com/AssemblyScript/assemblyscript.git#36040d5b5312f19a025782b5e36663823494c2f3": +"assemblyscript@https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3": version "0.6.0" - resolved "git+https://github.com/AssemblyScript/assemblyscript.git#36040d5b5312f19a025782b5e36663823494c2f3" + resolved "https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3" dependencies: "@protobufjs/utf8" "^1.1.0" binaryen "77.0.0-nightly.20190407"