Updated on 2026-08-14
This commit is contained in:
commit
f2a3f89c7e
21 changed files with 2449 additions and 74 deletions
|
|
@ -77,9 +77,9 @@ dependencies {
|
|||
implementation 'com.google.android.play:core-ktx:1.8.1'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
|
||||
implementation 'com.tangem:blockchain:develop-55'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-125'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-125'
|
||||
implementation 'com.tangem:blockchain:develop-59'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-127'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-127'
|
||||
|
||||
// WebView
|
||||
implementation "androidx.browser:browser:1.3.0"
|
||||
|
|
|
|||
1637
app/src/main/assets/avalanche_tokens.json
Normal file
1637
app/src/main/assets/avalanche_tokens.json
Normal file
File diff suppressed because it is too large
Load diff
24
app/src/main/assets/avalanche_tokens_testnet.json
Normal file
24
app/src/main/assets/avalanche_tokens_testnet.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"customIconUrl": "https://i.imgur.com/LPZDXoT.png",
|
||||
"symbol": "FUJISTABLE",
|
||||
"name": "The Fuji stablecoin",
|
||||
"contractAddress": "0x2058ec2791dD28b6f67DB836ddf87534F4Bbdf22",
|
||||
"blockchain": {
|
||||
"key": "avalanche",
|
||||
"testnet": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"customIconUrl": "https://i.imgur.com/jNTqyQA.png",
|
||||
"symbol": "FUJIMOON",
|
||||
"name": "To the Moon",
|
||||
"contractAddress": "0x97132C109c6816525F7f338DCb7435E1412A7668",
|
||||
"blockchain": {
|
||||
"key": "avalanche",
|
||||
"testnet": true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
"blockchain" : {
|
||||
"key" : "binance",
|
||||
"curve" : "secp256k1",
|
||||
"testnet" : false
|
||||
"testnet" : true
|
||||
},
|
||||
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/binance/assets/MATIC-84A/logo.png",
|
||||
"name" : "Hemster - 452"
|
||||
|
|
|
|||
519
app/src/main/assets/solana_tokens.json
Normal file
519
app/src/main/assets/solana_tokens.json
Normal file
|
|
@ -0,0 +1,519 @@
|
|||
[
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "SOLAPE",
|
||||
"name": "SolAPE Finance",
|
||||
"contractAddress": "GHvFFSZ9BctWsEc5nujR1MTmmJWY7tgQz2AXE6WVFtGN",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 1,
|
||||
"symbol": "FLOOF",
|
||||
"name": "FLOOF",
|
||||
"contractAddress": "3jzdrXXKxwkBk82u2eCWASZLCKoZs1LQTg87HBEAmBJw",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "MNDE",
|
||||
"name": "Marinade",
|
||||
"contractAddress": "MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "BTC",
|
||||
"name": "Wrapped BTC",
|
||||
"contractAddress": "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 8,
|
||||
"symbol": "TWT",
|
||||
"name": "Trust Wallet",
|
||||
"contractAddress": "HZNpqL7RT9gxf9eWoWsWzC5DfjzQ41XTQgEA7p3VzaaD",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "CCAI",
|
||||
"name": "Cryptocurrencies.Ai",
|
||||
"contractAddress": "E5ndSkaB17Dm7CsD22dvcjfrYSDLCxFcMd6z8ddCk5wp",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "ETH",
|
||||
"name": "Wrapped ETH",
|
||||
"contractAddress": "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "XRP",
|
||||
"name": "Wrapped XRP",
|
||||
"contractAddress": "Ga2AXHpfAF6mv2ekZwcsJFqu7wB4NV331qNH7fW9Nst8",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 5,
|
||||
"symbol": "KIN",
|
||||
"name": "Kin",
|
||||
"contractAddress": "kinXdEcpDQeHPEuQnqmUgtYykqKGVFq6CeVX5iAHJq6",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "mSOL",
|
||||
"name": "Marinade staked",
|
||||
"contractAddress": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "GENE",
|
||||
"name": "Genopets",
|
||||
"contractAddress": "GENEtH5amGSi8kHAtQoezp1XEXwZJ8vcuePYnXdKrMYz",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "MM",
|
||||
"name": "Million",
|
||||
"contractAddress": "FiCiuX9DetEE89PgRAU1hmoptnem8b1fkpEq8PGYTYkd",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "DFL",
|
||||
"name": "DeFi Land",
|
||||
"contractAddress": "DFL1zNkaGPWm1BqAVqRjCZvHmwTFrEaJtbzJWgseoNJh",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "CAVE",
|
||||
"name": "Crypto Cavemen",
|
||||
"contractAddress": "4SZjjNABoqhbd4hnapbvoEPEqT8mnNkfbEoAwALf1V8t",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "FTT",
|
||||
"name": "Wrapped FTX",
|
||||
"contractAddress": "AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "SOL",
|
||||
"name": "Wrapped SOL",
|
||||
"contractAddress": "So11111111111111111111111111111111111111112",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 8,
|
||||
"symbol": "ATLAS",
|
||||
"name": "Star Atlas",
|
||||
"contractAddress": "ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 4,
|
||||
"symbol": "BRZ",
|
||||
"name": "Brazilian Digital Token",
|
||||
"contractAddress": "FtgGSFADXBtroxq8VCausXRr2of47QBf5AS1NtZCu4GD",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "USDC",
|
||||
"name": "USD Coin",
|
||||
"contractAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "SLIM",
|
||||
"name": "Solanium",
|
||||
"contractAddress": "xxxxa1sKNGwFtw2kFn8XauW9xq8hBZ5kVtcSesTT9fW",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "USDT",
|
||||
"name": "Wrapped USDT",
|
||||
"contractAddress": "BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "HOLD",
|
||||
"name": "Holdana",
|
||||
"contractAddress": "8GQsW3f7mdwfjqJon2myADcBsSsRjpXmxHYDG8q1pvV6",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "MAPS",
|
||||
"name": "Maps.me",
|
||||
"contractAddress": "MAPS41MDahZ9QdKXhVa4dWB9RuyfV4XqhyAZ8XcYepb",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "SRM",
|
||||
"name": "Serum",
|
||||
"contractAddress": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "JET",
|
||||
"name": "Jet Protocol",
|
||||
"contractAddress": "JET6zMJWkCN9tpRT2v2jfAmm5VnQFDpUBCyaKojmGtz",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "STNK",
|
||||
"name": "Stonks",
|
||||
"contractAddress": "43VWkd99HjqkhFTZbWBpMpRhjG469nWa7x7uEsgSH7We",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "SKEM",
|
||||
"name": "SKEM",
|
||||
"contractAddress": "3x7UeXDF4imKSKnizK9mYyx1M5bTNzpeALfPeB8S6XT9",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "MEDIA",
|
||||
"name": "Media Network",
|
||||
"contractAddress": "ETAtLmCmsoiEEKfNrHKJ2kYy3MoABhU6NQvpSfij5tDs",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "ROPE",
|
||||
"name": "Rope Token",
|
||||
"contractAddress": "8PMHT4swUMtBzgHnh5U564N5sjPSiUz2cjEQzFnnP1Fo",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 8,
|
||||
"symbol": "POLIS",
|
||||
"name": "Star Atlas DAO",
|
||||
"contractAddress": "poLisWXnNRwC6oBu1vHiuKQzFjGL4XDSu4g9qjz9qVk",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "RAY",
|
||||
"name": "Raydium",
|
||||
"contractAddress": "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "Wrapped FRONT",
|
||||
"name": "Wrapped FRONT",
|
||||
"contractAddress": "9S4t2NEAiJVMvPdRYKVrfJpBafPBLtvbvyS3DecojQHw",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "USDC",
|
||||
"name": "Wrapped USDC",
|
||||
"contractAddress": "BXXkv6z8ykpG1yuvUDPgh732wzVHB69RnB9YgSYh3itW",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "USDT",
|
||||
"name": "USDT",
|
||||
"contractAddress": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "ORCA",
|
||||
"name": "Orca",
|
||||
"contractAddress": "orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "LIQ",
|
||||
"name": "LIQ Protocol",
|
||||
"contractAddress": "4wjPQJ6PrkC4dHhYghwJzGBVP78DkBzA2U3kHoFNBuhj",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "WOOF",
|
||||
"name": "WOOFENOMICS",
|
||||
"contractAddress": "9nEqaUcb16sQ3Tn1psbkWqyhPdLmfHWjKGymREjsAgTE",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "STEP",
|
||||
"name": "Step Finance",
|
||||
"contractAddress": "StepAscQoEioFxxWGnh2sLBDFp9d8rvKz2Yp39iDpyT",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "FOUR",
|
||||
"name": "The 4th Pillar Token",
|
||||
"contractAddress": "DAtU322C23YpoZyWBm8szk12QyqHa9rUQe1EYXzbm1JE",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "OXY",
|
||||
"name": "Oxygen Protocol",
|
||||
"contractAddress": "z3dn17yLaGMKffVogeFHQ9zWVcXgqgf3PQnDsNs2g6M",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 7,
|
||||
"symbol": "ISLAMI",
|
||||
"name": "ISLAMICOIN",
|
||||
"contractAddress": "HG2FnifX1WPY6UvnkXnMx2kAt4E4Ssu6DZ2aiB5RmLHo",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "AURY",
|
||||
"name": "Aurory",
|
||||
"contractAddress": "AURYydfxJib1ZkTir1Jn1J9ECYUtjb6rKQVmtYaixWPP",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "COPE",
|
||||
"name": "COPE",
|
||||
"contractAddress": "8HGyAAB1yoM1ttS7pXjHMa3dukTFGQggnFFH3hJZgzQh",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "FIDA",
|
||||
"name": "Bonfida",
|
||||
"contractAddress": "EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "wCCX",
|
||||
"name": "Wrapped Conceal",
|
||||
"contractAddress": "CzqJTjTp3R9opDHmzF5Gy1G2NKDHEyMufa4Keiju4PLu",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 0,
|
||||
"symbol": "XCOPE",
|
||||
"name": "XCOPE",
|
||||
"contractAddress": "3K6rftdAaQYMPunrtNRHgnK2UAtjm2JwyT2oCiTDouYE",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 6,
|
||||
"symbol": "MNGO",
|
||||
"name": "Mango Markets",
|
||||
"contractAddress": "MangoCzJ36AjZyKwVj3VnYU4GTonjfVEnJmvvWaxLac",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": false
|
||||
}
|
||||
}
|
||||
]
|
||||
24
app/src/main/assets/solana_tokens_testnet.json
Normal file
24
app/src/main/assets/solana_tokens_testnet.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "TCA",
|
||||
"name": "Tangem Coin A",
|
||||
"contractAddress": "22PTNbX31Zuztd6nD82fC8nQdT2hUfWv9XWXKuDkrFqR",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"decimalCount": 9,
|
||||
"symbol": "TCB",
|
||||
"name": "Tangem Coin B",
|
||||
"contractAddress": "HmSghNPg6KCk711YJA92aPejt8auyFkvmaED6jbHfUs4",
|
||||
"blockchain": {
|
||||
"key": "solana",
|
||||
"curve": "ed25519",
|
||||
"testnet": true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.tap.common.extensions
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.net.Uri
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
|
|
@ -9,6 +10,7 @@ import com.squareup.picasso.Picasso
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.IconsUtil
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.tap.domain.extensions.getCustomIconUrl
|
||||
import com.tangem.wallet.R
|
||||
|
||||
fun Picasso.loadCurrenciesIcon(
|
||||
|
|
@ -19,7 +21,7 @@ fun Picasso.loadCurrenciesIcon(
|
|||
) {
|
||||
|
||||
val url = if (token != null) {
|
||||
IconsUtil.getTokenIconUri(blockchain, token)
|
||||
token.getCustomIconUrl()?.let { Uri.parse(it) } ?: IconsUtil.getTokenIconUri(blockchain, token)
|
||||
} else {
|
||||
IconsUtil.getBlockchainIconUri(blockchain)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.tangem.tap.common.extensions
|
||||
|
||||
import com.tangem.blockchain.common.BlockchainSdkError
|
||||
import com.tangem.blockchain.common.Wallet
|
||||
import com.tangem.blockchain.common.WalletManager
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.tap.domain.TapError
|
||||
import com.tangem.tap.domain.extensions.amountToCreateAccount
|
||||
import com.tangem.tap.domain.extensions.isNoAccountError
|
||||
import com.tangem.tap.domain.getFirstToken
|
||||
import com.tangem.tap.domain.topup.TradeCryptoHelper
|
||||
import com.tangem.tap.features.wallet.redux.AddressData
|
||||
|
|
@ -26,7 +26,7 @@ suspend fun WalletManager.safeUpdate(): Result<Wallet> = try {
|
|||
val blockchain = wallet.blockchain
|
||||
val amountToCreateAccount = blockchain.amountToCreateAccount(wallet.getFirstToken())
|
||||
|
||||
if (blockchain.isNoAccountError(exception) && amountToCreateAccount != null) {
|
||||
if (exception is BlockchainSdkError.AccountNotFound && amountToCreateAccount != null) {
|
||||
Result.Failure(TapError.WalletManagerUpdate.NoAccountError(amountToCreateAccount.toString()))
|
||||
} else {
|
||||
val message = exception.localizedMessage ?: "An error has occurred. Try later"
|
||||
|
|
|
|||
|
|
@ -6,14 +6,6 @@ import com.tangem.common.card.EllipticCurve
|
|||
import java.math.BigDecimal
|
||||
|
||||
|
||||
fun Blockchain.isNoAccountError(exception: Throwable): Boolean {
|
||||
return when (this) {
|
||||
Blockchain.Stellar, Blockchain.XRP ->
|
||||
exception.message?.contains("Account not found") == true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
fun Blockchain.amountToCreateAccount(token: Token? = null): BigDecimal? {
|
||||
return when (this) {
|
||||
Blockchain.Stellar -> if (token?.symbol == NODL) BigDecimal(1.5) else BigDecimal.ONE
|
||||
|
|
|
|||
17
app/src/main/java/com/tangem/tap/domain/extensions/Token.kt
Normal file
17
app/src/main/java/com/tangem/tap/domain/extensions/Token.kt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package com.tangem.tap.domain.extensions
|
||||
|
||||
import com.tangem.blockchain.common.Token
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
|
||||
private val tokenCustomIconUrls = mutableMapOf<String, String>()
|
||||
|
||||
fun Token.getCustomIconUrl(): String? {
|
||||
return tokenCustomIconUrls[this.contractAddress]
|
||||
}
|
||||
|
||||
fun Token.setCustomIconUrl(url: String) {
|
||||
tokenCustomIconUrls[this.contractAddress] = url
|
||||
}
|
||||
|
|
@ -9,7 +9,10 @@ import com.squareup.moshi.Types
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.common.card.FirmwareVersion
|
||||
import com.tangem.common.json.MoshiJsonConverter
|
||||
import com.tangem.tap.common.extensions.readJsonFileToString
|
||||
import com.tangem.tap.domain.extensions.getCustomIconUrl
|
||||
import com.tangem.tap.domain.extensions.setCustomIconUrl
|
||||
import com.tangem.tap.network.createMoshi
|
||||
|
||||
class CurrenciesRepository(val context: Application) {
|
||||
|
|
@ -113,24 +116,28 @@ class CurrenciesRepository(val context: Application) {
|
|||
if (isTestNet) BSC_TESTNET_TOKENS_FILE_NAME else BSC_TOKENS_FILE_NAME
|
||||
val binanceTokensFileName =
|
||||
if (isTestNet) BINANCE_TESTNET_TOKENS_FILE_NAME else BINANCE_TOKENS_FILE_NAME
|
||||
val avalancheTokensFileName =
|
||||
if (isTestNet) AVALANCHE_TESTNET_TOKENS_FILE_NAME else AVALANCHE_TOKENS_FILE_NAME
|
||||
|
||||
val ethereumTokensJson = context.assets.readJsonFileToString(ethereumTokensFileName)
|
||||
val bscTokensJson = context.assets.readJsonFileToString(bscTokensFileName)
|
||||
val binanceTokensJson = context.assets.readJsonFileToString(binanceTokensFileName)
|
||||
val avalancheTokensJson = context.assets.readJsonFileToString(avalancheTokensFileName)
|
||||
|
||||
return tokensAdapter.fromJson(ethereumTokensJson)!!.map { it.toToken() } +
|
||||
tokensAdapter.fromJson(bscTokensJson)!!.map { it.toToken() } +
|
||||
tokensAdapter.fromJson(binanceTokensJson)!!.mapNotNull {
|
||||
// temporary exclude Binance BEP-8 tokens
|
||||
if (it.type != null && it.type == BINANCE_TOKEN_TYPE_BEP8) null else it.toToken()
|
||||
}
|
||||
tokensAdapter.fromJson(bscTokensJson)!!.map { it.toToken() } +
|
||||
tokensAdapter.fromJson(binanceTokensJson)!!.mapNotNull {
|
||||
// temporary exclude Binance BEP-8 tokens
|
||||
if (it.type != null && it.type == BINANCE_TOKEN_TYPE_BEP8) null else it.toToken()
|
||||
} +
|
||||
tokensAdapter.fromJson(avalancheTokensJson)!!.map { it.toToken() }
|
||||
}
|
||||
|
||||
fun getBlockchains(
|
||||
cardFirmware: FirmwareVersion?,
|
||||
cardFirmware: FirmwareVersion,
|
||||
isTestNet: Boolean = false
|
||||
): List<Blockchain> {
|
||||
return if (cardFirmware == null || cardFirmware < FirmwareVersion.MultiWalletAvailable) {
|
||||
return if (cardFirmware < FirmwareVersion.MultiWalletAvailable) {
|
||||
Blockchain.secp256k1Blockchains(isTestNet)
|
||||
} else {
|
||||
Blockchain.secp256k1Blockchains(isTestNet) + Blockchain.ed25519OnlyBlockchains(isTestNet)
|
||||
|
|
@ -144,6 +151,9 @@ class CurrenciesRepository(val context: Application) {
|
|||
private const val BSC_TESTNET_TOKENS_FILE_NAME = "bsc_tokens_testnet"
|
||||
private const val BINANCE_TOKENS_FILE_NAME = "binance_tokens"
|
||||
private const val BINANCE_TESTNET_TOKENS_FILE_NAME = "binance_tokens_testnet"
|
||||
private const val AVALANCHE_TOKENS_FILE_NAME = "avalanche_tokens"
|
||||
private const val AVALANCHE_TESTNET_TOKENS_FILE_NAME = "avalanche_tokens_testnet"
|
||||
|
||||
private const val FILE_NAME_PREFIX_TOKENS = "tokens"
|
||||
private const val FILE_NAME_PREFIX_BLOCKCHAINS = "blockchains"
|
||||
|
||||
|
|
@ -152,6 +162,18 @@ class CurrenciesRepository(val context: Application) {
|
|||
fun getFileNameForTokens(cardId: String): String = "${FILE_NAME_PREFIX_TOKENS}_$cardId"
|
||||
fun getFileNameForBlockchains(cardId: String): String =
|
||||
"${FILE_NAME_PREFIX_BLOCKCHAINS}_$cardId"
|
||||
|
||||
fun injectDaoBlockchain(context: Context, tokenFileName: String, blockchain: Blockchain): String? {
|
||||
val tokenJson = context.assets.readJsonFileToString(tokenFileName)
|
||||
val converter = MoshiJsonConverter.default()
|
||||
val rawTokensList = converter.fromJson<List<MutableMap<String, Any>>>(tokenJson) ?: return null
|
||||
|
||||
rawTokensList.forEach {
|
||||
it["blockchain"] = BlockchainDao.fromBlockchain(blockchain)
|
||||
}
|
||||
|
||||
return converter.toJson(rawTokensList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,6 +185,7 @@ data class TokenDao(
|
|||
val decimalCount: Int,
|
||||
@Json(name = "blockchain")
|
||||
val blockchainDao: BlockchainDao,
|
||||
val customIconUrl: String? = null,
|
||||
val type: String? = null
|
||||
) {
|
||||
fun toToken(): Token {
|
||||
|
|
@ -172,7 +195,9 @@ data class TokenDao(
|
|||
contractAddress = contractAddress,
|
||||
decimals = decimalCount,
|
||||
blockchain = blockchainDao.toBlockchain()
|
||||
)
|
||||
).apply {
|
||||
customIconUrl?.let { this.setCustomIconUrl(it) }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
@ -182,7 +207,8 @@ data class TokenDao(
|
|||
symbol = token.symbol,
|
||||
contractAddress = token.contractAddress,
|
||||
decimalCount = token.decimals,
|
||||
blockchainDao = BlockchainDao.fromBlockchain(token.blockchain)
|
||||
blockchainDao = BlockchainDao.fromBlockchain(token.blockchain),
|
||||
customIconUrl = token.getCustomIconUrl()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -205,8 +231,7 @@ data class BlockchainDao(
|
|||
companion object {
|
||||
fun fromBlockchain(blockchain: Blockchain): BlockchainDao {
|
||||
val name = blockchain.name.removeSuffix("Testnet").lowercase()
|
||||
val isTestnet = blockchain.name.endsWith("Testnet")
|
||||
return BlockchainDao(name, isTestnet)
|
||||
return BlockchainDao(name, blockchain.isTestnet())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,13 +205,13 @@ private fun sendTransaction(
|
|||
}
|
||||
is SimpleResult.Failure -> {
|
||||
when (sendResult.error) {
|
||||
is CreateAccountUnderfunded -> {
|
||||
val error = sendResult.error as CreateAccountUnderfunded
|
||||
is BlockchainSdkError.CreateAccountUnderfunded -> {
|
||||
val error = sendResult.error as BlockchainSdkError.CreateAccountUnderfunded
|
||||
val reserve = error.minReserve.value?.stripZeroPlainString() ?: "0"
|
||||
val symbol = error.minReserve.currencySymbol
|
||||
dispatch(SendAction.SendError(TapError.CreateAccountUnderfunded(listOf(reserve, symbol))))
|
||||
}
|
||||
is SendException -> {
|
||||
is BlockchainSdkError.SendException -> {
|
||||
sendResult.error?.let { FirebaseCrashlytics.getInstance().recordException(it) }
|
||||
}
|
||||
is Throwable -> {
|
||||
|
|
|
|||
|
|
@ -23,29 +23,35 @@ sealed class CurrencyListItem {
|
|||
blockchains: List<Blockchain>,
|
||||
tokens: List<Token>,
|
||||
): List<CurrencyListItem> {
|
||||
val blockchainsTitle = R.string.add_tokens_subtitle_blockchains
|
||||
val ethereumTokensTitle = R.string.add_tokens_subtitle_ethereum_tokens
|
||||
val bscTokensTitle = R.string.add_tokens_subtitle_bsc_tokens
|
||||
val binanceTokensTitle = R.string.add_tokens_subtitle_binance_tokens
|
||||
return createBlockchainList(blockchains) +
|
||||
createTokensList(R.string.add_tokens_subtitle_ethereum_tokens, Blockchain.Ethereum, tokens) +
|
||||
createTokensList(R.string.add_tokens_subtitle_bsc_tokens, Blockchain.BSC, tokens) +
|
||||
createTokensList(R.string.add_tokens_subtitle_binance_tokens, Blockchain.Binance, tokens) +
|
||||
createTokensList(R.string.add_tokens_subtitle_avalanche_tokens, Blockchain.Avalanche, tokens)
|
||||
}
|
||||
|
||||
val ethereumTokens = tokens.filter { it.blockchain == Blockchain.Ethereum }
|
||||
val bscTokens = tokens.filter { it.blockchain == Blockchain.BSC }
|
||||
val binanceTokens = tokens.filter { it.blockchain == Blockchain.Binance }
|
||||
return listOf(TitleListItem(blockchainsTitle)) +
|
||||
blockchains.map { BlockchainListItem(it) } +
|
||||
listOf(TitleListItem(ethereumTokensTitle, blockchain = Blockchain.Ethereum)) +
|
||||
ethereumTokens.map { TokenListItem(it) } +
|
||||
listOf(TitleListItem(bscTokensTitle, blockchain = Blockchain.BSC)) +
|
||||
bscTokens.map { TokenListItem(it) } +
|
||||
listOf(TitleListItem(binanceTokensTitle, blockchain = Blockchain.Binance)) +
|
||||
binanceTokens.map { TokenListItem(it) }
|
||||
private fun createBlockchainList(blockchains: List<Blockchain>): List<CurrencyListItem> {
|
||||
val blockchainsTitle = R.string.add_tokens_subtitle_blockchains
|
||||
return listOf(TitleListItem(blockchainsTitle)) + blockchains.map { BlockchainListItem(it) }
|
||||
}
|
||||
|
||||
private fun createTokensList(
|
||||
@StringRes titleResId: Int,
|
||||
blockchain: Blockchain,
|
||||
tokens: List<Token>
|
||||
): List<CurrencyListItem> {
|
||||
val filteredTokens = tokens.filter {
|
||||
it.blockchain == blockchain || it.blockchain == blockchain.getTestnetVersion()
|
||||
}
|
||||
val tokensListItem = filteredTokens.map { TokenListItem(it) }
|
||||
return listOf(TitleListItem(titleResId, blockchain = blockchain)) + tokensListItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun List<CurrencyListItem>.removeTokensForBlockchain(blockchain: Blockchain): List<CurrencyListItem> {
|
||||
return filterNot {
|
||||
it is CurrencyListItem.TokenListItem && it.token.blockchain == blockchain
|
||||
it is CurrencyListItem.TokenListItem && it.isTheSameOrTestnetBlockchain(blockchain)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,18 +59,31 @@ fun List<CurrencyListItem>.addTokensForBlockchain(
|
|||
blockchain: Blockchain, fullCurrenciesList: List<CurrencyListItem>,
|
||||
): List<CurrencyListItem> {
|
||||
val tokensToAdd = fullCurrenciesList.filter {
|
||||
it is CurrencyListItem.TokenListItem && it.token.blockchain == blockchain
|
||||
it is CurrencyListItem.TokenListItem && it.isTheSameOrTestnetBlockchain(blockchain)
|
||||
}
|
||||
val indexToInsert = indexOfFirst {
|
||||
it is CurrencyListItem.TitleListItem && it.blockchain == blockchain
|
||||
it is CurrencyListItem.TitleListItem && it.isTheSameOrTestnetBlockchain(blockchain)
|
||||
} + 1
|
||||
return this.toMutableList().apply { addAll(indexToInsert, tokensToAdd) }
|
||||
}
|
||||
|
||||
fun List<CurrencyListItem>.toggleHeaderContentShownValue(blockchain: Blockchain) {
|
||||
map {
|
||||
if (it is CurrencyListItem.TitleListItem && it.blockchain == blockchain) {
|
||||
if (it is CurrencyListItem.TitleListItem && it.isTheSameOrTestnetBlockchain(blockchain)) {
|
||||
it.isContentShown = !it.isContentShown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if you do not check the testNet blockchains, it will not collapse
|
||||
private fun CurrencyListItem.isTheSameOrTestnetBlockchain(blockchain: Blockchain): Boolean {
|
||||
return when (this) {
|
||||
is CurrencyListItem.TitleListItem -> this.blockchain?.isTheSameOrTestnetBlockchain(blockchain) ?: false
|
||||
is CurrencyListItem.BlockchainListItem -> this.blockchain.isTheSameOrTestnetBlockchain(blockchain)
|
||||
is CurrencyListItem.TokenListItem -> this.token.blockchain.isTheSameOrTestnetBlockchain(blockchain)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Blockchain.isTheSameOrTestnetBlockchain(blockchain: Blockchain): Boolean {
|
||||
return this == blockchain || this == blockchain.getTestnetVersion()
|
||||
}
|
||||
|
|
@ -146,4 +146,5 @@ sealed class WalletAction : Action {
|
|||
|
||||
data class ChangeSelectedAddress(val type: AddressType) : WalletAction()
|
||||
|
||||
data class SetWalletRent(val blockchain: Blockchain, val minRent: String, val rentExempt: String): WalletAction()
|
||||
}
|
||||
|
|
@ -246,7 +246,8 @@ data class WalletData(
|
|||
val fiatRateString: String? = null,
|
||||
val fiatRate: BigDecimal? = null,
|
||||
val mainButton: WalletMainButton = WalletMainButton.SendButton(false),
|
||||
val currency: Currency
|
||||
val currency: Currency,
|
||||
val walletRent: WalletRent? = null,
|
||||
) {
|
||||
fun shouldShowMultipleAddress(): Boolean {
|
||||
val listOfAddresses = walletAddresses?.list ?: return false
|
||||
|
|
@ -254,6 +255,11 @@ data class WalletData(
|
|||
}
|
||||
}
|
||||
|
||||
data class WalletRent(
|
||||
val minRentValue: String,
|
||||
val rentExemptValue: String
|
||||
)
|
||||
|
||||
sealed interface Currency {
|
||||
|
||||
val blockchain: com.tangem.blockchain.common.Blockchain
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.tangem.tap.features.wallet.redux.middlewares
|
||||
|
||||
import com.tangem.blockchain.blockchains.solana.RentProvider
|
||||
import com.tangem.blockchain.common.*
|
||||
import com.tangem.blockchain.extensions.Result
|
||||
import com.tangem.common.extensions.isZero
|
||||
import com.tangem.tap.common.extensions.dispatchOnMain
|
||||
import com.tangem.tap.common.extensions.safeUpdate
|
||||
import com.tangem.tap.common.extensions.stripZeroPlainString
|
||||
import com.tangem.tap.common.redux.global.GlobalState
|
||||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
|
|
@ -31,6 +33,7 @@ class MultiWalletMiddleware {
|
|||
when (action) {
|
||||
is WalletAction.MultiWallet.AddWalletManagers -> {
|
||||
globalState.feedbackManager?.infoHolder?.setWalletsInfo(action.walletManagers)
|
||||
action.walletManagers.forEach { checkForRentWarning(it) }
|
||||
}
|
||||
is WalletAction.MultiWallet.SelectWallet -> {
|
||||
if (action.walletData != null) {
|
||||
|
|
@ -197,6 +200,26 @@ class MultiWalletMiddleware {
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkForRentWarning(walletManager: WalletManager) {
|
||||
val rentProvider = walletManager as? RentProvider ?: return
|
||||
|
||||
scope.launch {
|
||||
when (val result = rentProvider.minimalBalanceForRentExemption()) {
|
||||
is Result.Success -> {
|
||||
val currency = walletManager.wallet.blockchain.currency
|
||||
val minRent = ("${rentProvider.rentAmount().stripZeroPlainString()} $currency")
|
||||
val rentExempt = ("${result.data.stripZeroPlainString()} $currency")
|
||||
store.dispatchOnMain(WalletAction.SetWalletRent(
|
||||
blockchain = walletManager.wallet.blockchain,
|
||||
minRent = minRent,
|
||||
rentExempt = rentExempt
|
||||
))
|
||||
}
|
||||
is Result.Failure -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addTokens(
|
||||
tokens: List<Token>,
|
||||
walletState: WalletState?,
|
||||
|
|
|
|||
|
|
@ -245,6 +245,17 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
|
|||
)
|
||||
newState = newState.copy(wallets = wallets)
|
||||
}
|
||||
is WalletAction.SetWalletRent -> {
|
||||
var walletData = newState.getWalletData(action.blockchain)
|
||||
if (walletData == null) {
|
||||
newState
|
||||
} else {
|
||||
walletData = walletData.copy(walletRent = WalletRent(action.minRent, action.rentExempt))
|
||||
newState = newState.copy(
|
||||
wallets = newState.replaceSomeWallets(listOf(walletData))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return newState
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.transition.TransitionInflater
|
||||
import com.squareup.picasso.Picasso
|
||||
import com.tangem.common.extensions.guard
|
||||
import com.tangem.tap.common.SnackbarHandler
|
||||
import com.tangem.tap.common.extensions.*
|
||||
import com.tangem.tap.common.redux.StateDialog
|
||||
|
|
@ -27,6 +28,8 @@ import kotlinx.android.synthetic.main.item_popular_token.view.*
|
|||
import kotlinx.android.synthetic.main.layout_balance_error.*
|
||||
import kotlinx.android.synthetic.main.layout_balance_wallet_details.*
|
||||
import kotlinx.android.synthetic.main.layout_wallet_details.*
|
||||
import kotlinx.android.synthetic.main.layout_wallet_details.card_balance
|
||||
import kotlinx.android.synthetic.main.layout_wallet_details_rent.*
|
||||
import org.rekotlin.StoreSubscriber
|
||||
|
||||
class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreSubscriber<WalletState> {
|
||||
|
|
@ -124,11 +127,12 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreS
|
|||
|
||||
handleDialogs(state.walletDialog)
|
||||
handleCurrencyIcon(selectedWallet)
|
||||
handleWalletRent(selectedWallet.walletRent)
|
||||
|
||||
srl_wallet_details.setOnRefreshListener {
|
||||
if (selectedWallet.currencyData.status != BalanceStatus.Loading) {
|
||||
store.dispatch(WalletAction.LoadWallet(
|
||||
blockchain = selectedWallet.currency?.blockchain
|
||||
blockchain = selectedWallet.currency.blockchain
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
@ -141,6 +145,18 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreS
|
|||
btn_sell.show(selectedWallet.tradeCryptoState.sellingAllowed)
|
||||
}
|
||||
|
||||
private fun handleWalletRent(rent: WalletRent?) {
|
||||
val rent = rent.guard {
|
||||
l_rent_warning.hide()
|
||||
return
|
||||
}
|
||||
|
||||
val warningMessage = requireContext().getString(
|
||||
R.string.solana_rent_warning, rent.minRentValue, rent.rentExemptValue)
|
||||
tv_rent_warning_message.text = warningMessage
|
||||
l_rent_warning.show()
|
||||
}
|
||||
|
||||
private fun handleCurrencyIcon(wallet: WalletData) {
|
||||
Picasso.get().loadCurrenciesIcon(
|
||||
imageView = iv_currency,
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:theme="@style/ThemeOverlay.MyTheme.Toolbar"
|
||||
app:menu="@menu/wallet_details"
|
||||
app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
|
||||
android:theme="@style/ThemeOverlay.MyTheme.Toolbar"
|
||||
app:title=" " />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
@ -46,7 +46,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_currency_title"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -79,7 +78,6 @@
|
|||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="tv_currency_subtitle,tv_currency_title" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pending_transaction"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -100,6 +98,18 @@
|
|||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/rv_pending_transaction" />
|
||||
|
||||
<include
|
||||
android:id="@+id/l_rent_warning"
|
||||
layout="@layout/layout_wallet_details_rent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/l_wallet_details" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card_pending_transaction_warning"
|
||||
|
|
@ -131,22 +141,6 @@
|
|||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="l_wallet_details,card_pending_transaction_warning" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_trade"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/wallet_button_buy"
|
||||
app:icon="@drawable/ic_arrow_up"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_sell"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_left_button"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -161,6 +155,22 @@
|
|||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="btn_sell, btn_confirm" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_trade"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/wallet_button_buy"
|
||||
app:icon="@drawable/ic_arrow_up"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_sell"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/l_rent_warning"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_sell"
|
||||
style="@style/TapButtonWithIcon"
|
||||
|
|
@ -172,10 +182,10 @@
|
|||
android:text="@string/wallet_button_sell"
|
||||
app:icon="@drawable/ic_arrow_down"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_confirm"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_trade"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_confirm"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier"
|
||||
app:layout_constraintTop_toBottomOf="@+id/l_rent_warning"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
|
@ -187,12 +197,11 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_sell"
|
||||
app:icon="@drawable/ic_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_sell"
|
||||
app:layout_constraintTop_toBottomOf="@+id/l_rent_warning"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
|||
47
app/src/main/res/layout/layout_wallet_details_rent.xml
Normal file
47
app/src/main/res/layout/layout_wallet_details_rent.xml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/card_balance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="3dp"
|
||||
app:cardBackgroundColor="@color/darkGray2">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rent_warning_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/common_warning"
|
||||
android:textColor="@color/lightGray0"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rent_warning_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:textColor="@color/lightGray0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_rent_warning_title"
|
||||
tools:text="@string/solana_rent_warning" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
|
@ -101,6 +101,7 @@
|
|||
<string name="add_tokens_subtitle_ethereum_tokens" translatable="false">Ethereum tokens</string>
|
||||
<string name="add_tokens_subtitle_bsc_tokens" translatable="false">Binance Smart Chain tokens</string>
|
||||
<string name="add_tokens_subtitle_binance_tokens" translatable="false">Binance Chain tokens</string>
|
||||
<string name="add_tokens_subtitle_avalanche_tokens" translatable="false">Avalanche C-Chain tokens</string>
|
||||
<string name="wallet_address_button_copy" translatable="false">Copy</string>
|
||||
<string name="wallet_address_button_share" translatable="false">Share</string>
|
||||
<string name="wallet_button_add_tokens" translatable="false">+ Add tokens</string>
|
||||
|
|
@ -311,4 +312,6 @@ Price: %s\n
|
|||
Amount to receive: %s\n
|
||||
Amount to pay: %s</string>
|
||||
|
||||
<string name="solana_rent_warning" translatable="false">Solana network charges a rent of %s every 2 days. Accounts that can’t afford the rent are purged from the network. Deposit your account with more than %s to use it for free.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue