Within this section, we will look at how to query the Injective name service contracts.
Abstraction Service (deprecated)
You can use our InjNameServiceabstraction to query the smart contracts with a single method call. Below this example, you can also find the raw implementation on how to query the smart contracts in case you need more flexibility.
import { getNetworkEndpoints, Network } from '@injectivelabs/network'
import { InjNameService } from '@injectivelabs/sdk-ui-ts'
const injNameService = new InjNameService(Network.Testnet)
const name = 'ninja.inj'
// Fetch the address for the particular name
const addressForName = await injNameService.fetchInjAddress(name)
// Fetch the name for the particular address
const nameFromAddress = await injNameService.fetchInjName(addressForName)
Raw Smart Contract Querying
Example code snippets to resolve .inj domain name.