Skip to content

Instantly share code, notes, and snippets.

@nekomeowww
Created February 9, 2021 14:23
Show Gist options
  • Save nekomeowww/fdd5e2524fda6b077dcd3a16127f6bae to your computer and use it in GitHub Desktop.
Save nekomeowww/fdd5e2524fda6b077dcd3a16127f6bae to your computer and use it in GitHub Desktop.
ArcLight Txs GraphQL
const { gql, request } = require("graphql-request")
const query = gql`
{
transactions(
tags: [
{ name: "App-Name", values: "arclight-app" }
{ name: "Type", values: "Purchase" }
],
first: 100
) {
edges {
node {
id
tags {
name
value
}
}
}
}
}
`
request('https://arweave.arcucy.io/graphql', query).then((data) => {
const txs = data.transactions.edges
let newArr = []
let customers = []
let d = new Date()
d.setFullYear(2020)
d.setMonth(11)
d.setDate(25)
const pre = d.getTime()
txs.forEach(tx => {
tx.node.tags.forEach(tag => {
if (tag.name === 'Unix-Time') {
const idTime = parseInt(tag.value)
if (idTime > pre) {
newArr.push(tx)
}
}
})
})
console.log("Total count for Purchase TX:", txs.length)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment