Skip to content

Commit

Permalink
October (#2838)
Browse files Browse the repository at this point in the history
* fix: Update account name instantly #2667

* linter update

* feat: Add green color for card valid status #2764

* color adjustment

* fix: Avoid double scan to get and present #2668

* fix: Fetch uri for image but not working and indication of deleted message #2771

* feat: Add all type of VCs #2779

* feat: Support all types presentaton wth VCFormat auto #2779

* feat: Update credential request for draft 13 - jwt_vc_json and ldp_vc #2796

* version update: 2.9.8+477

* Revert "version update: 2.9.8+477"

This reverts commit 6e8265c.

* refactor: Update oidc4vc test

* refactor: Try to display image #2771

* fix: Fix image and add photo viewer #2771

* refactor: Optimise code to load image smoothly side by side #2771

* feat: Display advanced security option in enterprise #2584

* feat: Update error responses #2573

* refactor: Remove long error message for now #2573

* refactor: Display advanced security options #2584

* refactor: Bug fix and optimise code

* some update and package update

* feat: Some bug fix

* feat: Add some etherlink functionlities #2820

* version update: 2.10.4+486

* feat: Add empty etherlink when no tokens are available

* version update : 2.10.5+487

* feat: Add etherlink balance and transfer

* version update: 2.10.6+488

* refactor: Copy clipboard data correctly #2830

* refactor: Copy clipboard data correctly #2830

* refactor: Create crypto account VC for etherlink #2833

* feat: Set timeout of 10seconds for statulist http get #2824

* feat: Enable advanced settings for non-enterprise profile #2828

* refactor: Correct the backend provider url #2818

* feat: Display some vc based on crypto account did issuer #2680

* version update: 2.10.7+489

* fix: Advanced security option #2828

* feat: Fix wallet configuration failing issue #2835

* fix: Show crypto account for respective wallet address only #2833

* version update:  2.10.8+490

---------

Co-authored-by: Bibash Shrestha <[email protected]>
  • Loading branch information
hawkbee1 and bibash28 authored Aug 15, 2024
1 parent 576aa92 commit 6fa1c5a
Show file tree
Hide file tree
Showing 17 changed files with 594 additions and 200 deletions.
81 changes: 81 additions & 0 deletions lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,84 @@ class Parameters {
// ThemeMode.light for talao
static const ThemeMode defaultTheme = ThemeMode.dark;
}

final respond = [
{
"token_instance": {
"is_unique": true,
"id": "431",
"holder_address_hash": "0x394c399dbA25B99Ab7708EdB505d755B3aa29997",
"image_url": "example.com/picture.png",
"animation_url": "example.com/video.mp4",
"external_app_url": "d-app.com",
"metadata": {
"year": 2023,
"tags": ["poap", "event"],
"name": "Social Listening Committee #2 Attendees",
"image_url":
"https://assets.poap.xyz/chanel-poap-4c-2023-logo-1675083420470.png",
"home_url": "https://app.poap.xyz/token/6292128",
"external_url": "https://api.poap.tech/metadata/99010/6292128",
"description":
"This is the POAP for attendees of the second Social Listening Committee.",
"attributes": [
{"value": "01-Feb-2023", "trait_type": "startDate"},
{"value": "01-Feb-2023", "trait_type": "endDate"},
{"value": "false", "trait_type": "virtualEvent"},
{"value": "Paris", "trait_type": "city"},
{"value": "France", "trait_type": "country"},
{"value": "https://www.chanel.com", "trait_type": "eventURL"}
]
},
"owner": {
"hash": "0xEb533ee5687044E622C69c58B1B12329F56eD9ad",
"implementation_name": "implementationName",
"name": "contractName",
"is_contract": true,
"private_tags": [
{
"address_hash": "0xEb533ee5687044E622C69c58B1B12329F56eD9ad",
"display_name": "name to show",
"label": "label"
}
],
"watchlist_names": [
{"display_name": "name to show", "label": "label"}
],
"public_tags": [
{
"address_hash": "0xEb533ee5687044E622C69c58B1B12329F56eD9ad",
"display_name": "name to show",
"label": "label"
}
],
"is_verified": true
},
"token": {
"circulating_market_cap": "83606435600.3635",
"icon_url":
"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
"name": "Tether USD",
"decimals": "6",
"symbol": "USDT",
"address": "0x394c399dbA25B99Ab7708EdB505d755B3aa29997",
"type": "ERC-20",
"holders": "837494234523",
"exchange_rate": "0.99",
"total_supply": "10000000"
}
},
"value": "10000",
"token_id": "123",
"token": {
"name": "Tether USD",
"decimals": "16",
"symbol": "USDT",
"address": "0x394c399dbA25B99Ab7708EdB505d755B3aa29997",
"type": "ERC-20",
"holders": 837494234523,
"exchange_rate": "0.99",
"total_supply": "10000000"
}
}
];
25 changes: 24 additions & 1 deletion lib/app/shared/extension/string_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:math';

import 'package:convert/convert.dart';
import 'package:decimal/decimal.dart';
Expand Down Expand Up @@ -46,7 +47,12 @@ extension StringExtension on String {
}

bool get isEVM {
if (this == 'ETH' || this == 'MATIC' || this == 'FTM' || this == 'BNB') {
if (this == 'ETH' ||
this == 'MATIC' ||
this == 'FTM' ||
this == 'BNB' ||
this == 'XTZ') {
// Etherlink - XTZ
return true;
}
return false;
Expand All @@ -66,4 +72,21 @@ extension StringExtension on String {
Decimal.parse(number.toString());
return twoDecimalNumber.toDecimal().toString();
}

BigInt get convertTo1e18 {
var value = BigInt.parse(this);

const int targetLength = 18;

final currentLength = value.toString().length;

final zerosToAdd = targetLength - currentLength;

if (zerosToAdd > 0) {
final factor = BigInt.from(pow(10, zerosToAdd));
value = value * factor;
}

return value;
}
}
58 changes: 50 additions & 8 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2180,19 +2180,42 @@ Future<Map<String, dynamic>?> checkVerifierAttestation({
return cnf['jwk'] as Map<String, dynamic>;
}

String? getWalletAddress(CredentialSubjectModel credentialSubjectModel) {
/// walletaddress and blockchain type
(String?, BlockchainType?) getWalletAddress(
CredentialSubjectModel credentialSubjectModel,
) {
if (credentialSubjectModel is TezosAssociatedAddressModel) {
return credentialSubjectModel.associatedAddress;
return (
credentialSubjectModel.associatedAddress,
BlockchainType.tezos,
);
} else if (credentialSubjectModel is EthereumAssociatedAddressModel) {
return credentialSubjectModel.associatedAddress;
return (
credentialSubjectModel.associatedAddress,
BlockchainType.ethereum,
);
} else if (credentialSubjectModel is PolygonAssociatedAddressModel) {
return credentialSubjectModel.associatedAddress;
return (
credentialSubjectModel.associatedAddress,
BlockchainType.polygon,
);
} else if (credentialSubjectModel is BinanceAssociatedAddressModel) {
return credentialSubjectModel.associatedAddress;
return (
credentialSubjectModel.associatedAddress,
BlockchainType.binance,
);
} else if (credentialSubjectModel is FantomAssociatedAddressModel) {
return credentialSubjectModel.associatedAddress;
return (
credentialSubjectModel.associatedAddress,
BlockchainType.fantom,
);
} else if (credentialSubjectModel is EtherlinkAssociatedAddressModel) {
return (
credentialSubjectModel.associatedAddress,
BlockchainType.etherlink,
);
}
return null;
return (null, null);
}

Future<String> fetchRpcUrl({
Expand All @@ -2202,7 +2225,8 @@ Future<String> fetchRpcUrl({
String rpcUrl = '';

if (blockchainNetwork is BinanceNetwork ||
blockchainNetwork is FantomNetwork) {
blockchainNetwork is FantomNetwork ||
blockchainNetwork is EtherlinkNetwork) {
rpcUrl = blockchainNetwork.rpcNodeUrl as String;
} else {
if (blockchainNetwork.networkname == 'Mainnet') {
Expand All @@ -2225,3 +2249,21 @@ Future<String> fetchRpcUrl({

return rpcUrl;
}

String getDidMethod(BlockchainType blockchainType) {
late String didMethod;

switch (blockchainType) {
case BlockchainType.tezos:
didMethod = AltMeStrings.cryptoTezosDIDMethod;

case BlockchainType.ethereum:
case BlockchainType.fantom:
case BlockchainType.polygon:
case BlockchainType.binance:
case BlockchainType.etherlink:
didMethod = AltMeStrings.cryptoEVMDIDMethod;
}

return didMethod;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class EtherlinkNetwork extends EthereumNetwork {
factory EtherlinkNetwork.mainNet() => const EtherlinkNetwork(
type: BlockchainType.etherlink,
networkname: 'Mainnet',
apiUrl: Urls.moralisBaseUrl,
apiUrl: 'https://explorer.etherlink.com/api',
chainId: 42793,
chain: 'etherlink',
rpcNodeUrl: 'https://explorer.etherlink.com',
rpcNodeUrl: 'https://node.mainnet.etherlink.com',
title: 'Etherlink Mainnet',
subTitle:
'This network is the official Etherlink blockchain running Network.'
Expand All @@ -38,10 +38,10 @@ class EtherlinkNetwork extends EthereumNetwork {
factory EtherlinkNetwork.testNet() => const EtherlinkNetwork(
type: BlockchainType.etherlink,
networkname: 'Ghostnet',
apiUrl: Urls.moralisBaseUrl,
apiUrl: 'https://testnet.explorer.etherlink.com/api',
chain: 'etherlink-testnet',
chainId: 128123,
rpcNodeUrl: 'https://testnet.explorer.etherlink.com/',
rpcNodeUrl: 'https://node.ghostnet.etherlink.com',
title: 'Etherlink Testnet (Ghostnet)',
subTitle: 'This network is used to test protocol upgrades'
' (do not use it unless you are a developer).',
Expand Down
17 changes: 3 additions & 14 deletions lib/credentials/cubit/credentials_helper_function.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,7 @@ Future<CredentialModel?> generateAssociatedWalletCredential({
getLogger('CredentialsCubit - generateAssociatedWalletCredential');
log.i(blockchainType);
try {
late String didMethod;

switch (blockchainType) {
case BlockchainType.tezos:
didMethod = AltMeStrings.cryptoTezosDIDMethod;

case BlockchainType.ethereum:
case BlockchainType.fantom:
case BlockchainType.polygon:
case BlockchainType.binance:
case BlockchainType.etherlink:
didMethod = AltMeStrings.cryptoEVMDIDMethod;
}
final didMethod = getDidMethod(blockchainType);

log.i('didMethod - $didMethod');

Expand All @@ -38,6 +26,7 @@ Future<CredentialModel?> generateAssociatedWalletCredential({
);

final String issuer = didKitProvider.keyToDID(didMethod, jwkKey);

log.i('jwkKey - $jwkKey');
log.i('didKitProvider.keyToDID - $issuer');

Expand Down Expand Up @@ -152,7 +141,7 @@ Future<CredentialModel?> generateAssociatedWalletCredential({
id: id,
issuer: issuer,
issuanceDate: issuanceDate,
credentialSubjectModel: EthereumAssociatedAddressModel(
credentialSubjectModel: EtherlinkAssociatedAddressModel(
id: did,
accountName: cryptoAccountData.name,
associatedAddress: cryptoAccountData.walletAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ class CryptoAccountItem extends StatelessWidget {
InkWell(
onTap: () async {
await Clipboard.setData(
ClipboardData(
text: walletAddressExtracted,
),
ClipboardData(text: cryptoAccountData.walletAddress),
);
AlertMessage.showStateMessage(
context: context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ class ManageAccountsItem extends StatelessWidget {
InkWell(
onTap: () async {
await Clipboard.setData(
ClipboardData(
text: walletAddressExtracted,
),
ClipboardData(text: cryptoAccountData.walletAddress),
);
AlertMessage.showStateMessage(
context: context,
Expand Down
Loading

0 comments on commit 6fa1c5a

Please sign in to comment.