You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to pass my own JsonAdapter that implements the MoshiAdapterFactory interface to the NetworkingRouterConfig() then it throws an exception as soon as it get used.
UserJsonAdapter.kt:
class UserJsonAdapter: MoshiAdapterFactory {
private lateinit var borsh: Borsh
override fun create(borsh: Borsh): Object {
this.borsh = borsh
return Object()
}
@FromJson
fun fromJson(rawData: Any): Buffer<User> = Buffer.create(borsh = borsh, rawData = rawData, clazz = User::class.java)
}
Exception: java.lang.IllegalArgumentException: Expected at least one @ToJson or @FromJson method on java.lang.Object at com.squareup.moshi.AdapterMethodsFactory.get(AdapterMethodsFactory.java:153) at com.squareup.moshi.Moshi$Builder.add(Moshi.java:223) at com.solana.networking.OkHttpNetworkingRouter$moshi$2.invoke(NetworkingRouter.kt:68) at com.solana.networking.OkHttpNetworkingRouter$moshi$2.invoke(NetworkingRouter.kt:60)
The text was updated successfully, but these errors were encountered:
tmcyrix
changed the title
Exception while passing a own moshiAdapters to NetworkingRouterConfig
Exception while passing own moshiAdapters to NetworkingRouterConfig
Oct 2, 2022
I need to pass my own JsonAdapter that implements the MoshiAdapterFactory interface to the NetworkingRouterConfig() then it throws an exception as soon as it get used.
UserJsonAdapter.kt:
Solana initialization:
Exception:
java.lang.IllegalArgumentException: Expected at least one @ToJson or @FromJson method on java.lang.Object at com.squareup.moshi.AdapterMethodsFactory.get(AdapterMethodsFactory.java:153) at com.squareup.moshi.Moshi$Builder.add(Moshi.java:223) at com.solana.networking.OkHttpNetworkingRouter$moshi$2.invoke(NetworkingRouter.kt:68) at com.solana.networking.OkHttpNetworkingRouter$moshi$2.invoke(NetworkingRouter.kt:60)
The text was updated successfully, but these errors were encountered: