TrustWalletCore/WalletCore pod in Kotlin Multiplatform - almost no classes

178 Views Asked by At

In our Kotlin Mobile Multiplatform project for iOS and Android, we're trying to access TrustWalletCore cocoapod from Kotlin.

// build.gradle.kts (:shared)
cocoapods {
   version = "1.0"
   podfile = project.file("../iosApp/Podfile")
   pod("WalletCore")
}

And the Podfile is

target 'iosApp' do
  pod 'TrustWalletCore'
end

This successfully enables import cocoapods.WalletCore.* in shared/iosMain - without the above cocoapods {...} the import is unavailable.

However, only a Crypto class is available from this package (and CryptoMeta which doesn't look too different). only Crypto class

By the looks of it, it's generated from the Pod/library by commonizer in 0_WalletCore.knm (about 15 expect functions in total - a couple here for illustration):

@kotlin.commonizer.ObjCCallable public open external expect fun base58Encode(data: platform.Foundation.NSData): kotlin.String { /* compiled code */ }

@kotlin.commonizer.ObjCCallable public open external expect fun generateMnemonicFromSeed(seed: platform.Foundation.NSData): kotlin.String { /* compiled code */ }

It has mnemonic-related functionality, as well as signHash/verifySignature but not much else.

I was hoping to see - available to import in Kotlin - classes like HDWallet, EthereumSigningInput etc. I can use these library classes in Swift, via pod TrustWalletCore in Xcode (import WalletCore).

WHY can I not get a similar/full set of classes via native.cocoapods plugin?

1

There are 1 best solutions below

0
On

Try to declare dependency with moduleName parameter:

kotlin {
    cocoapods {
        ...
        pod(name = "TrustWalletCore", version = "3.1.0", moduleName = "WalletCore")
    }
}