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

Wrong conversation of the Wei. #2

Closed
OlegGordiichuk opened this issue Jan 18, 2018 · 3 comments
Closed

Wrong conversation of the Wei. #2

OlegGordiichuk opened this issue Jan 18, 2018 · 3 comments

Comments

@OlegGordiichuk
Copy link

OlegGordiichuk commented Jan 18, 2018

Method return wrong value.

This issue is connected with lib that is download from Cocoapods.

In my case:
resultString = "0x1c31de57e49fc00".
balance = 2031649376000000000

Expected result is one of this.

2018-01-18 23 01 47

@shamatar
Copy link
Contributor

shamatar commented Jan 18, 2018

Hello Oleg.

I'll look into this issue. A reference for contract address/network/method/expected return value would be appreciated.

So far couldn't reproduce, returns correct value for by wallet (see Example project). BigUInt from hex string also returns correct value for your resultString.

Sincerely, Alex

@OlegGordiichuk
Copy link
Author

OlegGordiichuk commented Jan 18, 2018

@shamatar I find the problem. Problem is in cocoa pods. When you will set pod 'web3swift'. You will not use latest version of the lib. And in the version that is download from cocoa pods you can find this issue.

Issue was in :
guard let resultString = res["result"] as? String else {return nil}
let responseData = Data(Array(hex: resultString.lowercased().stripHexPrefix()))
guard responseData != Data() else {return nil}
let biguint = BigUInt(responseData)

@shamatar
Copy link
Contributor

Hello Oleg.

Please run

pod update

I've removed the code you listed for quite some time already. Version 0.2.8 should fix an issue for you. Please check your code with a new version and close if everything is resolved.

Sincerely, Alex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants