Swiftpack.co - Planetable/ENSKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Planetable.
Planetable/ENSKit 0.3.2
A swift utility to resolve Ethereum Domain Names.
⭐️ 4
🕓 3 weeks ago
iOS macOS
.package(url: "https://github.com/Planetable/ENSKit.git", from: "0.3.2")

ENSKit

A swift utility to resolve Ethereum Domain Names per EIP-137.

Examples

Initializing:

// Use default options with Cloudflare Ethereum Gateway
let enskit = ENSKit()

// Use Infura Ethereum API
let infuraURL = URL(string: "https://mainnet.infura.io/v3/<projectid>")!
let infura = ENSKit(jsonrpcClient: InfuraEthereumAPI(url: infuraURL))
// Use Infura Ethereum API with project secret
let infuraSecret = "<projectsecret>"
let infuraWithProjectSecret = ENSKit(jsonrpcClient: InfuraEthereumAPI(url: infuraURL, projectSecret: infuraSecret))
// Use Infura Ethereum API with JWT token
let infuraJWT = "<JWT>"
let infuraWithJWT = ENSKit(jsonrpcClient: InfuraEthereumAPI(url: infuraURL, jwt: infuraJWT))

Resolve IPFS/IPNS/Swarm URL:

// in async function
let vitalik = "vitalik.eth"
let vitalikURL: URL? = try await enskit.resolve(name: vitalik)

Get domain avatar as Data:

// in async function
let vitalik = "vitalik.eth"
let vitalikAvatar: Data? = try await enskit.avatar(name: vitalik)

Get domain avatar URL:

// in async function
let vitalik = "vitalik.eth"
if let avatar = try await enskit.getAvatar(name: vitalik) {
    let url: URL? = try await enskit.getAvatarImageURL(avatar: avatar)
}

Get domain email:

// in async function
let coa = "coa.eth"
let text: String? = try await enskit.text(name: coa, key: "email")

License

MIT

GitHub

link
Stars: 4
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics