Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new ENS class #606

Merged
merged 6 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions cypress/integration/resolverMigration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,19 @@ const DISABLED_COLOUR = 'rgb(223, 223, 223)'
describe('Migrate resolver and records', () => {
it('can visit a name with an old resolver and migrate it', () => {
cy.visit(`${ROOT}/name/abittooawesome2.eth`)
cy.wait(3000)
cy.getByText('Migrate').click({ force: true })
cy.getByText('Migrate', { timeout: 5000 }).click({ force: true })
cy.queryByText('migrate', { timeout: 50 }).should('not.exist')
cy.wait(1000)
cy.queryByTestId('edit-resolver').should(
'have.css',
'background-color',
ENABLED_COLOUR
)
cy.queryByTestId('edit-resolver', {
timeout: 5000,
exact: false
}).should('have.css', 'background-color', ENABLED_COLOUR)
})

it('can visit a name with an old content resolver and migrate it as swarm contenthash', () => {
cy.visit(`${ROOT}/name/oldresolver.eth`)
cy.wait(3000) // this one took a while to render Migrate
cy.getByText('Migrate').click({ force: true })
cy.getByText('Migrate', { timeout: 5000 }).click({ force: true })
cy.queryByText('migrate', { timeout: 50 }).should('not.exist')
cy.wait(1000)
cy.queryByTestId('edit-resolver').should(
cy.queryByTestId('edit-resolver', { timeout: 5000 }).should(
'have.css',
'background-color',
ENABLED_COLOUR
Expand All @@ -35,8 +30,8 @@ describe('Migrate resolver and records', () => {

it('cannot migrate resolver if the parent domain is not migrateed', () => {
cy.visit(`${ROOT}/name/a1.sub2.testing.eth`)
cy.wait(1000)
cy.queryByText('You must first migrate the parent domain ', {
timeout: 5000,
exact: false
}).should('exist')
cy.queryByTestId('edit-resolver').should(
Expand All @@ -48,9 +43,9 @@ describe('Migrate resolver and records', () => {

it('cannot migrate resolver if the domain is not migrateed', () => {
cy.visit(`${ROOT}/name/sub2.testing.eth`)
cy.wait(1000)
cy.queryByText('This name needs to be migrated to the new Registry.', {
exact: false
exact: false,
timeout: 5000
}).should('exist')
cy.queryByTestId('edit-resolver').should(
'have.css',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@ensdomains/ethregistrar": "^2.0.0",
"@ensdomains/react-ens-address": "0.0.17",
"@ensdomains/resolver": "^0.2.4",
"@ensdomains/ui": "2.0.12",
"@ensdomains/ui": "3.0.0",
"apollo-cache-inmemory": "^1.2.9",
"apollo-client": "^2.4.5",
"apollo-link": "^1.2.2",
Expand Down
30 changes: 30 additions & 0 deletions src/api/ens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { setupENS } from '@ensdomains/ui'

let ens = {},
registrar = {}

export async function setup({
reloadOnAccountsChange,
customProvider,
ensAddress
}) {
const { ens: ensInstance, registrar: registrarInstance } = await setupENS({
reloadOnAccountsChange,
customProvider,
ensAddress
})
ens = ensInstance
registrar = registrarInstance

return { ens, registrar }
}

function getRegistrar() {
return registrar
}

export { getRegistrar }

export default function getENS() {
return ens
}
Loading