@seedprotocol/arweave 0.7.4-next.793.g6dd83dd → 0.7.5-next.850.g9ab585b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +92 -0
  2. package/package.json +15 -2
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # @seedprotocol/arweave
2
+
3
+ [![npm](https://img.shields.io/npm/v/@seedprotocol/arweave.svg)](https://www.npmjs.com/package/@seedprotocol/arweave)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Arweave gateway client and helpers for [Seed Protocol](https://seedprotocol.io). It provides a process-wide `ArweaveClient` facade (gateway host, `/raw` and GraphQL URLs, transaction data, tags and status), read-gateway selection with health probing and a per-host circuit breaker, Seed gateway endpoint resolution (HTTP gateway, app-server proxy, or local Hyper sidecar), and helpers for classifying media references in Seed items.
7
+
8
+ This is a lean building block. [`@seedprotocol/sdk`](https://www.npmjs.com/package/@seedprotocol/sdk) depends on it and registers the right platform client during init, so **app developers should use the SDK**. Install this package directly when you need Arweave reads in a server, script or tool (feeds, indexers, CLIs) without the full SDK.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @seedprotocol/arweave
14
+ # or
15
+ bun add @seedprotocol/arweave
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ The root entry only holds the facade; it needs a platform implementation before it can fetch. In Node.js, import the `/node` subpath, which registers the Node client on import:
21
+
22
+ ```ts
23
+ import { registerNodeArweavePlatform } from '@seedprotocol/arweave/node'
24
+ import { ArweaveClient } from '@seedprotocol/arweave'
25
+
26
+ // Optional: set the preferred read gateway (default: ar.seedprotocol.io)
27
+ registerNodeArweavePlatform({ arweaveDomain: 'arweave.net' })
28
+
29
+ const text = await ArweaveClient.getTransactionData(txId, { string: true })
30
+ const tags = await ArweaveClient.getTransactionTags(txId)
31
+ const { status } = await ArweaveClient.getTransactionStatus(txId) // 200 when the gateway has it
32
+
33
+ ArweaveClient.getRawUrl(txId) // https://<gateway>/raw/<txId>
34
+ ```
35
+
36
+ `ArweaveClient.setHost('http://localhost:1984')` pins a gateway (plain hosts default to https) and disables read-gateway probing. Without an explicit host, the first of `NEXT_PUBLIC_ARWEAVE_HOST`, `ARWEAVE_HOST` or `VITE_ARWEAVE_HOST` is used.
37
+
38
+ ### Reading across gateways
39
+
40
+ ```ts
41
+ import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave'
42
+
43
+ // Tries preferred gateways, then the resolved / public ones; undefined if none answer
44
+ const body = await fetchArweaveRawTextAcrossGateways(txId)
45
+ ```
46
+
47
+ Override the fallback list with `ARWEAVE_READ_GATEWAYS` or `NEXT_PUBLIC_ARWEAVE_READ_GATEWAYS` (comma-separated hosts).
48
+
49
+ ### Gateway endpoint resolution
50
+
51
+ ```ts
52
+ import {
53
+ resolveSeedGatewayEndpoints,
54
+ seedGatewayConfigFromSeedConfig,
55
+ } from '@seedprotocol/arweave'
56
+
57
+ const endpoints = await resolveSeedGatewayEndpoints(
58
+ seedGatewayConfigFromSeedConfig({ gateway: { transport: 'hybrid' } }),
59
+ )
60
+ // endpoints.activePath: 'http' | 'http-proxy' | 'hyper-sidecar' | 'hybrid-fallback-http'
61
+ ```
62
+
63
+ See [GATEWAY_HYPER.md](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/docs/GATEWAY_HYPER.md) for transport modes, proxies and the Hyper sidecar.
64
+
65
+ ## Exports
66
+
67
+ | Entry | Main exports |
68
+ |-------|--------------|
69
+ | `@seedprotocol/arweave` | `ArweaveClient` (alias of `BaseArweaveClient`), `IArweaveClient` |
70
+ | | Gateway constants and env helpers: `DEFAULT_ARWEAVE_HOST`, `DEFAULT_ARWEAVE_GATEWAYS`, `ARWEAVE_HOST_ENV_KEYS`, `resolveArweaveHostFromEnv`, `getArweaveReadGatewayHostsForPrimary` |
71
+ | | Read gateways: `ensureReadGatewaySelected`, `selectFirstHealthyReadGateway`, `probeGateway`, `getArweaveReadBaseUrls`, `fetchArweaveRawFromBaseUrl`, `fetchArweaveRawTextAcrossGateways`, `setPreferredArweaveReadBaseUrls` |
72
+ | | Circuit breaker: `configureGatewayCircuitBreaker`, `isGatewayHostCircuitOpen`, `recordGatewayHostSuccess` / `recordGatewayHostFailure` |
73
+ | | Gateway config: `resolveSeedGatewayEndpoints`, `seedGatewayConfigFromSeedConfig`, `seedGatewayConfigFromClientContext`, `SeedGatewayConfig`, `ResolvedSeedGatewayEndpoints` |
74
+ | | Upload pipeline status: `getArweaveUploadStatus`, `isArweaveL1AnchoringComplete`, `getUploadPipelineTransactionStatus`, `queryArweaveGatewayTransactionWithFallback` |
75
+ | | Media / relation refs: `classifyMediaRef`, `normalizeFeedItemFields`, `getArweaveUrlForTransaction`, `resolveSeedRssImageRelationRef`, `resolveSeedIdsFromRefString` |
76
+ | | GraphQL documents (e.g. `GET_TRANSACTION_TAGS`) and types (`TransactionStatus`, `TransactionTag`, `GetDataOptions`, `DownloadResult`) |
77
+ | `@seedprotocol/arweave/node` | `registerNodeArweavePlatform({ arweaveDomain? })`, `NodeArweaveClient` (registered as a side effect of importing this entry) |
78
+
79
+ ## Related packages
80
+
81
+ - [`@seedprotocol/sdk`](https://www.npmjs.com/package/@seedprotocol/sdk) — the full local-first SDK (uses this package)
82
+ - [`@seedprotocol/eas`](https://www.npmjs.com/package/@seedprotocol/eas) — EAS GraphQL reads
83
+ - [`@seedprotocol/query`](https://www.npmjs.com/package/@seedprotocol/query) — canonical Seed JSON reads, with Arweave body hydration
84
+
85
+ ## Documentation
86
+
87
+ - [seedprotocol.io](https://seedprotocol.io)
88
+ - [Changelog](https://github.com/JournoLabs/seed-protocol-sdk/blob/main/packages/arweave/CHANGELOG.md)
89
+
90
+ ## License
91
+
92
+ MIT
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@seedprotocol/arweave",
3
- "version": "0.7.4-next.793.g6dd83dd",
4
- "description": "Arweave gateway client and helpers for Seed Protocol",
3
+ "version": "0.7.5-next.850.g9ab585b",
4
+ "description": "Arweave gateway client for Seed Protocol: transaction reads, read-gateway selection with health probing, and gateway endpoint resolution",
5
+ "keywords": [
6
+ "seed-protocol",
7
+ "arweave",
8
+ "arweave-gateway",
9
+ "permaweb",
10
+ "decentralized-storage",
11
+ "web3"
12
+ ],
5
13
  "type": "module",
6
14
  "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
7
16
  "exports": {
8
17
  ".": {
9
18
  "import": {
@@ -56,6 +65,10 @@
56
65
  "url": "git+https://github.com/JournoLabs/seed-protocol-sdk.git",
57
66
  "directory": "packages/arweave"
58
67
  },
68
+ "homepage": "https://github.com/JournoLabs/seed-protocol-sdk/tree/main/packages/arweave#readme",
69
+ "bugs": {
70
+ "url": "https://github.com/JournoLabs/seed-protocol-sdk/issues"
71
+ },
59
72
  "publishConfig": {
60
73
  "access": "public"
61
74
  }