Skip to content

Commit

Permalink
v5.3
Browse files Browse the repository at this point in the history
Support for Ton network
Support for Pepecoin-network
  • Loading branch information
mrtnetwork committed Jun 25, 2024
1 parent f48f148 commit 083afe1
Show file tree
Hide file tree
Showing 70 changed files with 1,864 additions and 681 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ Ethereum, Tron, Ripple, Dogecoin, Litecoin, Solana, Cardano, Cosmos and Dash, wi

- **Features:** Seamless support for Maya transactions.

### Ton (Mainnet, Testnet)

- **Features:** Seamless support for Ton transactions.
- **Highlights:** Jetton transfer, multiple message transfer.


## Decentralized, Secure, and Open Source

At MRT Wallet, we believe in the power of decentralization. Our commitment to decentralization is at the core of our design philosophy, providing you with full control over your assets. Your private keys remain in your hands, ensuring the highest level of security.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mrt_native_support/mrt_native_support_method_channel.dart';

void main() {}
6 changes: 0 additions & 6 deletions mrt_native_support/test/mrt_native_support_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:mrt_native_support/mrt_native_support.dart';
import 'package:mrt_native_support/mrt_native_support_platform_interface.dart';
import 'package:mrt_native_support/mrt_native_support_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

void main() {}
8 changes: 5 additions & 3 deletions mrt_wallet/lib/app/constant/storage_key.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class StorageKeysConst {
StorageKeysConst._();
static const String appMaterial = "appMaterial";
static const String appSetting = "setting";
static const String setting = "app_setting";
static const String walletStorageKey = "wallet_";
static const String walletChecksum = "wallet_checksum";
static const String walletNetworkKey = "network";
static const String apiProviderKey = "provider";
static const String networkContactKey = "C";
static const String coingeckoCoins = "coingeckoCoins";
static const String external = "external";
static const String app = "app";
}
12 changes: 12 additions & 0 deletions mrt_wallet/lib/app/extention/cbor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,15 @@ extension QuickCbor on CborObject {
return toe(value as T);
}
}

extension QuickCborTag on CborTagValue {
CborListValue get getList {
if (value is! CborListValue) {
throw MessageException("Failed to cast value.", details: {
"Value": "$value",
"Type": "CborListValue",
});
}
return value;
}
}
30 changes: 5 additions & 25 deletions mrt_wallet/lib/app/external/coingeko.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,18 @@ import 'package:mrt_wallet/models/app/app_image.dart';
class CoinGeckoUtils {
static const String _coingeckoPublicCurrenciesAPI =
"https://api.coingecko.com/api/v3/simple/price?ids=#ids&vs_currencies=#currencies";
static const String _coinGeckoCoinURL =
static const String coinGeckoCoinURL =
"https://www.coingecko.com/en/coins/#id";
static const String coinGeckoCoinListURL =
"https://api.coingecko.com/api/v3/coins/list";
static const AppImage logo = AppImage.local("assets/image/coingeko.png");
static String? getTokenCoinGeckoURL(String tokenName) {
final currencyId = getCoinGeckoCurrencyId(tokenName);
if (currencyId == null) return null;
return _coinGeckoCoinURL.replaceFirst("#id", currencyId);
static String? getTokenCoinGeckoURL(String id) {
return coinGeckoCoinURL.replaceFirst("#id", id);
}

static String toCoingeckoPriceUri(String currencies, String ids) {
return _coingeckoPublicCurrenciesAPI
.replaceFirst("#currencies", currencies)
.replaceFirst("#ids", ids);
}

static List<String> get currencyIds => _currencyIds.values.toList();

static Map<String, String> get _currencyIds => {
"BitcoinCash": "bitcoin-cash",
"Bitcoin": "bitcoin",
"Litecoin": "litecoin",
"Dogecoin": "dogecoin",
"BitcoinSV": "bitcoin-cash-sv",
"Dash": "dash",
"Ripple": "ripple",
"Ripple testnet": "ripple",
"Ethereum": "ethereum",
"Polygon": "matic-network",
"BNB Smart Chain": "binancecoin",
"Tron": "tron"
};
static String? getCoinGeckoCurrencyId(String tokenName) {
return _currencyIds[tokenName];
}
}
23 changes: 22 additions & 1 deletion mrt_wallet/lib/app/localization/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,28 @@ class Localization {
"show_content": "Show content.",
"backup_restored_desc": "Your backup has been successfully restored.",
"qr_code": "QR Barcode",
"submit": "Submit"
"submit": "Submit",
"live_price": "Live price",
"coin_gecko_desc":
"We can also provide live price updates for your token balance using CoinGecko. To enable this, locate your token on CoinGecko, find the API ID on the token's page, and select the appropriate name here.",
"retrieving_token_information": "Retrieving token. Please wait.",
"coingecko_id": "CoingeckoId",
"api_id": "API ID",
"coingecko_api_id_validator":
"The API ID must be at least 2 characters long",
"retrieving_token_price": "Retrieving token price. Please wait.",
"updating_token": "Updating token. Please wait. ",
"token_updated_successfully":
"The token has been successfully updated.",
"invalid_api_id": "Invalid API ID.",
"token_decimals": "Token decimals",
"token_decimals_validator":
"The number of token decimal places must be between 0 and 255.",
"change_token_decimal_desc":
"Warning: Changing the token decimal places can significantly impact token balances and transactions. For example, changing from 9 to 10 decimal places may cause balance discrepancies and potential loss of funds. Proceed with caution and ensure you understand the consequences before making this change. The number of decimal places must be between 0 and 255.",
"change_decimals": "Change decimals",
"change_token_decimal_desc2":
"The token decimal places will be changed from ___1__ to ___2__ ."
}
};
}
1 change: 1 addition & 0 deletions mrt_wallet/lib/app/utility/blockchain_constant/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ class BlockchainConstant {
static const int maxByronLegacyBip32LevelIndex = 2;
static final BigRational maxSupply = BigRational(maxU64);
static const int minimumKeysLength = 16;
static const int maxTokenDecimal = 255;
}
20 changes: 7 additions & 13 deletions mrt_wallet/lib/future/pages/start_page/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ class _TabbarView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final hasProvider = chainAccount.provider() != null;
final explorer = chainAccount.network.coinParam
.getAccountExplorer(chainAccount.account.address.address.toAddress);
final coinGeckoURL = CoinGeckoUtils.getTokenCoinGeckoURL(
chainAccount.network.coinParam.token.name);
final networkParam = chainAccount.network.coinParam;
return Column(
children: [
if (!hasProvider)
Expand All @@ -213,16 +210,17 @@ class _TabbarView extends StatelessWidget {
],
),
),
if (explorer != null)
if (networkParam.hasAccountExplorer)
AppListTile(
title: Text("view_on_explorer".tr),
subtitle: Text("view_address_on_explorer".tr),
trailing: const Icon(Icons.open_in_new),
onTap: () {
LunchUri.lunch(explorer);
LunchUri.lunch(networkParam.getAccountExplorer(
chainAccount.account.address.address.toAddress)!);
},
),
if (coinGeckoURL != null)
if (networkParam.hasMarketUrl)
AppListTile(
title: const Text("CoinGecko"),
subtitle: Text("view_on_coingecko"
Expand All @@ -231,7 +229,7 @@ class _TabbarView extends StatelessWidget {
trailing:
const CircleAssetsImgaeView(CoinGeckoUtils.logo, radius: 15),
onTap: () {
LunchUri.lunch(coinGeckoURL);
LunchUri.lunch(networkParam.marketUri!);
},
),
],
Expand Down Expand Up @@ -450,10 +448,6 @@ class _NetworkPageTabbar extends StatelessWidget
@override
Widget build(BuildContext context) {
return TabBar(
tabs: chainAccount.services
.map((e) => Tab(
text: e.tr,
))
.toList());
tabs: chainAccount.services.map((e) => Tab(text: e.tr)).toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import 'package:flutter/material.dart';
import 'package:mrt_wallet/app/constant/constant.dart';

import 'package:mrt_wallet/app/core.dart';
import 'package:mrt_wallet/future/widgets/custom_widgets.dart';
import 'package:mrt_wallet/models/app/app_seting.dart';
import 'package:mrt_wallet/models/app/material.dart';
import 'package:mrt_wallet/models/wallet_models/wallet_models.dart';
import 'package:mrt_wallet/provider/api/currency/live_currency.dart';
import 'package:mrt_wallet/provider/repository/repository.dart';

import 'package:mrt_wallet/provider/wallet/wallet_provider.dart';

class WalletProvider extends WalletCore with AppCurrencies {
class WalletProvider extends WalletCore
with ExternalRepository, APPRepository, AppCurrencies {
WalletProvider(super._navigatorKey, this._appSetting);

@override
Expand All @@ -19,14 +22,13 @@ class WalletProvider extends WalletCore with AppCurrencies {
AppSetting get appSetting => _appSetting;

void toggleBrightness() {
network;
AppMaterialController.toggleBrightness();
notify(StateIdsConst.main);
_appSetting = _appSetting.copyWith(
appBrightness: AppMaterialController.appBrightness,
appColor: AppMaterialController.appColorHex);
write(
key: StorageKeysConst.appMaterial,
value: _appSetting.toCbor().toCborHex());
saveAppSetting(_appSetting);
}

void changeColor(Color color) {
Expand All @@ -35,19 +37,15 @@ class WalletProvider extends WalletCore with AppCurrencies {
_appSetting = _appSetting.copyWith(
appBrightness: AppMaterialController.appBrightness,
appColor: AppMaterialController.appColorHex);
write(
key: StorageKeysConst.appMaterial,
value: _appSetting.toCbor().toCborHex());
saveAppSetting(_appSetting);
}

@override
void changeCurrency(Currency? currency) {
if (currency == null || _appSetting.currency == currency) return;
super.changeCurrency(currency);
_appSetting = _appSetting.copyWith(currency: currency);
write(
key: StorageKeysConst.appMaterial,
value: _appSetting.toCbor().toCborHex());
saveAppSetting(_appSetting);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,13 @@ class TokenDetailsModalView extends StatelessWidget {
IconButton(
onPressed: () {
context
.openSliverBottomSheet<Token>(
.openSliverBottomSheet<bool>(
"update_token".tr,
child: UpdateTokenDetailsView(token: token.token),
child:
UpdateTokenDetailsView(token: token, account: address),
)
.then((value) {
if (value != null) {
wallet
.updateToken(
token: token,
updatedToken: value,
address: address)
.then((value) {
if (value.hasError) return;
context.pop();
});
}
.then((v) {
if (v == true) context.pop();
});
},
icon: const Icon(Icons.edit)),
Expand Down
Loading

0 comments on commit 083afe1

Please sign in to comment.