Skip to content

Commit de9af8a

Browse files
authored
Merge pull request #325 from soramitsu/rc/1.8.3
Rc/1.8.3
2 parents c33bf77 + e37d57b commit de9af8a

File tree

112 files changed

+889
-521
lines changed

Some content is hidden

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

112 files changed

+889
-521
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ To build Fearless Wallet Android project, you need to provide several keys eithe
2121
``` properties
2222
MOONPAY_TEST_SECRET=stub
2323
MOONPAY_PRODUCTION_SECRET=stub
24+
SUBSCAN_API_KEY=
2425
```
2526

2627
Note, that with stub keys buy via moonpay will not work correctly. However, other parts of application will not be affected.
2728

29+
If you will leave SUBSCAN_API_KEY value empty, you will have very strict limits for the subscan api requests. If you want to increase the limits, check the [Subscan website](https://docs.api.subscan.io/#introduction) and then add the api key to the 'local.properties' -> SUBSCAN_API_KEY=YOUR_API_KEY
30+
2831
## License
2932
Fearless Wallet Android is available under the Apache 2.0 license. See the LICENSE file for more info.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
buildscript {
22
ext {
33
// App version
4-
versionName = '1.8.2'
5-
versionCode = 17
4+
versionName = '1.8.3'
5+
versionCode = 19
66

77
// SDK and tools
88
compileSdkVersion = 29

common/src/main/java/jp/co/soramitsu/common/data/network/NetworkApiCreator.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ class NetworkApiCreator(
1010
private val baseUrl: String
1111
) {
1212

13-
fun <T> create(service: Class<T>): T {
13+
fun <T> create(
14+
service: Class<T>,
15+
customBaseUrl: String = baseUrl
16+
): T {
1417
val retrofit = Retrofit.Builder()
1518
.client(okHttpClient)
16-
.baseUrl(baseUrl)
19+
.baseUrl(customBaseUrl)
1720
.addConverterFactory(ScalarsConverterFactory.create())
1821
.addConverterFactory(GsonConverterFactory.create())
1922
.build()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package jp.co.soramitsu.common.data.network.rpc
2+
3+
import jp.co.soramitsu.fearless_utils.extensions.toHexString
4+
import java.io.ByteArrayOutputStream
5+
6+
private const val CHILD_KEY_DEFAULT = ":child_storage:default:"
7+
8+
suspend fun childStateKey(
9+
builder: suspend ByteArrayOutputStream.() -> Unit
10+
): String {
11+
val buffer = ByteArrayOutputStream().apply {
12+
write(CHILD_KEY_DEFAULT.encodeToByteArray())
13+
14+
builder()
15+
}
16+
17+
return buffer.toByteArray().toHexString(withPrefix = true)
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package jp.co.soramitsu.common.data.network.runtime.binding
2+
3+
import java.math.BigInteger
4+
5+
typealias BalanceOf = BigInteger

common/src/main/java/jp/co/soramitsu/common/data/network/runtime/binding/BindingHelpers.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ annotation class HelperBinding
1818
fun incompatible(): Nothing = throw IllegalStateException("Binding is incompatible")
1919

2020
typealias Binder<T> = (scale: String?, RuntimeSnapshot) -> T
21+
typealias BinderWithKey<T, K> = (scale: String?, RuntimeSnapshot, key: K) -> T
2122
typealias NonNullBinder<T> = (scale: String, RuntimeSnapshot) -> T
23+
typealias NonNullBinderWithType<T> = (scale: String, RuntimeSnapshot, Type<*>) -> T
2224
typealias BinderWithType<T> = (scale: String?, RuntimeSnapshot, Type<*>) -> T
2325

2426
@OptIn(ExperimentalContracts::class)

common/src/main/java/jp/co/soramitsu/common/data/network/runtime/binding/Primitive.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ import java.math.BigInteger
44

55
@HelperBinding
66
fun bindNumber(dynamicInstance: Any?): BigInteger = dynamicInstance.cast()
7+
8+
@HelperBinding
9+
fun bindString(dynamicInstance: Any?): String = dynamicInstance.cast<ByteArray>().decodeToString()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package jp.co.soramitsu.common.data.network.runtime.calls
2+
3+
import jp.co.soramitsu.fearless_utils.wsrpc.request.runtime.RuntimeRequest
4+
5+
class GetChildStateRequest(
6+
storageKey: String,
7+
childKey: String
8+
) : RuntimeRequest(
9+
method = "childstate_getStorage",
10+
params = listOf(childKey, storageKey)
11+
)

common/src/main/java/jp/co/soramitsu/common/mixin/impl/ValidatableUi.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ package jp.co.soramitsu.common.mixin.impl
22

33
import android.content.Context
44
import jp.co.soramitsu.common.base.BaseFragment
5-
import jp.co.soramitsu.common.base.BaseViewModel
65
import jp.co.soramitsu.common.mixin.api.Validatable
76
import jp.co.soramitsu.common.validation.DefaultFailureLevel
87
import jp.co.soramitsu.common.view.dialog.errorDialog
98
import jp.co.soramitsu.common.view.dialog.warningDialog
109

11-
fun <T> BaseFragment<T>.observeValidations(
12-
viewModel: T,
10+
fun BaseFragment<*>.observeValidations(
11+
viewModel: Validatable,
1312
dialogContext: Context = requireContext()
14-
) where T : BaseViewModel, T : Validatable {
13+
) {
1514
viewModel.validationFailureEvent.observeEvent {
1615
val level = it.level
1716

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package jp.co.soramitsu.common.utils
2+
3+
import jp.co.soramitsu.fearless_utils.hash.Hasher.blake2b256
4+
import kotlinx.coroutines.sync.Mutex
5+
import kotlinx.coroutines.sync.withLock
6+
7+
object ConcurrentHasher {
8+
9+
private val mutex = Mutex()
10+
11+
suspend fun ByteArray.concurrentBlake2b256() = mutex.withLock { blake2b256() }
12+
}

0 commit comments

Comments
 (0)