Skip to content

Commit

Permalink
Sync dev with master (#3435)
Browse files Browse the repository at this point in the history
  • Loading branch information
lamafab authored Sep 20, 2023
1 parent f521ce6 commit 6bc8ec4
Show file tree
Hide file tree
Showing 78 changed files with 3,134 additions and 129 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/kotlin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,17 @@ jobs:
source emsdk/emsdk_env.sh
tools/generate-files
- name: CMake (Java, Kotlin)
run: |
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DTW_UNITY_BUILD=ON -DTW_COMPILE_JAVA=ON -DTW_COMPILE_KOTLIN=ON -GNinja
- name: Build JNI
run: |
ninja -Cbuild
mv build/libTrustWalletCore.dylib kotlin/wallet-core-kotlin/src/jvmMain/resources/jni/macos-arm64/
- name: Build Kotlin Multiplatform
run: tools/kotlin-build

- name: Run Kotlin Multiplatform tests
run: tools/kotlin-test
24 changes: 21 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ include(cmake/Protobuf.cmake)

# Source files
if (${ANDROID})
message("Configuring for JNI")
message("Configuring for Android JNI")
file(GLOB_RECURSE core_sources src/*.c src/*.cc src/*.cpp src/*.h jni/cpp/*.cpp jni/cpp/*.h)
if (${KOTLIN})
file(GLOB_RECURSE specific_sources
jni/kotlin/*.h
jni/kotlin/*.c
kotlin/wallet-core-kotlin/src/androidMain/cpp/generated/*.h
kotlin/wallet-core-kotlin/src/androidMain/cpp/generated/*.c
kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated/*.h
kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated/*.c
)
else ()
file(GLOB_RECURSE specific_sources jni/android/*.h jni/android/*.c)
Expand All @@ -75,6 +75,24 @@ if (${ANDROID})
set(WALLET_CORE_BINDGEN ${WALLET_CORE_RS_TARGET_DIR}/x86_64-linux-android/release/${WALLET_CORE_RS_LIB})
endif ()
target_link_libraries(TrustWalletCore PUBLIC ${WALLET_CORE_BINDGEN} ${PROJECT_NAME}_INTERFACE PRIVATE TrezorCrypto protobuf ${log-lib} Boost::boost)
elseif (${TW_COMPILE_JAVA})
message("Configuring for JNI")
file(GLOB_RECURSE core_sources src/*.c src/*.cc src/*.cpp src/*.h jni/cpp/*.cpp jni/cpp/*.h)
if (${TW_COMPILE_KOTLIN})
file(GLOB_RECURSE specific_sources
jni/kotlin/*.h
jni/kotlin/*.c
kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated/*.h
kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated/*.c
)
else ()
file(GLOB_RECURSE specific_sources jni/android/*.h jni/android/*.c)
endif ()
set(sources ${core_sources} ${specific_sources})
add_library(TrustWalletCore SHARED ${sources} ${PROTO_SRCS} ${PROTO_HDRS})
find_package(JNI REQUIRED)
target_include_directories(TrustWalletCore PRIVATE ${JNI_INCLUDE_DIRS})
target_link_libraries(TrustWalletCore PUBLIC ${WALLET_CORE_BINDGEN} ${PROJECT_NAME}_INTERFACE PRIVATE TrezorCrypto protobuf Boost::boost)
else ()
message("Configuring standalone")
file(GLOB_RECURSE sources src/*.c src/*.cc src/*.cpp src/*.h)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CoinAddressDerivationTests {
ETHEREUM, SMARTCHAIN, POLYGON, OPTIMISM, ZKSYNC, ARBITRUM, ARBITRUMNOVA, ECOCHAIN, AVALANCHECCHAIN, XDAI,
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
ETHEREUMCLASSIC -> assertEquals("0x078bA3228F3E6C08bEEac9A005de0b7e7089aD1c", address)
GOCHAIN -> assertEquals("0x5940ce4A14210d4Ccd0ac206CE92F21828016aC2", address)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Copyright © 2017-2023 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

package com.trustwallet.core.app.blockchains.greenfield

import com.google.protobuf.ByteString
import com.trustwallet.core.app.utils.toHexByteArray
import org.junit.Assert.assertEquals
import org.junit.Test
import wallet.core.java.AnySigner
import wallet.core.jni.CoinType
import wallet.core.jni.PrivateKey
import wallet.core.jni.proto.Greenfield

class TestGreenfieldSigner {

init {
System.loadLibrary("TrustWalletCore")
}

@Test
fun GreenfieldTransactionSigningSend() {
// Successfully broadcasted: https://greenfieldscan.com/tx/ED8508F3C174C4430B8EE718A6D6F0B02A8C516357BE72B1336CF74356529D19

val key =
PrivateKey("825d2bb32965764a98338139412c7591ed54c951dd65504cd8ddaeaa0fea7b2a".toHexByteArray())

val msgSend = Greenfield.Message.Send.newBuilder().apply {
fromAddress = "0xA815ae0b06dC80318121745BE40e7F8c6654e9f3"
toAddress = "0x8dbD6c7Ede90646a61Bbc649831b7c298BFd37A0"
addAmounts(Greenfield.Amount.newBuilder().apply {
amount = "1234500000000000"
denom = "BNB"
})
}.build()

val greenfieldFee = Greenfield.Fee.newBuilder().apply {
gas = 1200
addAmounts(Greenfield.Amount.newBuilder().apply {
amount = "6000000000000"
denom = "BNB"
})
}.build()

val signingInput = Greenfield.SigningInput.newBuilder().apply {
signingMode = Greenfield.SigningMode.Eip712
encodingMode = Greenfield.EncodingMode.Protobuf
accountNumber = 15952
ethChainId = "5600"
cosmosChainId = "greenfield_5600-1"
memo = "Trust Wallet test memo"
sequence = 0
fee = greenfieldFee
mode = Greenfield.BroadcastMode.SYNC
privateKey = ByteString.copyFrom(key.data())
addMessages(Greenfield.Message.newBuilder().apply {
sendCoinsMessage = msgSend
})
}.build()

val output = AnySigner.sign(signingInput, CoinType.GREENFIELD, Greenfield.SigningOutput.parser())

assertEquals(
output.serialized,
"{\"mode\":\"BROADCAST_MODE_SYNC\",\"tx_bytes\":\"CqwBCpEBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnEKKjB4QTgxNWFlMGIwNmRDODAzMTgxMjE3NDVCRTQwZTdGOGM2NjU0ZTlmMxIqMHg4ZGJENmM3RWRlOTA2NDZhNjFCYmM2NDk4MzFiN2MyOThCRmQzN0EwGhcKA0JOQhIQMTIzNDUwMDAwMDAwMDAwMBIWVHJ1c3QgV2FsbGV0IHRlc3QgbWVtbxJzClYKTQomL2Nvc21vcy5jcnlwdG8uZXRoLmV0aHNlY3AyNTZrMS5QdWJLZXkSIwohAhm/mQgs8vzaqBLW66HrqQNv86PYTBgXyElU1OiuKD/sEgUKAwjIBRIZChQKA0JOQhINNjAwMDAwMDAwMDAwMBCwCRpBwbRb1qEAWwaqVfmp1Mn7iMi7wwV/oPi2J2eW9NBIdNoky+ZL+uegS/kY+funCOrqVZ+Kbol9/djAV+bQaNUB0xw=\"}"
)
assertEquals(output.errorMessage, "")
}

@Test
fun GreenfieldTransactionSigningTransferOut() {
// Successfully broadcasted Greenfield: https://greenfieldscan.com/tx/38C29C530A74946CFD22EE07DA642F5EF9399BC9AEA59EC56A9B5BE16DE16CE7
// BSC (parent transaction): https://testnet.bscscan.com/tx/0x7f73c8a362e14e58cb5e0ec17616afc50eff7aa398db472383a6d017c8a5861a

val key =
PrivateKey("9066aa168c379a403becb235c15e7129c133c244e56a757ab07bc369288bcab0".toHexByteArray())

val msgTransferOut = Greenfield.Message.BridgeTransferOut.newBuilder().apply {
fromAddress = "0x9d1d97aDFcd324Bbd603D3872BD78e04098510b1"
toAddress = "0x9d1d97aDFcd324Bbd603D3872BD78e04098510b1"
amount = Greenfield.Amount.newBuilder().apply {
amount = "5670000000000000"
denom = "BNB"
}.build()
}.build()

val greenfieldFee = Greenfield.Fee.newBuilder().apply {
gas = 1200
addAmounts(Greenfield.Amount.newBuilder().apply {
amount = "6000000000000"
denom = "BNB"
})
}.build()

val signingInput = Greenfield.SigningInput.newBuilder().apply {
signingMode = Greenfield.SigningMode.Eip712
encodingMode = Greenfield.EncodingMode.Protobuf
accountNumber = 15560
ethChainId = "5600"
cosmosChainId = "greenfield_5600-1"
sequence = 7
fee = greenfieldFee
mode = Greenfield.BroadcastMode.SYNC
privateKey = ByteString.copyFrom(key.data())
addMessages(Greenfield.Message.newBuilder().apply {
bridgeTransferOut = msgTransferOut
})
}.build()

val output = AnySigner.sign(signingInput, CoinType.GREENFIELD, Greenfield.SigningOutput.parser())

assertEquals(
output.serialized,
"{\"mode\":\"BROADCAST_MODE_SYNC\",\"tx_bytes\":\"CpkBCpYBCiEvZ3JlZW5maWVsZC5icmlkZ2UuTXNnVHJhbnNmZXJPdXQScQoqMHg5ZDFkOTdhREZjZDMyNEJiZDYwM0QzODcyQkQ3OGUwNDA5ODUxMGIxEioweDlkMWQ5N2FERmNkMzI0QmJkNjAzRDM4NzJCRDc4ZTA0MDk4NTEwYjEaFwoDQk5CEhA1NjcwMDAwMDAwMDAwMDAwEnUKWApNCiYvY29zbW9zLmNyeXB0by5ldGguZXRoc2VjcDI1NmsxLlB1YktleRIjCiECee80Bk2hDbBGPHBIBha6AgcD7DpFAm3ve+vSCC9db8gSBQoDCMgFGAcSGQoUCgNCTkISDTYwMDAwMDAwMDAwMDAQsAkaQc4DDByhu80Uy/M3sQePvAmhmbFWZeGq359rugtskEiXKfCzSB86XmBi+l+Q5ETDS2folMxbufHSE8gM4WBCHzgc\"}"
)
assertEquals(output.errorMessage, "")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ class TestNativeInjectiveSigner {
val output = AnySigner.sign(signingInput, CoinType.NATIVEINJECTIVE, Cosmos.SigningOutput.parser())

// https://www.mintscan.io/injective/txs/135DD2C4A1910E4334A9C0F15125DA992E724EBF23FEB9638FCB71218BB064A5
assertEquals(output.serialized, "{\"mode\":\"BROADCAST_MODE_BLOCK\",\"tx_bytes\":\"Co8BCowBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEmwKKmluajEzdTZnN3ZxZ3cwNzRtZ21mMnplMmNhZHp2a3o5c25sd2NydHE4YRIqaW5qMXhtcGtteHI0YXMwMGVtMjN0YzJ6Z211eXkyZ3I0aDN3Z2NsNnZkGhIKA2luahILMTAwMDAwMDAwMDASfgpeClQKLS9pbmplY3RpdmUuY3J5cHRvLnYxYmV0YTEuZXRoc2VjcDI1NmsxLlB1YktleRIjCiEDWgxrg7i9mCflBycMrbSZt+OpCVJG9qIhMoH3g9h3yYsSBAoCCAEYARIcChYKA2luahIPMTAwMDAwMDAwMDAwMDAwELDbBhpArNDBBEwHVKwuSDozLIwvOOhDQ/i7bXC6Av5ZefSQf7RS2ejrapX/JKXPsYrtMWadhKCedomODhujvWzzGwmXVA==\"}")
assertEquals(output.serialized, "{\"mode\":\"BROADCAST_MODE_BLOCK\",\"tx_bytes\":\"Co8BCowBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEmwKKmluajEzdTZnN3ZxZ3cwNzRtZ21mMnplMmNhZHp2a3o5c25sd2NydHE4YRIqaW5qMXhtcGtteHI0YXMwMGVtMjN0YzJ6Z211eXkyZ3I0aDN3Z2NsNnZkGhIKA2luahILMTAwMDAwMDAwMDASngEKfgp0Ci0vaW5qZWN0aXZlLmNyeXB0by52MWJldGExLmV0aHNlY3AyNTZrMS5QdWJLZXkSQwpBBFoMa4O4vZgn5QcnDK20mbfjqQlSRvaiITKB94PYd8mLJWdCdBsGOfMXdo/k9MJ2JmDCESKDp2hdgVUH3uMikXMSBAoCCAEYARIcChYKA2luahIPMTAwMDAwMDAwMDAwMDAwELDbBhpAx2vkplmzeK7n3puCFGPWhLd0l/ZC/CYkGl+stH+3S3hiCvIe7uwwMpUlNaSwvT8HwF1kNUp+Sx2m0Uo1x5xcFw==\"}")
}
}
2 changes: 1 addition & 1 deletion cmake/StandardSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ endif ()
option(TW_UNIT_TESTS "Enable the unit tests of the project" ON)
option(TW_BUILD_EXAMPLES "Enable the examples builds of the project" ON)

if (ANDROID OR IOS_PLATFORM OR TW_COMPILE_WASM)
if (ANDROID OR IOS_PLATFORM OR TW_COMPILE_WASM OR TW_COMPILE_JAVA)
set(TW_UNIT_TESTS OFF)
set(TW_BUILD_EXAMPLES OFF)
endif()
Expand Down
2 changes: 1 addition & 1 deletion codegen-v2/manifest/TWCoinType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ enums:
- name: boba
value: 10000288
- name: metis
value: 1001088
value: 10001088
- name: aurora
value: 1323161554
- name: evmos
Expand Down
6 changes: 3 additions & 3 deletions codegen/lib/code_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def render_kotlin_common
end

def render_kotlin_android
render_template(header: nil, template: 'kotlin_android.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/androidMain/generated/com/trustwallet/core', extension: 'kt')
render_template(header: nil, template: 'kotlin_android.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/generated/com/trustwallet/core', extension: 'kt')
end

def render_kotlin_ios
Expand All @@ -126,11 +126,11 @@ def render_kotlin_js_accessors
end

def render_kotlin_jni_h
render_template(header: 'copyright_header.erb', template: 'kotlin_jni_h.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/androidMain/cpp/generated', extension: 'h')
render_template(header: 'copyright_header.erb', template: 'kotlin_jni_h.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated', extension: 'h')
end

def render_kotlin_jni_c
render_template(header: 'copyright_header.erb', template: 'kotlin_jni_c.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/androidMain/cpp/generated', extension: 'c')
render_template(header: 'copyright_header.erb', template: 'kotlin_jni_c.erb', output_subfolder: 'kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/cpp/generated', extension: 'c')
end

def render(file, locals = {})
Expand Down
5 changes: 4 additions & 1 deletion docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ This list is generated from [./registry.json](../registry.json)
| 2301 | Qtum | QTUM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/qtum/info/logo.png" width="32" /> | <https://qtum.org> |
| 2718 | Nebulas | NAS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nebulas/info/logo.png" width="32" /> | <https://nebulas.io> |
| 3030 | Hedera | HBAR | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/hedera/info/logo.png" width="32" /> | <https://hedera.com/> |
| 5000 | Mantle | MNT | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/mantle/info/logo.png" width="32" /> | <https://www.mantle.xyz> |
| 5600 | BNB Greenfield | BNB | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/greenfield/info/logo.png" width="32" /> | <https://greenfield.bnbchain.org> |
| 6060 | GoChain | GO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/gochain/info/logo.png" width="32" /> | <https://gochain.io> |
| 7332 | Zen EON | ZEN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zeneon/info/logo.png" width="32" /> | <https://eon.horizen.io> |
| 8453 | Base | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png" width="32" /> | <https://base.mirror.xyz/> |
| 8964 | NULS | NULS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nuls/info/logo.png" width="32" /> | <https://nuls.io> |
| 14001 | WAX | WAXP | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wax/info/logo.png" width="32" /> | <http://wax.io> |
Expand All @@ -95,7 +98,7 @@ This list is generated from [./registry.json](../registry.json)
| 59144 | Linea | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/linea/info/logo.png" width="32" /> | <https://linea.build> |
| 105105 | Stratis | STRAX | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stratis/info/logo.png" width="32" /> | <https://www.stratisplatform.com/> |
| 534353 | Scroll | ETH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png" width="32" /> | <https://scroll.io> |
| 1001088 | Metis | METIS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/metis/info/logo.png" width="32" /> | <https://www.metis.io/> |
| 10001088 | Metis | METIS | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/metis/info/logo.png" width="32" /> | <https://www.metis.io/> |
| 5718350 | Wanchain | WAN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wanchain/info/logo.png" width="32" /> | <https://wanchain.org> |
| 5741564 | Waves | WAVES | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/waves/info/logo.png" width="32" /> | <https://wavesplatform.com> |
| 10000025 | Cronos Chain | CRO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cronos/info/logo.png" width="32" /> | <https://cronos.org> |
Expand Down
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWBlockchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ enum TWBlockchain {
TWBlockchainHedera = 48, // Hedera
TWBlockchainTheOpenNetwork = 49,
TWBlockchainSui = 50,
TWBlockchainGreenfield = 51,
};

TW_EXTERN_C_END
5 changes: 4 additions & 1 deletion include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ enum TWCoinType {
TWCoinTypeSyscoin = 57,
TWCoinTypeVerge = 77,
TWCoinTypeZen = 121,
TWCoinTypeMetis = 1001088,
TWCoinTypeMetis = 10001088,
TWCoinTypeAurora = 1323161554,
TWCoinTypeEvmos = 10009001,
TWCoinTypeNativeEvmos = 20009001,
Expand Down Expand Up @@ -174,6 +174,9 @@ enum TWCoinType {
TWCoinTypeSei = 19000118,
TWCoinTypeArbitrumNova = 10042170,
TWCoinTypeLinea = 59144,
TWCoinTypeGreenfield = 5600,
TWCoinTypeMantle = 5000,
TWCoinTypeZenEON = 7332,
};

/// Returns the blockchain for a coin type.
Expand Down
6 changes: 6 additions & 0 deletions jni/cpp/Random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <jni.h>
#include <string.h>
#include <stdint.h>

static JavaVM* cachedJVM;

Expand All @@ -27,7 +28,12 @@ uint32_t random32() {

void random_buffer(uint8_t *buf, size_t len) {
JNIEnv *env;

#if defined(__ANDROID__) || defined(ANDROID)
cachedJVM->AttachCurrentThread(&env, nullptr);
#else
cachedJVM->AttachCurrentThread((void **) &env, nullptr);
#endif

// SecureRandom random = new SecureRandom();
jclass secureRandomClass = env->FindClass("java/security/SecureRandom");
Expand Down
2 changes: 2 additions & 0 deletions kotlin/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_enum_constants_wrap = split_into_lines
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_packages_to_use_import_on_demand = *
ij_kotlin_wrap_first_method_in_call_chain = true
43 changes: 30 additions & 13 deletions kotlin/wallet-core-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:Suppress("UnstableApiUsage")
@file:Suppress("UnstableApiUsage", "OPT_IN_USAGE")

import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput

Expand All @@ -10,10 +10,20 @@ plugins {
}

kotlin {
targetHierarchy.default()

android {
publishLibraryVariants = listOf("release")
}

jvm {
testRuns.named("test") {
executionTask.configure {
useJUnitPlatform()
}
}
}

val nativeTargets =
listOf(
iosArm64(),
Expand All @@ -37,9 +47,6 @@ kotlin {
}
}

val androidMain by getting {
kotlin.srcDir(projectDir.resolve("src/androidMain/generated"))
}
val commonMain by getting {
kotlin.srcDirs(
projectDir.resolve("src/commonMain/generated"),
Expand All @@ -50,18 +57,28 @@ kotlin {
api(libs.wire.runtime)
}
}
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosX64Main by getting
val iosMain by creating {
kotlin.srcDir(projectDir.resolve("src/iosMain/generated"))

getByName("commonTest") {
dependencies {
implementation(kotlin("test"))
}
}

val androidMain by getting
val jvmMain by getting
create("commonAndroidJvmMain") {
kotlin.srcDir(projectDir.resolve("src/commonAndroidJvmMain/generated"))

dependsOn(commonMain)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
iosX64Main.dependsOn(this)
androidMain.dependsOn(this)
jvmMain.dependsOn(this)
}
val jsMain by getting {

getByName("iosMain") {
kotlin.srcDir(projectDir.resolve("src/iosMain/generated"))
}

getByName("jsMain") {
kotlin.srcDir(projectDir.resolve("src/jsMain/generated"))
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.trustwallet.core

actual object LibLoader {
actual fun loadLibrary() {
throw NotImplementedError()
}
}
Loading

0 comments on commit 6bc8ec4

Please sign in to comment.