Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #60 from BANKEX/develop
Browse files Browse the repository at this point in the history
fix regression of abi encoding
  • Loading branch information
shamatar authored Apr 16, 2018
2 parents 38a7c6e + cc56825 commit c47647c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web3swift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "web3swift"
s.version = "0.5.2"
s.version = "0.5.4"
s.summary = "Web3 implementation in vanilla Swift for iOS ans macOS"

s.description = <<-DESC
Expand Down
15 changes: 11 additions & 4 deletions web3swift/ABIv2/Classes/ABIv2Encoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ extension ABIv2Encoder {
case let v as BigUInt:
return v
case let v as BigInt:
return v.magnitude
switch v.sign {
case .minus:
return nil
case .plus:
return v.magnitude
}
case let v as String:
let base10 = BigUInt(v, radix: 10)
if base10 != nil {
Expand Down Expand Up @@ -103,9 +108,11 @@ extension ABIv2Encoder {
case let d as Data:
return d
case let d as String:
let hex = Data.fromHex(d.stripHexPrefix())
if hex != nil {
return hex
if d.hasHexPrefix() {
let hex = Data.fromHex(d)
if hex != nil {
return hex
}
}
let str = d.data(using: .utf8)
if str != nil {
Expand Down

0 comments on commit c47647c

Please sign in to comment.