Skip to content

Commit

Permalink
basic compatability mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Mar 23, 2022
1 parent 435aafc commit 3096a6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ declare module "ar-wrapper" {
maxRetries: number
verifiedOnly: boolean
maxResults: number
compatabilityMode: boolean
}

export interface BlockDocument {
Expand Down
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ const DEFAULT_FETCH_OPTIONS = {
maxRetries: 10,
verifiedOnly: true,
maxResults: 25,
compatabilityMode: false,
}


class Document {
txID
client
posted
timestamp


name
content
version
Expand Down Expand Up @@ -174,7 +173,7 @@ class ArweaveClient {
// Internal fn for building GraphQL queries for fetching data.
// Both names and versions are arrays. Use `verifiedOnly = false` to include
// all submitted TXs (including ones from non-admin wallet accounts)
#queryBuilder(names, versions, userTags, verifiedOnly = true, cursor = undefined) {
#queryBuilder(names, versions, userTags, verifiedOnly = true, cursor = undefined, compat = false) {
// parse use defined tags
const tags = Object.entries(userTags).map(([k, v]) => `{
name: "${META}_${k}",
Expand Down Expand Up @@ -233,7 +232,7 @@ class ArweaveClient {
const fetchQuery = async (cursor) => {
// fetch latest to cache
// build query to lookup by name (and optionally version) and send request to arweave graphql server
const query = this.#queryBuilder(names, versions, userTags, options.verifiedOnly, cursor)
const query = this.#queryBuilder(names, versions, userTags, options.verifiedOnly, cursor, options.compatabilityMode)
const req = await fetch('https://arweave.net/graphql', {
method: 'POST',
headers: {
Expand Down

0 comments on commit 3096a6b

Please sign in to comment.