Updated on 2026-08-14

This commit is contained in:
Tangem 2021-07-09 19:10:47 +00:00
commit 0a3f90498b
19 changed files with 7635 additions and 4971 deletions

View file

@ -77,7 +77,7 @@ 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:BSK-84_testnets-27'
implementation 'com.tangem:blockchain:develop-33'
implementation 'com.tangem:core:fixes_for_app_release-44'
implementation 'com.tangem:sdk:fixes_for_app_release-44'
@ -117,6 +117,10 @@ dependencies {
implementation 'com.squareup.moshi:moshi:1.9.2'
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
//
// //Crypto
implementation "com.madgag.spongycastle:core:1.58.0.0"
testImplementation 'junit:junit:4.13.2'
testImplementation "com.google.truth:truth:1.0.1"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
[]

View file

@ -0,0 +1,782 @@
[
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x6c5FE6e99D2484db7E4BF34F365ABA42d0E4dC20/logo.png",
"symbol" : "ABS",
"name" : "Absorber",
"contractAddress" : "0x6c5FE6e99D2484db7E4BF34F365ABA42d0E4dC20",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x4197C6EF3879a08cD51e5560da5064B773aa1d29/logo.png",
"symbol" : "ACS",
"name" : "ACryptoS",
"contractAddress" : "0x4197C6EF3879a08cD51e5560da5064B773aa1d29",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xa1faa113cbE53436Df28FF0aEe54275c13B40975/logo.png",
"symbol" : "ALPHA",
"name" : "Alpha Token",
"contractAddress" : "0xa1faa113cbE53436Df28FF0aEe54275c13B40975",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xa184088a740c695E156F91f5cC086a06bb78b827/logo.png",
"symbol" : "AUTO",
"name" : "AUTOv2",
"contractAddress" : "0xa184088a740c695E156F91f5cC086a06bb78b827",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/logo.png",
"symbol" : "BUSD",
"name" : "BUSD",
"contractAddress" : "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xAD6cAEb32CD2c308980a548bD0Bc5AA4306c6c18/logo.png",
"symbol" : "BAND",
"name" : "Binance-Peg Band Protocol",
"contractAddress" : "0xAD6cAEb32CD2c308980a548bD0Bc5AA4306c6c18",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf/logo.png",
"symbol" : "BCH",
"name" : "Binance-Peg Bitcoin Cash",
"contractAddress" : "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x72fAa679E1008Ad8382959FF48E392042A8b06f7/logo.png",
"symbol" : "bALBT",
"name" : "AllianceBlock Token",
"contractAddress" : "0x72fAa679E1008Ad8382959FF48E392042A8b06f7",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 6,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x63870A18B6e42b01Ef1Ad8A2302ef50B7132054F/logo.png",
"symbol" : "BLINK",
"name" : "BLink Token",
"contractAddress" : "0x63870A18B6e42b01Ef1Ad8A2302ef50B7132054F",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x5Ac52EE5b2a633895292Ff6d8A89bB9190451587/logo.png",
"symbol" : "BSCX",
"name" : "BSCX",
"contractAddress" : "0x5Ac52EE5b2a633895292Ff6d8A89bB9190451587",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",
"symbol" : "BTCB",
"name" : "Binance-Peg BTCB Token",
"contractAddress" : "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47/logo.png",
"symbol" : "ADA",
"name" : "Binance-Peg Cardano",
"contractAddress" : "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD/logo.png",
"symbol" : "LINK",
"name" : "Binance-Peg ChainLink",
"contractAddress" : "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0Eb3a705fc54725037CC9e008bDede697f62F335/logo.png",
"symbol" : "ATOM",
"name" : "Binance-Peg Cosmos",
"contractAddress" : "0x0Eb3a705fc54725037CC9e008bDede697f62F335",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xC9849E6fdB743d08fAeE3E34dd2D1bc69EA11a51/logo.png",
"symbol" : "BUNNY",
"name" : "Bunny Token",
"contractAddress" : "0xC9849E6fdB743d08fAeE3E34dd2D1bc69EA11a51",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xBf5140A22578168FD562DCcF235E5D43A02ce9B1/logo.png",
"symbol" : "UNI",
"name" : "Binance-Peg Uniswap",
"contractAddress" : "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x88f1A5ae2A3BF98AEAF342D26B30a79438c9142e/logo.png",
"symbol" : "YFI",
"name" : "Binance-Peg yearn.finance",
"contractAddress" : "0x88f1A5ae2A3BF98AEAF342D26B30a79438c9142e",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x81859801b01764D4f0Fa5E64729f5a6C3b91435b/logo.png",
"symbol" : "BFI",
"name" : "bearn.fi",
"contractAddress" : "0x81859801b01764D4f0Fa5E64729f5a6C3b91435b",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xCa3F508B8e4Dd382eE878A314789373D80A5190A/logo.png",
"symbol" : "BIFI",
"name" : "beefy.finance",
"contractAddress" : "0xCa3F508B8e4Dd382eE878A314789373D80A5190A",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7F70642d88cf1C4a3a7abb072B53B929b653edA5/logo.png",
"symbol" : "YFII",
"name" : "Binance-Peg YFII.finance",
"contractAddress" : "0x7F70642d88cf1C4a3a7abb072B53B929b653edA5",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x790Be81C3cA0e53974bE2688cDb954732C9862e1/logo.png",
"symbol" : "BREW",
"name" : "CafeSwap Token",
"contractAddress" : "0x790Be81C3cA0e53974bE2688cDb954732C9862e1",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xcc2E12a9b5b75360c6FBf23B584c275D52cDdb0E/logo.png",
"symbol" : "CROW",
"name" : "Crow Token",
"contractAddress" : "0xcc2E12a9b5b75360c6FBf23B584c275D52cDdb0E",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 6,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xA8c2B8eec3d368C0253ad3dae65a5F2BBB89c929/logo.png",
"symbol" : "CTK",
"name" : "CertiK Token",
"contractAddress" : "0xA8c2B8eec3d368C0253ad3dae65a5F2BBB89c929",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x97a30C692eCe9C317235d48287d23d358170FC40/logo.png",
"symbol" : "CRX",
"name" : "CryptEx Token",
"contractAddress" : "0x97a30C692eCe9C317235d48287d23d358170FC40",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6/logo.png",
"symbol" : "EGG",
"name" : "Goose Golden Egg",
"contractAddress" : "0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbF7c81FFF98BbE61B40Ed186e4AfD6DDd01337fe/logo.png",
"symbol" : "EGLD",
"name" : "Elrond",
"contractAddress" : "0xbF7c81FFF98BbE61B40Ed186e4AfD6DDd01337fe",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x928e55daB735aa8260AF3cEDadA18B5f70C72f1b/logo.png",
"symbol" : "FRONT",
"name" : "Frontier Token",
"contractAddress" : "0x928e55daB735aa8260AF3cEDadA18B5f70C72f1b",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 6,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xf79037F6f6bE66832DE4E7516be52826BC3cBcc4/logo.png",
"symbol" : "HARD",
"name" : "Hard Protocol",
"contractAddress" : "0xf79037F6f6bE66832DE4E7516be52826BC3cBcc4",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 6,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xC7d8D35EBA58a0935ff2D5a33Df105DD9f071731/logo.png",
"symbol" : "HGET",
"name" : "Hedget",
"contractAddress" : "0xC7d8D35EBA58a0935ff2D5a33Df105DD9f071731",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x948d2a81086A075b3130BAc19e4c6DEe1D2E3fE8/logo.png",
"symbol" : "Helmet",
"name" : "Helmet.insure Governance Token",
"contractAddress" : "0x948d2a81086A075b3130BAc19e4c6DEe1D2E3fE8",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xa2B726B1145A4773F68593CF171187d8EBe4d495/logo.png",
"symbol" : "INJ",
"name" : "Injective Protocol",
"contractAddress" : "0xa2B726B1145A4773F68593CF171187d8EBe4d495",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2/logo.png",
"symbol" : "KEBAB",
"name" : "Kebab Token",
"contractAddress" : "0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xb59490aB09A0f526Cc7305822aC65f2Ab12f9723/logo.png",
"symbol" : "LIT",
"name" : "Litentry",
"contractAddress" : "0xb59490aB09A0f526Cc7305822aC65f2Ab12f9723",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png",
"symbol" : "MATIC",
"name" : "Matic Token",
"contractAddress" : "0xcc42724c6683b7e57334c4e856f4c9965ed682bd",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 9,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xC7FB8c5eFE8564205eE5CbA4dE8eeA8a086a4bd2/logo.png",
"symbol" : "POCROC",
"name" : "PocketRocket",
"contractAddress" : "0xC7FB8c5eFE8564205eE5CbA4dE8eeA8a086a4bd2",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xF21768cCBC73Ea5B6fd3C687208a7c2def2d966e/logo.png",
"symbol" : "REEF",
"name" : "Reef.finance",
"contractAddress" : "0xF21768cCBC73Ea5B6fd3C687208a7c2def2d966e",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xE40255C5d7fa7ceEc5120408C78C787CECB4cfdb/logo.png",
"symbol" : "SWGb",
"name" : "SWGb",
"contractAddress" : "0xE40255C5d7fa7ceEc5120408C78C787CECB4cfdb",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb/logo.png",
"symbol" : "SFP",
"name" : "SafePal Token",
"contractAddress" : "0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x78650B139471520656b9E7aA7A5e9276814a38e9/logo.png",
"symbol" : "BTCST",
"name" : "StandardBTCHashrateToken",
"contractAddress" : "0x78650B139471520656b9E7aA7A5e9276814a38e9",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3/logo.png",
"symbol" : "DAI",
"name" : "Binance-Peg Dai Token",
"contractAddress" : "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402/logo.png",
"symbol" : "DOT",
"name" : "Binance-Peg Polkadot",
"contractAddress" : "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2/logo.png",
"symbol" : "DODO",
"name" : "DODO",
"contractAddress" : "0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6/logo.png",
"symbol" : "EOS",
"name" : "Binance-Peg EOS",
"contractAddress" : "0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 9,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x233d91A0713155003fc4DcE0AFa871b508B3B715/logo.png",
"symbol" : "DITTO",
"name" : "Ditto",
"contractAddress" : "0x233d91A0713155003fc4DcE0AFa871b508B3B715",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",
"symbol" : "ETH",
"name" : "Ethereum Token",
"contractAddress" : "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454/logo.png",
"symbol" : "BDO",
"name" : "bDollar",
"contractAddress" : "0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",
"symbol" : "Cake",
"name" : "PancakeSwap Token",
"contractAddress" : "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153/logo.png",
"symbol" : "FIL",
"name" : "Binance-Peg Filecoin",
"contractAddress" : "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x4338665CBB7B2485A8855A139b75D5e34AB0DB94/logo.png",
"symbol" : "LTC",
"name" : "Binance-Peg Litecoin",
"contractAddress" : "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",
"symbol" : "USDT",
"name" : "Binance-Peg Tether USD",
"contractAddress" : "0x55d398326f99059fF775485246999027B3197955",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2090c8295769791ab7A3CF1CC6e0AA19F35e441A/logo.png",
"symbol" : "Fuel",
"name" : "Fuel Token",
"contractAddress" : "0x2090c8295769791ab7A3CF1CC6e0AA19F35e441A",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 9,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x3aabCf53A1930A42E18D938C019E83Ebee50a849/logo.png",
"symbol" : "SPG",
"name" : "SPONGE",
"contractAddress" : "0x3aabCf53A1930A42E18D938C019E83Ebee50a849",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x37Ac4D6140e54304D77437A5c11924f61a2D976f/logo.png",
"symbol" : "SFUEL",
"name" : "SparkPoint Fuel",
"contractAddress" : "0x37Ac4D6140e54304D77437A5c11924f61a2D976f",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A/logo.png",
"symbol" : "SXP",
"name" : "Swipe",
"contractAddress" : "0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xeAF7D8395CCE52DAef138d39a1CEfA51b97C15aE/logo.png",
"symbol" : "TBC",
"name" : "TeraBlock Token",
"contractAddress" : "0xeAF7D8395CCE52DAef138d39a1CEfA51b97C15aE",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x4B0F1812e5Df2A09796481Ff14017e6005508003/logo.png",
"symbol" : "TWT",
"name" : "Trust Wallet",
"contractAddress" : "0x4B0F1812e5Df2A09796481Ff14017e6005508003",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x728C5baC3C3e370E372Fc4671f9ef6916b814d8B/logo.png",
"symbol" : "UNFI",
"name" : "UNFI",
"contractAddress" : "0x728C5baC3C3e370E372Fc4671f9ef6916b814d8B",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7/logo.png",
"symbol" : "VAI",
"name" : "VAI Stablecoin",
"contractAddress" : "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x23396cF899Ca06c4472205fC903bDB4de249D6fC/logo.png",
"symbol" : "UST",
"name" : "Wrapped UST Token",
"contractAddress" : "0x23396cF899Ca06c4472205fC903bDB4de249D6fC",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE/logo.png",
"symbol" : "XRP",
"name" : "Binance-Peg XRP",
"contractAddress" : "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x16939ef78684453bfDFb47825F8a5F714f12623a/logo.png",
"symbol" : "XTZ",
"name" : "Binance-Peg Tezos",
"contractAddress" : "0x16939ef78684453bfDFb47825F8a5F714f12623a",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63/logo.png",
"symbol" : "XVS",
"name" : "Venus",
"contractAddress" : "0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0231f91e02DebD20345Ae8AB7D71A41f8E140cE7/logo.png",
"symbol" : "bwJUP",
"name" : "Jupiter",
"contractAddress" : "0x0231f91e02DebD20345Ae8AB7D71A41f8E140cE7",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",
"symbol" : "WBNB",
"name" : "Wrapped BNB",
"contractAddress" : "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
},
{
"decimalCount" : 18,
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x44754455564474A89358B2C2265883DF993b12F0/logo.png",
"symbol" : "ZEE",
"name" : "ZeroSwapToken",
"contractAddress" : "0x44754455564474A89358B2C2265883DF993b12F0",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : false
}
}
]

View file

@ -0,0 +1,99 @@
[
{
"decimalCount" : 18,
"symbol" : "BUSD",
"name" : "Binance-Peg BUSD Token",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/logo.png",
"contractAddress" : "0xed24fc36d5ee211ea25a80239fb8c4cfd80f12ee",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "ETH",
"name" : "Ethereum Token",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",
"contractAddress" : "0xd66c6b4f0be8ce5b39d52e0fd1344c389929b378",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "BTCB",
"name" : "Binance-Peg BTCB Token",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",
"contractAddress" : "0x6ce8da28e2f864420840cf74474eff5fd80e65b8",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "USDT",
"name" : "Binance-Peg Tether USD",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",
"contractAddress" : "0x337610d27c682e347c9cd60bd4b3b107c9d34ddd",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "USDT",
"name" : "Tether USD",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",
"contractAddress" : "0x7ef95a0fee0dd31b22626fa2e10ee6a223f8a684",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "XRP",
"name" : "Binance-Peg XRP",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE/logo.png",
"contractAddress" : "0xa83575490d7df4e2f47b7d38ef351a2722ca45b9",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "DAI",
"name" : "Binance-Peg Dai Token",
"customIconUrl" : "https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3/logo.png",
"contractAddress" : "0xec5dcb5dbf4b114c9d0f65bccab49ec54f6a0867",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "USDC",
"name" : "Binance-Peg USDC Token",
"customIconUrl" : "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"contractAddress" : "0x64544969ed7ebf5f083679233325356ebe738930",
"blockchain" : {
"key" : "bsc",
"curve" : "secp256k1",
"testnet" : true
}
}
]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,24 +3,44 @@
"decimalCount" : 18,
"symbol" : "WEENUS",
"name" : "Weenus",
"contractAddress" : "0xaFF4481D10270F50f203E0763e2597776068CBc5"
"contractAddress" : "0xaFF4481D10270F50f203E0763e2597776068CBc5",
"blockchain" : {
"key" : "ethereum",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 18,
"symbol" : "XEENUS",
"name" : "Xeenus",
"contractAddress" : "0x022E292b44B5a146F2e8ee36Ff44D3dd863C915c"
"contractAddress" : "0x022E292b44B5a146F2e8ee36Ff44D3dd863C915c",
"blockchain" : {
"key" : "ethereum",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 8,
"symbol" : "YEENUS",
"name" : "Yeenus",
"contractAddress" : "0xc6fDe3FD2Cc2b173aEC24cc3f267cb3Cd78a26B7"
"contractAddress" : "0xc6fDe3FD2Cc2b173aEC24cc3f267cb3Cd78a26B7",
"blockchain" : {
"key" : "ethereum",
"curve" : "secp256k1",
"testnet" : true
}
},
{
"decimalCount" : 0,
"symbol" : "ZEENUS",
"name" : "Zeenus",
"contractAddress" : "0x1f9061B953bBa0E36BF50F21876132DcF276fC6e"
"contractAddress" : "0x1f9061B953bBa0E36BF50F21876132DcF276fC6e",
"blockchain" : {
"key" : "ethereum",
"curve" : "secp256k1",
"testnet" : true
}
}
]

View file

@ -69,7 +69,7 @@ class TapWalletManager {
suspend fun loadFiatRate(fiatCurrency: FiatCurrencyName, wallet: Wallet) {
Timber.d(wallet.getTokens().toString())
val currencies = wallet.getTokens()
.map { Currency.Token(it, wallet.blockchain) }
.map { Currency.Token(it) }
.plus(Currency.Blockchain(wallet.blockchain))
loadFiatRate(fiatCurrency, currencies)
}
@ -186,18 +186,18 @@ class TapWalletManager {
private fun loadMultiWalletData(
card: Card, primaryBlockchain: Blockchain?, primaryWalletManager: WalletManager?
) {
val presetTokens = primaryWalletManager?.presetTokens ?: emptySet()
val primaryTokens = primaryWalletManager?.cardTokens ?: emptySet()
val savedCurrencies = currenciesRepository.loadCardCurrencies(card.cardId)
if (savedCurrencies == null) {
if (primaryBlockchain != null && primaryWalletManager != null) {
store.dispatch(WalletAction.MultiWallet.SaveCurrencies(
CardCurrencies(
blockchains = setOf(primaryBlockchain), tokens = presetTokens
blockchains = setOf(primaryBlockchain), tokens = primaryTokens
)))
store.dispatch(WalletAction.MultiWallet.AddWalletManagers(primaryWalletManager))
store.dispatch(WalletAction.MultiWallet.AddBlockchains(listOf(primaryBlockchain)))
store.dispatch(WalletAction.MultiWallet.AddTokens(presetTokens.toList()))
store.dispatch(WalletAction.MultiWallet.AddTokens(primaryTokens.toList()))
} else {
val blockchains = setOf(Blockchain.Bitcoin, Blockchain.Ethereum)
store.dispatch(WalletAction.MultiWallet.SaveCurrencies(
@ -213,7 +213,7 @@ class TapWalletManager {
} else {
val blockchains = savedCurrencies.blockchains.toList()
val walletManagers = if (
presetTokens.isNotEmpty() &&
primaryTokens.isNotEmpty() &&
primaryWalletManager != null && primaryBlockchain != null
) {
val blockchainsWithoutPrimary = blockchains.filterNot { it == primaryBlockchain }

View file

@ -8,18 +8,18 @@ import com.tangem.tap.domain.configurable.Loader
[REDACTED_AUTHOR]
*/
data class Config(
val coinMarketCapKey: String = "f6622117-c043-47a0-8975-9d673ce484de",
val moonPayApiKey: String = "pk_test_kc90oYTANy7UQdBavDKGfL4K9l6VEPE",
val moonPayApiSecretKey: String = "sk_test_V8w4M19LbDjjYOt170s0tGuvXAgyEb1C",
val blockchainSdkConfig: BlockchainSdkConfig = BlockchainSdkConfig(),
val isSendingToPayIdEnabled: Boolean = true,
val isTopUpEnabled: Boolean = false,
val isCreatingTwinCardsAllowed: Boolean = false
val coinMarketCapKey: String = "f6622117-c043-47a0-8975-9d673ce484de",
val moonPayApiKey: String = "pk_test_kc90oYTANy7UQdBavDKGfL4K9l6VEPE",
val moonPayApiSecretKey: String = "sk_test_V8w4M19LbDjjYOt170s0tGuvXAgyEb1C",
val blockchainSdkConfig: BlockchainSdkConfig = BlockchainSdkConfig(),
val isSendingToPayIdEnabled: Boolean = true,
val isTopUpEnabled: Boolean = false,
val isCreatingTwinCardsAllowed: Boolean = false
)
class ConfigManager(
private val localLoader: Loader<ConfigModel>,
private val remoteLoader: Loader<ConfigModel>
private val localLoader: Loader<ConfigModel>,
private val remoteLoader: Loader<ConfigModel>
) {
var config: Config = Config()
@ -49,10 +49,11 @@ class ConfigManager(
fun resetToDefault(name: String) {
when (name) {
isSendingToPayIdEnabled -> config = config.copy(isSendingToPayIdEnabled = defaultConfig.isSendingToPayIdEnabled)
isSendingToPayIdEnabled -> config =
config.copy(isSendingToPayIdEnabled = defaultConfig.isSendingToPayIdEnabled)
isTopUpEnabled -> config = config.copy(isTopUpEnabled = defaultConfig.isTopUpEnabled)
isCreatingTwinCardsAllowed -> config =
config.copy(isCreatingTwinCardsAllowed = defaultConfig.isCreatingTwinCardsAllowed)
config.copy(isCreatingTwinCardsAllowed = defaultConfig.isCreatingTwinCardsAllowed)
}
}
@ -60,38 +61,38 @@ class ConfigManager(
val model = featureModel ?: return
config = config.copy(
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
)
defaultConfig = defaultConfig.copy(
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
)
}
private fun setupKey(configValues: ConfigValueModel?) {
val values = configValues ?: return
config = config.copy(
coinMarketCapKey = values.coinMarketCapKey,
moonPayApiKey = values.moonPayApiKey,
moonPayApiSecretKey = values.moonPayApiSecretKey,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairApiKey = values.blockchairApiKey,
blockcypherTokens = values.blockcypherTokens,
infuraProjectId = values.infuraProjectId
)
coinMarketCapKey = values.coinMarketCapKey,
moonPayApiKey = values.moonPayApiKey,
moonPayApiSecretKey = values.moonPayApiSecretKey,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairAuthorizationToken = values.blockchairAuthorizationToken,
blockcypherTokens = values.blockcypherTokens,
infuraProjectId = values.infuraProjectId
)
)
defaultConfig = defaultConfig.copy(
coinMarketCapKey = values.coinMarketCapKey,
moonPayApiKey = values.moonPayApiKey,
moonPayApiSecretKey = values.moonPayApiSecretKey,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairApiKey = values.blockchairApiKey,
blockcypherTokens = values.blockcypherTokens,
infuraProjectId = values.infuraProjectId
)
coinMarketCapKey = values.coinMarketCapKey,
moonPayApiKey = values.moonPayApiKey,
moonPayApiSecretKey = values.moonPayApiSecretKey,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairAuthorizationToken = values.blockchairAuthorizationToken,
blockcypherTokens = values.blockcypherTokens,
infuraProjectId = values.infuraProjectId
)
)
}

View file

@ -15,7 +15,7 @@ class ConfigValueModel(
val coinMarketCapKey: String,
val moonPayApiKey: String,
val moonPayApiSecretKey: String,
val blockchairApiKey: String?,
val blockchairAuthorizationToken: String?,
val blockcypherTokens: Set<String>?,
val infuraProjectId: String?,
)

View file

@ -13,8 +13,9 @@ fun Card.getToken(): Token? {
val symbol = cardData?.tokenSymbol ?: return null
val contractAddress = cardData?.tokenContractAddress ?: return null
val decimals = cardData?.tokenDecimal ?: return null
val blockchain = cardData?.blockchainName?.let { Blockchain.fromId(it) } ?: return null
if (symbol.isBlank() || contractAddress.isBlank()) return null
return Token(symbol, contractAddress, decimals)
return Token(symbol, symbol, contractAddress, decimals, blockchain) // TODO: change to constructor without tokenName
}
fun Card.getBlockchain(): Blockchain? {

View file

@ -2,6 +2,7 @@ package com.tangem.tap.domain.tokens
import android.app.Application
import android.content.Context
import com.squareup.moshi.Json
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonClass
import com.squareup.moshi.Types
@ -13,11 +14,14 @@ import com.tangem.tap.network.createMoshi
class CurrenciesRepository(val context: Application) {
private val moshi = createMoshi()
private val blockchainsAdapter: JsonAdapter<Set<Blockchain>> = moshi.adapter(
Types.newParameterizedType(Set::class.java, Blockchain::class.java)
)
private val tokensAdapter: JsonAdapter<Set<TokenDao>> = moshi.adapter(
Types.newParameterizedType(Set::class.java, TokenDao::class.java)
)
private val blockchainsAdapter: JsonAdapter<Set<Blockchain>> = moshi.adapter(
Types.newParameterizedType(Set::class.java, Blockchain::class.java)
private val obsoleteTokensAdapter: JsonAdapter<Set<ObsoleteTokenDao>> = moshi.adapter(
Types.newParameterizedType(Set::class.java, ObsoleteTokenDao::class.java)
)
fun loadCardCurrencies(cardId: String): CardCurrencies? {
@ -57,11 +61,20 @@ class CurrenciesRepository(val context: Application) {
}
private fun loadSavedTokens(cardId: String): Set<Token> {
val json = try {
context.readFileText(getFileNameForTokens(cardId))
} catch (exception: Exception) {
return emptySet()
}
return try {
val json = context.readFileText(getFileNameForTokens(cardId))
tokensAdapter.fromJson(json)!!.map { it.toToken() }.toSet()
} catch (exception: Exception) {
emptySet()
try {
obsoleteTokensAdapter.fromJson(json)!!.map { it.toToken() }.toSet()
} catch (exception: Exception) {
emptySet()
}
}
}
@ -94,12 +107,20 @@ class CurrenciesRepository(val context: Application) {
}
fun getPopularTokens(isTestNet: Boolean = false): List<Token> {
val fileName = if (isTestNet) TESTNET_TOKENS_FILE_NAME else POPULAR_TOKENS_FILE_NAME
val json = context.assets.readJsonFileToString(fileName)
return tokensAdapter.fromJson(json)!!.map { it.toToken() }
val ethereumTokensFileName =
if (isTestNet) ETHEREUM_TESTNET_TOKENS_FILE_NAME else ETHEREUM_TOKENS_FILE_NAME
val bscTokensFileName =
if (isTestNet) BSC_TESTNET_TOKENS_FILE_NAME else BSC_TOKENS_FILE_NAME
val ethereumTokensJson = context.assets.readJsonFileToString(ethereumTokensFileName)
val bscTokensJson = context.assets.readJsonFileToString(bscTokensFileName)
return tokensAdapter.fromJson(ethereumTokensJson)!!.map { it.toToken() } +
tokensAdapter.fromJson(bscTokensJson)!!.map { it.toToken() }
}
fun getBlockchains(cardFirmware: FirmwareVersion?, isTestNet: Boolean = false): List<Blockchain> {
fun getBlockchains(
cardFirmware: FirmwareVersion?,
isTestNet: Boolean = false
): List<Blockchain> {
return if (cardFirmware == null || cardFirmware.major < 4) {
Blockchain.secp256k1Blockchains(isTestNet)
} else {
@ -108,8 +129,10 @@ class CurrenciesRepository(val context: Application) {
}
companion object {
private const val POPULAR_TOKENS_FILE_NAME = "erc20_tokens"
private const val TESTNET_TOKENS_FILE_NAME = "ethereum_tokens_testnet"
private const val ETHEREUM_TOKENS_FILE_NAME = "ethereum_tokens"
private const val ETHEREUM_TESTNET_TOKENS_FILE_NAME = "ethereum_tokens_testnet"
private const val BSC_TOKENS_FILE_NAME = "bsc_tokens"
private const val BSC_TESTNET_TOKENS_FILE_NAME = "bsc_tokens_testnet"
private const val FILE_NAME_PREFIX_TOKENS = "tokens"
private const val FILE_NAME_PREFIX_BLOCKCHAINS = "blockchains"
@ -119,40 +142,88 @@ class CurrenciesRepository(val context: Application) {
}
}
@JsonClass(generateAdapter = true)
data class TokenDao(
val name: String,
val symbol: String,
val contractAddress: String,
val decimalCount: Int,
@Json(name = "blockchain")
val blockchainDao: BlockchainDao
) {
fun toToken(): Token {
return Token(name = name,
return Token(
name = name,
symbol = symbol,
contractAddress = contractAddress,
decimals = decimalCount)
decimals = decimalCount,
blockchain = blockchainDao.toBlockchain()
)
}
companion object {
fun fromToken(token: Token): TokenDao {
return TokenDao(name = token.name,
return TokenDao(
name = token.name,
symbol = token.symbol,
contractAddress = token.contractAddress,
decimalCount = token.decimals)
decimalCount = token.decimals,
blockchainDao = BlockchainDao.fromBlockchain(token.blockchain)
)
}
}
}
@JsonClass(generateAdapter = true)
data class BlockchainDao(
@Json(name = "key")
val name: String,
@Json(name = "testnet")
val isTestNet: Boolean
) {
fun toBlockchain(): Blockchain {
val blockchain = Blockchain.values().find { it.name.lowercase() == name.lowercase() }
?: throw Exception("Invalid BlockchainDao")
return if (!isTestNet) blockchain else blockchain.getTestnetVersion()
?: throw Exception("Invalid 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)
}
}
}
@JsonClass(generateAdapter = true)
data class ObsoleteTokenDao(
val name: String,
val symbol: String,
val contractAddress: String,
val decimalCount: Int,
) {
fun toToken(): Token {
return Token(
name = name,
symbol = symbol,
contractAddress = contractAddress,
decimals = decimalCount
)
}
}
@JsonClass(generateAdapter = true)
data class CardCurrenciesDao(
val tokens: Set<TokenDao>,
val blockchains: Set<Blockchain>,
) {
fun toCardCurrencies(): CardCurrencies {
return CardCurrencies(tokens = tokens.map { it.toToken() }.toSet(),
blockchains = blockchains)
return CardCurrencies(
tokens = tokens.map { it.toToken() }.toSet(),
blockchains = blockchains
)
}
companion object {

View file

@ -11,7 +11,6 @@ import com.squareup.picasso.Picasso
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.Token
import com.tangem.tap.common.extensions.*
import com.tangem.tap.common.redux.global.CryptoCurrencyName
import com.tangem.tap.domain.tokens.CardCurrencies
import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.store
@ -175,11 +174,17 @@ sealed class CurrencyListItem {
tokens: List<Token>
): List<CurrencyListItem> {
val blockchainsTitle = R.string.add_tokens_subtitle_blockchains
val tokensTitle = R.string.add_tokens_subtitle_tokens
val ethereumTokensTitle = R.string.add_tokens_subtitle_ethereum_tokens
val bscTokensTitle = R.string.add_tokens_subtitle_bsc_tokens
val ethereumTokens = tokens.filter { it.blockchain == Blockchain.Ethereum }
val bscTokens = tokens.filter { it.blockchain == Blockchain.BSC }
return listOf(TitleListItem(blockchainsTitle)) +
blockchains.map { BlockchainListItem(it) } +
listOf(TitleListItem(tokensTitle)) +
tokens.map { TokenListItem(it) }
listOf(TitleListItem(ethereumTokensTitle)) +
ethereumTokens.map { TokenListItem(it) } +
listOf(TitleListItem(bscTokensTitle)) +
bscTokens.map { TokenListItem(it) }
}
}
}

View file

@ -50,19 +50,7 @@ data class WalletState(
fun getWalletManager(token: Token?): WalletManager? {
if (token == null) return null
val ethereumWalletManager = walletManagers
.find { it.wallet.blockchain == Blockchain.Ethereum ||
it.wallet.blockchain == Blockchain.EthereumTestnet }
return if (ethereumWalletManager?.presetTokens?.contains(token) == true) {
ethereumWalletManager
} else {
val primaryWalletManager = walletManagers.find { it.wallet.blockchain == primaryBlockchain }
if (primaryWalletManager?.presetTokens?.contains(token) == true) {
primaryWalletManager
} else {
ethereumWalletManager
}
}
return walletManagers.find { it.wallet.blockchain == token.blockchain }
}
fun getWalletManager(currency: Currency?) : WalletManager? {
@ -101,7 +89,7 @@ data class WalletState(
?: return true
if (walletData.currency is Currency.Blockchain &&
walletManager.presetTokens.isNotEmpty()
walletManager.cardTokens.isNotEmpty()
) {
return false
}
@ -233,9 +221,9 @@ sealed interface Currency {
val currencySymbol: CryptoCurrencyName
data class Token(
val token: com.tangem.blockchain.common.Token,
override val blockchain: com.tangem.blockchain.common.Blockchain
val token: com.tangem.blockchain.common.Token
) : Currency {
override val blockchain = token.blockchain
override val currencySymbol: CryptoCurrencyName = token.symbol
}

View file

@ -66,8 +66,10 @@ class MultiWalletMiddleware {
when (val currency = action.walletData.currency) {
is Currency.Blockchain -> {
cardId?.let {
currenciesRepository.removeBlockchain(it,
currency.blockchain)
currenciesRepository.removeBlockchain(
it,
currency.blockchain
)
}
}
is Currency.Token -> {
@ -94,11 +96,16 @@ class MultiWalletMiddleware {
if (coinAmount != null && !coinAmount.isZero()) {
scope.launch(Dispatchers.Main) {
if (walletState?.getWalletData(wallet.blockchain) == null) {
store.dispatch(WalletAction.MultiWallet.AddWalletManagers(
listOfNotNull(walletManager)))
store.dispatch(WalletAction.MultiWallet.AddBlockchain(
wallet.blockchain
))
store.dispatch(
WalletAction.MultiWallet.AddWalletManagers(
listOfNotNull(walletManager)
)
)
store.dispatch(
WalletAction.MultiWallet.AddBlockchain(
wallet.blockchain
)
)
store.dispatch(WalletAction.LoadWallet.Success(wallet))
}
}
@ -136,7 +143,7 @@ class MultiWalletMiddleware {
)
store.dispatch(
WalletAction.MultiWallet.AddTokens(
walletManager.presetTokens.toList()
walletManager.cardTokens.toList()
)
)
}
@ -160,12 +167,7 @@ class MultiWalletMiddleware {
}
store.dispatch(
WalletAction.LoadFiatRate(
currency = Currency.Token(
token = token,
blockchain = walletManager?.wallet?.blockchain ?: Blockchain.Ethereum
)
)
WalletAction.LoadFiatRate(currency = Currency.Token(token))
)
scope.launch {
@ -189,15 +191,14 @@ class MultiWalletMiddleware {
val walletManager = walletState?.getWalletManager(token)
?: globalState.tapWalletManager.walletManagerFactory.makeWalletManagerForApp(
card = card,
blockchain = if (card.isTestCard) Blockchain.EthereumTestnet else Blockchain.Ethereum
blockchain = token.blockchain
)?.also { walletManager ->
store.dispatch(WalletAction.MultiWallet.AddWalletManagers(walletManager))
store.dispatch(WalletAction.MultiWallet.AddBlockchain(walletManager.wallet.blockchain))
}
store.dispatch(WalletAction.LoadFiatRate(currency = Currency.Token(
token = token,
blockchain = walletManager?.wallet?.blockchain ?: Blockchain.Ethereum
)))
store.dispatch(
WalletAction.LoadFiatRate(currency = Currency.Token(token))
)
TokenWithManager(token, walletManager)
}
scope.launch {

View file

@ -166,9 +166,6 @@ fun Token.toWallet(state: WalletState): WalletData? {
walletAddresses = walletAddresses,
mainButton = WalletMainButton.SendButton(false),
topUpState = TopUpState(allowed = false),
currency = Currency.Token(
token = this,
blockchain = walletManager?.blockchain ?: Blockchain.Ethereum
)
currency = Currency.Token(this)
)
}

View file

@ -45,35 +45,42 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
newState.twinCardsState?.isCreatingTwinCardsAllowed != true)
newState = newState.copy(
state = ProgressState.Done,
wallets = listOf(WalletData(
currencyData = BalanceWidgetData(BalanceStatus.EmptyCard),
mainButton = WalletMainButton.CreateWalletButton(creatingWalletAllowed),
topUpState = TopUpState(false)
)))
state = ProgressState.Done,
wallets = listOf(
WalletData(
currencyData = BalanceWidgetData(BalanceStatus.EmptyCard),
mainButton = WalletMainButton.CreateWalletButton(creatingWalletAllowed),
topUpState = TopUpState(false)
)
)
)
}
is WalletAction.LoadData.Failure -> {
when (action.error) {
is TapError.NoInternetConnection -> {
val wallets = newState.wallets
.map {
it.copy(currencyData = it.currencyData.copy(
status = BalanceStatus.Unreachable
))
}
.map {
it.copy(
currencyData = it.currencyData.copy(
status = BalanceStatus.Unreachable
)
)
}
newState = newState.copy(
state = ProgressState.Error,
error = ErrorType.NoInternetConnection,
wallets = wallets
state = ProgressState.Error,
error = ErrorType.NoInternetConnection,
wallets = wallets
)
}
is TapError.UnknownBlockchain -> {
newState = newState.copy(
state = ProgressState.Done,
wallets = listOf(WalletData(
currencyData = BalanceWidgetData(BalanceStatus.UnknownBlockchain),
topUpState = TopUpState(false)
))
state = ProgressState.Done,
wallets = listOf(
WalletData(
currencyData = BalanceWidgetData(BalanceStatus.UnknownBlockchain),
topUpState = TopUpState(false)
)
)
)
}
}
@ -81,73 +88,76 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
is WalletAction.LoadData -> {
newState = newState.copy(
state = ProgressState.Loading,
error = null,
state = ProgressState.Loading,
error = null,
)
}
is WalletAction.LoadWallet -> {
if (action.blockchain == null) {
val wallets = newState.wallets.map { wallet ->
wallet.copy(
currencyData = wallet.currencyData.copy(
status = BalanceStatus.Loading,
currency = wallet.currencyData.currency,
currencySymbol = wallet.currencyData.currencySymbol,
),
mainButton = WalletMainButton.SendButton(false),
topUpState = TopUpState(allowed = action.allowTopUp
?: wallet.topUpState.allowed)
currencyData = wallet.currencyData.copy(
status = BalanceStatus.Loading,
currency = wallet.currencyData.currency,
currencySymbol = wallet.currencyData.currencySymbol,
),
mainButton = WalletMainButton.SendButton(false),
topUpState = TopUpState(
allowed = action.allowTopUp
?: wallet.topUpState.allowed
)
)
}
newState = newState.copy(
state = ProgressState.Loading,
wallets = wallets
state = ProgressState.Loading,
wallets = wallets
)
} else {
val walletManager = newState.getWalletManager(action.blockchain) ?: return newState
val blockchain = walletManager.wallet.blockchain
val currencies = listOf(Currency.Blockchain(blockchain)) + walletManager.presetTokens.map {
Currency.Token(token = it, blockchain = blockchain)
}
val currencies = listOf(Currency.Blockchain(blockchain)) +
walletManager.cardTokens.map { Currency.Token(it) }
val newWallets = newState.wallets.filter { currencies.contains(it.currency) }
.map { wallet ->
wallet.copy(
currencyData = wallet.currencyData.copy(
status = BalanceStatus.Loading,
currency = wallet.currencyData.currency,
currencySymbol = wallet.currencyData.currencySymbol,
),
mainButton = WalletMainButton.SendButton(false),
topUpState = TopUpState(
allowed = action.allowTopUp ?: wallet.topUpState.allowed
)
.map { wallet ->
wallet.copy(
currencyData = wallet.currencyData.copy(
status = BalanceStatus.Loading,
currency = wallet.currencyData.currency,
currencySymbol = wallet.currencyData.currencySymbol,
),
mainButton = WalletMainButton.SendButton(false),
topUpState = TopUpState(
allowed = action.allowTopUp ?: wallet.topUpState.allowed
)
}
)
}
val wallets = newState.replaceSomeWallets(newWallets)
newState = newState.copy(wallets = wallets)
}
}
is WalletAction.LoadWallet.Success -> newState = onWalletLoadedReducer.reduce(action.wallet, newState)
is WalletAction.LoadWallet.Success -> newState =
onWalletLoadedReducer.reduce(action.wallet, newState)
is WalletAction.UpdateWallet.Success -> {
newState = onWalletLoadedReducer.reduce(action.wallet, newState)
}
is WalletAction.LoadWallet.NoAccount -> {
val walletData = newState.getWalletData(action.wallet.blockchain)?.copy(
currencyData = BalanceWidgetData(
BalanceStatus.NoAccount, action.wallet.blockchain.fullName,
currencySymbol = action.wallet.blockchain.currency,
amountToCreateAccount = action.amountToCreateAccount
)
currencyData = BalanceWidgetData(
BalanceStatus.NoAccount, action.wallet.blockchain.fullName,
currencySymbol = action.wallet.blockchain.currency,
amountToCreateAccount = action.amountToCreateAccount
)
)
val wallets = newState.replaceWalletInWallets(walletData)
val progressState = if (wallets.any { it.currencyData.status == BalanceStatus.Loading }) {
ProgressState.Loading
} else {
ProgressState.Done
}
val progressState =
if (wallets.any { it.currencyData.status == BalanceStatus.Loading }) {
ProgressState.Loading
} else {
ProgressState.Done
}
newState = newState.copy(
state = progressState,
wallets = wallets
state = progressState,
wallets = wallets
)
}
is WalletAction.LoadWallet.Failure -> {
@ -158,28 +168,31 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
}
val walletData = newState.getWalletData(action.wallet.blockchain)
val newWalletData = walletData?.copy(
currencyData = walletData.currencyData.copy(
status = BalanceStatus.Unreachable,
errorMessage = message
),
topUpState = TopUpState(false)
currencyData = walletData.currencyData.copy(
status = BalanceStatus.Unreachable,
errorMessage = message
),
topUpState = TopUpState(false)
)
val tokenWallets = action.wallet.getTokens()
.mapNotNull { newState.getWalletData(it) }
.map {
it.copy(currencyData = it.currencyData.copy(
status = BalanceStatus.Unreachable, errorMessage = message
))
}
.mapNotNull { newState.getWalletData(it) }
.map {
it.copy(
currencyData = it.currencyData.copy(
status = BalanceStatus.Unreachable, errorMessage = message
)
)
}
val wallets = newState.replaceSomeWallets(listOfNotNull(newWalletData) + tokenWallets)
val progressState = if (wallets.any { it.currencyData.status == BalanceStatus.Loading }) {
ProgressState.Loading
} else {
ProgressState.Done
}
val progressState =
if (wallets.any { it.currencyData.status == BalanceStatus.Loading }) {
ProgressState.Loading
} else {
ProgressState.Done
}
newState = newState.copy(
state = progressState, wallets = wallets
state = progressState, wallets = wallets
)
}
is WalletAction.SetArtworkId -> {
@ -216,11 +229,11 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
is WalletAction.ShowDialog.QrCode -> {
val selectedWalletData = newState.getWalletData(newState.selectedWallet)
newState = newState.copy(
walletDialog = WalletDialog.QrDialog(
selectedWalletData?.walletAddresses?.selectedAddress?.shareUrl?.toQrCode(),
selectedWalletData?.walletAddresses?.selectedAddress?.shareUrl,
selectedWalletData?.currencyData?.currency
)
walletDialog = WalletDialog.QrDialog(
selectedWalletData?.walletAddresses?.selectedAddress?.shareUrl?.toQrCode(),
selectedWalletData?.walletAddresses?.selectedAddress?.shareUrl,
selectedWalletData?.currencyData?.currency
)
)
}
is WalletAction.ShowDialog.ScanFails -> {
@ -234,7 +247,7 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
}
is WalletAction.Send.ChooseCurrency -> {
newState = newState.copy(
walletDialog = WalletDialog.SelectAmountToSendDialog(action.amounts)
walletDialog = WalletDialog.SelectAmountToSendDialog(action.amounts)
)
}
is WalletAction.Send.Cancel -> newState = newState.copy(walletDialog = null)
@ -242,12 +255,18 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
is WalletAction.ChangeSelectedAddress -> {
val selectedWalletData = newState.getWalletData(newState.selectedWallet)
val walletAddresses = newState.getWalletData(selectedWalletData?.currency)?.walletAddresses
val walletAddresses =
newState.getWalletData(selectedWalletData?.currency)?.walletAddresses
?: return newState
val address = walletAddresses.list.firstOrNull { it.type == action.type }
?: return newState
?: return newState
val wallets = newState.replaceWalletInWallets(
selectedWalletData?.copy(walletAddresses = WalletAddresses(address, walletAddresses.list))
selectedWalletData?.copy(
walletAddresses = WalletAddresses(
address,
walletAddresses.list
)
)
)
newState = newState.copy(wallets = wallets)
}
@ -261,7 +280,12 @@ fun createAddressList(wallet: Wallet?, walletAddresses: WalletAddresses? = null)
val listOfAddressData = mutableListOf<AddressData>()
// put a defaultAddress at the first place
wallet.addresses.forEach {
val addressData = AddressData(it.value, it.type, wallet.getShareUri(it.value), wallet.getExploreUrl(it.value))
val addressData = AddressData(
it.value,
it.type,
wallet.getShareUri(it.value),
wallet.getExploreUrl(it.value)
)
if (it.type == wallet.blockchain.defaultAddressType()) {
listOfAddressData.add(0, addressData)
} else {
@ -272,16 +296,22 @@ fun createAddressList(wallet: Wallet?, walletAddresses: WalletAddresses? = null)
// restore a selected wallet address
var indexOfSelectedWallet = 0
walletAddresses?.let {
val index = listOfAddressData.indexOfFirst { it.address == walletAddresses.selectedAddress.address }
val index =
listOfAddressData.indexOfFirst { it.address == walletAddresses.selectedAddress.address }
if (index != -1) indexOfSelectedWallet = index
}
return WalletAddresses(listOfAddressData[indexOfSelectedWallet], listOfAddressData)
}
private fun handleCheckSignedHashesActions(action: WalletAction.Warnings, state: WalletState): WalletState {
private fun handleCheckSignedHashesActions(
action: WalletAction.Warnings,
state: WalletState
): WalletState {
return when (action) {
WalletAction.Warnings.CheckHashesCount.ConfirmHashesCount -> state.copy(hashesCountVerified = true)
WalletAction.Warnings.CheckHashesCount.NeedToCheckHashesCountOnline -> state.copy(hashesCountVerified = false)
WalletAction.Warnings.CheckHashesCount.NeedToCheckHashesCountOnline -> state.copy(
hashesCountVerified = false
)
is WalletAction.Warnings.Set -> state.copy(mainWarningsList = action.warningList)
else -> state
}
@ -289,8 +319,8 @@ private fun handleCheckSignedHashesActions(action: WalletAction.Warnings, state:
private fun setNewFiatRate(
fiatRate: Pair<Currency, BigDecimal?>,
appCurrency: FiatCurrencyName, state: WalletState
fiatRate: Pair<Currency, BigDecimal?>,
appCurrency: FiatCurrencyName, state: WalletState
): WalletState {
val rate = fiatRate.second ?: return state
val rateFormatted = rate.toFormattedCurrencyString(2, appCurrency, RoundingMode.HALF_UP)
@ -327,33 +357,34 @@ private fun setMultiWalletFiatRate(
}
private fun setSingeWalletFiatRate(
rate: BigDecimal, rateFormatted: String, currency: Currency,
appCurrency: FiatCurrencyName, state: WalletState
rate: BigDecimal, rateFormatted: String, currency: Currency,
appCurrency: FiatCurrencyName, state: WalletState
): WalletState {
val wallet = state.walletManagers[0].wallet
val token = wallet.getFirstToken()
if (currency == state.primaryWallet?.currency) {
val fiatAmount = wallet.amounts[AmountType.Coin]?.value
?.toFiatString(rate, appCurrency)
?.toFiatString(rate, appCurrency)
val walletData = state.primaryWallet.copy(
currencyData = state.primaryWallet.currencyData.copy(fiatAmountFormatted = fiatAmount),
fiatRate = rate,
fiatRateString = rateFormatted
currencyData = state.primaryWallet.currencyData.copy(fiatAmountFormatted = fiatAmount),
fiatRate = rate,
fiatRateString = rateFormatted
)
return state.copy(wallets = listOf(walletData))
} else if (currency is Currency.Token && currency.token == token) {
val tokenFiatAmount = wallet.getTokenAmount(token)?.value?.toFiatString(rate, appCurrency)
val tokenData = state.primaryWallet?.currencyData?.token?.copy(
fiatAmount = tokenFiatAmount,
fiatRate = rate,
fiatRateString = rateFormatted
fiatAmount = tokenFiatAmount,
fiatRate = rate,
fiatRateString = rateFormatted
)
val walletData = state.primaryWallet?.copy(
currencyData = state.primaryWallet.currencyData.copy(
token = tokenData
))
currencyData = state.primaryWallet.currencyData.copy(
token = tokenData
)
)
val wallets = walletData?.let { listOf(walletData) } ?: emptyList()
return state.copy(wallets = wallets)
}

View file

@ -93,7 +93,8 @@ this wallet.
<string name="details_row_title_manage_tokens" translatable="false">Manage tokens</string>
<string name="add_tokens_subtitle_blockchains" translatable="false">Blockchains</string>
<string name="add_tokens_subtitle_tokens" translatable="false">Ethereum Tokens</string>
<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="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>