The Irys query package enables users to search Irys and Arweave through an intuitive JavaScript package.
It is easily implemented in a few lines of code.
The query package is for searching transaction metadata on Irys and Arweave and Arweave block information. Once you've found transactions, use the transaction ID to download the associated data.
You can install via npm:
npm install @irys/queryand yarn:
yarn add @irys/queryImport the Irys query package with:
import Query from "@irys/query";Start by instantiating a new Query object, this is a shared instance you can reuse each time you want to execute a new query:
const myQuery = new Query();Then execute a query by chaining together a series of functions that collaboratively narrow down the results returned:
const results = await myQuery
.search("irys:transactions")
.tags([{ name: "Content-Type", values: ["image/png", "image/gif"] }])
.token("matic")
.fromTimestamp(new Date("2022-07-01"))
.toTimestamp(new Date("2023-07-03"))
.sort("ASC")
.limit(20);Using the Query class users can search:
- Irys transactions
- Arweave transactions
- Arweave blocks
Consult our documentation for sample code demonstrating each query type.
