Skip to content

A minimal Swift package for resolving ENS names and Ethereum addresses using the api.ensdata.net API.

Notifications You must be signed in to change notification settings

Planetable/ENSDataKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENSDataKit

A minimal Swift package for resolving ENS names and Ethereum addresses using the api.ensdata.net API.

Installation

Add ENSDataKit to your project using Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/Planetable/ENSDataKit.git", from: "1.0.0")
]

Usage

Basic Resolution

import ENSDataKit

let client = ENSDataClient()

do {
    let data = try await client.resolve("vitalik.eth")
    print("Address: \(data.address ?? "N/A")")
    print("Twitter: \(data.twitter ?? "N/A")")
    print("Description: \(data.description ?? "N/A")")
} catch {
    print("Error: \(error)")
}

Resolve by Ethereum Address

let data = try await client.resolve("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")
print("Primary ENS: \(data.ensPrimary ?? "N/A")")

API

ENSDataClient

The main client for interacting with the ENS Data API.

Methods

  • resolve(_ nameOrAddress: String) async throws -> ENSData
    • Resolves an ENS name or Ethereum address
    • Returns: ENSData containing all available profile information

ENSData

A struct containing ENS profile information:

  • address: Ethereum address
  • avatar, avatarSmall, avatarUrl: Avatar images
  • contentHash: IPFS content hash
  • description: Profile description
  • ens: ENS name
  • ensPrimary: Primary ENS name
  • github: GitHub username
  • twitter: Twitter handle
  • url: Website URL
  • pgp: PGP public key
  • resolverAddress: ENS resolver contract address
  • wallets: Cryptocurrency wallet addresses

Requirements

  • iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+
  • Swift 5.9+

License

MIT

About

A minimal Swift package for resolving ENS names and Ethereum addresses using the api.ensdata.net API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages