UNPKG

@sky-mavis/tanto-widget

Version:
41 lines (37 loc) 973 B
'use strict'; var viem = require('viem'); var wagmi = require('wagmi'); var index = require('../constants/index.cjs'); var index$1 = require('../utils/index.cjs'); function useRnsName({ address, chainId: targetChainId }) { const currentChainId = wagmi.useChainId(); const chainId = targetChainId ?? currentChainId; const contractAddress = index.RNS_PUBLIC_RESOLVER_ADDRESS[chainId]; return wagmi.useReadContract(address && contractAddress ? { address: contractAddress, abi: [{ inputs: [{ internalType: 'bytes32', name: 'node', type: 'bytes32' }], name: 'name', outputs: [{ internalType: 'string', name: '', type: 'string' }], stateMutability: 'view', type: 'function' }], functionName: 'name', args: [viem.namehash(index$1.getReverseNode(address))], query: { staleTime: Infinity } } : undefined); } exports.useRnsName = useRnsName;