Skip to content

Commit

Permalink
Merge pull request #1068 from novasamatech/rc/6.7.3
Browse files Browse the repository at this point in the history
Rc/6.7.3
  • Loading branch information
valentunn authored Aug 21, 2023
2 parents 9da3778 + 025fd49 commit cee1ad2
Show file tree
Hide file tree
Showing 80 changed files with 1,268 additions and 317 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ on:
gradlew-command:
required: false
type: string
default: false
default: "false"
run-tests:
required: false
type: boolean
default: true
keystore-file-name:
required: false
type: string
default: false
default: "false"
keystore-file-base64:
required: false
type: string
default: "false"
secrets:
ACALA_PROD_AUTH_TOKEN:
required: true
Expand Down Expand Up @@ -94,6 +95,8 @@ env:
CI_GITHUB_KEYSTORE_PASS: ${{ secrets.CI_GITHUB_KEYSTORE_PASS }}
CI_GITHUB_KEYSTORE_KEY_ALIAS: ${{ secrets.CI_GITHUB_KEYSTORE_KEY_ALIAS }}
CI_GITHUB_KEYSTORE_KEY_PASS: ${{ secrets.CI_GITHUB_KEYSTORE_KEY_PASS }}
CI_GITHUB_KEYSTORE_KEY_FILE: ${{ secrets.BASE64_GITHUB_KEYSTORE_FILE }}


jobs:
build-app:
Expand All @@ -113,14 +116,21 @@ jobs:
if: ${{ inputs.run-tests }} == "true"
run: ./gradlew runTest

- name: 🔐 Getting sign key
if: ${{ !startsWith(inputs.keystore-file-name, 'false') }}
id: write_file
- name: 🔐 Getting github sign key
if: ${{ startsWith(inputs.keystore-file-name, 'github_key.jks') }}
uses: timheuer/[email protected]
with:
fileName: ${{ inputs.keystore-file-name }}
fileDir: './app/'
encodedString: ${{ env.CI_GITHUB_KEYSTORE_KEY_FILE }}

- name: 🔐 Getting market sign key
if: ${{ startsWith(inputs.keystore-file-name, 'market_key.jks') }}
uses: timheuer/[email protected]
with:
fileName: ${{ inputs.keystore-file-name }}
fileDir: './app/'
encodedString: ${{ inputs.keystore-file-base64 }}
encodedString: ${{ env.CI_MARKET_KEY_FILE }}

- name: 🏗 Build app
if: ${{ !startsWith(inputs.gradlew-command, 'false') }}
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/publish_github_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish GitHub release

on:
push:
tags:
- '*'

jobs:
build:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
with:
branch: master
gradlew-command: assembleReleaseGithub
keystore-file-name: github_key.jks
secrets: inherit

create-release:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v2

- name: Download built artifact
uses: actions/download-artifact@v2
with:
name: apk
path: app

- name: Rename artifacts
run: mv app/releaseGithub/app-releaseGithub.apk app/releaseGithub/nova-wallet-android-${{ github.ref_name }}-github.apk

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true
draft: true
files: app/releaseGithub/nova-wallet-android-${{ github.ref_name }}-github.apk
44 changes: 44 additions & 0 deletions .github/workflows/update_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bump app version

on:
push:
branches:
['master']

jobs:
update-tag:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Version in build.gradle
run: |
versionName=$(grep "versionName" build.gradle | grep -o "'.*'")
versionName=${versionName//\'/}
echo Version in gradle file: $versionName
echo "GRADLE_APP_VERSION=$versionName" >> "$GITHUB_ENV"
- name: Was version changed?
id: version
run: |
if [[ ${{ env.GRADLE_APP_VERSION }} == ${{ secrets.ANDROID_APP_VERSION }} ]]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- uses: rickstaa/action-create-tag@v1
if: steps.version.outputs.changed == 'true'
with:
tag: 'v${{ env.GRADLE_APP_VERSION }}'
message: Release v${{ env.GRADLE_APP_VERSION }}

- name: Write app version to secrets
if: steps.version.outputs.changed == 'true'
uses: hmanzur/[email protected]
with:
name: 'ANDROID_APP_VERSION'
value: ${{ env.GRADLE_APP_VERSION }}
repository: novasamatech/nova-wallet-android
token: ${{ secrets.WRITE_SECRET_PAT }}
5 changes: 4 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Nova - Polkadot, Kusama wallet

Copyright 2022 Novasama Technologies PTE. LTD.
Copyright 2022-2023 Novasama Technologies PTE. LTD.
This product includes software developed at Novasama Technologies PTE. LTD.

Some parts of this product are derived from https://github.com/soramitsu/fearless-Android, which belongs to Soramitsu K.K. and was mostly developed by our team of developers from May 1, 2020, to October 5, 2021.
Copyright 2021, Soramitsu Helvetia AG, all rights reserved.

License Rights transferred from Novasama Technologies PTE. LTD to Novasama Technologies GmbH starting from 1st of April 2023
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Developed by former Fearless Wallet team & based on open source work under Apach

## License
Nova Wallet Android is available under the Apache 2.0 license. See the LICENSE file for more info.
© Novasama Technologies GmbH 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package io.novafoundation.nova

import android.util.Log
import io.novafoundation.nova.common.utils.average
import io.novafoundation.nova.common.utils.divideToDecimal
import io.novafoundation.nova.runtime.ethereum.gas.LegacyGasPriceProvider
import io.novafoundation.nova.runtime.ethereum.gas.MaxPriorityFeeGasProvider
import io.novafoundation.nova.runtime.ext.Ids
import io.novafoundation.nova.runtime.multiNetwork.awaitCallEthereumApiOrThrow
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.take
import org.junit.Test
import java.math.BigInteger

class GasPriceProviderIntegrationTest : BaseIntegrationTest() {

@Test
fun compareLegacyAndImprovedGasPriceEstimations() = runTest {
val api = chainRegistry.awaitCallEthereumApiOrThrow(Chain.Ids.MOONBEAM)

val legacy = LegacyGasPriceProvider(api)
val improved = MaxPriorityFeeGasProvider(api)

val legacyStats = mutableSetOf<BigInteger>()
val improvedStats = mutableSetOf<BigInteger>()

api.newHeadsFlow().map {
legacyStats.add(legacy.getGasPrice())
improvedStats.add(improved.getGasPrice())
}
.take(1000)
.collect()

legacyStats.printStats("Legacy")
improvedStats.printStats("Improved")
}

private fun Set<BigInteger>.printStats(name: String) {
val min = min()
val max = max()

Log.d("GasPriceProviderIntegrationTest", """
Stats for $name source
Min: $min
Max: $max
Avg: ${average()}
Max/Min ratio: ${max.divideToDecimal(min)}
""")
}
}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '6.7.2'
versionCode = 85
versionName = '6.7.3'
versionCode = 86

applicationId = "io.novafoundation.nova"
releaseApplicationSuffix = "market"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ open class BaseViewModel : ViewModel(), CoroutineScope, WithCoroutineScopeExtens
suspend fun <P, S> ValidationExecutor.requireValid(
validationSystem: ValidationSystem<P, S>,
payload: P,
validationFailureTransformerCustom: (ValidationStatus.NotValid<S>, ValidationFlowActions) -> TransformedFailure,
validationFailureTransformerCustom: (ValidationStatus.NotValid<S>, ValidationFlowActions) -> TransformedFailure?,
autoFixPayload: (original: P, failureStatus: S) -> P = { original, _ -> original },
progressConsumer: ProgressConsumer? = null,
block: (P) -> Unit,
) = requireValid(
Expand All @@ -84,6 +85,7 @@ open class BaseViewModel : ViewModel(), CoroutineScope, WithCoroutineScopeExtens
errorDisplayer = ::showError,
validationFailureTransformerCustom = validationFailureTransformerCustom,
progressConsumer = progressConsumer,
autoFixPayload = autoFixPayload,
block = block
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ import java.io.InputStream
import java.math.BigDecimal
import java.math.BigInteger
import java.math.MathContext
import java.util.Calendar
import java.util.Collections
import java.util.Date
import java.util.UUID
import java.util.Collections
import java.util.Calendar
import java.util.concurrent.TimeUnit
import kotlin.Comparator
import kotlin.collections.HashMap
import kotlin.collections.LinkedHashMap
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.math.sqrt
Expand Down Expand Up @@ -49,6 +46,16 @@ inline fun <K, V> List<V>.associateByMultiple(keysExtractor: (V) -> Iterable<K>)
return destination
}

fun ByteArray.startsWith(prefix: ByteArray): Boolean {
if (prefix.size > size) return false

prefix.forEachIndexed { index, byte ->
if (get(index) != byte) return false
}

return true
}

/**
* Compares two BigDecimals taking into account only values but not scale unlike `==` operator
*/
Expand All @@ -74,10 +81,6 @@ val BigDecimal.isNonNegative: Boolean
val BigInteger.isZero: Boolean
get() = signum() == 0

inline fun <T : Comparable<T>, R : Comparable<R>> ClosedRange<T>.map(mapper: (T) -> R): ClosedRange<R> {
return mapper(start)..mapper(endInclusive)
}

fun BigInteger?.orZero(): BigInteger = this ?: BigInteger.ZERO
fun BigDecimal?.orZero(): BigDecimal = this ?: 0.toBigDecimal()

Expand Down Expand Up @@ -178,6 +181,12 @@ fun List<Double>.median(): Double = sorted().let {
(middleLeft + middleRight) / 2
}

fun Collection<BigInteger>.average(): BigInteger {
if (isEmpty()) throw NoSuchFieldException("Collection is empty")

return sum() / size.toBigInteger()
}

fun generateLinearSequence(initial: Int, step: Int) = generateSequence(initial) { it + step }

fun <T> Set<T>.toggle(item: T): Set<T> = if (item in this) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.novafoundation.nova.common.utils

interface SemiUnboundedRange<T : Comparable<T>> {

val start: T

val endInclusive: T?
}

infix operator fun <T : Comparable<T>> T.rangeTo(another: T?): SemiUnboundedRange<T> {
return ComparableSemiUnboundedRange(this, another)
}

inline fun <T : Comparable<T>, R : Comparable<R>> SemiUnboundedRange<T>.map(mapper: (T) -> R): SemiUnboundedRange<R> {
return mapper(start)..endInclusive?.let(mapper)
}

class ComparableSemiUnboundedRange<T : Comparable<T>>(override val start: T, override val endInclusive: T?) : SemiUnboundedRange<T>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ValidationExecutor : Validatable {
validationSystem: ValidationSystem<P, S>,
payload: P,
errorDisplayer: (Throwable) -> Unit,
validationFailureTransformerCustom: (ValidationStatus.NotValid<S>, ValidationFlowActions) -> TransformedFailure,
validationFailureTransformerCustom: (ValidationStatus.NotValid<S>, ValidationFlowActions) -> TransformedFailure?,
progressConsumer: ProgressConsumer? = null,
autoFixPayload: (original: P, failureStatus: S) -> P = { original, _ -> original },
block: (P) -> Unit,
Expand Down Expand Up @@ -65,9 +65,13 @@ class ValidationExecutor : Validatable {
confirmWarning = validationFlowActions::resumeFlow
)
}

null -> null
}

validationFailureEvent.value = Event(eventPayload)
eventPayload?.let {
validationFailureEvent.value = Event(eventPayload)
}
}
)
}
Expand Down
12 changes: 9 additions & 3 deletions common/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<string name="accounts_change_chain_secrets">Изменить аккаунт</string>
<string name="add_delegation_missing_account_message">Вы должны добавить %s аккаунт в кошелек, чтобы иметь возможность делегировать</string>
<string name="asset_add_evm_token_already_exist_message">Введенный адрес контракта уже добавлен в Nova как токен %s.</string>
<string name="asset_add_evm_token_already_exist_modifiable_message">Введенный адрес контракта присутствует в Nova как токен %s. Вы уверены, что хотите изменить его?</string>
<string name="asset_add_evm_token_already_exist_title">Этот токен уже добавлен</string>
<string name="asset_add_evm_token_invalid_coin_gecko_link_message">Пожалуйста, убедитесь, что введенный URL-адрес имеет следующую форму: www.coingecko.com/en/coins/tether.</string>
<string name="asset_add_evm_token_invalid_coin_gecko_link_title">Недействительная ссылка на CoinGecko</string>
Expand Down Expand Up @@ -163,7 +164,7 @@
<string name="assets_receive_ledger_not_supported_message" formatted="false">Не переводите %s на Ledger аккаунт так как Ledger не поддерживает переводы %s, таким образом ассет будет недоступен для перевода на этом аккаунте</string>
<string name="assets_receive_ledger_not_supported_title">Ledger не поддерживает этот токен</string>
<string name="assets_search_hint">Поиск по названию сети или токена</string>
<string name="assets_search_placeholder">Токены с указанным именем\nне найдены</string>
<string name="assets_search_placeholder">Токены и сети с указанным именем\nне найдены</string>
<string name="assets_select_send_your_wallets">Ваши кошельки</string>
<string name="biometric_auth_title">Биометрия</string>
<string name="buy_completed">Покупка совершена! Ожидайте до 60 минут. Вы можете отслеживать статус по электронной почте.</string>
Expand Down Expand Up @@ -234,6 +235,8 @@
<string name="common_existential_warning_title">Операция удалит аккаунт</string>
<string name="common_expired">Истекла</string>
<string name="common_explore">Исследуй</string>
<string name="common_fee_changed_message" formatted="false">Предполагаемая комиссия %s намного выше, чем комиссия по умолчанию (%s). Это может быть связано с временной перегрузкой сети. Вы можете обновить комиссию, чтобы дождаться более низкой суммы.</string>
<string name="common_fee_changed_title">Комиссия сети слишком высокая</string>
<string name="common_filter_sort_header">Сортировать по:</string>
<string name="common_filters">Фильтры</string>
<string name="common_find_out_more">Узнать больше</string>
Expand Down Expand Up @@ -305,6 +308,7 @@
<string name="common_price">Цена</string>
<string name="common_proceed">Продолжить</string>
<string name="common_read_more">Подробнее</string>
<string name="common_refresh_fee">Обновить</string>
<string name="common_reject">Отклонить</string>
<string name="common_remove">Удалить</string>
<string name="common_required">Обязательные</string>
Expand Down Expand Up @@ -739,6 +743,8 @@
<string name="select_ledger_location_enable_request_message">Nova нуждается в включении местоположения, чтобы иметь возможность выполнять сканирование Bluetooth для поиска вашего устройства Ledger</string>
<string name="select_ledger_location_enable_request_title">Пожалуйста, включите геолокацию в настройках устройства</string>
<string name="send_address_hint">Адрес или w3n</string>
<string name="send_recipient_system_account_message">Получатель является системным аккаунтом. Этот аккаунт не контролируется какой-либо компанией или частным лицом. \nВы уверены, что все еще хотите выполнить данный перевод?</string>
<string name="send_recipient_system_account_title">Токены будут потеряны</string>
<string name="settings_biometric_not_ready_message">Пожалуйста, убедитесь, что биометрия включена в настройках</string>
<string name="settings_biometric_not_ready_title">Биометрия отключена в настройках</string>
<string name="settings_community">Сообщество</string>
Expand Down Expand Up @@ -798,8 +804,8 @@
<string name="staking_custom_validators_update_list">Обновить свой список</string>
<string name="staking_dashboard_browser_stake_header">Стейкинг через DApp браузер Nova</string>
<string name="staking_dashboard_more_options">Больше вариантов стейкинга</string>
<string name="staking_dashboard_no_stake_header">Стейкайте и получайте вознаграждения</string>
<string name="staking_earnings_per_year">Примерная доходность</string>
<string name="staking_dashboard_no_stake_header">Стейкайте и получайте награды</string>
<string name="staking_earnings_per_year">Примерный доход</string>
<string name="staking_era_title">эра %s</string>
<string name="staking_estimate_earning_title_v1.9.0">Расчёт доходности</string>
<string name="staking_estimate_earning_title_v2_2_0">Расчёт доходности %s</string>
Expand Down
Loading

0 comments on commit cee1ad2

Please sign in to comment.