diff --git a/web3swift/ABIv2/Classes/ABIv2Elements.swift b/web3swift/ABIv2/Classes/ABIv2Elements.swift index 29fd9cfad..ec6e455b3 100755 --- a/web3swift/ABIv2/Classes/ABIv2Elements.swift +++ b/web3swift/ABIv2/Classes/ABIv2Elements.swift @@ -9,7 +9,7 @@ import Foundation import BigInt -extension ABIv2 { +public extension ABIv2 { // JSON Decoding public struct Input: Decodable { var name: String? @@ -48,16 +48,16 @@ extension ABIv2 { case event(Event) public struct InOut { - let name: String - let type: ParameterType + public let name: String + public let type: ParameterType } public struct Function { - let name: String? - let inputs: [InOut] - let outputs: [InOut] - let constant: Bool - let payable: Bool + public let name: String? + public let inputs: [InOut] + public let outputs: [InOut] + public let constant: Bool + public let payable: Bool } public struct Constructor { diff --git a/web3swift/Utils/Classes/EIP681.swift b/web3swift/Utils/Classes/EIP681.swift index c88982aa8..d50a33028 100644 --- a/web3swift/Utils/Classes/EIP681.swift +++ b/web3swift/Utils/Classes/EIP681.swift @@ -116,6 +116,7 @@ extension Web3 { var code = EIP681Code(targetAddress) if chainIDString != nil { + chainIDString!.remove(at: chainIDString!.startIndex) code.chainID = BigUInt(chainIDString!) } if tail == nil { @@ -137,7 +138,13 @@ extension Web3 { switch inputType { case .address: let val = EIP681Code.TargetAddress(value) - nativeValue = val as AnyObject + switch val { + case .ethereumAddress(let ethereumAddress): + nativeValue = ethereumAddress as AnyObject + case .ensAddress(let ens): + //TODO: - convert ens into ethereum + nativeValue = ens as AnyObject + } case .uint(bits: _): if let val = BigUInt(value, radix: 10) { nativeValue = val as AnyObject @@ -164,6 +171,15 @@ extension Web3 { } else if let val = value.data(using: .utf8) { nativeValue = val as AnyObject } + case .bool: + switch value { + case "true","True","1": + nativeValue = true as AnyObject + case "false", "False", "0": + nativeValue = false as AnyObject + default: + nativeValue = true as AnyObject + } default: continue }