-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #977 from Portkey-Wallet/feature/revamp-v2.2
Feature/revamp v2.2
- Loading branch information
Showing
73 changed files
with
1,910 additions
and
47 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookCreateRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookCreateRequestDto | ||
{ | ||
[RegularExpression(@"^[a-zA-Z\d'_'' '\s]{1,16}$")] | ||
[Required] | ||
public string Name { get; set; } | ||
|
||
[Required] public string Address { get; set; } | ||
[Required] public string Network { get; set; } | ||
public string ChainId { get; set; } | ||
public bool IsExchange { get; set; } | ||
} |
8 changes: 8 additions & 0 deletions
8
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookDeleteRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookDeleteRequestDto | ||
{ | ||
public Guid Id { get; set; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookDto | ||
{ | ||
public Guid Id { get; set; } | ||
public string Index { get; set; } | ||
public string Name { get; set; } | ||
public ContactAddressInfoDto AddressInfo { get; set; } | ||
public ContactCaHolderInfo CaHolderInfo { get; set; } | ||
public Guid UserId { get; set; } | ||
public bool IsDeleted { get; set; } | ||
public DateTime CreateTime { get; set; } | ||
public DateTime ModificationTime { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookExistDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookExistDto | ||
{ | ||
public bool Existed { get; set; } | ||
} |
9 changes: 9 additions & 0 deletions
9
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookListRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Volo.Abp.Application.Dtos; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookListRequestDto : PagedResultRequestDto | ||
{ | ||
public string Filter { get; set; } | ||
public string Sort { get; set; } | ||
} |
8 changes: 8 additions & 0 deletions
8
src/CAServer.Application.Contracts/AddressBook/Dtos/AddressBookUpdateRequestDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class AddressBookUpdateRequestDto : AddressBookCreateRequestDto | ||
{ | ||
public Guid Id { get; set; } | ||
} |
10 changes: 10 additions & 0 deletions
10
src/CAServer.Application.Contracts/AddressBook/Dtos/ContactAddressInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class ContactAddressInfo | ||
{ | ||
public string Network { get; set; } | ||
public string NetworkName { get; set; } | ||
public string ChainId { get; set; } | ||
public string Address { get; set; } | ||
public bool IsExchange { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/CAServer.Application.Contracts/AddressBook/Dtos/ContactAddressInfoDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class ContactAddressInfoDto : ContactAddressInfo | ||
{ | ||
public string NetworkImage { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
src/CAServer.Application.Contracts/AddressBook/Dtos/ContactCaHolderInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class ContactCaHolderInfo | ||
{ | ||
public Guid UserId { get; set; } | ||
public string CaHash { get; set; } | ||
public string WalletName { get; set; } | ||
public string Avatar { get; set; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/CAServer.Application.Contracts/AddressBook/Dtos/GetNetworkListDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace CAServer.AddressBook.Dtos; | ||
|
||
public class GetNetworkListDto | ||
{ | ||
public List<AddressBookNetwork> NetworkList { get; set; } | ||
} | ||
|
||
public class AddressBookNetwork | ||
{ | ||
public string Network { get; set; } | ||
public string Name { get; set; } | ||
public string ChainId { get; set; } | ||
public string ImageUrl { get; set; } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/CAServer.Application.Contracts/AddressBook/Etos/AddressBookEto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using CAServer.AddressBook.Dtos; | ||
|
||
namespace CAServer.AddressBook.Etos; | ||
|
||
public class AddressBookEto : AddressBookDto | ||
{ | ||
} |
15 changes: 15 additions & 0 deletions
15
src/CAServer.Application.Contracts/AddressBook/IAddressBookAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Threading.Tasks; | ||
using CAServer.AddressBook.Dtos; | ||
using Volo.Abp.Application.Dtos; | ||
|
||
namespace CAServer.AddressBook; | ||
|
||
public interface IAddressBookAppService | ||
{ | ||
Task<AddressBookDto> CreateAsync(AddressBookCreateRequestDto requestDto); | ||
Task<AddressBookDto> UpdateAsync(AddressBookUpdateRequestDto requestDto); | ||
Task DeleteAsync(AddressBookDeleteRequestDto requestDto); | ||
Task<AddressBookExistDto> ExistAsync(string name); | ||
Task<PagedResultDto<AddressBookDto>> GetListAsync(AddressBookListRequestDto requestDto); | ||
Task<GetNetworkListDto> GetNetworkListAsync(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/CAServer.Application.Contracts/AddressBook/Migrate/Dto/AddressBookMigrateDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Migrate.Dto; | ||
|
||
public class AddressBookMigrateDto | ||
{ | ||
public string Name { get; set; } | ||
public Guid UserId { get; set; } | ||
public string Address { get; set; } | ||
public string Network { get; set; } | ||
public string ChainId { get; set; } | ||
public bool IsExchange { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/CAServer.Application.Contracts/AddressBook/Migrate/Dto/ContactMigrateCache.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace CAServer.AddressBook.Migrate.Dto; | ||
|
||
public class ContactMigrateCache | ||
{ | ||
public int MigrateCount { get; set; } | ||
} |
18 changes: 18 additions & 0 deletions
18
src/CAServer.Application.Contracts/AddressBook/Migrate/Eto/AddressBookMigrateEto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace CAServer.AddressBook.Migrate.Eto; | ||
|
||
public class AddressBookMigrateEto | ||
{ | ||
public string Id { get; set; } = Guid.NewGuid().ToString("N"); | ||
public Guid OriginalContactId { get; set; } | ||
public Guid NewContactId { get; set; } | ||
public Guid UserId { get; set; } | ||
public string ChainId { get; set; } | ||
public string Address { get; set; } | ||
public string FailType { get; set; } | ||
public string Status { get; set; } | ||
public string Message { get; set; } | ||
public DateTime CreateTime { get; set; } | ||
public DateTime UpdateTime { get; set; } | ||
} |
8 changes: 8 additions & 0 deletions
8
src/CAServer.Application.Contracts/AddressBook/Migrate/IAddressBookMigrateService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace CAServer.AddressBook.Migrate; | ||
|
||
public interface IAddressBookMigrateService | ||
{ | ||
Task MigrateAsync(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/CAServer.Application.Contracts/Commons/AddressHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace CAServer.Commons; | ||
|
||
public static class AddressHelper | ||
{ | ||
private const string FullAddressPrefix = "ELF"; | ||
private const char FullAddressSeparator = '_'; | ||
|
||
public static string ToFullAddress(string address, string chainId) | ||
{ | ||
if (address.Contains(FullAddressSeparator)) return address; | ||
|
||
return string.Join(FullAddressSeparator, FullAddressPrefix, address, chainId); | ||
} | ||
|
||
public static string ToShortAddress(string address) | ||
{ | ||
if (string.IsNullOrEmpty(address)) return address; | ||
var parts = address.Split(FullAddressSeparator); | ||
return parts.Length < 3 ? parts[parts.Length - 1] : parts[1]; | ||
} | ||
|
||
public static string GetChainId(string address) | ||
{ | ||
if (string.IsNullOrEmpty(address)) return string.Empty; | ||
var chainId = address.Split(FullAddressSeparator).ToList().Last(); | ||
return chainId.Length != 4 ? string.Empty : chainId; | ||
} | ||
|
||
public static readonly Dictionary<string, string> ChainNameMap = new Dictionary<string, string> | ||
{ | ||
[CommonConstant.MainChainId] = "aelf MainChain", | ||
[CommonConstant.TDVWChainId] = "aelf dAppChain", | ||
[CommonConstant.TDVVChainId] = "aelf dAppChain", | ||
["ARBITRUM"] = "Arbitrum One", | ||
["AVAXC"] = "AVAX C-Chain", | ||
["Base"] = "Base", // need to confirm | ||
["BSC"] = "BNB Smart Chain", | ||
["TBSC"] = "BNB Smart Chain", | ||
["ETH"] = "Ethereum", | ||
["SETH"] = "Ethereum", | ||
["OPTIMISM"] = "Optimism", | ||
["MATIC"] = "Polygon", | ||
["Solana"] = "Solana", | ||
["TRX"] = "TRON", | ||
["TON"] = "The Open Network" | ||
}; | ||
|
||
public static string GetNetworkName(string network) | ||
{ | ||
return ChainNameMap.GetOrDefault(network); | ||
} | ||
|
||
public static string GetNetwork(string network) | ||
{ | ||
return network is CommonConstant.MainChainId or CommonConstant.TDVWChainId or CommonConstant.TDVWChainId | ||
? "aelf" | ||
: network; | ||
} | ||
|
||
public static string GetAelfChainId(string network) | ||
{ | ||
return network is CommonConstant.MainChainId or CommonConstant.TDVWChainId or CommonConstant.TDVWChainId | ||
? network | ||
: null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.