1.1.0 • Published 7 months ago

arweave-indexer v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Arweave Indexer

A lightweight utility for querying and indexing data on the AO network.

Installation

npm install arweave-indexer

Usage

Querying Data

import { query } from 'arweave-indexer';

async function searchProjects() {
  const results = await query('web3');
  console.log(results);
}

Indexing Data

import { index } from 'arweave-indexer';

async function indexProject() {
  const result = await index(
    JSON.stringify({
      title: 'My Web3 Project',
      description: 'An awesome decentralized project'
    }),
    window.arweaveWallet
  );
  console.log(result);
}

Advanced Usage

// Custom process and tags
const results = await query('web3', {
  process: 'custom-process-id',
  tags: [{ name: 'Category', value: 'Blockchain' }]
});

API

query(searchTerm: string, options?: IndexerOptions)

  • Performs a dry run query on the AO network
  • Returns an array of projects or null

index(data: string, wallet: any, options?: IndexerOptions)

  • Sends an indexing message to the AO network
  • Returns the message result or null

Types

interface Project {
  title: string;
  link: string;
  description: string;
  twitter?: string;
}

interface IndexerOptions {
  process?: string;
  tags?: { name: string; value: string }[];
}

License

MIT

1.1.0

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago