-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "feat(website): automatically publish latest blog post…
- Loading branch information
Showing
6 changed files
with
251 additions
and
100 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
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,73 @@ | ||
import Arweave from "arweave"; | ||
|
||
const arweave = Arweave.init({ | ||
host: "arweave.net", | ||
port: 443, | ||
protocol: "https", | ||
}); | ||
|
||
export const getPosts = new Promise<Array<Object>>((resolve, reject) => { | ||
async function getTransanctionIds() { | ||
await fetch('https://arweave.net/graphql', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
query: ` | ||
query { | ||
transactions( | ||
first: 100 | ||
sort: HEIGHT_DESC | ||
tags: [ | ||
{ | ||
name: "Contributor" | ||
values: ["0x5b796c4B197B6DfD413f177059C27963EB80af0F","0x2b1F13149C7F89622BBfB46Ae1e3ECc573Bb9331","0x381636D0E4eD0fa6aCF07D8fd821909Fb63c0d10"] | ||
}, | ||
{ | ||
name: "App-Name" | ||
values: "MirrorXYZ" | ||
} | ||
] | ||
) { | ||
edges { | ||
node { | ||
id | ||
tags { | ||
name | ||
value | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`}) | ||
}).then((res) => res.json()) | ||
.then((response) => { | ||
getPosts(response); | ||
}) | ||
.catch(); | ||
} | ||
|
||
async function getPosts(response) { | ||
const posts = [] | ||
Promise.all(response.data.transactions.edges.map((edge) => { | ||
const transactionId = edge.node.id; | ||
arweave.transactions | ||
.getData(`${transactionId}`, { decode: true, string: true }).then((response: string) => JSON.parse(response)) | ||
.then((data) => { | ||
// Check if the posts have the required keys | ||
if (data.hasOwnProperty('wnft')) { | ||
|
||
// add the original digest | ||
data["OriginalDigest"] = edge.node.tags[4].value; | ||
posts.push(data); | ||
} | ||
|
||
}).catch(); | ||
})) | ||
resolve(posts); | ||
} | ||
getTransanctionIds(); | ||
}) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@tailwind utilities; |
Oops, something went wrong.