Skip to content

Commit b5f6004

Browse files
gupniksatoshiotomakany3fers0n
authored
[BreakingChange]: Migrates FFI Tests to Private Key V2 APIs (#4333)
* feat(eip7702): Add Biz Smart Contract Account Type (#4319) * fix(eip7702): Add `UserOperationMode` * Add `erc4337.biz_account.abi.json` ABI * fix(eip7702): Add `test_barz_transfer_erc7702_eoa` test * fix(eip7702): Fix `Biz.execute4337Ops()` * fix(eip7702): Minor changes * fix(eip7702): Rename `UserOperationMode` to `SCAccountType` * fix: tron message sign (#4326) * Adds ability to specify the curve while constructing Private Key (#4324) * Adds ability to specify the curve while constructing Private Key * Adds signing functions without a curve * Migrates to new API * Use TWCoinTypeCurve * Adds Curve * Adds FFI Tests for Private Key V2 APIs * Migrates Swift tests to new API * Migrates Kotlin tests to V2 API * Migrates WASM tests * Migrates C++ tests to V2 APIs * Removes deprecated APIs and migrates all to new ones --------- Co-authored-by: Sergei Boiko <[email protected]> Co-authored-by: Yeferson Licet <[email protected]>
1 parent 70a2a40 commit b5f6004

File tree

406 files changed

+1910
-1007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

406 files changed

+1910
-1007
lines changed

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaAddress.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TestAcalaAddress {
1818

1919
@Test
2020
fun testAddress() {
21-
val key = PrivateKey("0x9066aa168c379a403becb235c15e7129c133c244e56a757ab07bc369288bcab0".toHexByteArray())
21+
val key = PrivateKey("0x9066aa168c379a403becb235c15e7129c133c244e56a757ab07bc369288bcab0".toHexByteArray(), CoinType.ACALA.curve())
2222
val pubkey = key.publicKeyEd25519
2323
val address = AnyAddress(pubkey, CoinType.ACALA)
2424
assertEquals(address.description(), "269ZCS3WLGydTN8ynhyhZfzJrXkePUcdhwgLQs6TWFs5wVL5")

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acalaevm/TestAcalaEVMAddress.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TestAcalaEVMAddress {
1717

1818
@Test
1919
fun testAddress() {
20-
val key = PrivateKey("828c4c48c2cef521f0251920891ed79e871faa24f64f43cde83d07bc99f8dbf0".toHexByteArray())
20+
val key = PrivateKey("828c4c48c2cef521f0251920891ed79e871faa24f64f43cde83d07bc99f8dbf0".toHexByteArray(), CoinType.ACALAEVM.curve())
2121
val pubkey = key.getPublicKeySecp256k1(false)
2222
val address = AnyAddress(pubkey, CoinType.ACALAEVM)
2323
val expected = AnyAddress("0xe32DC46bfBF78D1eada7b0a68C96903e01418D64", CoinType.ACALAEVM)

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricAddress.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestAgoricAddress {
1919
@Test
2020
fun testAddress() {
2121

22-
val key = PrivateKey("037048190544fa57651452f477c096de4f3073e7835cf3845b04602563a73f73".toHexByteArray())
22+
val key = PrivateKey("037048190544fa57651452f477c096de4f3073e7835cf3845b04602563a73f73".toHexByteArray(), CoinType.AGORIC.curve())
2323
val pubkey = key.getPublicKeySecp256k1(true)
2424
val address = AnyAddress(pubkey, CoinType.AGORIC)
2525
val expected = AnyAddress("agoric18zvvgk6j3eq5wd7mqxccgt20gz2w94cy88aek5", CoinType.AGORIC)

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricSigner.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestAgoricSigner {
2222

2323
@Test
2424
fun AgoricTransactionSigning() {
25-
val key = PrivateKey("037048190544fa57651452f477c096de4f3073e7835cf3845b04602563a73f73".toHexByteArray())
25+
val key = PrivateKey("037048190544fa57651452f477c096de4f3073e7835cf3845b04602563a73f73".toHexByteArray(), CoinType.AGORIC.curve())
2626
val publicKey = key.getPublicKeySecp256k1(true)
2727
val from = AnyAddress(publicKey, CoinType.AGORIC).description()
2828

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aion/TestAion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestAionAddress {
2222

2323
@Test
2424
fun testAddressFromPublicKey() {
25-
val privateKey = PrivateKey("db33ffdf82c7ba903daf68d961d3c23c20471a8ce6b408e52d579fd8add80cc9".toHexByteArray())
25+
val privateKey = PrivateKey("db33ffdf82c7ba903daf68d961d3c23c20471a8ce6b408e52d579fd8add80cc9".toHexByteArray(), CoinType.AION.curve())
2626
val publicKey = privateKey.getPublicKeyEd25519()
2727
val address = AnyAddress(publicKey, CoinType.AION)
2828

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/algorand/TestAlgorandAddress.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TestAlgorandAddress {
1414

1515
@Test
1616
fun testAddress() {
17-
val key = PrivateKey("a6c4394041e64fe93d889386d7922af1b9a87f12e433762759608e61434d6cf7".toHexByteArray())
17+
val key = PrivateKey("a6c4394041e64fe93d889386d7922af1b9a87f12e433762759608e61434d6cf7".toHexByteArray(), CoinType.ALGORAND.curve())
1818
val pubkey = key.publicKeyEd25519
1919
val address = AnyAddress(pubkey, CoinType.ALGORAND)
2020
val expected = AnyAddress("ADIYK65L3XR5ODNNCUIQVEET455L56MRKJHRBX5GU4TZI2752QIWK4UL5A", CoinType.ALGORAND)

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainAddress.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestBandChainAddress {
1919
@Test
2020
fun testAddress() {
2121

22-
val key = PrivateKey("1037f828ca313f4c9e120316e8e9ff25e17f07fe66ba557d5bc5e2eeb7cba8f6".toHexByteArray())
22+
val key = PrivateKey("1037f828ca313f4c9e120316e8e9ff25e17f07fe66ba557d5bc5e2eeb7cba8f6".toHexByteArray(), CoinType.BANDCHAIN.curve())
2323
val publicKey = key.getPublicKeySecp256k1(true)
2424
val address = AnyAddress(publicKey, CoinType.BANDCHAIN)
2525
val expected = AnyAddress("band1jf9aaj9myrzsnmpdr7twecnaftzmku2mgms4n3", CoinType.BANDCHAIN)

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainSigner.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.junit.Assert.assertEquals
1010
import org.junit.Test
1111
import wallet.core.java.AnySigner
1212
import wallet.core.jni.AnyAddress
13+
import wallet.core.jni.CoinType
1314
import wallet.core.jni.CoinType.BANDCHAIN
1415
import wallet.core.jni.PrivateKey
1516
import wallet.core.jni.proto.Cosmos
@@ -24,7 +25,7 @@ class TestBandChainSigner {
2425
@Test
2526
fun testSigningTransaction() {
2627
val key =
27-
PrivateKey("80e81ea269e66a0a05b11236df7919fb7fbeedba87452d667489d7403a02f005".toHexByteArray())
28+
PrivateKey("80e81ea269e66a0a05b11236df7919fb7fbeedba87452d667489d7403a02f005".toHexByteArray(), CoinType.BANDCHAIN.curve())
2829
val publicKey = key.getPublicKeySecp256k1(true)
2930
val from = AnyAddress(publicKey, BANDCHAIN).description()
3031

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/binance/TestBinanceTransactionSigning.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class TestBinanceTransactionSigning {
1717
System.loadLibrary("TrustWalletCore")
1818
}
1919

20-
val testKey = PrivateKey("eeba3f6f2db26ced519a3d4c43afff101db957a21d54d25dc7fd235c404d7a5d".toHexBytes())
20+
val testKey = PrivateKey("eeba3f6f2db26ced519a3d4c43afff101db957a21d54d25dc7fd235c404d7a5d".toHexBytes(), BINANCE.curve())
2121

2222
@Test
2323
fun testSignBinanceTransaction() {
24-
val privateKey = PrivateKey("95949f757db1f57ca94a5dff23314accbe7abee89597bf6a3c7382c84d7eb832".toHexBytes())
24+
val privateKey = PrivateKey("95949f757db1f57ca94a5dff23314accbe7abee89597bf6a3c7382c84d7eb832".toHexBytes(), BINANCE.curve())
2525
val publicKey = privateKey.getPublicKeySecp256k1(true)
2626

2727
val signingInput = Binance.SigningInput.newBuilder()

android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinPsbt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class TestBitcoinPsbt {
6464
fun testPlanThorSwap() {
6565
// Successfully broadcasted tx: https://mempool.space/tx/634a416e82ac710166725f6a4090ac7b5db69687e86b2d2e38dcb3d91c956c32
6666

67-
val privateKey = PrivateKey("f00ffbe44c5c2838c13d2778854ac66b75e04eb6054f0241989e223223ad5e55".toHexBytes())
67+
val privateKey = PrivateKey("f00ffbe44c5c2838c13d2778854ac66b75e04eb6054f0241989e223223ad5e55".toHexBytes(), CoinType.BITCOIN.curve())
6868
val publicKey = privateKey.getPublicKeySecp256k1(true)
6969
val psbt = "70736274ff0100bc0200000001147010db5fbcf619067c1090fec65c131443fbc80fb4aaeebe940e44206098c60000000000ffffffff0360ea000000000000160014f22a703617035ef7f490743d50f26ae08c30d0a70000000000000000426a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a35303e12000000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d000000000001011f6603010000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d00000000".toHexBytesInByteString()
7070

0 commit comments

Comments
 (0)