mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-01 08:54:06 +03:00
update string extension
This commit is contained in:
parent
163e866cca
commit
030b51a4c7
@ -35,7 +35,7 @@ enum EthereumNetwork: Int {
|
||||
}
|
||||
|
||||
var hexStringId: String {
|
||||
return String(id, radix: 16, uppercase: false).withHexPrefix
|
||||
return String.hex(id, withPrefix: true)
|
||||
}
|
||||
|
||||
static func withChainId(_ chainId: String?) -> EthereumNetwork? {
|
||||
|
@ -35,8 +35,9 @@ extension String {
|
||||
return String.hexPrefix + self
|
||||
}
|
||||
|
||||
static func hex<T>(_ value: T) -> String where T : BinaryInteger {
|
||||
return String(value, radix: 16)
|
||||
static func hex<T>(_ value: T, withPrefix: Bool = false) -> String where T : BinaryInteger {
|
||||
let prefix = withPrefix ? hexPrefix : ""
|
||||
return prefix + String(value, radix: 16)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user