Created
February 9, 2021 14:23
-
-
Save nekomeowww/fdd5e2524fda6b077dcd3a16127f6bae to your computer and use it in GitHub Desktop.
ArcLight Txs GraphQL
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
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