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 ENS Resolver #180

Merged
merged 3 commits into from
May 4, 2019
Merged

Conversation

barrasso
Copy link
Contributor

@barrasso barrasso commented May 1, 2019

Updated the Resolver ABI and added the interfaceImplementer function.

Use this function to get the address of the ETHRegistrarController like so:

public enum InterfaceID: String {
    case legacyRegistrar = "0x7ba18ba1"
    case permanentRegistrar = "0x018fac06"
    case baseRegistrar = "0x6ccb2df4"
}

// Get the ETHRegistrarController's address
let controller = try! ens.resolver?.interfaceImplementer(forNode: "eth", interfaceID: InterfaceID.permanentRegistrar.rawValue)

New resolver code: https://ropsten.etherscan.io/address/0x44385b20865fe3578e56aa0e9f7ec534deb10501#code

Docs on this are at: https://docs.ens.domains/contract-api-reference/.eth-permanent-registrar#discovery

Mark Barrasso and others added 3 commits April 30, 2019 18:59
Changed old resolver ABI to `legacyResolverABI`.

Added new resolver ABI -> https://ropsten.etherscan.io/address/0x44385b20865fe3578e56aa0e9f7ec534deb10501#code
Added `interfaceImplementer` function found in the new [OwnedResolver](https://ropsten.etherscan.io/address/0x44385b20865fe3578e56aa0e9f7ec534deb10501#code).

### Usage

```swift
public enum InterfaceID: String {
    case legacyRegistrar = "0x7ba18ba1"
    case permanentRegistrar = "0x018fac06"
    case baseRegistrar = "0x6ccb2df4"
}

// Get the ETHRegistrarController's address
let controller = try! e.resolver?.interfaceImplementer(forNode: "eth", interfaceID: InterfaceID.permanentRegistrar.rawValue)
```

See more usage at: https://github.com/ensdomains/ens-app/blob/d79a4f5a8231e46743caa19d0368fff9fe237383/src/api/registrar.js#L94
@TonioMacaronio
Copy link
Collaborator

@barrasso wow thanks!

@TonioMacaronio TonioMacaronio merged commit 631422a into web3swift-team:develop May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants