Skip to content

Commit f794937

Browse files
authored
[core-v2.15.3-alpha.2]: Fix - Add config to disable Unstoppable Domains resolution (#1556)
* Add config to disable Unstoppable Domains resolution * Remove commented code * Clean up uns import * Add check to getUns func * revert check at account level
1 parent 626e5ae commit f794937

File tree

11 files changed

+42
-13
lines changed

11 files changed

+42
-13
lines changed

docs/src/routes/docs/[...3]modules/core.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ type ConnectModalOptions = {
195195
* Defaults to `https://ethereum.org/en/wallets/find-wallet/#main-content`
196196
*/
197197
iDontHaveAWalletLink?: string
198+
/**
199+
* Define support for Unstoppable Domains resolutions
200+
* after a user connects. Similar to ens, uns can be used for users who
201+
* have minted an Unstoppable Domain and associated it with their wallet.
202+
* ENS resolution takes precedent over UNS
203+
* Defaults to true
204+
*/
205+
disableUDResolution?: boolean
198206
}
199207
```
200208

docs/src/routes/docs/[...4]wallets/formatic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Fortmatic
22

3-
Wallet module for connecting Ledger hardware wallets to web3-onboard
3+
Wallet module for connecting Fortmatic hardware wallets to web3-onboard
44

55
### Install
66

packages/core/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ type ConnectModalOptions = {
145145
* Defaults to `https://ethereum.org/en/wallets/find-wallet/#main-content`
146146
*/
147147
iDontHaveAWalletLink?: string
148+
/**
149+
* Define support for Unstoppable Domains resolutions
150+
* after a user connects. Similar to ens, uns can be used for users who
151+
* have minted an Unstoppable Domain and associated it with their wallet.
152+
* ENS resolution takes precedent over UNS
153+
* Defaults to false
154+
*/
155+
disableUDResolution?: boolean
148156
}
149157
```
150158

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.15.3-alpha.1",
3+
"version": "2.15.3-alpha.2",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",

packages/core/src/provider.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { validEnsChain } from './utils.js'
99
import disconnect from './disconnect.js'
1010
import { state } from './store/index.js'
1111
import { getBNMulitChainSdk } from './services.js'
12-
import { Resolution } from '@unstoppabledomains/resolution'
1312

1413
import type {
1514
ChainId,
@@ -384,15 +383,19 @@ export async function getUns(
384383
address: Address,
385384
chain: Chain
386385
): Promise<Uns | null> {
386+
const { connect } = state.get()
387+
387388
// check if address is valid ETH address before attempting to resolve
388389
// chain we don't recognize and don't have a rpcUrl for requests
389-
if (!utils.isAddress(address) || !chain) return null
390-
391-
const resolutionInstance = new Resolution()
390+
if (connect.disableUDResolution || !utils.isAddress(address) || !chain)
391+
return null
392392

393393
try {
394-
const name = await resolutionInstance.reverse(address)
395394
let uns = null
395+
const { Resolution } = await import('@unstoppabledomains/resolution')
396+
397+
const resolutionInstance = new Resolution()
398+
const name = await resolutionInstance.reverse(address)
396399

397400
if (name) {
398401
uns = {

packages/core/src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ export type ConnectModalOptions = {
195195
* Defaults to `https://ethereum.org/en/wallets/find-wallet/#main-content`
196196
*/
197197
iDontHaveAWalletLink?: string
198+
/**
199+
* Define support for Unstoppable Domains resolutions
200+
* after a user connects. Similar to ens, uns can be used for users who
201+
* have minted an Unstoppable Domain and associated it with their wallet.
202+
* ENS resolution takes precedent over UNS
203+
* Defaults to false
204+
*/
205+
disableUDResolution?: boolean
198206
}
199207

200208
export type CommonPositions =

packages/core/src/validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ const connectModalOptions = Joi.object({
174174
showSidebar: Joi.boolean(),
175175
disableClose: Joi.boolean(),
176176
autoConnectLastWallet: Joi.boolean(),
177-
iDontHaveAWalletLink: Joi.string()
177+
iDontHaveAWalletLink: Joi.string(),
178+
disableUDResolution: Joi.boolean()
178179
})
179180

180181
const containerElements = Joi.object({

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"webpack-dev-server": "4.7.4"
2424
},
2525
"dependencies": {
26-
"@web3-onboard/core": "^2.15.3-alpha.1",
26+
"@web3-onboard/core": "^2.15.3-alpha.2",
2727
"@web3-onboard/coinbase": "^2.1.4",
2828
"@web3-onboard/transaction-preview": "^2.0.4",
2929
"@web3-onboard/dcent": "^2.2.3",

packages/demo/src/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
],
244244
connect: {
245245
// disableClose: true,
246+
// disableUDResolution: true,
246247
autoConnectLastWallet: true
247248
},
248249
appMetadata: {

packages/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/react",
3-
"version": "2.6.5-alpha.1",
3+
"version": "2.6.5-alpha.2",
44
"description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -62,7 +62,7 @@
6262
"typescript": "^4.5.5"
6363
},
6464
"dependencies": {
65-
"@web3-onboard/core": "^2.15.3-alpha.1",
65+
"@web3-onboard/core": "^2.15.3-alpha.2",
6666
"@web3-onboard/common": "^2.2.3",
6767
"use-sync-external-store": "1.0.0"
6868
},

packages/vue/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/vue",
3-
"version": "2.5.5-alpha.1",
3+
"version": "2.5.5-alpha.12",
44
"description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -63,7 +63,7 @@
6363
"@vueuse/core": "^8.4.2",
6464
"@vueuse/rxjs": "^8.2.0",
6565
"@web3-onboard/common": "^2.2.3",
66-
"@web3-onboard/core": "^2.15.3-alpha.1",
66+
"@web3-onboard/core": "^2.15.3-alpha.2",
6767
"vue-demi": "^0.12.4"
6868
},
6969
"peerDependencies": {

0 commit comments

Comments
 (0)