Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ import io.ton.walletkit.demo.designsystem.icons.TonIcon
import io.ton.walletkit.demo.designsystem.icons.TonIconImage
import io.ton.walletkit.demo.designsystem.theme.TonTheme

// Mirrors iOS WalletHomeAssetItem.Icon — keeps the icon shape behind a sealed type
// so we can swap between the bundled TON brand mark, a network image URL, and a
// last-resort coloured initials placeholder without leaking the resolution to call
// sites.
@Immutable
sealed interface WalletHomeAssetIcon {
data object Ton : WalletHomeAssetIcon
Expand Down Expand Up @@ -110,9 +106,8 @@ private fun AssetIcon(item: WalletHomeAssetItem) {
) {
when (val icon = item.icon) {
WalletHomeAssetIcon.Ton -> TonIconImage(
icon = TonIcon.Ton,
icon = TonIcon.Gram,
size = IconSize,
// No tint — TON brand mark ships its blue + white fills baked into the SVG.
)
is WalletHomeAssetIcon.Url -> AsyncImage(
model = ImageRequest.Builder(androidx.compose.ui.platform.LocalContext.current)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fun WalletHomeBalance(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
TonIconImage(icon = TonIcon.Ton, size = 16.dp)
TonIconImage(icon = TonIcon.Gram, size = 16.dp)
TonText(
text = truncatedAddress,
style = TonTheme.typography.subheadline2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ object PreviewData {
hash = "abc123def456hash789preview",
timestamp = System.currentTimeMillis() - 3600000, // 1 hour ago
isOutgoing = true,
amount = "1.5 TON",
fee = "0.005 TON",
amount = "1.5 GRAM",
fee = "0.005 GRAM",
fromAddress = wallet.address,
toAddress = "EQrecipientAddressForPreviewTest12345678",
comment = "Payment for services",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ private fun buildAssetList(
val tonAmount = trimFraction(rawBalance, maxFractionDigits)
val tonItem = WalletHomeAssetItem(
id = "ton",
name = "Toncoin",
symbol = "TON",
formattedAmount = "$tonAmount TON",
name = "Gram",
symbol = "GRAM",
formattedAmount = "$tonAmount GRAM",
amountValue = rawBalance?.toDoubleOrNull() ?: 0.0,
icon = WalletHomeAssetIcon.Ton,
)
Expand Down Expand Up @@ -541,7 +541,7 @@ fun WalletScreen(

WalletHomeContent(
totalBalance = totalBalance,
balanceSuffix = " TON",
balanceSuffix = " GRAM",
balanceMaxFractionDigits = MAX_FRACTION_DIGITS,
truncatedAddress = WalletHomeTopBar.shortAddress(homeAddress),
onCopyAddress = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ enum class RealBridgeIframeCase {
CROSS_ORIGIN_DATA,
SRCDOC,
SANDBOXED,
RAW_JS_INTERFACE;
RAW_JS_INTERFACE,
;

val shortTitle: String
get() = when (this) {
Expand Down Expand Up @@ -271,8 +272,7 @@ enum class RealBridgeIframeCase {
})();
""".trimIndent()

private fun frameStyle(v: String) =
"$v.style.cssText='width:100%;border:0;min-height:150px;background:#fff;border-radius:8px;margin-top:6px';"
private fun frameStyle(v: String) = "$v.style.cssText='width:100%;border:0;min-height:150px;background:#fff;border-radius:8px;margin-top:6px';"

/** A script that, run inside a frame, renders an overlay and auto-fires a real signData. */
fun realSendScript(label: String, note: String): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ private data class OnboardingPage(

private val DefaultPages = listOf(
OnboardingPage(
icon = TonIcon.Toncoin40,
icon = TonIcon.Gram40,
title = "Welcome to TON",
description = "Hold and manage your Toncoin and tokens in one place.",
description = "Hold and manage your Gram and tokens in one place.",
),
OnboardingPage(
icon = TonIcon.Hand40,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private fun StakingContent(
isError = amountInvalid || belowMinimum || aboveBalance,
supporting = when {
amountInvalid -> "Enter a valid positive amount."
belowMinimum -> "TonStakers minimum stake is 1 TON."
belowMinimum -> "TonStakers minimum stake is 1 GRAM."
aboveBalance -> "Amount is higher than the available wallet balance."
else -> null
},
Expand Down Expand Up @@ -299,7 +299,7 @@ private fun TONUnstakeMode.toDisplayLabel(): String = when (this) {
}

private fun TONStakingQuoteDirection.inputSymbol(): String = when (this) {
TONStakingQuoteDirection.stake -> "TON"
TONStakingQuoteDirection.stake -> "GRAM"
TONStakingQuoteDirection.unstake -> "tsTON"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fun TransferJettonSheet(

// Info
Text(
text = "A small amount of TON will be used as a network fee for this transfer.",
text = "A small amount of GRAM will be used as a network fee for this transfer.",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private fun ItemEntry(item: TONStructuredItem, index: Int) {
when (item) {
is TONStructuredItem.Ton -> item.value.let { ton ->
EntryCard(
title = "Send TON #${index + 1}",
title = "Send GRAM #${index + 1}",
toAddress = ton.address,
amount = tonAmount(ton.amount),
extraLines = emptyList(),
Expand Down Expand Up @@ -243,7 +243,7 @@ private fun MoneyFlowRow(transfer: TONTransactionTraceMoneyFlowItem) {
val amountText = TonFormatter.formatNanoTon(transfer.amount.removePrefix("-"))
val prefix = if (isPositive) "+" else "-"
val unit = when (transfer.assetType) {
TONAssetType.ton -> "TON"
TONAssetType.ton -> "GRAM"
TONAssetType.nft -> "NFT"
TONAssetType.jetton -> ""
}
Expand Down Expand Up @@ -291,12 +291,12 @@ internal fun TransactionPreviewError(message: String) {
}

private fun assetName(transfer: TONTransactionTraceMoneyFlowItem): String = when (transfer.assetType) {
TONAssetType.ton -> "TON"
TONAssetType.ton -> "GRAM"
TONAssetType.jetton -> transfer.tokenAddress?.value?.let(::shortAddress) ?: "Jetton"
TONAssetType.nft -> transfer.tokenAddress?.value?.let(::shortAddress) ?: "NFT"
}

private fun tonAmount(nano: String): String = "${TonFormatter.formatNanoTon(nano)} TON"
private fun tonAmount(nano: String): String = "${TonFormatter.formatNanoTon(nano)} GRAM"

private fun shortAddress(address: String): String = if (address.length > ADDRESS_TRUNCATION * 2) {
"${address.take(ADDRESS_TRUNCATION)}...${address.takeLast(ADDRESS_TRUNCATION)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ class SendTokensViewModel(
runCatching {
tokens += SendableToken(
id = "ton",
name = "Toncoin",
symbol = "TON",
name = "Gram",
symbol = "GRAM",
decimals = TON_DECIMALS,
displayBalance = TonFormatter.formatNanoTon(wallet.balance().value),
masterAddress = null,
imageSource = null,
requiredAmountInfo = "Minimum transaction: 0.0001 TON",
requiredAmountInfo = "Minimum transaction: 0.0001 GRAM",
)
}.onFailure { Log.e(TAG, "Failed to load TON balance", it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class StakingViewModel(
),
) {
val inputTokenSymbol: String
get() = if (direction == TONStakingQuoteDirection.stake) "TON" else "tsTON"
get() = if (direction == TONStakingQuoteDirection.stake) "GRAM" else "tsTON"

val receiveTokenSymbol: String
get() = if (direction == TONStakingQuoteDirection.stake) "tsTON" else "TON"
get() = if (direction == TONStakingQuoteDirection.stake) "tsTON" else "GRAM"

val canGetQuote: Boolean
get() = amount.isNotEmpty() && (amount.toDoubleOrNull() ?: 0.0) > 0 && !isLoadingQuote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SwapViewModel(
}

data class UiState(
val fromToken: TONSwapToken = TONSwapToken(address = "ton", decimals = 9.0, name = "TON", symbol = "TON"),
val fromToken: TONSwapToken = TONSwapToken(address = "ton", decimals = 9.0, name = "Gram", symbol = "GRAM"),
val toToken: TONSwapToken = TONSwapToken(
address = "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
decimals = 6.0,
Expand Down
30 changes: 30 additions & 0 deletions AndroidDemo/app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group
android:scaleX="1.8"
android:scaleY="1.8"
android:translateX="18"
android:translateY="18">
<path
android:fillColor="#000000"
android:pathData="M12.7047 4.90206C14.6529 4.65565 16.432 6.03525 16.6784 7.98348C16.8437 9.29041 16.2772 10.5211 15.2983 11.2642C16.4314 11.7401 17.2865 12.7911 17.4518 14.0981C17.6982 16.0463 16.3186 17.8254 14.3703 18.0718C12.4221 18.3182 10.643 16.9386 10.3966 14.9904C10.2313 13.6835 10.7977 12.4527 11.7766 11.7096C10.6436 11.2336 9.78853 10.1827 9.62324 8.87581C9.37683 6.92758 10.7564 5.14847 12.7047 4.90206Z"/>
<path
android:fillColor="#000000"
android:pathData="M29.4261 6.13226C30.6136 7.69627 30.3084 9.92683 28.7444 11.1143C27.6952 11.911 26.3461 12.0357 25.2131 11.5594C25.3675 12.7787 24.8849 14.0447 23.8357 14.8414C22.2717 16.0289 20.0411 15.7237 18.8536 14.1597C17.6661 12.5956 17.9713 10.3651 19.5353 9.17758C20.5845 8.38097 21.9336 8.25611 23.0666 8.73234C22.9123 7.51308 23.3949 6.24714 24.444 5.45055C26.008 4.26304 28.2386 4.56825 29.4261 6.13226Z"/>
<path
android:fillColor="#000000"
android:pathData="M36.7215 21.2286C35.9607 23.039 33.8764 23.8899 32.066 23.1292C30.8515 22.6189 30.0689 21.5129 29.9149 20.2936C28.9361 21.037 27.5984 21.252 26.3839 20.7417C24.5735 19.981 23.7226 17.8966 24.4833 16.0862C25.244 14.2758 27.3283 13.4248 29.1387 14.1856C30.3532 14.6959 31.1359 15.8018 31.29 17.0211C32.2687 16.2778 33.6063 16.0628 34.8208 16.5731C36.6312 17.3338 37.4822 19.4181 36.7215 21.2286Z"/>
<path
android:fillColor="#000000"
android:pathData="M27.2953 35.0947C25.3471 35.3411 23.568 33.9615 23.3216 32.0132C23.1563 30.7063 23.7228 29.4756 24.7017 28.7325C23.5686 28.2566 22.7135 27.2056 22.5482 25.8987C22.3018 23.9504 23.6814 22.1713 25.6297 21.9249C27.5779 21.6785 29.357 23.0581 29.6034 25.0063C29.7687 26.3133 29.2023 27.544 28.2234 28.2871C29.3564 28.7631 30.2115 29.814 30.3768 31.1209C30.6232 33.0691 29.2436 34.8483 27.2953 35.0947Z"/>
<path
android:fillColor="#000000"
android:pathData="M10.5739 33.8645C9.38638 32.3004 9.69159 30.0699 11.2556 28.8824C12.3048 28.0858 13.6539 27.961 14.7869 28.4373C14.6325 27.218 15.1151 25.952 16.1643 25.1554C17.7283 23.9678 19.9589 24.2731 21.1464 25.8371C22.3339 27.4011 22.0287 29.6316 20.4647 30.8191C19.4155 31.6157 18.0664 31.7406 16.9334 31.2644C17.0877 32.4836 16.6051 33.7496 15.556 34.5462C13.992 35.7337 11.7614 35.4285 10.5739 33.8645Z"/>
<path
android:fillColor="#000000"
android:pathData="M3.27855 18.7682C4.03927 16.9577 6.12359 16.1068 7.93401 16.8675C9.14849 17.3778 9.93106 18.4838 10.0851 19.7031C11.0639 18.9597 12.4016 18.7447 13.6161 19.255C15.4265 20.0158 16.2774 22.1001 15.5167 23.9105C14.756 25.7209 12.6717 26.5719 10.8613 25.8112C9.64679 25.3009 8.86411 24.1949 8.71004 22.9756C7.7313 23.7189 6.39366 23.9339 5.17921 23.4236C3.36879 22.6629 2.51783 20.5786 3.27855 18.7682Z"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@android:color/white" />
<foreground android:drawable="@android:color/black" />
<monochrome android:drawable="@android:color/black" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@android:color/white" />
<foreground android:drawable="@android:color/black" />
<monochrome android:drawable="@android:color/black" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
14 changes: 7 additions & 7 deletions AndroidDemo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<string name="wallet_switcher_remove_title">Remove Wallet?</string>
<string name="wallet_switcher_remove_message">Are you sure you want to remove this wallet?</string>
<string name="wallet_switcher_remove_warning">This will switch to another wallet.</string>
<string name="wallet_switcher_balance_format">%1$s TON</string>
<string name="wallet_switcher_balance_format">%1$s GRAM</string>
<string name="wallet_switcher_active_badge">Active</string>

<!-- Sessions -->
Expand Down Expand Up @@ -221,17 +221,17 @@
<string name="transactions_sent">Sent</string>
<string name="transactions_received">Received</string>
<string name="transactions_unknown_time">Unknown time</string>
<string name="transactions_amount_outgoing">-%1$s TON</string>
<string name="transactions_amount_incoming">+%1$s TON</string>
<string name="transactions_amount_outgoing">-%1$s GRAM</string>
<string name="transactions_amount_incoming">+%1$s GRAM</string>

<!-- Send transaction -->
<string name="send_title">Send TON</string>
<string name="send_title">Send GRAM</string>
<string name="send_from_label">From</string>
<string name="send_balance_format">Balance: %1$s TON</string>
<string name="send_balance_format">Balance: %1$s GRAM</string>
<string name="send_recipient_label">Recipient Address</string>
<string name="send_recipient_placeholder">EQ... or UQ...</string>
<string name="send_recipient_error">Invalid TON address</string>
<string name="send_amount_label">Amount (TON)</string>
<string name="send_amount_label">Amount (GRAM)</string>
<string name="send_amount_placeholder">0.00</string>
<string name="send_amount_error">Invalid amount</string>
<string name="send_amount_insufficient">Insufficient balance</string>
Expand Down Expand Up @@ -298,7 +298,7 @@
<string name="wallet_event_wallet_renamed">Renamed wallet to: %1$s</string>
<string name="wallet_default_name">Wallet %1$d</string>
<string name="wallet_transaction_unknown_party">Unknown</string>
<string name="wallet_transaction_fee_default">0 TON</string>
<string name="wallet_transaction_fee_default">0 GRAM</string>
<string name="wallet_transaction_status_success">Success</string>
<string name="wallet_error_prepare_demo_wallet">Failed to prepare demo wallet</string>
<string name="wallet_permission_unknown_name">unknown</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp

// Mirrors iOS `Icons/TONIcon.swift` 1-for-1.
//
// Each case is backed by a vector drawable in
// `:designsystem/src/main/res/drawable/<resourceName>.xml`. Resource names are flat
// lowercase to match the conversion the iOS SVGs were dropped through. Two iOS
// names ("Switch", "New") collide with Kotlin/AAPT reserved or near-reserved names
// — those drawables ship as `resource_switch` / `resource_new`.
enum class TonIcon(val resourceName: String, val category: Category) {
// Tabbar
DiscoverFilled("discoverfilled", Category.Tabbar),
Expand Down Expand Up @@ -81,7 +74,7 @@ enum class TonIcon(val resourceName: String, val category: Category) {
Star24("star24", Category.Icons24),
SwitchVertical24("switchvertical24", Category.Icons24),
Ton("ton", Category.Icons24),
Toncoin("toncoin", Category.Icons24),
Gram("gram", Category.Icons24),
TonFill("tonfill", Category.Icons24),
Trend("trend", Category.Icons24),
Volume("volume", Category.Icons24),
Expand Down Expand Up @@ -149,7 +142,7 @@ enum class TonIcon(val resourceName: String, val category: Category) {
Share40("share40", Category.Icons40),
Share40Alt("share40alt", Category.Icons40),
TelegramWallet40("telegramwallet40", Category.Icons40),
Toncoin40("toncoin40", Category.Icons40),
Gram40("gram40", Category.Icons40),
;

enum class Category { Tabbar, Icons24, Icons20, Icons16, Icons12, Icons40 }
Expand Down
20 changes: 20 additions & 0 deletions AndroidDemo/designsystem/src/main/res/drawable/gram.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="100"
android:viewportHeight="100">
<path
android:pathData="M0,50a50,50 0 1,0 100,0a50,50 0 1,0 -100,0Z"
android:fillColor="#30A1F5"/>
<path
android:pathData="M0.5,50a49.5,49.5 0 1,0 99,0a49.5,49.5 0 1,0 -99,0Z"
android:strokeColor="#000000"
android:strokeAlpha="0.06"
android:strokeWidth="1"/>
<path
android:pathData="M60.41 26.75H39.59c-2.772 0-4.159 0-5.413.388a8.691 8.691 0 0 0-3.028 1.653c-1.005.846-1.754 2.012-3.254 4.344L21.277 43.43c-.99 1.54-1.486 2.311-1.62 3.122-.119.715-.04 1.45.228 2.123.304.764.951 1.411 2.247 2.707l24.59 24.59c1.148 1.148 1.721 1.722 2.383 1.936.582.19 1.208.19 1.79 0 .661-.214 1.235-.788 2.382-1.935l24.591-24.591c1.296-1.296 1.943-1.943 2.247-2.707a3.982 3.982 0 0 0 .228-2.123c-.134-.81-.63-1.581-1.62-3.122l-6.618-10.295c-1.5-2.332-2.25-3.498-3.254-4.344a8.692 8.692 0 0 0-3.028-1.653c-1.255-.388-2.64-.388-5.414-.388z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M56.469 34.871c.338-.914 1.631-.914 1.97 0l2.337 6.317c.14.38.44.679.819.82l6.317 2.337c.914.338.914 1.63 0 1.97l-6.317 2.337c-.38.14-.679.44-.82.818l-2.337 6.317c-.338.915-1.631.915-1.97 0l-2.337-6.317c-.14-.379-.44-.678-.819-.818l-6.316-2.338c-.915-.338-.915-1.631 0-1.97l6.316-2.337c.38-.14.679-.44.82-.819l2.337-6.317z"
android:fillColor="#30A1F5"/>
</vector>
20 changes: 20 additions & 0 deletions AndroidDemo/designsystem/src/main/res/drawable/gram40.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="100"
android:viewportHeight="100">
<path
android:pathData="M0,50a50,50 0 1,0 100,0a50,50 0 1,0 -100,0Z"
android:fillColor="#30A1F5"/>
<path
android:pathData="M0.5,50a49.5,49.5 0 1,0 99,0a49.5,49.5 0 1,0 -99,0Z"
android:strokeColor="#000000"
android:strokeAlpha="0.06"
android:strokeWidth="1"/>
<path
android:pathData="M60.41 26.75H39.59c-2.772 0-4.159 0-5.413.388a8.691 8.691 0 0 0-3.028 1.653c-1.005.846-1.754 2.012-3.254 4.344L21.277 43.43c-.99 1.54-1.486 2.311-1.62 3.122-.119.715-.04 1.45.228 2.123.304.764.951 1.411 2.247 2.707l24.59 24.59c1.148 1.148 1.721 1.722 2.383 1.936.582.19 1.208.19 1.79 0 .661-.214 1.235-.788 2.382-1.935l24.591-24.591c1.296-1.296 1.943-1.943 2.247-2.707a3.982 3.982 0 0 0 .228-2.123c-.134-.81-.63-1.581-1.62-3.122l-6.618-10.295c-1.5-2.332-2.25-3.498-3.254-4.344a8.692 8.692 0 0 0-3.028-1.653c-1.255-.388-2.64-.388-5.414-.388z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M56.469 34.871c.338-.914 1.631-.914 1.97 0l2.337 6.317c.14.38.44.679.819.82l6.317 2.337c.914.338.914 1.63 0 1.97l-6.317 2.337c-.38.14-.679.44-.82.818l-2.337 6.317c-.338.915-1.631.915-1.97 0l-2.337-6.317c-.14-.379-.44-.678-.819-.818l-6.316-2.338c-.915-.338-.915-1.631 0-1.97l6.316-2.337c.38-.14.679-.44.82-.819l2.337-6.317z"
android:fillColor="#30A1F5"/>
</vector>
Loading
Loading