Skip to content

Commit 3212973

Browse files
v5.0.21
* 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 <[email protected]> * fixed * fix battery * fixeds remote config * upd version * run action after push to dev branch --------- Signed-off-by: polstianka <[email protected]> * fixeds for refferer (#127) * fixeds for refferer Signed-off-by: polstianka <[email protected]> * add manual build in github action Signed-off-by: polstianka <[email protected]> * trigger github action Signed-off-by: polstianka <[email protected]> * remove trigger Signed-off-by: polstianka <[email protected]> * fix referrer Signed-off-by: polstianka <[email protected]> --------- Signed-off-by: polstianka <[email protected]> --------- Signed-off-by: polstianka <[email protected]> Co-authored-by: Andrey Sorokin <[email protected]>
1 parent 8f120f7 commit 3212973

File tree

722 files changed

+51826
-181873
lines changed

Some content is hidden

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

722 files changed

+51826
-181873
lines changed

.github/workflows/cd.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Android APK build CD
33
on:
44
push:
55
branches:
6-
- dev
6+
- 'dev'
7+
workflow_dispatch:
78

89
jobs:
910
android-build:
@@ -44,13 +45,13 @@ jobs:
4445
- name: Upload android aab to artifacts
4546
uses: actions/upload-artifact@v4
4647
with:
47-
name: Tonkeeper X aab ${{ env.VERSION_CODE }}
48+
name: Tonkeeper aab ${{ env.VERSION_CODE }}
4849
path: |
4950
${{ env.AAB_OUTPUT_PATH }}
5051
5152
- name: Upload android apk to artifacts
5253
uses: actions/upload-artifact@v4
5354
with:
54-
name: Tonkeeper X apk ${{ env.VERSION_CODE }}
55+
name: Tonkeeper apk ${{ env.VERSION_CODE }}
5556
path: |
5657
${{ env.APK_OUTPUT_PATH }}

.github/workflows/uk.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Android UK build CD
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
android-build:
8+
name: android-build
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Checkout to git repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up ruby env
16+
uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: 3.2
19+
bundler-cache: true
20+
21+
- name: Setup Java
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: 'temurin'
25+
java-version: 20.0.2+9
26+
27+
- name: Decode signing certificate into a file
28+
env:
29+
CERTIFICATE_BASE64: ${{ secrets.ANDROID_DIST_SIGNING_KEY }}
30+
run: |
31+
echo $CERTIFICATE_BASE64 | base64 --decode > google-release.keystore
32+
33+
- name: Build android beta
34+
run: bundle exec fastlane android beta_uk
35+
env:
36+
KEYSTORE_FILE: ${{ github.workspace }}/google-release.keystore
37+
KEYSTORE_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_STORE_PASSWORD }}
38+
KEY_ALIAS: ${{ secrets.TONKEEPER_UPLOAD_KEY_ALIAS}}
39+
KEY_PASSWORD: ${{ secrets.TONKEEPER_UPLOAD_KEY_PASSWORD }}
40+
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}
41+
42+
- name: Upload android aab to artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: Tonkeeper UK aab ${{ env.VERSION_CODE }}
46+
path: |
47+
${{ env.AAB_OUTPUT_PATH }}
48+
49+
- name: Upload android apk to artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: Tonkeeper UK apk ${{ env.VERSION_CODE }}
53+
path: |
54+
${{ env.APK_OUTPUT_PATH }}

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.tonapps.wallet.api
22

33
import android.content.Context
4+
import android.net.Uri
45
import android.util.ArrayMap
6+
import android.util.Log
57
import com.squareup.moshi.JsonAdapter
68
import com.tonapps.blockchain.ton.contract.BaseWalletContract
79
import com.tonapps.blockchain.ton.contract.WalletVersion
@@ -13,9 +15,11 @@ import com.tonapps.blockchain.ton.extensions.toRawAddress
1315
import com.tonapps.extensions.toUriOrNull
1416
import com.tonapps.icu.Coins
1517
import com.tonapps.network.SSEvent
18+
import com.tonapps.network.execute
1619
import com.tonapps.network.get
1720
import com.tonapps.network.post
1821
import com.tonapps.network.postJSON
22+
import com.tonapps.network.requestBuilder
1923
import com.tonapps.network.sse
2024
import com.tonapps.wallet.api.core.SourceAPI
2125
import com.tonapps.wallet.api.entity.AccountDetailsEntity
@@ -116,6 +120,7 @@ class API(
116120
builder.addHeader(key, value)
117121
}
118122
}
123+
builder.addHeader("Authorization", "Bearer ${config.tonApiV2Key}")
119124

120125
if (methodOptions.equals("POST", ignoreCase = true)) {
121126
builder.post(bodyOptions.toRequestBody(contentTypeOptions.toMediaType()))
@@ -756,20 +761,16 @@ class API(
756761
firebaseToken: String,
757762
): Boolean {
758763
return try {
759-
val url = "${config.tonapiMainnetHost}/v1/internal/pushes/tonconnect"
760-
761-
val json = JSONObject()
762-
json.put("app_url", appUrl)
763-
json.put("account", accountId)
764-
json.put("firebase_token", firebaseToken)
765-
json.put("commercial", false)
766-
json.put("silent", true)
767-
val data = json.toString().replace("\\/", "/")
768-
769-
tonAPIHttpClient.postJSON(url, data, ArrayMap<String, String>().apply {
770-
set("X-TonConnect-Auth", token)
771-
set("Connection", "close")
772-
}).isSuccessful
764+
val uriBuilder = Uri.parse("${config.tonapiMainnetHost}/v1/internal/pushes/tonconnect").buildUpon()
765+
uriBuilder.appendQueryParameter("firebase_token", firebaseToken)
766+
uriBuilder.appendQueryParameter("app_url", appUrl)
767+
uriBuilder.appendQueryParameter("account", accountId)
768+
769+
val builder = requestBuilder(uriBuilder.build().toString())
770+
builder.delete()
771+
builder.addHeader("X-TonConnect-Auth", token)
772+
builder.addHeader("Connection", "close")
773+
tonAPIHttpClient.execute(builder.build()).isSuccessful
773774
} catch (e: Throwable) {
774775
false
775776
}

apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/AccountDetailsEntity.kt

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import android.os.Parcelable
44
import android.util.Log
55
import com.tonapps.blockchain.ton.contract.BaseWalletContract
66
import com.tonapps.blockchain.ton.contract.WalletVersion
7+
import com.tonapps.blockchain.ton.extensions.isValidTonAddress
8+
import com.tonapps.blockchain.ton.extensions.toRawAddress
9+
import com.tonapps.blockchain.ton.extensions.toUserFriendly
710
import io.tonapi.models.Account
811
import io.tonapi.models.AccountStatus
912
import kotlinx.parcelize.Parcelize
@@ -17,6 +20,7 @@ data class AccountDetailsEntity(
1720
val balance: Long,
1821
val new: Boolean = false,
1922
val initialized: Boolean,
23+
val testnet: Boolean,
2024
): Parcelable {
2125

2226
val address: String
@@ -29,29 +33,55 @@ data class AccountDetailsEntity(
2933
contract: BaseWalletContract,
3034
testnet: Boolean,
3135
new: Boolean = false,
32-
initialized: Boolean
36+
initialized: Boolean,
3337
) : this(
3438
query = "",
3539
preview = AccountEntity(contract.address, testnet),
3640
active = true,
3741
walletVersion = contract.getWalletVersion(),
3842
balance = 0,
3943
new = new,
40-
initialized = initialized
44+
initialized = initialized,
45+
testnet = testnet,
4146
)
4247

43-
constructor(query: String, account: Account, testnet: Boolean, new: Boolean = false) : this(
48+
constructor(
49+
query: String,
50+
account: Account,
51+
testnet: Boolean,
52+
new: Boolean = false
53+
) : this(
4454
query = query,
4555
preview = AccountEntity(account, testnet),
4656
active = account.status == AccountStatus.active,
47-
walletVersion = resolveVersion(account.interfaces),
57+
walletVersion = resolveVersion(testnet, account.interfaces, account.address),
4858
balance = account.balance,
4959
new = new,
50-
initialized = account.status == AccountStatus.active || account.status == AccountStatus.frozen
60+
initialized = account.status == AccountStatus.active || account.status == AccountStatus.frozen,
61+
testnet = testnet,
5162
)
5263

5364
private companion object {
54-
private fun resolveVersion(interfaces: List<String>?): WalletVersion {
65+
66+
private fun resolveVersion(testnet: Boolean, interfaces: List<String>?, address: String): WalletVersion {
67+
val version = resolveVersionByInterface(interfaces)
68+
if (version == WalletVersion.UNKNOWN) {
69+
return resolveVersionByAddress(address.toUserFriendly(
70+
wallet = true,
71+
testnet = testnet,
72+
))
73+
}
74+
return version
75+
}
76+
77+
private fun resolveVersionByAddress(userFriendlyAddress: String): WalletVersion {
78+
/*if (userFriendlyAddress.isValidTonAddress()) {
79+
return WalletVersion.V5BETA
80+
}*/
81+
return WalletVersion.UNKNOWN
82+
}
83+
84+
private fun resolveVersionByInterface(interfaces: List<String>?): WalletVersion {
5585
interfaces ?: return WalletVersion.UNKNOWN
5686
return if (interfaces.contains("wallet_v5_beta")) {
5787
WalletVersion.V5BETA

apps/wallet/api/src/main/java/com/tonapps/wallet/api/entity/ConfigEntity.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ data class ConfigEntity(
4040
val batteryMeanPriceNft: String,
4141
val batteryMeanPriceSwap: String,
4242
val batteryMeanPriceJetton: String,
43-
val disableBatteryCryptoRecharge: Boolean,
4443
val disableBatteryIapModule: Boolean,
4544
val batteryReservedAmount: String,
4645
val batteryMaxInputAmount: String,
@@ -68,7 +67,7 @@ data class ConfigEntity(
6867

6968
@IgnoredOnParcel
7069
val domains: List<String> by lazy {
71-
listOf(tonapiMainnetHost, tonapiTestnetHost, tonapiSSEEndpoint, tonapiSSETestnetEndpoint, "https://bridge.tonapi.io/")
70+
listOf(tonapiMainnetHost, tonapiTestnetHost, tonapiSSEEndpoint, tonapiSSETestnetEndpoint, "https://bridge.tonapi.io/", "https://tonapi.io/")
7271
}
7372

7473
@IgnoredOnParcel
@@ -109,7 +108,6 @@ data class ConfigEntity(
109108
batteryDisabled = json.optBoolean("disable_battery", false),
110109
batterySendDisabled = json.optBoolean("disable_battery_send", false),
111110
batteryMeanFees = json.optString("batteryMeanFees", "0.0055"),
112-
disableBatteryCryptoRecharge = json.optBoolean("disable_battery_crypto_recharge_module", false),
113111
disableBatteryIapModule = json.optBoolean("disable_battery_iap_module", false),
114112
batteryMeanPriceNft = json.optString("batteryMeanPrice_nft", "0.03"),
115113
batteryMeanPriceSwap = json.optString("batteryMeanPrice_swap", "0.22"),
@@ -140,7 +138,7 @@ data class ConfigEntity(
140138
mercuryoSecret = "",
141139
tonapiMainnetHost = "https://keeper.tonapi.io",
142140
tonapiTestnetHost = "https://testnet.tonapi.io",
143-
stonfiUrl = "https://tonkeeper.ston.fi/swap",
141+
stonfiUrl = "https://swap-widget.tonkeeper.com",
144142
tonNFTsMarketplaceEndpoint = "https://ton.diamonds",
145143
directSupportUrl = "https://t.me/tonkeeper_supportbot",
146144
tonkeeperNewsUrl = "https://t.me/tonkeeper_new",
@@ -159,7 +157,6 @@ data class ConfigEntity(
159157
batteryDisabled = false,
160158
batterySendDisabled = false,
161159
batteryMeanFees = "0.0055",
162-
disableBatteryCryptoRecharge = false,
163160
disableBatteryIapModule = false,
164161
batteryMeanPriceNft = "0.03",
165162
batteryMeanPriceSwap = "0.22",

apps/wallet/api/src/main/java/com/tonapps/wallet/api/internal/InternalApi.kt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package com.tonapps.wallet.api.internal
33
import android.content.Context
44
import android.net.Uri
55
import android.util.ArrayMap
6-
import android.util.Log
76
import com.google.firebase.crashlytics.FirebaseCrashlytics
8-
import com.tonapps.extensions.appVersionName
7+
import com.tonapps.extensions.deviceCountry
8+
import com.tonapps.extensions.getStoreCountry
99
import com.tonapps.extensions.isDebug
1010
import com.tonapps.extensions.locale
1111
import com.tonapps.network.get
@@ -14,6 +14,7 @@ import com.tonapps.wallet.api.entity.NotificationEntity
1414
import com.tonapps.wallet.api.entity.StoryEntity
1515
import com.tonapps.wallet.api.withRetry
1616
import kotlinx.coroutines.Dispatchers
17+
import kotlinx.coroutines.runBlocking
1718
import kotlinx.coroutines.withContext
1819
import okhttp3.OkHttpClient
1920
import org.json.JSONObject
@@ -30,8 +31,8 @@ internal class InternalApi(
3031
testnet: Boolean,
3132
platform: String,
3233
build: String,
33-
boot: Boolean = false
34-
): String {
34+
boot: Boolean = false,
35+
): String = runBlocking {
3536
val builder = Uri.Builder()
3637
builder.scheme("https")
3738
.authority(if (boot) "boot.tonkeeper.com" else "api.tonkeeper.com")
@@ -40,8 +41,15 @@ internal class InternalApi(
4041
.appendQueryParameter("build", build)
4142
.appendQueryParameter("platform", platform)
4243
.appendQueryParameter("chainName", if (testnet) "testnet" else "mainnet")
44+
.appendQueryParameter("bundle_id", context.packageName)
4345

44-
return builder.build().toString()
46+
val storeCountry = context.getStoreCountry()
47+
storeCountry?.let {
48+
builder.appendQueryParameter("store_country_code", storeCountry)
49+
}
50+
builder.appendQueryParameter("device_country_code", context.deviceCountry)
51+
52+
builder.build().toString()
4553
}
4654

4755
private fun request(
@@ -50,7 +58,7 @@ internal class InternalApi(
5058
platform: String = "android",
5159
build: String = appVersionName,
5260
locale: Locale,
53-
boot: Boolean = false
61+
boot: Boolean = false,
5462
): JSONObject {
5563
val url = endpoint(path, testnet, platform, build, boot)
5664
val headers = ArrayMap<String, String>()

apps/wallet/data/account/src/main/java/com/tonapps/wallet/data/account/AccountRepository.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ class AccountRepository(
243243

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

246+
fun getVaultKeys(): String {
247+
return vaultSource.getVaultKeys()
248+
}
249+
246250
suspend fun getMnemonic(id: String): Array<String>? {
247251
val wallet = database.getAccount(id) ?: return null
248252
return vaultSource.getMnemonic(wallet.publicKey)

apps/wallet/data/account/src/main/java/com/tonapps/wallet/data/account/entities/WalletEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ data class WalletEntity(
7676
}
7777

7878
val maxMessages: Int
79-
get() = if (isLedger) 1 else contract.maxMessages
79+
get() = contract.maxMessages
8080

8181
val testnet: Boolean
8282
get() = type == Wallet.Type.Testnet

0 commit comments

Comments
 (0)