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

Commit 4784042

Browse files
committed
Fixed address starts with 0x in keystore v3 #279
1 parent 7a89338 commit 4784042

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public struct KeystoreParamsV3: Decodable, Encodable {
229229

230230
/// Init with all params
231231
public init(address ad: String?, crypto cr: CryptoParamsV3, id i: String, version ver: Int) {
232-
address = ad
232+
address = ad?.withoutHex
233233
crypto = cr
234234
id = i
235235
version = ver

Tests/web3swiftTests/KeystoreTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class KeystoresTests: XCTestCase {
3131

3232
func testImportAndExport() throws {
3333
let json = """
34-
{"version":3,"id":"8b60fda9-5f27-4478-9cc9-72059571aa6e","crypto":{"ciphertext":"d34e78640359a599970a58b3b4b7c987945e56c69411028ea62394e8d1ea7e4b","cipherparams":{"iv":"6e4a429a30807ab9202a9aefad152398"},"kdf":"scrypt","kdfparams":{"r":6,"p":1,"n":4096,"dklen":32,"salt":"0000000000000000000000000000000000000000000000000000000000000000"},"mac":"79888d6ce3a2a24d6b70d07ca9067b57e4a57bd9416a3abb336900cacf82e29a","cipher":"aes-128-cbc"},"address":"0x0b0f7a95485060973726d03e7c326a6542bcb55b"}
34+
{"version":3,"id":"8b60fda9-5f27-4478-9cc9-72059571aa6e","crypto":{"ciphertext":"d34e78640359a599970a58b3b4b7c987945e56c69411028ea62394e8d1ea7e4b","cipherparams":{"iv":"6e4a429a30807ab9202a9aefad152398"},"kdf":"scrypt","kdfparams":{"r":6,"p":1,"n":4096,"dklen":32,"salt":"0000000000000000000000000000000000000000000000000000000000000000"},"mac":"79888d6ce3a2a24d6b70d07ca9067b57e4a57bd9416a3abb336900cacf82e29a","cipher":"aes-128-cbc"},"address":"0b0f7a95485060973726d03e7c326a6542bcb55b"}
3535
"""
3636
let keystore = EthereumKeystoreV3(json)!
3737
let data = try keystore.serialize()!

web3swift.pod.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'web3swift.pod'
3-
spec.version = '2.1.8'
3+
spec.version = '2.1.9'
44
spec.ios.deployment_target = "8.0"
55
spec.osx.deployment_target = "10.10"
66
spec.tvos.deployment_target = "9.0"

web3swift.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'web3swift'
3-
spec.version = '2.1.8'
3+
spec.version = '2.1.9'
44
spec.ios.deployment_target = "8.0"
55
spec.osx.deployment_target = "10.10"
66
spec.tvos.deployment_target = "9.0"

0 commit comments

Comments
 (0)