@web3modal/wagmi
Advanced tools
Comparing version 4.2.2 to 4.2.3-cn-social.0
@@ -8,2 +8,3 @@ import { EthereumProvider, OPTIONAL_METHODS } from '@walletconnect/ethereum-provider'; | ||
import { ConstantsUtil, PresetsUtil, HelpersUtil } from '@web3modal/scaffold-utils'; | ||
import { ConstantsUtil as CommonConstants } from '@web3modal/common'; | ||
import { getCaipDefaultChain, getEmailCaipNetworks, getWalletConnectCaipNetworks } from './utils/helpers.js'; | ||
@@ -176,11 +177,20 @@ import { W3mFrameConstants, W3mFrameHelpers, W3mFrameRpcConstants } from '@web3modal/wallet'; | ||
getEnsAddress: async (value) => { | ||
const chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id); | ||
if (chainId !== mainnet.id) { | ||
try { | ||
const chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id); | ||
let ensName = false; | ||
let wcName = false; | ||
if (value?.endsWith(CommonConstants.WC_NAME_SUFFIX)) { | ||
wcName = await this.resolveWalletConnectName(value); | ||
} | ||
if (chainId === mainnet.id) { | ||
ensName = await wagmiGetEnsAddress(this.wagmiConfig, { | ||
name: normalize(value), | ||
chainId | ||
}); | ||
} | ||
return ensName || wcName || false; | ||
} | ||
catch { | ||
return false; | ||
} | ||
const address = await wagmiGetEnsAddress(this.wagmiConfig, { | ||
name: normalize(value), | ||
chainId | ||
}); | ||
return address || false; | ||
}, | ||
@@ -295,2 +305,17 @@ getEnsAvatar: async (value) => { | ||
} | ||
async syncWalletConnectName(address) { | ||
try { | ||
const registeredWcNames = await this.getWalletConnectName(address); | ||
if (registeredWcNames[0]) { | ||
const wcName = registeredWcNames[0]; | ||
this.setProfileName(wcName.name); | ||
} | ||
else { | ||
this.setProfileName(null); | ||
} | ||
} | ||
catch { | ||
this.setProfileName(null); | ||
} | ||
} | ||
async syncProfile(address, chainId) { | ||
@@ -303,2 +328,5 @@ try { | ||
this.setProfileImage(avatar); | ||
if (!name) { | ||
await this.syncWalletConnectName(address); | ||
} | ||
} | ||
@@ -318,5 +346,9 @@ catch { | ||
} | ||
else { | ||
await this.syncWalletConnectName(address); | ||
this.setProfileImage(null); | ||
} | ||
} | ||
else { | ||
this.setProfileName(null); | ||
await this.syncWalletConnectName(address); | ||
this.setProfileImage(null); | ||
@@ -323,0 +355,0 @@ } |
@@ -36,2 +36,3 @@ import type { Chain } from '@wagmi/core/chains'; | ||
private syncNetwork; | ||
private syncWalletConnectName; | ||
private syncProfile; | ||
@@ -38,0 +39,0 @@ private syncBalance; |
{ | ||
"name": "@web3modal/wagmi", | ||
"version": "4.2.2", | ||
"version": "4.2.3-cn-social.0", | ||
"type": "module", | ||
@@ -55,8 +55,8 @@ "main": "./dist/esm/exports/index.js", | ||
"@walletconnect/ethereum-provider": "2.13.0", | ||
"@web3modal/polyfills": "4.2.2", | ||
"@web3modal/scaffold": "4.2.2", | ||
"@web3modal/scaffold-react": "4.2.2", | ||
"@web3modal/scaffold-utils": "4.2.2", | ||
"@web3modal/scaffold-vue": "4.2.2", | ||
"@web3modal/siwe": "4.2.2" | ||
"@web3modal/polyfills": "4.2.3-cn-social.0", | ||
"@web3modal/scaffold": "4.2.3-cn-social.0", | ||
"@web3modal/scaffold-react": "4.2.3-cn-social.0", | ||
"@web3modal/scaffold-utils": "4.2.3-cn-social.0", | ||
"@web3modal/scaffold-vue": "4.2.3-cn-social.0", | ||
"@web3modal/siwe": "4.2.3-cn-social.0" | ||
}, | ||
@@ -63,0 +63,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
76996
981
1
+ Added@web3modal/common@4.2.3-cn-social.0(transitive)
+ Added@web3modal/core@4.2.3-cn-social.0(transitive)
+ Added@web3modal/polyfills@4.2.3-cn-social.0(transitive)
+ Added@web3modal/scaffold@4.2.3-cn-social.0(transitive)
+ Added@web3modal/scaffold-react@4.2.3-cn-social.0(transitive)
+ Added@web3modal/scaffold-utils@4.2.3-cn-social.0(transitive)
+ Added@web3modal/scaffold-vue@4.2.3-cn-social.0(transitive)
+ Added@web3modal/siwe@4.2.3-cn-social.0(transitive)
+ Added@web3modal/ui@4.2.3-cn-social.0(transitive)
+ Added@web3modal/wallet@4.2.3-cn-social.0(transitive)
- Removed@web3modal/common@4.2.2(transitive)
- Removed@web3modal/core@4.2.2(transitive)
- Removed@web3modal/polyfills@4.2.2(transitive)
- Removed@web3modal/scaffold@4.2.2(transitive)
- Removed@web3modal/scaffold-react@4.2.2(transitive)
- Removed@web3modal/scaffold-utils@4.2.2(transitive)
- Removed@web3modal/scaffold-vue@4.2.2(transitive)
- Removed@web3modal/siwe@4.2.2(transitive)
- Removed@web3modal/ui@4.2.2(transitive)
- Removed@web3modal/wallet@4.2.2(transitive)