Skip to content

Commit

Permalink
v5.0.21
Browse files Browse the repository at this point in the history
* fix invalid data crash

* spam folder, bug fixeds, update libs

* fix fastlane

* bug fixeds for need_for_release

* copy code from ledger repo

* bug fixeds

* bug fixeds for release

* bug fixeds

* delete usb ledger code

* baseline

* ledger bug fixes

* bug fixeds

* add uk build

* fix fastlane

* add LICENSE

* bug fixeds (#122)

* bug fixeds

* Bug fixeds

* fix transfer deeplink

* install refferer

* fee fixeds

* upd dep

* fix webview

* bug fixeds

* fix webview deeplink

* send balance fix

* fixeds

* insufficient founds fix

Signed-off-by: polstianka <peer_id@yahoo.com>

* fixed

* fix battery

* fixeds remote config

* upd version

* run action after push to dev branch

---------

Signed-off-by: polstianka <peer_id@yahoo.com>

* fixeds for refferer (#127)

* fixeds for refferer

Signed-off-by: polstianka <peer_id@yahoo.com>

* add manual build in github action

Signed-off-by: polstianka <peer_id@yahoo.com>

* trigger github action

Signed-off-by: polstianka <peer_id@yahoo.com>

* remove trigger

Signed-off-by: polstianka <peer_id@yahoo.com>

* fix referrer

Signed-off-by: polstianka <peer_id@yahoo.com>

---------

Signed-off-by: polstianka <peer_id@yahoo.com>

---------

Signed-off-by: polstianka <peer_id@yahoo.com>
Co-authored-by: Andrey Sorokin <sorokin0andrey@gmail.com>
  • Loading branch information
polstianka and sorokin0andrey authored Feb 21, 2025
1 parent 8f120f7 commit 3212973
Show file tree
Hide file tree
Showing 722 changed files with 51,826 additions and 181,873 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Android APK build CD
on:
push:
branches:
- dev
- 'dev'
workflow_dispatch:

jobs:
android-build:
Expand Down Expand Up @@ -44,13 +45,13 @@ jobs:
- name: Upload android aab to artifacts
uses: actions/upload-artifact@v4
with:
name: Tonkeeper X aab ${{ env.VERSION_CODE }}
name: Tonkeeper aab ${{ env.VERSION_CODE }}
path: |
${{ env.AAB_OUTPUT_PATH }}
- name: Upload android apk to artifacts
uses: actions/upload-artifact@v4
with:
name: Tonkeeper X apk ${{ env.VERSION_CODE }}
name: Tonkeeper apk ${{ env.VERSION_CODE }}
path: |
${{ env.APK_OUTPUT_PATH }}
54 changes: 54 additions & 0 deletions .github/workflows/uk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Android UK build CD

on:
workflow_dispatch:

jobs:
android-build:
name: android-build
runs-on: macos-latest

steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 20.0.2+9

- name: Decode signing certificate into a file
env:
CERTIFICATE_BASE64: ${{ secrets.ANDROID_DIST_SIGNING_KEY }}
run: |
echo $CERTIFICATE_BASE64 | base64 --decode > google-release.keystore
- name: Build android beta
run: bundle exec fastlane android beta_uk
env:
KEYSTORE_FILE: ${{ github.workspace }}/google-release.keystore
KEYSTORE_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.TONKEEPER_UPLOAD_KEY_ALIAS}}
KEY_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_KEY_PASSWORD }}
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}

- name: Upload android aab to artifacts
uses: actions/upload-artifact@v4
with:
name: Tonkeeper UK aab ${{ env.VERSION_CODE }}
path: |
${{ env.AAB_OUTPUT_PATH }}
- name: Upload android apk to artifacts
uses: actions/upload-artifact@v4
with:
name: Tonkeeper UK apk ${{ env.VERSION_CODE }}
path: |
${{ env.APK_OUTPUT_PATH }}
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.tonapps.wallet.api

import android.content.Context
import android.net.Uri
import android.util.ArrayMap
import android.util.Log
import com.squareup.moshi.JsonAdapter
import com.tonapps.blockchain.ton.contract.BaseWalletContract
import com.tonapps.blockchain.ton.contract.WalletVersion
Expand All @@ -13,9 +15,11 @@ import com.tonapps.blockchain.ton.extensions.toRawAddress
import com.tonapps.extensions.toUriOrNull
import com.tonapps.icu.Coins
import com.tonapps.network.SSEvent
import com.tonapps.network.execute
import com.tonapps.network.get
import com.tonapps.network.post
import com.tonapps.network.postJSON
import com.tonapps.network.requestBuilder
import com.tonapps.network.sse
import com.tonapps.wallet.api.core.SourceAPI
import com.tonapps.wallet.api.entity.AccountDetailsEntity
Expand Down Expand Up @@ -116,6 +120,7 @@ class API(
builder.addHeader(key, value)
}
}
builder.addHeader("Authorization", "Bearer ${config.tonApiV2Key}")

if (methodOptions.equals("POST", ignoreCase = true)) {
builder.post(bodyOptions.toRequestBody(contentTypeOptions.toMediaType()))
Expand Down Expand Up @@ -756,20 +761,16 @@ class API(
firebaseToken: String,
): Boolean {
return try {
val url = "${config.tonapiMainnetHost}/v1/internal/pushes/tonconnect"

val json = JSONObject()
json.put("app_url", appUrl)
json.put("account", accountId)
json.put("firebase_token", firebaseToken)
json.put("commercial", false)
json.put("silent", true)
val data = json.toString().replace("\\/", "/")

tonAPIHttpClient.postJSON(url, data, ArrayMap<String, String>().apply {
set("X-TonConnect-Auth", token)
set("Connection", "close")
}).isSuccessful
val uriBuilder = Uri.parse("${config.tonapiMainnetHost}/v1/internal/pushes/tonconnect").buildUpon()
uriBuilder.appendQueryParameter("firebase_token", firebaseToken)
uriBuilder.appendQueryParameter("app_url", appUrl)
uriBuilder.appendQueryParameter("account", accountId)

val builder = requestBuilder(uriBuilder.build().toString())
builder.delete()
builder.addHeader("X-TonConnect-Auth", token)
builder.addHeader("Connection", "close")
tonAPIHttpClient.execute(builder.build()).isSuccessful
} catch (e: Throwable) {
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import android.os.Parcelable
import android.util.Log
import com.tonapps.blockchain.ton.contract.BaseWalletContract
import com.tonapps.blockchain.ton.contract.WalletVersion
import com.tonapps.blockchain.ton.extensions.isValidTonAddress
import com.tonapps.blockchain.ton.extensions.toRawAddress
import com.tonapps.blockchain.ton.extensions.toUserFriendly
import io.tonapi.models.Account
import io.tonapi.models.AccountStatus
import kotlinx.parcelize.Parcelize
Expand All @@ -17,6 +20,7 @@ data class AccountDetailsEntity(
val balance: Long,
val new: Boolean = false,
val initialized: Boolean,
val testnet: Boolean,
): Parcelable {

val address: String
Expand All @@ -29,29 +33,55 @@ data class AccountDetailsEntity(
contract: BaseWalletContract,
testnet: Boolean,
new: Boolean = false,
initialized: Boolean
initialized: Boolean,
) : this(
query = "",
preview = AccountEntity(contract.address, testnet),
active = true,
walletVersion = contract.getWalletVersion(),
balance = 0,
new = new,
initialized = initialized
initialized = initialized,
testnet = testnet,
)

constructor(query: String, account: Account, testnet: Boolean, new: Boolean = false) : this(
constructor(
query: String,
account: Account,
testnet: Boolean,
new: Boolean = false
) : this(
query = query,
preview = AccountEntity(account, testnet),
active = account.status == AccountStatus.active,
walletVersion = resolveVersion(account.interfaces),
walletVersion = resolveVersion(testnet, account.interfaces, account.address),
balance = account.balance,
new = new,
initialized = account.status == AccountStatus.active || account.status == AccountStatus.frozen
initialized = account.status == AccountStatus.active || account.status == AccountStatus.frozen,
testnet = testnet,
)

private companion object {
private fun resolveVersion(interfaces: List<String>?): WalletVersion {

private fun resolveVersion(testnet: Boolean, interfaces: List<String>?, address: String): WalletVersion {
val version = resolveVersionByInterface(interfaces)
if (version == WalletVersion.UNKNOWN) {
return resolveVersionByAddress(address.toUserFriendly(
wallet = true,
testnet = testnet,
))
}
return version
}

private fun resolveVersionByAddress(userFriendlyAddress: String): WalletVersion {
/*if (userFriendlyAddress.isValidTonAddress()) {
return WalletVersion.V5BETA
}*/
return WalletVersion.UNKNOWN
}

private fun resolveVersionByInterface(interfaces: List<String>?): WalletVersion {
interfaces ?: return WalletVersion.UNKNOWN
return if (interfaces.contains("wallet_v5_beta")) {
WalletVersion.V5BETA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ data class ConfigEntity(
val batteryMeanPriceNft: String,
val batteryMeanPriceSwap: String,
val batteryMeanPriceJetton: String,
val disableBatteryCryptoRecharge: Boolean,
val disableBatteryIapModule: Boolean,
val batteryReservedAmount: String,
val batteryMaxInputAmount: String,
Expand Down Expand Up @@ -68,7 +67,7 @@ data class ConfigEntity(

@IgnoredOnParcel
val domains: List<String> by lazy {
listOf(tonapiMainnetHost, tonapiTestnetHost, tonapiSSEEndpoint, tonapiSSETestnetEndpoint, "https://bridge.tonapi.io/")
listOf(tonapiMainnetHost, tonapiTestnetHost, tonapiSSEEndpoint, tonapiSSETestnetEndpoint, "https://bridge.tonapi.io/", "https://tonapi.io/")
}

@IgnoredOnParcel
Expand Down Expand Up @@ -109,7 +108,6 @@ data class ConfigEntity(
batteryDisabled = json.optBoolean("disable_battery", false),
batterySendDisabled = json.optBoolean("disable_battery_send", false),
batteryMeanFees = json.optString("batteryMeanFees", "0.0055"),
disableBatteryCryptoRecharge = json.optBoolean("disable_battery_crypto_recharge_module", false),
disableBatteryIapModule = json.optBoolean("disable_battery_iap_module", false),
batteryMeanPriceNft = json.optString("batteryMeanPrice_nft", "0.03"),
batteryMeanPriceSwap = json.optString("batteryMeanPrice_swap", "0.22"),
Expand Down Expand Up @@ -140,7 +138,7 @@ data class ConfigEntity(
mercuryoSecret = "",
tonapiMainnetHost = "https://keeper.tonapi.io",
tonapiTestnetHost = "https://testnet.tonapi.io",
stonfiUrl = "https://tonkeeper.ston.fi/swap",
stonfiUrl = "https://swap-widget.tonkeeper.com",
tonNFTsMarketplaceEndpoint = "https://ton.diamonds",
directSupportUrl = "https://t.me/tonkeeper_supportbot",
tonkeeperNewsUrl = "https://t.me/tonkeeper_new",
Expand All @@ -159,7 +157,6 @@ data class ConfigEntity(
batteryDisabled = false,
batterySendDisabled = false,
batteryMeanFees = "0.0055",
disableBatteryCryptoRecharge = false,
disableBatteryIapModule = false,
batteryMeanPriceNft = "0.03",
batteryMeanPriceSwap = "0.22",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.tonapps.wallet.api.internal
import android.content.Context
import android.net.Uri
import android.util.ArrayMap
import android.util.Log
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.tonapps.extensions.appVersionName
import com.tonapps.extensions.deviceCountry
import com.tonapps.extensions.getStoreCountry
import com.tonapps.extensions.isDebug
import com.tonapps.extensions.locale
import com.tonapps.network.get
Expand All @@ -14,6 +14,7 @@ import com.tonapps.wallet.api.entity.NotificationEntity
import com.tonapps.wallet.api.entity.StoryEntity
import com.tonapps.wallet.api.withRetry
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import org.json.JSONObject
Expand All @@ -30,8 +31,8 @@ internal class InternalApi(
testnet: Boolean,
platform: String,
build: String,
boot: Boolean = false
): String {
boot: Boolean = false,
): String = runBlocking {
val builder = Uri.Builder()
builder.scheme("https")
.authority(if (boot) "boot.tonkeeper.com" else "api.tonkeeper.com")
Expand All @@ -40,8 +41,15 @@ internal class InternalApi(
.appendQueryParameter("build", build)
.appendQueryParameter("platform", platform)
.appendQueryParameter("chainName", if (testnet) "testnet" else "mainnet")
.appendQueryParameter("bundle_id", context.packageName)

return builder.build().toString()
val storeCountry = context.getStoreCountry()
storeCountry?.let {
builder.appendQueryParameter("store_country_code", storeCountry)
}
builder.appendQueryParameter("device_country_code", context.deviceCountry)

builder.build().toString()
}

private fun request(
Expand All @@ -50,7 +58,7 @@ internal class InternalApi(
platform: String = "android",
build: String = appVersionName,
locale: Locale,
boot: Boolean = false
boot: Boolean = false,
): JSONObject {
val url = endpoint(path, testnet, platform, build, boot)
val headers = ArrayMap<String, String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ class AccountRepository(

suspend fun getInitializedWallets() = database.getAccounts().filter { it.initialized }

fun getVaultKeys(): String {
return vaultSource.getVaultKeys()
}

suspend fun getMnemonic(id: String): Array<String>? {
val wallet = database.getAccount(id) ?: return null
return vaultSource.getMnemonic(wallet.publicKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ data class WalletEntity(
}

val maxMessages: Int
get() = if (isLedger) 1 else contract.maxMessages
get() = contract.maxMessages

val testnet: Boolean
get() = type == Wallet.Type.Testnet
Expand Down
Loading

0 comments on commit 3212973

Please sign in to comment.