Skip to content

Commit

Permalink
test removal of tz2 paths for Regular wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Nov 13, 2023
1 parent b25a975 commit d622d50
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.library(name: "KukaiCoreSwift", targets: ["KukaiCoreSwift"]),
],
dependencies: [
.package(name: "KukaiCryptoSwift", url: "https://github.com/kukai-wallet/kukai-crypto-swift", from: "1.0.12"),
.package(name: "KukaiCryptoSwift", url: "https://github.com/kukai-wallet/kukai-crypto-swift", /*from: "1.0.12"*/ .branch("feature/tz2_test")),
//.package(url: "https://github.com/onevcat/Kingfisher.git", from: "7.6.2"),
.package(url: "https://github.com/simonmcl/Kingfisher.git", from: "1.0.0"),
.package(name: "CustomAuth", url: "https://github.com/torusresearch/customauth-swift-sdk", from: "6.0.0"),
Expand Down
8 changes: 4 additions & 4 deletions Sources/KukaiCoreSwift/Models/RegularWallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public class RegularWallet: Wallet {
- Parameter passphrase: String contianing a passphrase, or empty string if none
- Parameter ellipticalCurve: Optional: Choose the `EllipticalCurve` used to generate the wallet address
*/
public init?(withMnemonic mnemonic: Mnemonic, passphrase: String, ellipticalCurve: EllipticalCurve = .ed25519) {
guard let keyPair = KeyPair.regular(fromMnemonic: mnemonic, passphrase: passphrase, andSigningCurve: ellipticalCurve), let pkh = keyPair.publicKey.publicKeyHash else {
public init?(withMnemonic mnemonic: Mnemonic, passphrase: String/*, ellipticalCurve: EllipticalCurve = .ed25519*/) {
guard let keyPair = KeyPair.regular(fromMnemonic: mnemonic, passphrase: passphrase/*, andSigningCurve: ellipticalCurve*/), let pkh = keyPair.publicKey.publicKeyHash else {
return nil
}

Expand All @@ -84,9 +84,9 @@ public class RegularWallet: Wallet {
- Parameter passphrase: String contianing a passphrase, or empty string if none
- Parameter ellipticalCurve: Optional: Choose the `EllipticalCurve` used to generate the wallet address
*/
public convenience init?(withMnemonicLength length: Mnemonic.NumberOfWords, passphrase: String, ellipticalCurve: EllipticalCurve = .ed25519) {
public convenience init?(withMnemonicLength length: Mnemonic.NumberOfWords, passphrase: String/*, ellipticalCurve: EllipticalCurve = .ed25519*/) {
if let mnemonic = try? Mnemonic(numberOfWords: length) {
self.init(withMnemonic: mnemonic, passphrase: passphrase, ellipticalCurve: ellipticalCurve)
self.init(withMnemonic: mnemonic, passphrase: passphrase/*, ellipticalCurve: ellipticalCurve*/)

} else {
return nil
Expand Down
4 changes: 3 additions & 1 deletion Tests/KukaiCoreSwiftTests/Models/RegularWalletTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ class RegularWalletTests: XCTestCase {
}

func testCurves() {
let wallet1 = RegularWallet(withMnemonic: MockConstants.mnemonic, passphrase: "", ellipticalCurve: .ed25519)
let wallet1 = RegularWallet(withMnemonic: MockConstants.mnemonic, passphrase: ""/*, ellipticalCurve: .ed25519*/)
XCTAssert(wallet1?.address == MockConstants.linearWalletEd255519.address, wallet1?.address ?? "-")
XCTAssert(wallet1?.privateKey.bytes.toHexString() == MockConstants.linearWalletEd255519.privateKey, wallet1?.privateKey.bytes.toHexString() ?? "-")
XCTAssert(wallet1?.publicKey.bytes.toHexString() == MockConstants.linearWalletEd255519.publicKey, wallet1?.publicKey.bytes.toHexString() ?? "-")

/*
let wallet2 = RegularWallet(withMnemonic: MockConstants.mnemonic, passphrase: "", ellipticalCurve: .secp256k1)
XCTAssert(wallet2?.address == MockConstants.linearWalletSecp256k1.address, wallet2?.address ?? "-")
XCTAssert(wallet2?.privateKey.bytes.toHexString() == MockConstants.linearWalletSecp256k1.privateKey, wallet2?.privateKey.bytes.toHexString() ?? "-")
XCTAssert(wallet2?.publicKey.bytes.toHexString() == MockConstants.linearWalletSecp256k1.publicKey, wallet2?.publicKey.bytes.toHexString() ?? "-")
*/
}

func testSigning() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ class WalletCacheServiceTests: XCTestCase {
}

func testCurves() {
let wallet = RegularWallet(withMnemonic: MockConstants.mnemonic, passphrase: "", ellipticalCurve: .secp256k1)!
/*let wallet = RegularWallet(withMnemonic: MockConstants.mnemonic, passphrase: "", ellipticalCurve: .secp256k1)!
XCTAssert(walletCacheService.cache(wallet: wallet, childOfIndex: nil, backedUp: false))

let wallet1 = walletCacheService.fetchWallet(forAddress: wallet.address)
XCTAssert(wallet1 != nil)
XCTAssert(wallet1?.address == MockConstants.linearWalletSecp256k1.address, wallet1?.address ?? "-")
XCTAssert(walletCacheService.deleteAllCacheAndKeys())
XCTAssert(walletCacheService.deleteAllCacheAndKeys())*/
}

func testDerivationPaths() {
Expand Down

0 comments on commit d622d50

Please sign in to comment.