@web3auth/modal
Version:
Multi chain wallet aggregator for web3Auth
23 lines (20 loc) • 815 B
JavaScript
import { computed } from 'vue';
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
const useChain = () => {
const context = useWeb3AuthInner();
const chainId = computed(() => {
var _context$web3Auth$val;
if (!((_context$web3Auth$val = context.web3Auth.value) !== null && _context$web3Auth$val !== void 0 && _context$web3Auth$val.currentChain)) return null;
return context.web3Auth.value.currentChain.chainId;
});
const chainNamespace = computed(() => {
var _context$web3Auth$val2;
if (!((_context$web3Auth$val2 = context.web3Auth.value) !== null && _context$web3Auth$val2 !== void 0 && _context$web3Auth$val2.currentChain)) return null;
return context.web3Auth.value.currentChain.chainNamespace;
});
return {
chainId,
chainNamespace
};
};
export { useChain };