Skip to content

Commit

Permalink
Johnny/hot fix tokens owned by (#52)
Browse files Browse the repository at this point in the history
* fix address comparison

* update changelog and increment version in .podspec

* update README.md version

* remove hardcoded long timeout

* fix tokenUri test
  • Loading branch information
JohnnyJumper authored Aug 3, 2021
1 parent 2aea9d7 commit 8bfd983
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Resolution-swift CHANGELOG

## 2.0.1
- Fix `Resolution#tokensOwnedBy` issue with lowercased addresses.

## 2.0.0

### Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Resoultion supports decentralized domains across three main zones:
## Cocoa Pods

```ruby
pod 'UnstoppableDomainsResolution', '~> 2.0.0'
pod 'UnstoppableDomainsResolution', '~> 2.0.1'
```

## Swift Package Manager

```swift
package.dependencies.append(
.package(url: "https://github.com/unstoppabledomains/resolution-swift", from: "2.0.0")
.package(url: "https://github.com/unstoppabledomains/resolution-swift", from: "2.0.1")
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ internal class UNS: CommonNamingService, NamingService {
guard let self = self else { return }
do {
let owners = try self.batchOwners(domains: possibleDomains)
for (ind, addr) in owners.enumerated() where addr == address {
for (ind, addr) in owners.enumerated() where addr?.lowercased() == address.lowercased() {
domains.append(possibleDomains[ind])
}
semaphore.signal()
Expand Down
24 changes: 12 additions & 12 deletions Sources/UnstoppableDomainsResolution/Resources/UNS/uns-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@
"1337": {
"contracts": {
"CNSRegistry": {
"address": "0xA310F8e781F8aE80690649be920991AEc9a6595D",
"address": "0xC58206842E4030a3B2CaBC78780Ae7635173C533",
"legacyAddresses": [],
"deploymentBlock": "0x01"
},
"SignatureController": {
"address": "0xBd8b374200A7D99F15f4e90621dA1BEAEcb705a0",
"address": "0x7bB6Cd9be29fab783c0b494A06FED8b2E2596B7a",
"legacyAddresses": [],
"deploymentBlock": "0x02"
},
"MintingController": {
"address": "0x4513073d9B3af7e62be59B57205a2368F76dE9C7",
"address": "0x4a3C194eB88966178bfDD81744ddDafED611B830",
"legacyAddresses": [],
"deploymentBlock": "0x03"
},
"URIPrefixController": {
"address": "0xeE1f42382091e260f5B9c152E17639d729Ab829F",
"address": "0x4872CC1be60A9DB9c880A0A437Da7a6AF134F08f",
"legacyAddresses": [],
"deploymentBlock": "0x04"
},
"Resolver": {
"address": "0x76CBBE3B425A7D258B30457785d54de8c8322bfa",
"address": "0xF8C26340C1eAeA6c7fF1760B25005e1306953572",
"legacyAddresses": [],
"deploymentBlock": "0x08"
},
"WhitelistedMinter": {
"address": "0x4d4E78764a6aF57bf628120A38c10560deD2E134",
"address": "0xAc52F68f31577E44aE0C7E95A42dC9eb574B9383",
"legacyAddresses": [],
"deploymentBlock": "0x09"
},
Expand All @@ -209,24 +209,24 @@
"deploymentBlock": "0x0"
},
"ProxyAdmin": {
"address": "0x7bB6Cd9be29fab783c0b494A06FED8b2E2596B7a",
"address": "0xa1A2114B0C4bDF9AEe05fdd80801e6267639FAd9",
"legacyAddresses": [],
"deploymentBlock": "0x0"
},
"UNSRegistry": {
"address": "0x4a3C194eB88966178bfDD81744ddDafED611B830",
"address": "0x27935e7e85db3c4e7885eB828B9e889BA69a4e7f",
"legacyAddresses": [],
"deploymentBlock": "0x0f",
"implementation": "0xC58206842E4030a3B2CaBC78780Ae7635173C533"
"implementation": "0x58a175BEbc8ec21A94ea63Aa5a28743945940EE6"
},
"MintingManager": {
"address": "0x4Be0126fB2885a6D2909166D5801E606470C9aB0",
"address": "0xC20631145b77a58018E2b10f2282Dd048E12fC81",
"legacyAddresses": [],
"deploymentBlock": "0x11",
"implementation": "0x4872CC1be60A9DB9c880A0A437Da7a6AF134F08f"
"implementation": "0x6E53896B006fA3f173aF0096f8DfC0a179cFe8c8"
},
"ProxyReader": {
"address": "0xAc52F68f31577E44aE0C7E95A42dC9eb574B9383",
"address": "0x107733feD96C4Cd390c944a31F5425A7FB98Ae5e",
"legacyAddresses": [],
"deploymentBlock": "0x15"
}
Expand Down
23 changes: 22 additions & 1 deletion Tests/ResolutionTests/ResolutionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,27 @@ class ResolutionTests: XCTestCase {
assert(chatID == "0x8912623832e174f2eb1f59cc3b587444d619376ad5bf10070e937e0dc22b9ffb2e3ae059e6ebf729f87746b2f71e5d88ec99c1fb3c7c49b8617e2520d474c48e1c")
}

func testForTokensOwnedByUns() throws {
let tokenReceived = expectation(description: "tokens for 0xac54c586798912c9a6d4a26d3e9fe19f384256de address should be received");
var returnedDomains: [String] = [];

resolution.tokensOwnedBy(address: "0xac54c586798912c9a6d4a26d3e9fe19f384256de", service: "uns") { result in
switch result {
case .success(let domains):
returnedDomains = domains.compactMap{ $0 };
tokenReceived.fulfill()
case .failure(let error):
XCTFail("Expected domains, but got \(error)")
}
}
waitForExpectations(timeout: timeout, handler: nil)
assert(returnedDomains.count >= 3);
assert(returnedDomains.contains("amazing.crypto"));
assert(returnedDomains.contains("july23.bitcoin"));
assert(returnedDomains.contains("roman.bitcoin"));

}

func testForTokensOwnedByCns() throws {
let tokenReceived = expectation(description: "tokens for 0x8aaD44321A86b170879d7A244c1e8d360c99DdA8 address should be received");
var returnedDomains: [String] = [];
Expand Down Expand Up @@ -778,7 +799,7 @@ class ResolutionTests: XCTestCase {
waitForExpectations(timeout: timeout, handler: nil)

// Then
assert(tokenURI == "https://staging-dot-dot-crypto-metadata.appspot.com/metadata/brad.crypto")
assert(tokenURI == "https://metadata.staging.unstoppabledomains.com/metadata/brad.crypto")
self.checkError(result: unregisteredResult, expectedError: ResolutionError.unregisteredDomain)
}

Expand Down
2 changes: 1 addition & 1 deletion UnstoppableDomainsResolution.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "UnstoppableDomainsResolution"
spec.version = "2.0.0"
spec.version = "2.0.1"
spec.summary = "Swift framework for resolving Unstoppable domains."

spec.description = <<-DESC
Expand Down

0 comments on commit 8bfd983

Please sign in to comment.