UNPKG

@sky-mavis/tanto-widget

Version:
41 lines (37 loc) 937 B
'use strict'; var viem = require('viem'); var wagmi = require('wagmi'); var index = require('../constants/index.cjs'); function useRnsAddress({ name, chainId: targetChainId }) { const currentChainId = wagmi.useChainId(); const chainId = targetChainId ?? currentChainId; const contractAddress = index.RNS_UNIFIED_ADDRESS[chainId]; return wagmi.useReadContract(name && contractAddress ? { address: contractAddress, abi: [{ inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }], name: 'ownerOf', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' }], functionName: 'ownerOf', // Invalid contract type? args: [viem.namehash(name)], query: { staleTime: Infinity } } : undefined); } exports.useRnsAddress = useRnsAddress;