diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt index 6c518ea54e7..d565a1a08be 100644 --- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt +++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt @@ -52,9 +52,9 @@ class TestCoinType { fun testDerivationPath() { var res = CoinType.createFromValue(CoinType.BITCOIN.value()).derivationPath().toString() assertEquals(res, "m/84'/0'/0'/0/0") - res = CoinType.createFromValue(CoinType.BITCOIN.value()).derivationPathWithDerivation(Derivation.LEGACY).toString() + res = CoinType.createFromValue(CoinType.BITCOIN.value()).derivationPathWithDerivation(Derivation.BITCOINLEGACY).toString() assertEquals(res, "m/44'/0'/0'/0/0") - res = CoinType.createFromValue(CoinType.SOLANA.value()).derivationPathWithDerivation(Derivation.SOLANA).toString() + res = CoinType.createFromValue(CoinType.SOLANA.value()).derivationPathWithDerivation(Derivation.SOLANASOLANA).toString() assertEquals(res, "m/44'/501'/0'/0'") } @@ -62,7 +62,7 @@ class TestCoinType { fun testDeriveAddressFromPublicKeyAndDerivation() { val publicKey = PublicKey("0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798".toHexByteArray(), PublicKeyType.SECP256K1) - val address = CoinType.BITCOIN.deriveAddressFromPublicKeyAndDerivation(publicKey, Derivation.SEGWIT) + val address = CoinType.BITCOIN.deriveAddressFromPublicKeyAndDerivation(publicKey, Derivation.BITCOINSEGWIT) assertEquals(address, "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4") } } diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt index 40f9fe147c9..ae4b47b4bd0 100644 --- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt +++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt @@ -53,10 +53,10 @@ class TestAnyAddress { fun testCreateWithPublicKeyDerivation() { val coin = CoinType.BITCOIN val pubkey = PublicKey(any_address_test_pubkey.toHexByteArray(), PublicKeyType.SECP256K1) - val address1 = AnyAddress(pubkey, coin, Derivation.SEGWIT) + val address1 = AnyAddress(pubkey, coin, Derivation.BITCOINSEGWIT) assertEquals(address1.description(), any_address_test_address) - val address2 = AnyAddress(pubkey, coin, Derivation.LEGACY) + val address2 = AnyAddress(pubkey, coin, Derivation.BITCOINLEGACY) assertEquals(address2.description(), "1JvRfEQFv5q5qy9uTSAezH7kVQf4hqnHXx") } diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt index 6e6d2e995b9..e3ec6f29b12 100644 --- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt +++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt @@ -113,13 +113,13 @@ class TestHDWallet { val coin = CoinType.BITCOIN val wallet = HDWallet(words, password) - val key1 = wallet.getKeyDerivation(coin, Derivation.SEGWIT) + val key1 = wallet.getKeyDerivation(coin, Derivation.BITCOINSEGWIT) assertEquals(key1.data().toHex(), "0x1901b5994f075af71397f65bd68a9fff8d3025d65f5a2c731cf90f5e259d6aac") - val key2 = wallet.getKeyDerivation(coin, Derivation.LEGACY) + val key2 = wallet.getKeyDerivation(coin, Derivation.BITCOINLEGACY) assertEquals(key2.data().toHex(), "0x28071bf4e2b0340db41b807ed8a5514139e5d6427ff9d58dbd22b7ed187103a4") - val key3 = wallet.getKeyDerivation(coin, Derivation.TESTNET) + val key3 = wallet.getKeyDerivation(coin, Derivation.BITCOINTESTNET) assertEquals(key3.data().toHex(), "0xca5845e1b43e3adf577b7f110b60596479425695005a594c88f9901c3afe864f") } @@ -137,13 +137,13 @@ class TestHDWallet { val coin = CoinType.BITCOIN val wallet = HDWallet(words, password) - val address1 = wallet.getAddressDerivation(coin, Derivation.SEGWIT) + val address1 = wallet.getAddressDerivation(coin, Derivation.BITCOINSEGWIT) assertEquals(address1, "bc1qumwjg8danv2vm29lp5swdux4r60ezptzz7ce85") - val address2 = wallet.getAddressDerivation(coin, Derivation.LEGACY) + val address2 = wallet.getAddressDerivation(coin, Derivation.BITCOINLEGACY) assertEquals(address2, "1PeUvjuxyf31aJKX6kCXuaqxhmG78ZUdL1") - val address3 = wallet.getAddressDerivation(coin, Derivation.TESTNET) + val address3 = wallet.getAddressDerivation(coin, Derivation.BITCOINTESTNET) assertEquals(address3, "tb1qwgpxgwn33z3ke9s7q65l976pseh4edrzfmyvl0") } diff --git a/swift/Tests/AnyAddressTests.swift b/swift/Tests/AnyAddressTests.swift index 1ecdde2c8f3..85893b6ba17 100644 --- a/swift/Tests/AnyAddressTests.swift +++ b/swift/Tests/AnyAddressTests.swift @@ -35,10 +35,10 @@ class AnyAddressTests: XCTestCase { func testCreateWithPublicKeyDerivation() { let coin = CoinType.bitcoin let pubkey = PublicKey(data: Data(hexString: any_address_test_pubkey)!, type: .secp256k1)! - let address1 = AnyAddress(publicKey: pubkey, coin: coin, derivation: .segwit) + let address1 = AnyAddress(publicKey: pubkey, coin: coin, derivation: .bitcoinSegwit) XCTAssertEqual(address1.description, any_address_test_address) - let address2 = AnyAddress(publicKey: pubkey, coin: coin, derivation: .legacy) + let address2 = AnyAddress(publicKey: pubkey, coin: coin, derivation: .bitcoinLegacy) XCTAssertEqual(address2.description, "1JvRfEQFv5q5qy9uTSAezH7kVQf4hqnHXx") } diff --git a/swift/Tests/CoinTypeTests.swift b/swift/Tests/CoinTypeTests.swift index 575e08fc0a2..63b4f8e9b6a 100644 --- a/swift/Tests/CoinTypeTests.swift +++ b/swift/Tests/CoinTypeTests.swift @@ -31,15 +31,15 @@ class CoinTypeTests: XCTestCase { func testCoinDerivation() { XCTAssertEqual(CoinType.bitcoin.derivationPath(), "m/84'/0'/0'/0/0") - XCTAssertEqual(CoinType.bitcoin.derivationPathWithDerivation(derivation: Derivation.legacy), "m/44'/0'/0'/0/0") - XCTAssertEqual(CoinType.solana.derivationPathWithDerivation(derivation: Derivation.solana), "m/44'/501'/0'/0'") + XCTAssertEqual(CoinType.bitcoin.derivationPathWithDerivation(derivation: Derivation.bitcoinLegacy), "m/44'/0'/0'/0/0") + XCTAssertEqual(CoinType.solana.derivationPathWithDerivation(derivation: Derivation.solanaSolana), "m/44'/501'/0'/0'") } - + func testDeriveAddressFromPublicKeyAndDerivation() { let pkData = Data(hexString: "0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798")! let publicKey = PublicKey(data: pkData, type: .secp256k1)! - - let address = CoinType.bitcoin.deriveAddressFromPublicKeyAndDerivation(publicKey: publicKey, derivation: Derivation.segwit) + + let address = CoinType.bitcoin.deriveAddressFromPublicKeyAndDerivation(publicKey: publicKey, derivation: Derivation.bitcoinSegwit) XCTAssertEqual(address, "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4") } } diff --git a/swift/Tests/HDWalletTests.swift b/swift/Tests/HDWalletTests.swift index 911638706b1..789dad6a6c4 100644 --- a/swift/Tests/HDWalletTests.swift +++ b/swift/Tests/HDWalletTests.swift @@ -92,13 +92,13 @@ class HDWalletTests: XCTestCase { let coin = CoinType.bitcoin let wallet = HDWallet.test - let key1 = wallet.getKeyDerivation(coin: coin, derivation: .segwit) + let key1 = wallet.getKeyDerivation(coin: coin, derivation: .bitcoinSegwit) XCTAssertEqual(key1.data.hexString, "1901b5994f075af71397f65bd68a9fff8d3025d65f5a2c731cf90f5e259d6aac") - let key2 = wallet.getKeyDerivation(coin: coin, derivation: .legacy) + let key2 = wallet.getKeyDerivation(coin: coin, derivation: .bitcoinLegacy) XCTAssertEqual(key2.data.hexString, "28071bf4e2b0340db41b807ed8a5514139e5d6427ff9d58dbd22b7ed187103a4") - let key3 = wallet.getKeyDerivation(coin: coin, derivation: .testnet) + let key3 = wallet.getKeyDerivation(coin: coin, derivation: .bitcoinTestnet) XCTAssertEqual(key3.data.hexString, "ca5845e1b43e3adf577b7f110b60596479425695005a594c88f9901c3afe864f") } @@ -114,13 +114,13 @@ class HDWalletTests: XCTestCase { let coin = CoinType.bitcoin let wallet = HDWallet.test - let address1 = wallet.getAddressDerivation(coin: coin, derivation: .segwit) + let address1 = wallet.getAddressDerivation(coin: coin, derivation: .bitcoinSegwit) XCTAssertEqual(address1, "bc1qumwjg8danv2vm29lp5swdux4r60ezptzz7ce85") - let address2 = wallet.getAddressDerivation(coin: coin, derivation: .legacy) + let address2 = wallet.getAddressDerivation(coin: coin, derivation: .bitcoinLegacy) XCTAssertEqual(address2, "1PeUvjuxyf31aJKX6kCXuaqxhmG78ZUdL1") - let address3 = wallet.getAddressDerivation(coin: coin, derivation: .testnet) + let address3 = wallet.getAddressDerivation(coin: coin, derivation: .bitcoinTestnet) XCTAssertEqual(address3, "tb1qwgpxgwn33z3ke9s7q65l976pseh4edrzfmyvl0") } diff --git a/swift/Tests/Keystore/KeyStoreTests.swift b/swift/Tests/Keystore/KeyStoreTests.swift index 31a813e2938..3017d10c304 100755 --- a/swift/Tests/Keystore/KeyStoreTests.swift +++ b/swift/Tests/Keystore/KeyStoreTests.swift @@ -434,7 +434,7 @@ class KeyStoreTests: XCTestCase { XCTAssertEqual(btc1.address, "bc1qturc268v0f2srjh4r2zu4t6zk4gdutqd5a6zny") XCTAssertEqual(btc1.extendedPublicKey, "zpub6qbsWdbcKW9sC6shTKK4VEhfWvDCoWpfLnnVfYKHLHt31wKYUwH3aFDz4WLjZvjHZ5W4qVEyk37cRwzTbfrrT1Gnu8SgXawASnkdQ994atn") - let btc2 = try wallet.getAccount(password: password, coin: .bitcoin, derivation: .legacy) + let btc2 = try wallet.getAccount(password: password, coin: .bitcoin, derivation: .bitcoinLegacy) XCTAssertEqual(btc2.address, "1NyRyFewhZcWMa9XCj3bBxSXPXyoSg8dKz") XCTAssertEqual(btc2.extendedPublicKey, "xpub6CR52eaUuVb4kXAVyHC2i5ZuqJ37oWNPZFtjXaazFPXZD45DwWBYEBLdrF7fmCR9pgBuCA9Q57zZfyJjDUBDNtWkhWuGHNYKLgDHpqrHsxV") @@ -442,7 +442,7 @@ class KeyStoreTests: XCTestCase { XCTAssertEqual(solana1.address, "HiipoCKL8hX2RVmJTz3vaLy34hS2zLhWWMkUWtw85TmZ") XCTAssertEqual(solana1.derivationPath, "m/44'/501'/0'") - let solana2 = try wallet.getAccount(password: password, coin: .solana, derivation: .solana) + let solana2 = try wallet.getAccount(password: password, coin: .solana, derivation: .solanaSolana) XCTAssertEqual(solana2.address, "CgWJeEWkiYqosy1ba7a3wn9HAQuHyK48xs3LM4SSDc1C") XCTAssertEqual(solana2.derivationPath, "m/44'/501'/0'/0'") } diff --git a/wasm/tests/CoinType.test.ts b/wasm/tests/CoinType.test.ts index efaa02d6ba9..75a0bed0408 100644 --- a/wasm/tests/CoinType.test.ts +++ b/wasm/tests/CoinType.test.ts @@ -26,7 +26,7 @@ describe("CoinType", () => { assert.equal(CoinTypeExt.curve(CoinType.solana), Curve.ed25519); assert.isTrue(CoinTypeExt.validate(CoinType.solana, "Bxp8yhH9zNwxyE4UqxP7a7hgJ5xTZfxNNft7YJJ2VRjT")) assert.equal(CoinTypeExt.derivationPath(CoinType.solana), "m/44'/501'/0'"); - assert.equal(CoinTypeExt.derivationPathWithDerivation(CoinType.solana, Derivation.solana), "m/44'/501'/0'/0'"); + assert.equal(CoinTypeExt.derivationPathWithDerivation(CoinType.solana, Derivation.solanaSolana), "m/44'/501'/0'/0'"); }); it("test deriveAddress", () => { @@ -52,7 +52,7 @@ describe("CoinType", () => { const data = HexCoding.decode("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"); const key = PublicKey.createWithData(data, PublicKeyType.secp256k1); - const addr = CoinTypeExt.deriveAddressFromPublicKeyAndDerivation(CoinType.bitcoin, key, Derivation.segwit); + const addr = CoinTypeExt.deriveAddressFromPublicKeyAndDerivation(CoinType.bitcoin, key, Derivation.bitcoinSegwit); assert.equal(addr, "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"); }); });