Updated on 2026-08-14
This commit is contained in:
parent
a9bca131c3
commit
b4ae0c1547
14 changed files with 533 additions and 465 deletions
19
.claude/rules/codestyle/drawable-naming.md
Normal file
19
.claude/rules/codestyle/drawable-naming.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Image Resources
|
||||
|
||||
## Naming
|
||||
|
||||
There are 3 types of icons:
|
||||
|
||||
1. Black or single color icon (naming: `ic_name_24`, where number is size)
|
||||
2. Icon with constant color, and tint could be applied (naming: `img_name_24`)
|
||||
3. Large image with different colors and shapes (naming: `ill_name`)
|
||||
|
||||
Examples:
|
||||
|
||||
1. `ic_chevron_24`
|
||||
2. `img_walletconnect_24`
|
||||
3. `ill_bussiness`
|
||||
|
||||
## Attention
|
||||
|
||||
For complex vector images (named with `ill_name`), you should use `.png` resources, because when the project is compiled, all complex vectors are converted to large, heavy PNGs for different dimensions.
|
||||
107
.claude/rules/domain/core-components.md
Normal file
107
.claude/rules/domain/core-components.md
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Domain Components
|
||||
|
||||
Key domain mechanisms that orchestrate data flow: suppliers, fetchers, and use cases.
|
||||
|
||||
## Retrieving Core Models
|
||||
|
||||
### UserWallet
|
||||
|
||||
#### UserWalletsListRepository
|
||||
|
||||
**Location:** `domain/common` — `com.tangem.domain.common.wallets.UserWalletsListRepository`
|
||||
|
||||
Repository for managing user wallets list. Provides `StateFlow<List<UserWallet>?>` for the wallets list and `StateFlow<UserWallet?>` for the selected wallet. Supports loading, selecting, saving, locking/unlocking (biometric, access code), deleting, and reordering wallets.
|
||||
|
||||
### Account / AccountList
|
||||
|
||||
#### SingleAccountSupplier
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.supplier.SingleAccountSupplier`
|
||||
|
||||
Supplier that provides a single `Account` by `AccountId`. Has convenience methods `filterPaymentAccount` and `filterCryptoPortfolioAccount` to filter by account subtype.
|
||||
|
||||
#### SingleAccountListSupplier
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.supplier.SingleAccountListSupplier`
|
||||
|
||||
Supplier that provides an `AccountList` for a specific user wallet by `UserWalletId`.
|
||||
|
||||
#### MultiAccountListSupplier
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.supplier.MultiAccountListSupplier`
|
||||
|
||||
Supplier that provides a list of `AccountList`s for all user wallets. Extends `FlowCachingSupplier`.
|
||||
|
||||
#### SingleAccountListFetcher
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.fetcher.SingleAccountListFetcher`
|
||||
|
||||
Fetcher that fetches a list of accounts for a single wallet by `UserWalletId`. Extends `FlowFetcher`.
|
||||
|
||||
### AccountStatus / AccountStatusList
|
||||
|
||||
#### SingleAccountStatusSupplier
|
||||
|
||||
**Location:** `domain/account/status` — `com.tangem.domain.account.status.supplier.SingleAccountStatusSupplier`
|
||||
|
||||
Supplier that provides a single `AccountStatus` by account identifier. Extends `FlowCachingSupplier`.
|
||||
|
||||
#### SingleAccountStatusListSupplier
|
||||
|
||||
**Location:** `domain/account/status` — `com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier`
|
||||
|
||||
Same as `SingleAccountListSupplier` but provides `AccountStatusList` (accounts with balances) for a specific user wallet.
|
||||
|
||||
#### MultiAccountStatusListSupplier
|
||||
|
||||
**Location:** `domain/account/status` — `com.tangem.domain.account.status.supplier.MultiAccountStatusListSupplier`
|
||||
|
||||
Same as `MultiAccountListSupplier` but provides a list of `AccountStatusList`s for all user wallets.
|
||||
|
||||
### Network / NetworkStatus
|
||||
|
||||
#### SingleNetworkStatusSupplier
|
||||
|
||||
**Location:** `domain/networks` — `com.tangem.domain.networks.single.SingleNetworkStatusSupplier`
|
||||
|
||||
Supplier of `NetworkStatus` for a specific network and wallet. Extends `FlowCachingSupplier`.
|
||||
|
||||
#### MultiNetworkStatusSupplier
|
||||
|
||||
**Location:** `domain/networks` — `com.tangem.domain.networks.multi.MultiNetworkStatusSupplier`
|
||||
|
||||
Supplier of all `NetworkStatus`es (as `Set<NetworkStatus>`) for a selected wallet. Extends `FlowCachingSupplier`.
|
||||
|
||||
#### SingleNetworkStatusFetcher
|
||||
|
||||
**Location:** `domain/networks` — `com.tangem.domain.networks.single.SingleNetworkStatusFetcher`
|
||||
|
||||
Fetcher of network status for a single `Network` by `UserWalletId`. Extends `FlowFetcher`.
|
||||
|
||||
#### MultiNetworkStatusFetcher
|
||||
|
||||
**Location:** `domain/networks` — `com.tangem.domain.networks.multi.MultiNetworkStatusFetcher`
|
||||
|
||||
Fetcher of network statuses for a set of `Network`s for a multi-currency wallet by `UserWalletId`. Extends `FlowFetcher`.
|
||||
|
||||
## Updating Balances
|
||||
|
||||
### WalletBalanceFetcher
|
||||
|
||||
**Location:** `domain/tokens` — `com.tangem.domain.tokens.wallet.WalletBalanceFetcher`
|
||||
|
||||
Fetcher of wallet balances by `UserWalletId`. Selects the appropriate fetching strategy based on wallet type (multi-wallet, single wallet with tokens, single wallet). Delegates to `BalanceFetchingOperations` for shared fetching logic.
|
||||
|
||||
### CryptoCurrencyBalanceFetcher
|
||||
|
||||
**Location:** `domain/account/status` — `com.tangem.domain.account.status.utils.CryptoCurrencyBalanceFetcher`
|
||||
|
||||
Fetches and refreshes balances for specific crypto currencies. Uses per-wallet mutexes to allow concurrent refreshes for different wallets while preventing concurrent refreshes for the same wallet. Delegates to `BalanceFetchingOperations`.
|
||||
|
||||
## Managing Portfolio (User Tokens)
|
||||
|
||||
### ManageCryptoCurrenciesUseCase
|
||||
|
||||
**Location:** `domain/account/status` — `com.tangem.domain.account.status.usecase.ManageCryptoCurrenciesUseCase`
|
||||
|
||||
Use case for adding and removing crypto currencies in an account.
|
||||
142
.claude/rules/domain/core-models.md
Normal file
142
.claude/rules/domain/core-models.md
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
# Domain Models
|
||||
|
||||
Core business models used across the application. Models are defined in `domain/models/` and `domain/account/`.
|
||||
|
||||
## StatusSource
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.StatusSource`
|
||||
|
||||
Enum representing data loading/refresh status. Used across all status models (NetworkStatus, QuoteStatus, YieldBalance, CryptoCurrencyStatus.Sources):
|
||||
- `CACHE` — initial status, data loaded from cache
|
||||
- `ACTUAL` — terminal status, data successfully fetched from server
|
||||
- `ONLY_CACHE` — terminal status, data could not be refreshed (only cached data available)
|
||||
|
||||
## CryptoCurrency
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.currency.CryptoCurrency`
|
||||
|
||||
Sealed class representing a cryptocurrency — either a native coin (`Coin`) or a token (`Token`). Used throughout the application: portfolio, token search, swaps, buy/sell, staking, etc.
|
||||
|
||||
## CryptoCurrencyStatus
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.currency.CryptoCurrencyStatus`
|
||||
|
||||
Model representing a currency with its balance state. Primarily used to display user's coin balance in the portfolio. Wraps `CryptoCurrency` with a `Value` sealed interface:
|
||||
|
||||
| Value subtype | Description |
|
||||
|---|---|
|
||||
| `Loading` | First-time fetch; once data is loaded, subsequent updates use cache via StatusSource, bypassing Loading |
|
||||
| `Loaded` | Full data available |
|
||||
| `Custom` | Custom token in portfolio; some data may be missing (e.g., no balance if backend has no quotes for it) |
|
||||
| `NoQuote` | Balance known, no price data |
|
||||
| `NoAccount` | Account not created (e.g., Solana reserve) |
|
||||
| `Unreachable` | Network error |
|
||||
| `NoAmount` | Coin is added to portfolio but no blockchain data available for it |
|
||||
| `MissedDerivation` | Coin has no derivations — failed to obtain a blockchain network address |
|
||||
|
||||
All Value subtypes carry `sources: Sources` tracking data freshness per dimension: `networkSource`, `quoteSource`, `stakingBalanceSource`, and aggregated `total`.
|
||||
|
||||
## Network
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.network.Network`
|
||||
|
||||
Represents a blockchain network (e.g., Ethereum, Bitcoin). Contains network metadata: ID, name, currency symbol, derivation path, standard type (ERC20, TRC20, BEP20, etc.), and capabilities (token support, transaction extras, name resolving).
|
||||
|
||||
## NetworkStatus
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.network.NetworkStatus`
|
||||
|
||||
Blockchain balances for all tokens of a network at a specific address. Only `Verified` and `NoAccount` are cached.
|
||||
|
||||
| Value subtype | Description |
|
||||
|---|---|
|
||||
| `Verified` | Successful response from blockchain |
|
||||
| `Unreachable` | Failed response from blockchain |
|
||||
| `NoAccount` | Blockchain-specific status for chains that require a deposit to an address before it can be used |
|
||||
| `MissedDerivation` | Derivation failed — no blockchain network address |
|
||||
|
||||
## QuoteStatus
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.quote.QuoteStatus`
|
||||
|
||||
Exchange rate between the app's selected fiat currency and a coin's currency.
|
||||
|
||||
## YieldBalance
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.staking.YieldBalance`
|
||||
|
||||
Staking yield balance for a specific `StakingID` (integrationId + address).
|
||||
|
||||
## TotalFiatBalance
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.TotalFiatBalance`
|
||||
|
||||
Aggregate fiat balance across all tokens. Sealed interface with three states: `Loading`, `Failed`, `Loaded(amount, source)`.
|
||||
|
||||
## TokenList
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.tokenlist.TokenList`
|
||||
|
||||
List of cryptocurrency tokens for display in portfolio. Sealed interface with subtypes:
|
||||
- `GroupedByNetwork` — tokens grouped by `Network`, each group contains a list of `CryptoCurrencyStatus`
|
||||
- `Ungrouped` — flat list of `CryptoCurrencyStatus`
|
||||
- `Empty` — no tokens
|
||||
|
||||
All subtypes carry `totalFiatBalance: TotalFiatBalance` and `sortedBy: TokensSortType`.
|
||||
|
||||
## Account
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.account.Account`
|
||||
|
||||
Model representing a user account. Subtypes:
|
||||
- **`Account.CryptoPortfolio`** — crypto portfolio with coins. All tokens in the account share the account's derivation (main account is an exception). Has a `DerivationIndex`: `0` for main account, `1..19` for secondary
|
||||
- **`Account.Payment`** — account for Visa card integration
|
||||
|
||||
## AccountStatus
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.account.AccountStatus`
|
||||
|
||||
Model representing an account with balances. Has a similar structure to `Account`: `CryptoPortfolio` and `Payment` subtypes.
|
||||
|
||||
## AccountList
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.models.AccountList`
|
||||
|
||||
List of all accounts for a user wallet (`UserWallet`).
|
||||
|
||||
Business rules (enforced by factory returning `Either<Error, AccountList>`):
|
||||
- Accounts list cannot be empty
|
||||
- Exactly 1 main account
|
||||
- Max 20 active accounts (`MAX_ACCOUNTS_COUNT`), max 1000 archived
|
||||
- No duplicate AccountIds or custom AccountNames
|
||||
- `totalAccounts >= activeAccounts`
|
||||
|
||||
## AccountStatusList
|
||||
|
||||
**Location:** `domain/account` — `com.tangem.domain.account.models.AccountStatusList`
|
||||
|
||||
Same as `AccountList` but with balances (wraps `AccountStatus` instead of `Account`).
|
||||
|
||||
## UserWallet
|
||||
|
||||
**Location:** `domain/models` — `com.tangem.domain.models.wallet.UserWallet`
|
||||
|
||||
Top-level model representing a user's wallet stored in the app. Subtypes:
|
||||
- **`Cold`** — wallet backed by a physical Tangem card (NFC). Contains `ScanResponse`, card info, backup state
|
||||
- **`Hot`** — software (hot) wallet without a physical card
|
||||
|
||||
## Model Hierarchy
|
||||
|
||||
```
|
||||
UserWallet
|
||||
└─ AccountList / AccountStatusList
|
||||
└─ Account.CryptoPortfolio / AccountStatus.CryptoPortfolio
|
||||
├─ CryptoCurrency (Coin | Token)
|
||||
│ └─ CryptoCurrencyStatus (currency + Value state)
|
||||
│ ├─ built from NetworkStatus (per network)
|
||||
│ ├─ built from QuoteStatus (per rawCurrencyId)
|
||||
│ └─ built from YieldBalance (per stakingId)
|
||||
├─ AccountId (SHA-256 hash)
|
||||
├─ DerivationIndex (0 = main)
|
||||
└─ CryptoPortfolioIcon (icon + color)
|
||||
```
|
||||
22
.claude/rules/git-rules.md
Normal file
22
.claude/rules/git-rules.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Git Rules
|
||||
|
||||
## Branch Naming
|
||||
|
||||
| Type | Format | Example |
|
||||
|------|--------|---------|
|
||||
| Feature | `feature/AND-xxx_short_description` | `feature/AND-13391_balance_fetcher` |
|
||||
| Bugfix | `bugfix/AND-xxx_short_description` | `bugfix/AND-14000_fix_crash` |
|
||||
| Pre-release | `x.x_pre_release` | `5.36_pre_release` |
|
||||
|
||||
**Key branches:**
|
||||
- `develop` — main integration branch, all feature/bugfix branches merge here
|
||||
- `x.x_pre_release` — branched from `develop` on the last day of sprint for the upcoming release; receives regression bugfixes and additional release items
|
||||
- `release` — merging into this branch triggers appTester build and production artifacts; PRs come from `x.x_pre_release`
|
||||
|
||||
## Commit Messages
|
||||
|
||||
Format: `AND-xxx Description`
|
||||
|
||||
- Start with the Jira task number (AND-xxx)
|
||||
- Followed by a space and a short description in English
|
||||
- Example: `[REDACTED_TASK_KEY] Finalize CryptoCurrencyBalanceFetcher refactoring`
|
||||
16
.claude/rules/tangem-sdk.md
Normal file
16
.claude/rules/tangem-sdk.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Tangem SDK & Libraries
|
||||
|
||||
## In-house SDKs (via `tangem_dependencies.toml`)
|
||||
|
||||
- **Blockchain SDK** (`com.tangem:blockchain`) — multichain SDK for working with blockchains: creating/signing transactions, fetching balances, managing addresses. Wrapped in `libs/blockchain-sdk/`
|
||||
- **Card SDK** (`com.tangem.tangem-sdk-kotlin:core`, `:android`) — SDK for interacting with physical Tangem cards via NFC: scanning, wallet creation, key derivation, passcode management, backup. Wrapped in `libs/tangem-sdk-api/`
|
||||
- **Hot SDK** (`com.tangem.tangem-hot-sdk-kotlin:core`, `:android`) — SDK for hot (software) wallets
|
||||
- **Vico** (`com.tangem.vico`) — forked charting library Vico, adapted for project needs
|
||||
|
||||
## Wrapper Modules (`libs/`)
|
||||
|
||||
- `libs/blockchain-sdk/` — wrapper around Blockchain SDK, provides domain-level abstractions for blockchain operations
|
||||
- `libs/tangem-sdk-api/` — wrapper around Card SDK, exposes NFC card interaction API to the app
|
||||
- `libs/crypto/` — cryptographic utilities: derivation, address handling, blockchain-specific helpers
|
||||
- `libs/auth/` — API key provider interfaces for external services (Express, StakeKit)
|
||||
- `libs/visa/` — Visa integration: smart contracts, limits, balances via Web3j
|
||||
Loading…
Add table
Add a link
Reference in a new issue