erc721 and 875 are now checked with proper encoding

pull/540/head
James Sangalli 6 years ago
parent 6710ec863f
commit b690fcf022
  1. 2
      AlphaWallet/Settings/Types/Constants.swift
  2. 7
      AlphaWallet/Tokens/Coordinators/GetIsERC721ContractCoordinator.swift
  3. 4
      AlphaWallet/Tokens/Coordinators/GetIsERC875ContractCoordinator.swift
  4. 2
      AlphaWallet/Vendors/New Group/Commands/GetIsERC721Encode.swift
  5. 2
      AlphaWallet/Vendors/New Group/Commands/GetIsERC875Encode.swift
  6. 1
      AlphaWallet/Vendors/New Group/Web3Swift.swift

@ -50,7 +50,7 @@ public struct Constants {
public static let rinkebyEtherscanContractDetailsWebPageURL = "https://rinkeby.etherscan.io/address/"
//ERC specs
public static let erc721InterfaceHash = "0x80ac58cd"
public static let erc721InterfaceHash = "0x9a20483d"
}
public struct UnitConfiguration {

@ -35,11 +35,8 @@ class GetIsERC721ContractCoordinator {
let request = GetIsERC721Decode(data: is721)
self?.web3.request(request: request) { result in
switch result {
case .success(let isERC721):
if isERC721 == "true" {
completion(.success(true))
}
completion(.success(false))
case .success(let res):
completion(.success(res.toBool()))
case .failure(let error):
NSLog("getIsERC721Contract 3 error \(error)")
completion(.failure(AnyError(error)))

@ -30,8 +30,8 @@ class GetIsERC875ContractCoordinator {
)
Session.send(request2) { [weak self] result2 in
switch result2 {
case .success(let balance):
let request = GetIsERC875Decode(data: balance)
case .success(let is875):
let request = GetIsERC875Decode(data: is875)
self?.web3.request(request: request) { result in
switch result {
case .success(let res):

@ -22,7 +22,7 @@ struct GetIsERC721Decode: Web3Request {
let data: String
var type: Web3RequestType {
let run = "web3.eth.abi.decodeParameter('bool', '\(data)')"
let run = "web3.eth.abi.decodeParameter('uint256', '\(data)')"
return .script(command: run)
}
}

@ -18,7 +18,7 @@ struct GetIsERC875Decode: Web3Request {
let data: String
var type: Web3RequestType {
let run = "web3.eth.abi.decodeParameter('bool', '\(data)')"
let run = "web3.eth.abi.decodeParameter('unit256', '\(data)')"
return .script(command: run)
}
}

@ -12,7 +12,6 @@ class Web3Swift: NSObject {
let url: URL
var isLoaded = false
//"http://stormbird.duckdns.org:8545"
init(url: URL = URL(string: "https://ropsten.infura.io/llyrtzQ3YhkdESt2Fzrk")!) {
self.url = url
}

Loading…
Cancel
Save