wayfinder.resolveUrl()

Resolve ar:// URLs to dynamic gateway URLs using the configured routing strategy.

Parameters

  • originalUrl (string): The ar:// URL to resolve to a full gateway URL
  • logger (Logger, optional): Custom logger for this operation. Defaults to wayfinder's logger

Returns

Type: Promise<URL>

Returns a fully-qualified URL object that points to the selected gateway.

Examples

Legacy URLs

import { Wayfinder, NetworkGatewaysProvider } from '@ar.io/wayfinder-core'
import { ARIO } from '@ar.io/sdk'

const wayfinder = new Wayfinder({
  gatewaysProvider: new NetworkGatewaysProvider({
    ario: ARIO.mainnet(),
  }),
})

// An existing arweave.net URL
const url = await wayfinder.resolveUrl({
  originalUrl: 'https://arweave.net/<some-tx-id>',
})
console.log('Resolved URL:', url.toString())
// Output: https://<some-other-gateway>/ABC123...XYZ

Transaction IDs

// Transaction IDs are resolved to sandboxed subdomains
const txUrl = await wayfinder.resolveUrl({
  txId: 'YTB0dGJURWpqQ25iS2NaY1RPSi1TOUQxMmd3cGRFaHUzV2hiWnVlZ2o5WT0',
})
console.log('Transaction URL:', txUrl.toString())
// Output: https://ytb0dgjuqwpqq25iy2naytpsi1tpuqxnz3dqrfaohuzwhiwnu5j9y.<some-gateway>

ArNS Names

// ArNS names resolve to subdomain format
const arnsUrl = await wayfinder.resolveUrl({
  arnsName: 'ardrive',
})
console.log('ArNS URL:', arnsUrl.toString())
// Output: https://ardrive.<some-gateway>

Gateway Endpoints

// Gateway info endpoint
const infoUrl = await wayfinder.resolveUrl({
  originalUrl: 'ar:///info',
})
console.log('Info URL:', infoUrl.toString())
// Output: https://<some-gateway>/info

Comparison with request()

MethodNetwork RequestVerificationUse Case
resolveUrl()✅ Yes❌ NoGet a dynamic URL for transaction id, ArNS name or gateway endpoint
request()✅ Yes✅ OptionalFetch and optionally verify data from an AR.IO gateway

Was this page helpful?