### Clone and Setup Local Gateway Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Clone the repository and run the setup script to install the local gateway stack. This script also handles the authorization of a locally signed CA certificate for HTTPS support. ```bash git clone https://github.com/ethlimo/dweb-proxy-api.git cd dweb-proxy-api/local_gateway ./setup.sh ``` -------------------------------- ### Start Local Gateway Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Commands to start the local gateway after initial setup, using different container runtimes or docker-compose. ```bash ./start.sh ``` ```bash docker-compose up -d ``` ```bash podman-compose up -d ``` -------------------------------- ### Custom RPC configuration Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Set RPC endpoints and start the service. ```bash export ETH_RPC_ENDPOINT="https://your-rpc-endpoint" export GNO_RPC_ENDPOINT="https://your-gnosis-rpc" ./start.sh ``` -------------------------------- ### Start Redis Container Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Commands to pull and run a Redis instance using podman or docker. ```bash podman pull docker.io/library/redis podman run --net=host docker.io/library/redis ``` -------------------------------- ### Build and Start Proxy API Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Build script execution for the ENS dWeb Proxy API. ```bash ./bin/build.sh ``` -------------------------------- ### Set Up Local Gateway Deployment with Docker/Podman Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Clone the dweb-proxy-api repository and navigate to the `local_gateway` directory to run the `setup.sh` script. This script deploys Caddy, IPFS, Arweave, and Swarm gateways, installs a local CA certificate for HTTPS, and configures DNS resolution for `*.eth.localhost`. ```bash # Clone and setup local gateway git clone https://github.com/ethlimo/dweb-proxy-api.git cd dweb-proxy-api/local_gateway ./setup.sh # The setup script will: # 1. Deploy Caddy, IPFS, Arweave, and Swarm gateways via containers # 2. Install a local CA certificate for HTTPS support # 3. Configure DNS resolution for *.eth.localhost ``` -------------------------------- ### Fetch IPFS Content via Local Gateway Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Examples of fetching IPFS content using its CID, IPNS record, or an ENS domain that resolves to IPFS content, all through the local gateway. ```bash https://{cid}.ipfs.localhost ``` ```bash https://{ipns_record}.ipns.localhost ``` ```bash https://ens-eth.ipns.localhost ``` -------------------------------- ### GET /ask (Caddy Ask Endpoint) Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Validates whether a domain is eligible for on-demand TLS certificate provisioning by checking if the ENS name resolves to valid content. ```APIDOC ## GET /ask ### Description Checks if a domain should receive a TLS certificate based on ENS resolution status. ### Method GET ### Endpoint /ask ### Parameters #### Query Parameters - **domain** (string) - Required - The domain name to validate. ### Response #### Success Response (200) - Returns 200 OK if the domain is valid and eligible for a certificate. #### Error Response (404) - Returns 404 Not Found if the domain is ineligible. ``` -------------------------------- ### Access ENS Domain via Local Gateway Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Example of how to access an ENS domain (e.g., ens.eth) through the local gateway using a web browser. The `.localhost` TLD is used for wildcard DNS resolution on the local machine. ```bash curl https://ens.eth.localhost ``` -------------------------------- ### GET / (Proxy Resolution) Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt The primary endpoint for resolving ENS/GNS hostnames. It accepts an HTTP request with a Host header and returns routing headers for upstream proxies. ```APIDOC ## GET / ### Description Resolves an ENS/GNS hostname provided in the Host header to decentralized storage routing headers. ### Method GET ### Endpoint / ### Parameters #### Request Headers - **Host** (string) - Required - The ENS or GNS domain name to resolve. ### Response #### Success Response (200) - **X-Content-Location** (string) - The resolved storage backend location. - **X-Content-Path** (string) - The path to the content on the storage backend. - **X-Content-Storage-Type** (string) - The storage protocol type (e.g., ipfs-ns, arweave-ns, swarm). ``` -------------------------------- ### GET /dns-query (DNS-over-HTTPS) Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Provides DNS-over-HTTPS (DoH) resolution for ENS domains, allowing standard DNS clients to retrieve dnslink TXT records. ```APIDOC ## GET /dns-query ### Description Resolves ENS domains via DNS-over-HTTPS protocol. ### Method GET ### Endpoint /dns-query ### Parameters #### Query Parameters - **name** (string) - Required - The domain name to resolve. - **type** (string) - Required - The DNS record type (e.g., TXT). ### Response #### Success Response (200) - **Status** (string) - DNS status code. - **Answer** (array) - List of DNS answers containing the dnslink data. ``` -------------------------------- ### Get ENS Content Hash Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Query the EnsService to retrieve the content hash associated with an ENS name. The returned hash is in a protocol-specific format (e.g., ipfs://, ipns://). Returns null if no content hash is set. ```typescript // Get content hash for an ENS name const request = { trace_id: "req-123" }; const contentHash = await ensService.getContentHash(request, "vitalik.eth"); // Returns content hash in protocol format: // "ipfs://bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4" // "ipns://k51qzi5uqu5dipklqpo2uq7advlajxx5wxob0mwyqbxb5zu4htblc4bjipy834" // "arweave://tx_id_here" // "bzz://swarm_hash_here" // null (if no content hash set) ``` -------------------------------- ### Containerize and run service Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Commands for pulling Redis, building the proxy image, and running the container with environment variables. ```shell podman pull docker.io/library/redis podman run --net=host docker.io/library/redis buildah bud -t dweb-api-proxy . # Make sure to pass the necessary environment variables with "-e" flags podman run --rm -it --net=host -e "ETH_RPC_ENDPOINT=${ETH_RPC_ENDPOINT}" dweb-api-proxy ``` -------------------------------- ### Run test suite Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Execute the project test suite. ```shell npm run test ``` -------------------------------- ### Configure RPC Provider Environment Variables Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Set custom RPC endpoints for Ethereum and Gnosis chains to override default providers. ```bash export ETH_RPC_ENDPOINT="https://" export GNO_RPC_ENDPOINT="https://" ``` -------------------------------- ### Execute development script Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Run the development environment script. ```shell ./bin/runDev.sh ``` -------------------------------- ### Container management Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Commands for managing the service containers. ```bash ./stop.sh # Stop all containers ./start.sh # Start containers docker-compose logs # View logs ``` -------------------------------- ### Initialize EnsResolverService Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Instantiate the EnsResolverService with its required dependencies. This service is the main engine for resolving ENS/GNS hostnames to content records. ```typescript import { EnsResolverService } from "dweb-api-resolver/dist/resolver/index.js"; import { EnsService } from "dweb-api-resolver/dist/nameservice/EnsService.js"; import { ArweaveResolver } from "dweb-api-resolver/dist/resolver/arweave.js"; import { RedisCacheService } from "dweb-api-cache/dist/index.js"; // Create the resolver service with dependencies const ensResolverService = new EnsResolverService( logger, // ILoggerService cacheService, // ICacheService (Redis-backed) arweaveResolver, // IArweaveResolver kuboApiService, // IKuboApiService | null (optional IPNS resolution) nameServiceFactory // INameServiceFactory ); ``` -------------------------------- ### Initialize EnsService Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Create an instance of EnsService for direct Ethereum blockchain queries to resolve ENS content hashes. Requires configuration for Ethereum RPC endpoints and failover providers. ```typescript import { EnsService } from "dweb-api-resolver/dist/nameservice/EnsService.js"; // Configuration for Ethereum RPC const config = { getConfigEthereumBackend: () => ({ getBackend: () => "https://ethereum.publicnode.com" }), getConfigEthereumFailover: () => ({ getStallTimeout: () => 200, getProviderStallTimeout: () => 7000, getQuorum: () => 1, getPrimaryFailoverBackend: () => "https://eth-mainnet.g.alchemy.com/v2/key", getSecondaryFailoverBackend: () => null }) }; const ensService = new EnsService(config, logger); ``` -------------------------------- ### Check Gateway Status Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Verify that the gateway services are running by listing the active containers. ```bash docker ps ``` ```bash podman ps ``` -------------------------------- ### Parse and Generate Proxy Records with dweb-api-resolver Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use `parseRecord` to convert content hash strings into structured records and `recordToProxyRecord` to generate proxy-ready records with gateway URLs. Ensure necessary configurations for IPFS, Arweave, and Swarm backends are provided. ```typescript import { parseRecord, recordToProxyRecord } from "dweb-api-resolver/dist/resolver/index.js"; // Parse a content hash string into a structured record const request = { trace_id: "req-789" }; const record = await parseRecord( request, logger, "ipfs://bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4", "example.eth" ); // Record structure: // { // _tag: "Record", // codec: "ipfs-ns", // DoHContentIdentifier: "bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4", // ensName: "example.eth" // } // Convert record to proxy-ready format with gateway URLs const config = { getConfigEnsSocialsEndpoint: () => ({ getEnsSocialsEndpoint: null }), getConfigIpfsBackend: () => ({ getBackend: () => "https://dweb.link", getSubdomainSupport: () => true }), getConfigArweaveBackend: () => ({ getBackend: () => "https://arweave.net" }), getConfigSwarmBackend: () => ({ getBackend: () => "https://api.gateway.ethswarm.org" }) }; const proxyRecord = await recordToProxyRecord(request, config, logger, record); ``` -------------------------------- ### Access Server Configuration with dweb-api-server Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Retrieve default server configurations, which are read from environment variables, using `getDefaultServerConfiguration`. Access specific settings like router listen port, IPFS backend details, and Ethereum/Gnosis RPC endpoints. ```typescript import { getDefaultServerConfiguration, ServerConfiguration } from "dweb-api-server/dist/configuration/index.js"; // Get default configuration (reads from environment) const config = getDefaultServerConfiguration(); // Access configuration values const routerConfig = config.getRouterConfig(); console.log(routerConfig.getRouterListenPort()); // "8888" const ipfsConfig = config.getConfigIpfsBackend(); console.log(ipfsConfig.getBackend()); // "http://localhost:8080" console.log(ipfsConfig.getSubdomainSupport()); // false const ethereumConfig = config.getConfigEthereumBackend(); console.log(ethereumConfig.getBackend()); // RPC endpoint // Hostname substitution configuration (maps gateway domains to TLDs) const hostnameConfig = config.getHostnameSubstitutionConfig(); // Default: { "eth.limo": "eth", "eth.local": "eth", "gno.limo": "gno", "gno.local": "gno" } // Environment variables for configuration: // LISTEN_PORT=8888 // IPFS_TARGET=http://localhost:8080 // IPFS_SUBDOMAIN_SUPPORT=true // ARWEAVE_TARGET=https://arweave.net // SWARM_TARGET=https://api.gateway.ethswarm.org // REDIS_URL=redis://127.0.0.1:6379 // CACHE_TTL=300 // ETH_RPC_ENDPOINT=https://ethereum.publicnode.com // GNO_RPC_ENDPOINT=https://rpc.gnosischain.com // ASK_ENABLED=true // DNSQUERY_ENABLED=true // LOG_LEVEL=info ``` -------------------------------- ### Initialize ArweaveResolver Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Instantiate the ArweaveResolver for handling Arweave Name System (ArNS) resolution and transaction ID lookups. It uses Warp Contracts for resolution. ```typescript import { ArweaveResolver } from "dweb-api-resolver/dist/resolver/arweave.js"; const arweaveResolver = new ArweaveResolver(logger); ``` -------------------------------- ### Validate Domains with Caddy Ask Endpoint Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use the Ask endpoint to validate domains for on-demand TLS provisioning in Caddy. Returns 200 OK to issue a certificate or 404 to deny. ```bash # Check if domain should receive a certificate curl 'http://localhost:9090/ask?domain=ens.eth.limo' # Response: 200 OK = issue certificate, 404 = deny certificate # Example Caddy configuration using the ask endpoint: # { # on_demand_tls { # ask http://localhost:9090/ask # } # } # # *.eth.limo { # tls { # on_demand # } # reverse_proxy localhost:8888 # } # Rate limiting is applied per domain (configurable via ASK_RATE_LIMIT) # Default: 10 requests per 15 minutes per domain ``` -------------------------------- ### Customize Caddy Server Headers Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Modify ./caddy/snippets/headers.Caddyfile to add site-specific headers like COOP and COEP for WASM applications. ```caddyfile # Site-specific headers can be added here if needed # Example: enable COOP and COEP for WASM applications # COOP and COEP headers @WasmHeaders { expression {host}.contains("domain.eth") } header @WasmHeaders { Cross-Origin-Embedder-Policy "credentialless" Cross-Origin-Opener-Policy "same-origin" } ``` -------------------------------- ### Direct Swarm access Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Access Swarm content using hashes. ```bash curl https://swarm_hash.swarm.localhost ``` -------------------------------- ### Implement Two-Tier Caching with Redis and Memory Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Utilize `RedisCacheService` for basic Redis caching or `LocallyCachedRedisCacheService` for a two-tier approach combining memory and Redis. The `memoize` function can automatically cache asynchronous operations with a specified key prefix and unique key. ```typescript import { RedisClient, RedisCacheService, LocallyCachedRedisCacheService, MemoryCacheFactory } from "dweb-api-cache/dist/index.js"; // Create Redis client const redisConfig = { getRedisConfig: () => ({ getUrl: () => "redis://127.0.0.1:6379" }) }; const redisClient = new RedisClient(redisConfig); // Create cache service with configurable TTL const cacheConfig = { ...redisConfig, getCacheConfig: () => ({ getTtl: () => 300 }) // 5 minutes }; // Basic Redis cache service const cacheService = new RedisCacheService(logger, redisClient, cacheConfig); // Two-tier cache (memory + Redis) for better performance const memoryCacheFactory = new MemoryCacheFactory(); const localCacheService = new LocallyCachedRedisCacheService( logger, redisClient, (name) => memoryCacheFactory.createNamedMemoryCacheFactory(name, logger, cacheConfig), cacheConfig ); // Use memoize for automatic caching of async operations import { z } from "zod"; const ResultSchema = z.object({ data: z.string(), timestamp: z.number() }); const request = { trace_id: "req-101" }; const result = await cacheService.memoize( request, async () => { // Expensive operation (only runs on cache miss) return { data: "fetched data", timestamp: Date.now() }; }, ResultSchema, "myPrefix", // Cache key prefix "uniqueKey" // Cache key ); ``` -------------------------------- ### Perform DNS-over-HTTPS Query Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Use curl to query the local DoH endpoint for ENS domain resolution. ```bash $ curl 'https://dns.eth.localhost/dns-query?name=ens.eth' ``` -------------------------------- ### Stop Local Gateway Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/local_gateway/README.md Commands to stop the local gateway using different container runtimes or docker-compose. ```bash ./stop.sh ``` ```bash docker-compose down ``` ```bash podman-compose down ``` -------------------------------- ### EnsService API Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt The EnsService class handles direct Ethereum blockchain queries for ENS content hash resolution using ethers.js with failover provider support. ```APIDOC ## EnsService (Name Resolution) ### Description The `EnsService` class handles direct Ethereum blockchain queries for ENS content hash resolution using ethers.js with failover provider support. ### Method POST ### Endpoint /api/resolve/ens/direct ### Parameters #### Query Parameters - **name** (string) - Required - The ENS name to query. ### Request Body - **trace_id** (string) - Required - A unique identifier for tracing the request. ### Request Example ```json { "trace_id": "req-123" } ``` ### Response #### Success Response (200) - **contentHash** (string | null) - The content hash in protocol format (e.g., "ipfs://...", "ipns://...") or null if no content hash is set. #### Response Example ```json "ipfs://bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4" ``` #### Response Example (No Content Hash) ```json null ``` ``` -------------------------------- ### EnsResolverService API Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt The EnsResolverService is the core resolution engine that resolves ENS/GNS hostnames to content records. It uses a caching layer (Redis + in-memory) and supports multiple name services. ```APIDOC ## EnsResolverService ### Description The `EnsResolverService` is the core resolution engine that resolves ENS/GNS hostnames to content records. It uses a caching layer (Redis + in-memory) and supports multiple name services. ### Method POST ### Endpoint /api/resolve/ens ### Parameters #### Query Parameters - **name** (string) - Required - The ENS/GNS hostname to resolve. ### Request Body - **trace_id** (string) - Required - A unique identifier for tracing the request. ### Request Example ```json { "trace_id": "unique-request-id" } ``` ### Response #### Success Response (200) - **record** (object) - The resolved content record. - **_tag** (string) - Type of record (e.g., "Record", "ens-socials-redirect"). - **codec** (string) - Content encoding format (e.g., "ipfs-ns", "ipns-ns", "arweave-ns", "swarm"). - **DoHContentIdentifier** (string) - The content identifier (e.g., IPFS hash). - **ensName** (string) - The original ENS name. - **resolverExists** (boolean) - Indicates if a resolver was found for the name. #### Response Example ```json { "record": { "_tag": "Record", "codec": "ipfs-ns", "DoHContentIdentifier": "bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4", "ensName": "vitalik.eth" }, "resolverExists": true } ``` #### Response Example (Socials Redirect) ```json { "record": { "_tag": "ens-socials-redirect", "ensName": "no-content.eth" }, "resolverExists": false } ``` ``` -------------------------------- ### DoH endpoint for DNS resolution Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Perform DNS-over-HTTPS queries for ENS domains. ```bash curl 'https://dns.eth.localhost/dns-query?name=ens.eth' ``` -------------------------------- ### Access ENS domains locally Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use curl to resolve ENS domains via the local proxy. ```bash curl https://ens.eth.localhost curl https://vitalik.eth.localhost curl https://app.ens.eth.localhost ``` -------------------------------- ### Proxy Response Headers Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Headers used by upstream proxies to route requests to the appropriate storage gateway. ```http X-Content-Location: ${cid}.ipfs.dweb.link X-Content-Path: / X-Content-Storage-Type: ipfs-ns ``` -------------------------------- ### Direct IPFS/IPNS access Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Access IPFS content or flattened ENS domains via IPNS. ```bash curl https://bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4.ipfs.localhost curl https://ens-eth.ipns.localhost # ENS domain flattened (dots become dashes) ``` -------------------------------- ### Direct Arweave access Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Access Arweave content using transaction IDs. ```bash curl https://sandbox_subdomain.arweave.localhost/tx_id ``` -------------------------------- ### Resolve ENS/GNS domains via Proxy Endpoint Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use the proxy endpoint to retrieve routing headers for decentralized storage backends like IPFS, IPNS, Arweave, and Swarm. ```bash # Basic ENS domain resolution curl http://localhost:8888 -H 'Host: ens.eth' -sD - -o /dev/null # Response: # HTTP/1.1 200 OK # X-Content-Location: k51qzi5uqu5dipklqpo2uq7advlajxx5wxob0mwyqbxb5zu4htblc4bjipy834.ipns.dweb.link # X-Content-Path: / # X-Content-Storage-Type: ipns-ns # Resolve IPFS content curl http://localhost:8888 -H 'Host: vitalik.eth' -sD - -o /dev/null # Response headers indicate IPFS gateway routing: # X-Content-Location: bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4.ipfs.dweb.link # X-Content-Path: / # X-Content-Storage-Type: ipfs-ns # Resolve Arweave content curl http://localhost:8888 -H 'Host: arweave-site.eth' -sD - -o /dev/null # Response indicates Arweave gateway routing: # X-Content-Location: abcdefg123456.arweave.net # X-Content-Path: /tx_id_here/ # X-Content-Storage-Type: arweave-ns # Resolve Swarm content curl http://localhost:8888 -H 'Host: swarm-site.eth' -sD - -o /dev/null # Response indicates Swarm gateway routing: # X-Content-Location: api.gateway.ethswarm.org # X-Content-Path: /bzz/swarm_hash_here/ # X-Content-Storage-Type: swarm ``` -------------------------------- ### Query DNS-over-HTTPS (DoH) Endpoint Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Perform DNS queries for ENS domains using standard DoH protocols. Supports both JSON and binary DNS message formats. ```bash # GET request for DNS resolution (JSON response) curl 'http://localhost:11000/dns-query?name=ens.eth&type=TXT' # Response: # { # "Status": "0", # "TC": false, # "Question": [{"name": "ens.eth", "type": 16}], # "Answer": [{ # "name": "ens.eth", # "data": "dnslink=/ipfs/bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4", # "type": 16, # "ttl": 300 # }] # } # Query with DNSLink prefix (standard format) curl 'http://localhost:11000/dns-query?name=_dnslink.vitalik.eth&type=TXT' # POST request with binary DNS message curl -X POST http://localhost:11000/dns-query \ -H 'Content-Type: application/dns-message' \ -H 'Accept: application/dns-message' \ --data-binary @dns_query.bin # Using with external DNS tools (dig via DoH) # Configure your DNS resolver to use: http://localhost:11000/dns-query ``` -------------------------------- ### Request dWeb proxy Source: https://github.com/ethlimo/dweb-proxy-api/blob/main/README.md Perform a curl request to the local proxy server to verify resolution. ```shell $ curl http://localhost:8888 -H 'Host: ens.eth' -sD - -o /dev/null ``` -------------------------------- ### Convert Arweave Transaction ID to Sandbox Subdomain Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Convert an Arweave transaction ID into a base32-encoded sandbox subdomain format using the provided utility function. This is useful for accessing Arweave content via a subdomain. ```typescript // Convert transaction ID to sandbox subdomain format import { arweaveTxIdToArweaveSandboxSubdomainId } from "dweb-api-resolver/dist/resolver/arweave.js"; const sandboxId = await arweaveTxIdToArweaveSandboxSubdomainId( request, logger, "abc123txid" ); // Returns base32-encoded subdomain: "mfrggzdfmy..." ``` -------------------------------- ### ArweaveResolver API Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt The ArweaveResolver handles Arweave Name System (ArNS) resolution and transaction ID lookups using Warp Contracts. ```APIDOC ## ArweaveResolver ### Description The `ArweaveResolver` handles Arweave Name System (ArNS) resolution and transaction ID lookups using Warp Contracts. ### Method POST ### Endpoint /api/resolve/arweave ### Parameters #### Query Parameters - **arns_contract_tx_id** (string) - Required - The transaction ID of the ArNS contract. - **ens_name** (string) - Required - The ENS name for subdomain matching. ### Request Body - **trace_id** (string) - Required - A unique identifier for tracing the request. ### Request Example ```json { "trace_id": "req-456" } ``` ### Response #### Success Response (200) - **txId** (string) - The resolved Arweave transaction ID. #### Response Example ```json "abc123txid" ``` ## Arweave Transaction ID to Sandbox Subdomain Conversion ### Description Converts an Arweave transaction ID to its corresponding sandbox subdomain format. ### Method POST ### Endpoint /api/convert/arweave/txid-to-subdomain ### Parameters #### Request Body - **trace_id** (string) - Required - A unique identifier for tracing the request. - **txId** (string) - Required - The Arweave transaction ID. ### Request Example ```json { "trace_id": "req-789", "txId": "abc123txid" } ``` ### Response #### Success Response (200) - **sandboxId** (string) - The base32-encoded sandbox subdomain. #### Response Example ```json "mfrggzdfmy..." ``` ``` -------------------------------- ### Service worker registration Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Register the service worker in the main application for client-side resolution. ```typescript // Configure service worker bundle URL // Set SW_BUNDLE_PUBLIC_URL environment variable during build // Example: SW_BUNDLE_PUBLIC_URL=eth.example.com // Service worker registration (in your main application) if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/_limo_loader_worker.js') .then(registration => { console.log('Service Worker registered:', registration); }); } // The service worker handles: // 1. ENS domain resolution via blockchain queries // 2. IPFS content fetching via verified-fetch (trustless mode) // 3. Automatic routing to appropriate storage backends // For trustless IPFS verification, set SERVICE_WORKER_TRUSTLESS=true // This enables @helia/verified-fetch for cryptographic content verification ``` -------------------------------- ### Resolve ENS Name to Content Record Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use the EnsResolverService to resolve an ENS name to its associated content record. Handles different record types like IPFS, IPNS, Arweave, and Swarm, as well as social redirects. ```typescript // Resolve an ENS name to its content record const request = { trace_id: "unique-request-id" }; const result = await ensResolverService.resolveEns(request, "vitalik.eth"); // Result structure: // { // record: { // _tag: "Record", // codec: "ipfs-ns", // "ipfs-ns" | "ipns-ns" | "arweave-ns" | "swarm" // DoHContentIdentifier: "bafybeifnx3u22ngv4ygpnj32qkwzrpgizw4i7e3swp4v6am5piiih3ude4", // ensName: "vitalik.eth" // }, // resolverExists: true // } // For ENS names without content hash (redirects to socials page): // { // record: { // _tag: "ens-socials-redirect", // ensName: "no-content.eth" // }, // resolverExists: false // } ``` -------------------------------- ### Resolve ArNS Record to Transaction ID Source: https://context7.com/ethlimo/dweb-proxy-api/llms.txt Use ArweaveResolver to resolve an ArNS record to its corresponding Arweave transaction ID. Supports subdomain matching and falls back to the '@' record if no subdomain match is found. ```typescript // Resolve ArNS record to transaction ID const request = { trace_id: "req-456" }; const txId = await arweaveResolver.resolveArweave( request, "arns_contract_tx_id", // ArNS contract transaction ID "subdomain.eth" // ENS name for subdomain matching ); // Returns the resolved Arweave transaction ID // Supports subdomain matching in ArNS records // Falls back to "@" record if no subdomain match found ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.