Skip to main content

JavaScript SDK API Reference / Domain / safeResolve

Function: safeResolve()

safeResolve(connection, domain, config?): Promise<PublicKey>

Defined in: resolve/index.ts:88

Resolves a full .sns or .sol domain using the same routing as resolve.

When SRS-backed .sol resolution is enabled, both the .sol domain and its corresponding .sns domain must resolve to the same target; otherwise, Errors.SnsSolResolutionMismatchError is thrown.

Parameters

connection

Connection

Solana RPC connection

domain

string

Full domain name with a supported .sns or .sol suffix

config?

ResolveConfig = ...

PDA allowance policy. Defaults to { allowPda: false }

Returns

Promise<PublicKey>

The matching SRS and SNS target when compared; otherwise the target returned by resolve

Throws

Example

const target = await safeResolve(connection, "name.sol");
console.log(target.toBase58());
// => "<BASE58_PUBLIC_KEY>"