Skip to content

Instantly share code, notes, and snippets.

@saarim-mirror
saarim-mirror / arweave-query.gql
Created April 4, 2022 19:20
Query for Mirror Content on Arweave
// GraphQL query to get the Arweave transaction ID of a Mirror post
// With the transaction ID we can use `getData()` from the Arweave JS SDK, eg.
// arweave.transactions.getData('bNbA3TEQVL60xlgCcqdz4ZPHFZ711cZ3hmkpGttDt_U').then(data => { console.log(data); });
// We can use the explorer at https://arweave.net/graphql, which queries https://arweave.net/graphql to test it out
// With the transaction ID we can go to the URL `arweave.net/<YOUR_TRANSACTION_ID>` which will render the JSON
// More details on how this works on https://dev.mirror.xyz/GjssNdA6XK7VYynkvwDem3KYwPACSU9nDWpR5rei3hw
query GetMirrorTransactions($digest: String!) {
transactions(tags:[
const signer = library.getSigner(account)
const address = await signer.getAddress()
const hexMessage = bufferToHex(Buffer.from(message, 'utf-8'))
const messageLength = new Blob([message]).size
const bytesMessage = ethers.utils.toUtf8Bytes(
'\x19Ethereum Signed Message:\n' + messageLength + message
)
const keccakMessage = ethers.utils.keccak256(bytesMessage)