├── MaizeUI ├── Output │ └── .gitkeep ├── Assets │ ├── LogoClose.ico │ └── maize_full_logo.png ├── Properties │ └── launchSettings.json ├── ViewModels │ ├── ViewModelBase.cs │ ├── ScriptingCryptoAirdropInputFileWindowViewModel.cs │ ├── FindNftDataFromAWalletWindowViewModel.cs │ └── ScriptingAirdropInputFileWindowViewModel.cs ├── Views │ ├── MainMenuWindow.axaml.cs │ ├── MainWindow.axaml.cs │ ├── AirdropNftsToUsersWindow.axaml.cs │ ├── ExpressAirdropNftsWindow.axaml.cs │ ├── AirdropCryptoToUsersWindow.axaml.cs │ ├── AirdropMigrateWalletWindow.axaml.cs │ ├── MetadataUploadToInfuraWindow.axaml.cs │ ├── MetadataRefreshCollectionWindow.axaml.cs │ ├── ScriptingAirdropInputFileWindow.axaml.cs │ ├── ScriptingCryptoAirdropInputFileWindow.axaml.cs │ ├── FindHoldersFromNftDataWindow.axaml.cs │ ├── FindNftDataFromAWalletWindow.axaml.cs │ ├── FindNftDataFromACollectionWindow.axaml.cs │ ├── MintWindow.axaml.cs │ ├── GenerateOneOfOnesWindow.axaml.cs │ ├── LooperLandsGenerateOneOfOnesWindow.axaml.cs │ ├── ScriptingAirdropInputFileWindow.axaml │ ├── ScriptingCryptoAirdropInputFileWindow.axaml │ ├── AppsettingsNoticeWindow.axaml.cs │ ├── MetadataUploadToInfuraWindow.axaml │ ├── AppsettingsNoticeWindow.axaml │ ├── FindHoldersFromNftDataWindow.axaml │ ├── FindNftDataFromAWalletWindow.axaml │ ├── FindNftDataFromACollectionWindow.axaml │ ├── AirdropMigrateWalletWindow.axaml │ ├── AirdropCryptoToUsersWindow.axaml │ ├── AirdropNftsToUsersWindow.axaml │ ├── GenerateOneOfOnesWindow.axaml │ ├── MetadataRefreshCollectionWindow.axaml │ ├── LooperLandsGenerateOneOfOnesWindow.axaml │ ├── MainWindow.axaml │ ├── MintWindow.axaml │ ├── ExpressAirdropNftsWindow.axaml │ └── MainMenuWindow.axaml ├── Things │ ├── Minting │ │ ├── Models │ │ │ ├── CounterFactualNft.cs │ │ │ ├── Type.cs │ │ │ ├── CreateCollectionResult.cs │ │ │ ├── StorageId.cs │ │ │ ├── IpfsData.cs │ │ │ ├── CounterFactualNftInfo.cs │ │ │ ├── OffchainFee.cs │ │ │ ├── CreateCollectionRequest.cs │ │ │ ├── RedPacketNftMintResponse.cs │ │ │ ├── MintResponseData.cs │ │ │ ├── NftData.cs │ │ │ ├── NftBalance.cs │ │ │ ├── NftTransferTypedData.cs │ │ │ ├── FindCollectionResult.cs │ │ │ └── RedPacketNft.cs │ │ ├── Helpers │ │ │ ├── Utils.cs │ │ │ ├── NftMetadataModify.cs │ │ │ └── TokenAmountConverter.cs │ │ └── Services │ │ │ └── ILoopringMintService.cs │ └── ImageModifier │ │ ├── OpenAi.cs │ │ └── Helpers.cs ├── App.axaml ├── Program.cs ├── App.axaml.cs ├── ViewLocator.cs ├── Helpers │ ├── DialogService.cs │ └── Calculations.cs └── MaizeUI.csproj ├── Maize ├── Input │ ├── Input.txt │ ├── Banish.txt │ └── Environment │ │ └── Infurasettings.json ├── LogoClose.ico ├── Models │ ├── StorageId.cs │ ├── Responses │ │ ├── Infura │ │ │ ├── FileAddResponse.cs │ │ │ └── PinAddResponse.cs │ │ ├── ApiKeyResponse.cs │ │ ├── GasPriceResponse.cs │ │ ├── ResolveEnsOrNameResponse.cs │ │ ├── UserMintedCollectionResponse.cs │ │ ├── UserOwnedCollectionResponse.cs │ │ ├── RefreshNftResponse.cs │ │ ├── CounterFactualInfo.cs │ │ ├── WalletTypeResponse.cs │ │ ├── NftOffChainFeeResponse.cs │ │ ├── AccountInformationResponse.cs │ │ ├── UserAssetsResponse.cs │ │ ├── TokenPriceResponse.cs │ │ ├── NftHoldersResponse.cs │ │ ├── NftDataResponse.cs │ │ ├── NftInformationResponse.cs │ │ ├── TokensResponse.cs │ │ ├── CommonCollectionResponse.cs │ │ ├── UserTransactionsResponse.cs │ │ └── NftResponseByCollection.cs │ ├── Token.cs │ ├── TransferInformationCrypto.cs │ ├── Type.cs │ ├── OffchainFee.cs │ ├── ApplicationSpecific │ │ ├── Leaderboard.cs │ │ ├── Settings.cs │ │ └── Constants.cs │ ├── TransferFeeOffchainFee.cs │ ├── NftHolders.cs │ ├── CryptoTransferAuditInformation.cs │ ├── QrCodeJson.cs │ ├── NftTransferAuditInformation.cs │ ├── TransferRequest.cs │ ├── TransferInformation.cs │ ├── NftTransferTypedData.cs │ ├── NftMetadata.cs │ └── NftBalance.cs ├── Services │ ├── ILoopExchangeService.cs │ ├── IInfuraClient.cs │ ├── IEthereumService.cs │ ├── INftMetadataService.cs │ ├── LoopExchangeService.cs │ ├── InfuraClient.cs │ ├── EthereumService.cs │ └── ILoopringService.cs ├── Maize.csproj.user ├── Helpers │ ├── PoseidonHelper.cs │ ├── Timers.cs │ ├── FormatJson.cs │ ├── Things.cs │ └── ApplicationFunctionalities.cs └── Maize.csproj ├── .gitignore ├── README.md ├── LICENSE ├── ContributionGuide.md └── Maize.sln /MaizeUI/Output/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Maize/Input/Input.txt: -------------------------------------------------------------------------------- 1 | cobmin.eth -------------------------------------------------------------------------------- /Maize/Input/Banish.txt: -------------------------------------------------------------------------------- 1 | 0x000000000000000000000000000000000000dead -------------------------------------------------------------------------------- /Maize/LogoClose.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobhuberonline/Maize/HEAD/Maize/LogoClose.ico -------------------------------------------------------------------------------- /MaizeUI/Assets/LogoClose.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobhuberonline/Maize/HEAD/MaizeUI/Assets/LogoClose.ico -------------------------------------------------------------------------------- /MaizeUI/Assets/maize_full_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobhuberonline/Maize/HEAD/MaizeUI/Assets/maize_full_logo.png -------------------------------------------------------------------------------- /MaizeUI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "MaizeUI": { 4 | "commandName": "Project", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /MaizeUI/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | 3 | namespace MaizeUI.ViewModels 4 | { 5 | public class ViewModelBase : ReactiveObject 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Maize/Models/StorageId.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class StorageId 4 | { 5 | public int orderId { get; set; } 6 | public int offchainId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Maize/Input/Environment/MYmainnetappsettings.json 2 | Maize/Input/Environment/MYtestnetappsettings.json 3 | Maize/Properties 4 | Maize/obj 5 | Maize/bin 6 | .vs/ 7 | /MaizeUI/Helpers/Encryption.cs 8 | /Updater 9 | -------------------------------------------------------------------------------- /Maize/Services/ILoopExchangeService.cs: -------------------------------------------------------------------------------- 1 | using Maize.Models; 2 | using Maize.Models.Responses; 3 | 4 | namespace Maize 5 | { 6 | public interface ILoopExchangeService 7 | { 8 | Task GetUser(string owner); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Maize/Input/Environment/Infurasettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment1": "This file contains the API keys for Infura.", 3 | "_comment2": "You can obtain these keys by signing up at https://infura.io/", 4 | "InfuraApiKey": "asdasd", 5 | "InfuraSecretKey": "asdasdasd" 6 | } -------------------------------------------------------------------------------- /Maize/Models/Responses/Infura/FileAddResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class FileAddResponse 4 | { 5 | public string Name { get; set; } 6 | public string Hash { get; set; } 7 | public string Size { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Maize/Services/IInfuraClient.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Services 2 | { 3 | public interface IInfuraClient 4 | { 5 | Task PinAdd(); 6 | Task PinView(); 7 | Task FileAdd(string filePath); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /MaizeUI/Views/MainMenuWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class MainMenuWindow : Window 7 | { 8 | public MainMenuWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Maize/Models/Token.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize 8 | { 9 | public class Token 10 | { 11 | public int tokenId { get; set; } 12 | public string volume { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Maize/Models/TransferInformationCrypto.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class TransferInformationCrypto 4 | { 5 | public decimal Amount { get; set; } 6 | public string? ToAddress { get; set; } 7 | public string? Memo { get; set; } 8 | public bool Activated { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Maize/Models/Type.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize 8 | { 9 | public class Type 10 | { 11 | public string name { get; set; } 12 | public string type { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /MaizeUI/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | using MaizeUI.ViewModels; 4 | 5 | namespace MaizeUI.Views 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Maize/Models/Responses/ApiKeyResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class ApiKeyResponse 10 | { 11 | public string apiKey { get; set; } 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Maize/Models/Responses/GasPriceResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class GasPriceResponse 10 | { 11 | public string Price { get; set; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/CounterFactualNft.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class CounterFactualNft 10 | { 11 | public string tokenAddress { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/Type.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopDropSharp 8 | { 9 | public class Type 10 | { 11 | public string name { get; set; } 12 | public string type { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropNftsToUsersWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class AirdropNftsToUsersWindow : Window 7 | { 8 | public AirdropNftsToUsersWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Views/ExpressAirdropNftsWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class ExpressAirdropNftsWindow : Window 7 | { 8 | public ExpressAirdropNftsWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/CreateCollectionResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class CreateCollectionResult 10 | { 11 | public string contractAddress { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropCryptoToUsersWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class AirdropCryptoToUsersWindow : Window 7 | { 8 | public AirdropCryptoToUsersWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropMigrateWalletWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class AirdropMigrateWalletWindow : Window 7 | { 8 | public AirdropMigrateWalletWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Views/MetadataUploadToInfuraWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class MetadataUploadToInfuraWindow : Window 7 | { 8 | public MetadataUploadToInfuraWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/StorageId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class StorageId 10 | { 11 | public int orderId { get;set; } 12 | public int offchainId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /MaizeUI/Views/MetadataRefreshCollectionWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class MetadataRefreshCollectionWindow : Window 7 | { 8 | public MetadataRefreshCollectionWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaizeUI/Views/ScriptingAirdropInputFileWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class ScriptingAirdropInputFileWindow : Window 7 | { 8 | public ScriptingAirdropInputFileWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Maize/Maize.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <_LastSelectedProfileId>C:\Users\cobmin\OneDrive\Code\MaizeConsoleApplication\Maize\Maize\Properties\PublishProfiles\FolderProfile.pubxml 5 | 6 | -------------------------------------------------------------------------------- /MaizeUI/Views/ScriptingCryptoAirdropInputFileWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | 4 | namespace MaizeUI.Views 5 | { 6 | public partial class ScriptingCryptoAirdropInputFileWindow : Window 7 | { 8 | public ScriptingCryptoAirdropInputFileWindow() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Maize/Models/OffchainFee.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class Fee 4 | { 5 | public string token { get; set; } 6 | public string fee { get; set; } 7 | public int discount { get; set; } 8 | } 9 | 10 | public class OffchainFee 11 | { 12 | public string gasPrice { get; set; } 13 | public List fees { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Maize/Models/Responses/ResolveEnsOrNameResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models 2 | { 3 | public class ResultInfo 4 | { 5 | public int code { get; set; } 6 | public string message { get; set; } 7 | } 8 | 9 | public class ResolveEnsOrNameResponse 10 | { 11 | public ResultInfo resultInfo { get; set; } 12 | public string data { get; set; } 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/IpfsData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp.Models 8 | { 9 | public class IpfsData 10 | { 11 | public string Name { get; set; } 12 | public string Hash { get; set; } 13 | public string Size { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Maize/Models/Responses/UserMintedCollectionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models.Responses 2 | { 3 | public class CollectionMinted 4 | { 5 | public CollectionInformation collection { get; set; } 6 | } 7 | public class UserMintedCollectionResponse 8 | { 9 | public List collections { get; set; } 10 | public int totalNum { get; set; } 11 | } 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /Maize/Models/ApplicationSpecific/Leaderboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class Leaderboard 10 | { 11 | public string owner { get; set; } 12 | public int transactionCount { get; set; } 13 | public int nftAmountSent { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Maize/Models/Responses/Infura/PinAddResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class ProgressResponse 4 | { 5 | public int Progress { get; set; } 6 | } 7 | 8 | public class PinsResponse 9 | { 10 | public List Pins { get; set; } 11 | } 12 | public class PinAddResponse 13 | { 14 | public int Progress { get; set; } 15 | public List Pins { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/CounterFactualNftInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class CounterFactualNftInfo 10 | { 11 | public string nftOwner { get; set; } 12 | public string nftFactory { get; set; } 13 | public string nftBaseUri { get; set; } = ""; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Maize/Models/Responses/UserOwnedCollectionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models.Responses 2 | { 3 | public class CollectionOwned 4 | { 5 | public CollectionInformation collection { get; set; } 6 | public int count { get; set; } 7 | } 8 | public class UserOwnedCollectionResponse 9 | { 10 | public List collections { get; set; } 11 | public int totalNum { get; set; } 12 | } 13 | 14 | 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /MaizeUI/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Maize/Helpers/PoseidonHelper.cs: -------------------------------------------------------------------------------- 1 | using PoseidonSharp; 2 | using System.Numerics; 3 | 4 | namespace Maize.Helpers 5 | { 6 | public static class PoseidonHelper 7 | { 8 | public static BigInteger GetPoseidonHash(BigInteger[] inputs) 9 | { 10 | var poseidonHasher = new Poseidon(inputs.Length + 1, 6, 53, "poseidon", 5, _securityTarget: 128); 11 | return poseidonHasher.CalculatePoseidonHash(inputs); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![MaizeHelps.Art](https://github.com/cobmin/Maize/assets/97369738/4db3a21f-11aa-4cb6-8214-aa5655332c1f)](https://maizehelps.art/) 2 | 3 | [Explore everything about Maize here](https://maizehelps.art/) 4 | 5 | 6 | --- 7 | 8 | ### Acknowledgments 🌟 9 | A sincere thank you to [**Fudgey**](https://github.com/fudgebucket27). Your insights, expertise, and continued support have brought this application to life. Your assistance goes beyond code; it's the camaraderie and the invaluable lessons learned. 💙 10 | -------------------------------------------------------------------------------- /Maize/Models/Responses/RefreshNftResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class RefreshNftResponse 10 | { 11 | public string name { get; set; } 12 | public string nftId { get; set; } 13 | public string status { get; set; } 14 | public long createdAt { get; set; } 15 | public long updatedAt { get; set; } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Maize/Models/Responses/CounterFactualInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class CounterFactualInfo 10 | { 11 | public int accountId { get; set; } 12 | public string wallet { get; set; } 13 | public string walletFactory { get; set; } 14 | public string walletSalt { get; set; } 15 | public string walletOwner { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Maize/Models/TransferFeeOffchainFee.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class TransferFee 10 | { 11 | public string token { get; set; } 12 | public string fee { get; set; } 13 | public decimal discount { get; set; } 14 | } 15 | 16 | public class TransferFeeOffchainFee 17 | { 18 | public string gasPrice { get; set; } 19 | public List fees { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/OffchainFee.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class Fee 10 | { 11 | public string token { get; set; } 12 | public int tokenId { get; set; } 13 | public string fee { get; set; } 14 | public int discount { get; set; } 15 | } 16 | 17 | public class OffchainFee 18 | { 19 | public string gasPrice { get; set; } 20 | public List fees { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Maize/Models/Responses/WalletTypeResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class Data 10 | { 11 | public bool isInCounterFactualStatus { get; set; } 12 | public bool isContract { get; set; } 13 | public string loopringWalletContractVersion { get; set; } 14 | } 15 | 16 | public class WalletTypeResponse 17 | { 18 | public ResultInfo resultInfo { get; set; } 19 | public Data data { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Maize/Models/Responses/NftOffChainFeeResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class Fee 10 | { 11 | public string token { get; set; } 12 | public int tokenId { get; set; } 13 | public string fee { get; set; } 14 | public int discount { get; set; } 15 | } 16 | 17 | public class NftOffChainFeeResponse 18 | { 19 | public string gasPrice { get; set; } 20 | public List fees { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/CreateCollectionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class CreateCollectionRequest 10 | { 11 | public string avatar { get; set; } 12 | public string banner { get; set; } 13 | public string description { get; set; } 14 | public string name { get; set; } 15 | public string nftFactory { get; set; } 16 | public string owner { get; set; } 17 | public string tileUri { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindHoldersFromNftDataWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using Avalonia.Markup.Xaml; 4 | using MaizeUI.Helpers; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class FindHoldersFromNftDataWindow : Window 9 | { 10 | public FindHoldersFromNftDataWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 15 | { 16 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/lookups/holders-from-nft-data"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindNftDataFromAWalletWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using Avalonia.Markup.Xaml; 4 | using MaizeUI.Helpers; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class FindNftDataFromAWalletWindow : Window 9 | { 10 | public FindNftDataFromAWalletWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 15 | { 16 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/lookups/nft-info-from-a-wallet"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindNftDataFromACollectionWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using Avalonia.Markup.Xaml; 4 | using MaizeUI.Helpers; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class FindNftDataFromACollectionWindow : Window 9 | { 10 | public FindNftDataFromACollectionWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 15 | { 16 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/lookups/nft-info-from-collection"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Maize/Models/Responses/AccountInformationResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class PublicKey 4 | { 5 | public string x { get; set; } 6 | public string y { get; set; } 7 | } 8 | 9 | public class AccountInformationResponse 10 | { 11 | public int accountId { get; set; } 12 | public string owner { get; set; } 13 | public bool frozen { get; set; } 14 | public PublicKey publicKey { get; set; } 15 | public string tags { get; set; } 16 | public int nonce { get; set; } 17 | public int keyNonce { get; set; } 18 | public string keySeed { get; set; } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Maize/Models/Responses/UserAssetsResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | public class Pending 10 | { 11 | public string withdraw { get; set; } 12 | public string deposit { get; set; } 13 | } 14 | 15 | public class UserAssetsResponse 16 | { 17 | public int accountId { get; set; } 18 | public int tokenId { get; set; } 19 | public string total { get; set; } 20 | public string locked { get; set; } 21 | public Pending pending { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Maize/Helpers/Timers.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace Maize.Helpers 4 | { 5 | public class Timers 6 | { 7 | public static void ApiStopWatchCheck(Stopwatch apiSw) 8 | { 9 | apiSw.Stop(); 10 | TimeSpan elapsed = apiSw.Elapsed; 11 | TimeSpan maxDelay = TimeSpan.FromSeconds(1); 12 | 13 | if (elapsed < maxDelay) 14 | { 15 | TimeSpan remainingDelay = maxDelay - elapsed; 16 | 17 | if (remainingDelay > TimeSpan.Zero) 18 | { 19 | Thread.Sleep(remainingDelay); 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Maize/Models/NftHolders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class NftHolders 10 | { 11 | public class OwnerAndAmount 12 | { 13 | public string nftData { get; set; } 14 | public string nftName { get; set; } 15 | public string nftOwner { get; set; } 16 | public string ownerAmountOwned { get; set; } 17 | } 18 | public class OwnerAndTotal 19 | { 20 | public string owner { get; set; } 21 | public int total { get; set; } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Maize/Services/IEthereumService.cs: -------------------------------------------------------------------------------- 1 | using Nethereum.Web3; 2 | using System; 3 | using System.Diagnostics; 4 | using System.Threading.Tasks; 5 | using Nethereum.ENS; 6 | 7 | namespace Maize 8 | { 9 | 10 | public interface IEthereumService 11 | { 12 | 13 | Task GetMetadataLink(string? tokenId, string? tokenAddress, int? nftType); 14 | 15 | Task GetMetadataLink(string? tokenId, string? tokenAddress, string? contractABI, string? functionName); 16 | 17 | Task GetEthAddressFromEns(string? ens); 18 | 19 | Task GetTokenNameFromAddress(string address); 20 | 21 | Task GetTokenSymbolFromAddress(string address); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Maize/Models/CryptoTransferAuditInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class CryptoTransferAuditInformation 10 | { 11 | public List validAddress { get; set; } 12 | public List invalidAddress { get; set; } 13 | public List banishAddress { get; set; } 14 | public List? alreadyActivatedAddress { get; set; } 15 | public decimal gasFeeTotal { get; set; } 16 | public decimal transactionFeeTotal { get; set; } 17 | public decimal cryptoSentTotal { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/RedPacketNftMintResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp.Models 8 | { 9 | public class RedPacketNftMintResponse 10 | { 11 | public string hash { get; set; } 12 | public string status { get; set; } 13 | public bool isIdempotent { get; set; } 14 | 15 | public string nftData { get; set; } 16 | public int accountId { get; set; } 17 | public int tokenId { get; set; } 18 | public int storageId { get; set; } 19 | public string errorMessage { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Maize/Services/INftMetadataService.cs: -------------------------------------------------------------------------------- 1 | using Maize.Models; 2 | namespace Maize 3 | { 4 | public interface INftMetadataService 5 | { 6 | public string? MakeIPFSLink(string? link); 7 | 8 | Task GetCollectionMetadata(string URL, CancellationToken cancellationToken = default); 9 | 10 | Task GetMetadata(string link, CancellationToken cancellationToken = default); 11 | 12 | public NftMetadata? GetMetadataFromResponse(string response); 13 | Task GetMetadataFromCid(string cid); 14 | Task SaveFileFromCid(string cid); 15 | 16 | Task GetContentTypeFromURL(string link, CancellationToken cancellationToken = default); 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /Maize/Models/QrCodeJson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopringSmartWalletRecoveryPhraseExtractor 8 | { 9 | public class QrCodeJson 10 | { 11 | public string? wallet { get; set; } 12 | public string? iv { get; set; } 13 | public string? mnemonic { get; set; } 14 | public string? ens { get; set; } 15 | public bool isCounterFactual { get; set;} 16 | public string register { get; set; } 17 | public string? type { get; set; } 18 | public int setting { get; set; } 19 | public string? salt { get; set; } 20 | public string? network { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Maize/Models/NftTransferAuditInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class NftTransferAuditInformation 10 | { 11 | public List validAddress { get; set; } 12 | public List invalidAddress { get; set; } 13 | public List banishAddress { get; set; } 14 | public List? invalidNftData { get; set; } 15 | public List? alreadyActivatedAddress { get; set; } 16 | public decimal gasFeeTotal { get; set; } 17 | public decimal transactionFeeTotal { get; set; } 18 | public int nftSentTotal { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Maize/Models/Responses/TokenPriceResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | // Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse); 10 | public class TokenPrice 11 | { 12 | public string token { get; set; } 13 | public string price { get; set; } 14 | } 15 | 16 | public class ResultInfo 17 | { 18 | public int code { get; set; } 19 | public string message { get; set; } 20 | } 21 | 22 | public class TokenPriceResponse 23 | { 24 | public ResultInfo resultInfo { get; set; } 25 | public List data { get; set; } 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/MintResponseData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class MintResponseData 10 | { 11 | public string hash { get; set; } 12 | public int nftTokenId { get; set; } 13 | 14 | public string nftId { get; set; } 15 | public string nftData { get; set; } 16 | public string status { get; set; } 17 | public bool isIdempotent { get; set; } 18 | public int accountId { get; set; } 19 | public int storageId { get; set; } 20 | public string metadataCid { get; set; } 21 | public string errorMessage { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MaizeUI/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.ReactiveUI; 3 | 4 | namespace MaizeUI 5 | { 6 | internal class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace() 20 | .UseReactiveUI(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Maize/Models/Responses/NftHoldersResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class NftHolder 4 | { 5 | public int accountId { get; set; } 6 | public string address { get; set; } 7 | public int tokenId { get; set; } 8 | public string amount { get; set; } 9 | } 10 | 11 | public class NftHoldersResponse 12 | { 13 | public int totalNum { get; set; } 14 | public List nftHolders { get; set; } 15 | } 16 | //public class NftHolderAndNftData 17 | //{ 18 | 19 | // public string walletAddress { get; set; } 20 | // public string nftName { get; set; } 21 | // public string amount { get; set; } 22 | // public string nftData { get; set; } 23 | // public int accountId { get; set; } 24 | // public int tokenId { get; set; } 25 | //} 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Maize/Models/TransferRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize 8 | { 9 | public class TransferRequest 10 | { 11 | // ESSENTIAL TRANSFER INFO 12 | public string exchange { get; set; } 13 | public int payerId { get; set; } 14 | public string payerAddr { get; set; } 15 | public int payeeId { get; set; } = 0; // Default of 0 if unknown is fine 16 | public string payeeAddr { get; set; } 17 | public Token token { get; set; } 18 | public Token maxFee { get; set; } 19 | public int storageId { get; set; } 20 | public int validUntil { get; set; } 21 | public string tokenName { get; set; } 22 | public string tokenFeeName { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Maize/Models/Responses/NftDataResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class NftDataResponse 4 | { 5 | public string nftData { get; set; } 6 | public string minter { get; set; } 7 | public string nftType { get; set; } 8 | public string tokenAddress { get; set; } 9 | public string nftId { get; set; } 10 | public int creatorFeeBips { get; set; } 11 | public int royaltyPercentage { get; set; } 12 | public int originalRoyaltyPercentage { get; set; } 13 | public bool status { get; set; } 14 | public string nftFactory { get; set; } 15 | public string nftOwner { get; set; } 16 | public string nftBaseUri { get; set; } 17 | public string royaltyAddress { get; set; } 18 | public string originalMinter { get; set; } 19 | public long createdAt { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MaizeUI/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | using MaizeUI.ViewModels; 5 | using MaizeUI.Views; 6 | using MaizeUI.Helpers; 7 | 8 | namespace MaizeUI 9 | { 10 | public class App : Application 11 | { 12 | public override void OnFrameworkInitializationCompleted() 13 | { 14 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 15 | { 16 | var dialogService = new DialogService(); 17 | var accountService = new AccountService(); 18 | 19 | desktop.MainWindow = new MainWindow 20 | { 21 | DataContext = new MainWindowViewModel(accountService, dialogService), 22 | }; 23 | } 24 | 25 | base.OnFrameworkInitializationCompleted(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Maize/Models/TransferInformation.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models 2 | { 3 | public class TransferInformation 4 | { 5 | public string? NftData { get; set; } 6 | public int Amount { get; set; } 7 | public string? ToAddress { get; set; } 8 | public string? Memo { get; set; } 9 | public bool Activated { get; set; } 10 | } 11 | 12 | public class UserTransferInformation 13 | { 14 | public string NftData { get; set; } 15 | public string WalletAddress { get; set; } 16 | public int Amount { get; set; } 17 | 18 | private decimal gasFee; 19 | public decimal GasFee 20 | { 21 | get => gasFee; 22 | set => gasFee = value / 1000000000000000000M; // Divide by 1,000,000,000 23 | } 24 | 25 | public bool TransferFail { get; set; } 26 | public string? ErrorMessage { get; set; } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Maize/Services/LoopExchangeService.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using RestSharp; 3 | 4 | 5 | namespace Maize 6 | { 7 | public class LoopExchangeService : ILoopExchangeService 8 | { 9 | 10 | readonly RestClient _client; 11 | 12 | public LoopExchangeService(string environmentUrl) 13 | { 14 | _client = new RestClient(environmentUrl); 15 | } 16 | public async Task GetUser(string owner) 17 | { 18 | var request = new RestRequest($"web-v1/resolution/{owner}"); 19 | try 20 | { 21 | var response = await _client.GetAsync(request); 22 | var data = JsonConvert.DeserializeObject(response.Content!); 23 | return data; 24 | } 25 | catch (HttpRequestException httpException) 26 | { 27 | return null; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MaizeUI/ViewLocator.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Controls.Templates; 3 | using MaizeUI.ViewModels; 4 | using System; 5 | 6 | namespace MaizeUI 7 | { 8 | public class ViewLocator : IDataTemplate 9 | { 10 | public Control? Build(object? data) 11 | { 12 | if (data == null) 13 | { 14 | return null; // Or you might want to return a default Control here 15 | } 16 | 17 | var name = data.GetType().FullName!.Replace("ViewModel", "View"); 18 | var type = Type.GetType(name); 19 | 20 | if (type != null) 21 | { 22 | return (Control?)Activator.CreateInstance(type); 23 | } 24 | 25 | return new TextBlock { Text = "Not Found: " + name }; 26 | } 27 | 28 | public bool Match(object? data) 29 | { 30 | return data is ViewModelBase; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Maize/Helpers/FormatJson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ApiCalls.Helpers 8 | { 9 | public static class FormatJson 10 | { 11 | public static string SaveJsonToDownloadsFolder(string jsonData, string fileName) 12 | { 13 | var downloadsPath = GetDownloadsFolderPath(); 14 | var fullPath = Path.Combine(downloadsPath, fileName); 15 | 16 | File.WriteAllText(fullPath, jsonData); 17 | return fullPath; 18 | } 19 | public static string GetDownloadsFolderPath() 20 | { 21 | return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); 22 | } 23 | } 24 | 25 | public class JsonData 26 | { 27 | public string image { get; set; } 28 | public string animation_url { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Maize/Models/Responses/NftInformationResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models.Responses 2 | { 3 | public class NftInformationResponse 4 | { 5 | public string nftData { get; set; } 6 | public string minter { get; set; } 7 | public string nftType { get; set; } 8 | public string tokenAddress { get; set; } 9 | public string nftId { get; set; } 10 | public int creatorFeeBips { get; set; } 11 | public int royaltyPercentage { get; set; } 12 | public int originalRoyaltyPercentage { get; set; } 13 | public bool status { get; set; } 14 | public string nftFactory { get; set; } 15 | public string nftOwner { get; set; } 16 | public string nftBaseUri { get; set; } 17 | public string royaltyAddress { get; set; } 18 | public string originalMinter { get; set; } 19 | public object createdAt { get; set; } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/NftData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | public class NftData 10 | { 11 | public string nftData { get; set; } 12 | public string minter { get; set; } 13 | public string nftType { get; set; } 14 | public string tokenAddress { get; set; } 15 | public string nftId { get; set; } 16 | public int creatorFeeBips { get; set; } 17 | public int royaltyPercentage { get; set; } 18 | public int originalRoyaltyPercentage { get; set; } 19 | public bool status { get; set; } 20 | public string nftFactory { get; set; } 21 | public string nftOwner { get; set; } 22 | public string nftBaseUri { get; set; } 23 | public string royaltyAddress { get; set; } 24 | public string originalMinter { get; set; } 25 | public long createdAt { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Maize/Helpers/Things.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Maize.Helpers 10 | { 11 | public static class Things 12 | { 13 | public static void OpenUrl(string url) 14 | { 15 | try 16 | { 17 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) 18 | { 19 | Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); 20 | } 21 | else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 22 | { 23 | Process.Start("xdg-open", url); 24 | } 25 | } 26 | catch (Exception ex) 27 | { 28 | // Handle exceptions, if any 29 | // For example, log the error or inform the user 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Jacob Huber 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Helpers/Utils.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using RestSharp; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Numerics; 8 | using System.Security.Cryptography; 9 | using System.Text; 10 | using System.Text.RegularExpressions; 11 | using System.Threading.Tasks; 12 | using System.Web; 13 | 14 | namespace LoopMintSharp 15 | { 16 | public static class Utils 17 | { 18 | public static BigInteger ParseHexUnsigned(string toParse) 19 | { 20 | toParse = toParse.Replace("0x", ""); 21 | var parsResult = BigInteger.Parse(toParse, System.Globalization.NumberStyles.HexNumber); 22 | if (parsResult < 0) 23 | parsResult = BigInteger.Parse("0" + toParse, System.Globalization.NumberStyles.HexNumber); 24 | return parsResult; 25 | } 26 | 27 | public static string UrlEncodeUpperCase(string stringToEncode) 28 | { 29 | var reg = new Regex(@"%[a-f0-9]{2}"); 30 | stringToEncode = HttpUtility.UrlEncode(stringToEncode); 31 | return reg.Replace(stringToEncode, m => m.Value.ToUpperInvariant()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MaizeUI/Helpers/DialogService.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls.ApplicationLifetimes; 2 | using Avalonia.Controls; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace MaizeUI.Helpers 10 | { 11 | public interface IDialogService 12 | { 13 | Task ShowDialogAsync(TViewModel viewModel, Window ownerWindow = null) 14 | where TDialog : Window, new() 15 | where TViewModel : class; 16 | } 17 | 18 | public class DialogService : IDialogService 19 | { 20 | public async Task ShowDialogAsync(TViewModel viewModel, Window ownerWindow = null) 21 | where TDialog : Window, new() 22 | where TViewModel : class 23 | { 24 | var dialog = new TDialog 25 | { 26 | DataContext = viewModel, 27 | WindowStartupLocation = WindowStartupLocation.CenterOwner 28 | }; 29 | 30 | if (ownerWindow != null && ownerWindow.IsVisible) 31 | { 32 | await dialog.ShowDialog(ownerWindow); 33 | } 34 | else 35 | { 36 | dialog.Show(); 37 | } 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Maize/Models/ApplicationSpecific/Settings.cs: -------------------------------------------------------------------------------- 1 | namespace Maize 2 | { 3 | public class RootObject 4 | { 5 | public Settings Settings { get; set; } 6 | } 7 | public class Settings 8 | { 9 | public string LoopringApiKey { get; set; } 10 | public string LoopringPrivateKey { get; set; } 11 | public string LoopringAddress { get; set; } 12 | public int LoopringAccountId { get; set; } 13 | public long ValidUntil { get; set; } 14 | public int MaxFeeTokenId { get; set; } 15 | public int Environment { get; set; } 16 | public string MMorGMEPrivateKey { get; set; } 17 | } 18 | 19 | public class WalletDetails 20 | { 21 | public string Address { get; set; } 22 | public long AccountId { get; set; } 23 | public string Level { get; set; } 24 | public int Nonce { get; set; } 25 | public string ApiKey { get; set; } 26 | public string PublicX { get; set; } 27 | public string PublicY { get; set; } 28 | public string PrivateKey { get; set; } 29 | } 30 | public class InfuraKeys 31 | { 32 | public string _comment1 { get; set; } 33 | public string _comment2 { get; set; } 34 | public string InfuraApiKey { get; set; } 35 | public string InfuraSecretKey { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/NftBalance.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Serialization; 3 | 4 | namespace LoopMintSharp 5 | { 6 | public class Datum 7 | { 8 | public int id { get; set; } 9 | public int accountId { get; set; } 10 | public int tokenId { get; set; } 11 | public string nftData { get; set; } 12 | public string tokenAddress { get; set; } 13 | public string nftId { get; set; } 14 | public string nftType { get; set; } 15 | public string total { get; set; } 16 | public string locked { get; set; } 17 | public Pending pending { get; set; } 18 | public string deploymentStatus { get; set; } 19 | public bool isCounterFactualNFT { get; set; } 20 | 21 | public Metadata metadata { get; set; } 22 | 23 | } 24 | 25 | public class Metadata 26 | { 27 | [JsonProperty(PropertyName = "base")] 28 | public Base basename { get; set; } 29 | } 30 | 31 | public class Base 32 | { 33 | public string name { get; set; } 34 | } 35 | 36 | public class Pending 37 | { 38 | public string withdraw { get; set; } 39 | public string deposit { get; set; } 40 | } 41 | 42 | public class NftBalance 43 | { 44 | public int totalNum { get; set; } 45 | public List data { get; set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /MaizeUI/Views/MintWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using MaizeUI.Helpers; 4 | using MaizeUI.ViewModels; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class MintWindow : Window 9 | { 10 | public MintWindow() 11 | { 12 | InitializeComponent(); 13 | DataContextChanged += OnDataContextChanged; 14 | } 15 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 16 | { 17 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials//minting/bulk-minting"); 18 | } 19 | private void OnDataContextChanged(object sender, EventArgs e) 20 | { 21 | var viewModel = DataContext as MintWindowViewModel; 22 | if (viewModel != null) 23 | { 24 | viewModel.RequestOpenFolder += OpenFolderDialog; 25 | } 26 | } 27 | private async void OpenFolderDialog() 28 | { 29 | var folderPickerDialog = new OpenFolderDialog { Title = "Select Input Directory" }; 30 | var result = await folderPickerDialog.ShowAsync(this); 31 | var viewModel = (MintWindowViewModel)this.DataContext; 32 | if (!string.IsNullOrEmpty(result)) 33 | { 34 | viewModel.InputDirectory = result; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Maize/Models/NftTransferTypedData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Numerics; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Maize 9 | { 10 | public class TransferTypedData 11 | { 12 | public Domain domain { get; set; } 13 | public Message message { get; set; } 14 | public string primaryType { get; set; } 15 | public Types types { get; set; } 16 | 17 | public class Domain 18 | { 19 | public BigInteger chainId { get; set; } 20 | public string name { get; set; } 21 | public string verifyingContract { get; set; } 22 | public string version { get; set; } 23 | } 24 | 25 | public class Message 26 | { 27 | public string from { get; set; } 28 | public string to { get; set; } 29 | public int tokenID { get; set; } 30 | public string amount { get; set; } 31 | public int feeTokenID { get; set; } 32 | public string maxFee { get; set; } 33 | public int validUntil { get; set; } 34 | public int storageID { get; set; } 35 | } 36 | 37 | public class Types 38 | { 39 | public List EIP712Domain { get; set; } 40 | public List Transfer { get; set; } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/NftTransferTypedData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Numerics; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LoopDropSharp 9 | { 10 | public class TransferTypedData 11 | { 12 | public Domain domain { get; set; } 13 | public Message message { get; set; } 14 | public string primaryType { get; set; } 15 | public Types types { get; set; } 16 | 17 | public class Domain 18 | { 19 | public BigInteger chainId { get; set; } 20 | public string name { get; set; } 21 | public string verifyingContract { get; set; } 22 | public string version { get; set; } 23 | } 24 | 25 | public class Message 26 | { 27 | public string from { get; set; } 28 | public string to { get; set; } 29 | public int tokenID { get; set; } 30 | public string amount { get; set; } 31 | public int feeTokenID { get; set; } 32 | public string maxFee { get; set; } 33 | public int validUntil { get; set; } 34 | public int storageID { get; set; } 35 | } 36 | 37 | public class Types 38 | { 39 | public List EIP712Domain { get; set; } 40 | public List Transfer { get; set; } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MaizeUI/Views/GenerateOneOfOnesWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using MaizeUI.Helpers; 4 | using MaizeUI.ViewModels; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class GenerateOneOfOnesWindow : Window 9 | { 10 | public GenerateOneOfOnesWindow() 11 | { 12 | InitializeComponent(); 13 | DataContextChanged += OnDataContextChanged; 14 | } 15 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 16 | { 17 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/one-of-one-creation/generate-one-of-one-nfts"); 18 | } 19 | private void OnDataContextChanged(object sender, EventArgs e) 20 | { 21 | var viewModel = DataContext as GenerateOneOfOnesWindowViewModel; 22 | if (viewModel != null) 23 | { 24 | viewModel.RequestOpenFolder += OpenFolderDialog; 25 | } 26 | } 27 | private async void OpenFolderDialog() 28 | { 29 | var folderPickerDialog = new OpenFolderDialog { Title = "Select Input Directory" }; 30 | var result = await folderPickerDialog.ShowAsync(this); 31 | var viewModel = (GenerateOneOfOnesWindowViewModel)this.DataContext; 32 | if (!string.IsNullOrEmpty(result)) 33 | { 34 | viewModel.InputDirectory = result; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MaizeUI/Views/LooperLandsGenerateOneOfOnesWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using MaizeUI.Helpers; 4 | using MaizeUI.ViewModels; 5 | 6 | namespace MaizeUI.Views 7 | { 8 | public partial class LooperLandsGenerateOneOfOnesWindow : Window 9 | { 10 | public LooperLandsGenerateOneOfOnesWindow() 11 | { 12 | InitializeComponent(); 13 | DataContextChanged += OnDataContextChanged; 14 | } 15 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 16 | { 17 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/one-of-one-creation/generate-one-of-one-loopers"); 18 | } 19 | private void OnDataContextChanged(object sender, EventArgs e) 20 | { 21 | var viewModel = DataContext as LooperLandsGenerateOneOfOnesWindowViewModel; 22 | if (viewModel != null) 23 | { 24 | viewModel.RequestOpenFolder += OpenFolderDialog; 25 | } 26 | } 27 | private async void OpenFolderDialog() 28 | { 29 | var folderPickerDialog = new OpenFolderDialog { Title = "Select Input Directory" }; 30 | var result = await folderPickerDialog.ShowAsync(this); 31 | var viewModel = (LooperLandsGenerateOneOfOnesWindowViewModel)this.DataContext; 32 | if (!string.IsNullOrEmpty(result)) 33 | { 34 | viewModel.InputDirectory = result; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/FindCollectionResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp 8 | { 9 | 10 | public class Collection 11 | { 12 | public int id { get; set; } 13 | public string owner { get; set; } 14 | public string name { get; set; } 15 | public string contractAddress { get; set; } 16 | public string collectionAddress { get; set; } 17 | public bool isPublic { get; set; } 18 | public string baseUri { get; set; } 19 | public string nftFactory { get; set; } 20 | public string collectionTitle { get; set; } 21 | public string description { get; set; } 22 | public string avatar { get; set; } 23 | public string banner { get; set; } 24 | public string thumbnail { get; set; } 25 | public string cid { get; set; } 26 | public string tileUri { get; set; } 27 | public string deployStatus { get; set; } 28 | public bool isCounterFactualNFT { get; set; } 29 | public bool isMintable { get; set; } 30 | public string nftType { get; set; } 31 | public long createdAt { get; set; } 32 | public long updatedAt { get; set; } 33 | 34 | } 35 | public class Collections 36 | { 37 | public Collection collection { get; set; } 38 | 39 | } 40 | public class CollectionResult 41 | { 42 | public IList collections { get; set; } 43 | public int totalNum { get; set; } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Maize/Models/Responses/TokensResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models.Responses 8 | { 9 | // Root myDeserializedClass = JsonConvert.DeserializeObject>(myJsonResponse); 10 | public class GasAmounts 11 | { 12 | public string distribution { get; set; } 13 | public string deposit { get; set; } 14 | } 15 | 16 | public class LuckyTokenAmounts 17 | { 18 | public string minimum { get; set; } 19 | public string maximum { get; set; } 20 | public string dust { get; set; } 21 | } 22 | 23 | public class OrderAmounts 24 | { 25 | public string minimum { get; set; } 26 | public string maximum { get; set; } 27 | public string dust { get; set; } 28 | } 29 | 30 | public class TokensResponse 31 | { 32 | public string type { get; set; } 33 | public int tokenId { get; set; } 34 | public string symbol { get; set; } 35 | public string name { get; set; } 36 | public string address { get; set; } 37 | public int decimals { get; set; } 38 | public int precision { get; set; } 39 | public int precisionForOrder { get; set; } 40 | public OrderAmounts orderAmounts { get; set; } 41 | public LuckyTokenAmounts luckyTokenAmounts { get; set; } 42 | public string fastWithdrawLimit { get; set; } 43 | public GasAmounts gasAmounts { get; set; } 44 | public bool enabled { get; set; } 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Maize/Models/NftMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Newtonsoft.Json; 5 | 6 | namespace Maize.Models 7 | { 8 | public class NftMetadata 9 | { 10 | public string? description { get; set; } 11 | public string? image { get; set; } 12 | public string? name { get; set; } 13 | public int royalty_percentage { get; set; } 14 | public string? animation_url { get; set; } 15 | public string? contentType { get; set; } 16 | 17 | //found with GME minted NFTs 18 | public string? collection_metadata { get; set; } 19 | 20 | public List? attributes { get; set; } 21 | 22 | [JsonIgnore] //we read this manually to be fail-safe 23 | public Dictionary? properties { get; set; } 24 | 25 | public string? JSONContent { get; set; } 26 | public string? Error { get; set; } 27 | public string? URL { get; set; } 28 | public string? GatewayURL { get; set; } 29 | } 30 | 31 | public class NftAttribute 32 | { 33 | public string? trait_type { get; set; } 34 | public object? value { get; set; } //value can be either string or int 35 | } 36 | 37 | public class NftCollectionMetadata 38 | { 39 | public string? name { get; set; } 40 | public string? description { get; set; } 41 | 42 | public string? thumbnail_uri { get; set; } 43 | public string? banner_uri { get; set; } 44 | public string? avatar_uri { get; set; } 45 | public string? tile_uri { get; set; } 46 | 47 | public string? JSONContent { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Models/RedPacketNft.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LoopMintSharp.Models 8 | { 9 | public class LuckyToken 10 | { 11 | public string exchange { get; set; } 12 | public string payerAddr { get; set; } 13 | public int payerId { get; set; } 14 | public string payeeAddr { get; set; } 15 | public int storageId { get; set; } 16 | public int token { get; set; } 17 | public string amount { get; set; } 18 | public int feeToken { get; set; } 19 | public string maxFeeAmount { get; set; } 20 | public long validUntil { get; set; } 21 | public int payeeId { get; set; } 22 | public string memo { get; set; } 23 | public string eddsaSig { get; set; } 24 | } 25 | 26 | public class RedPacketNft 27 | { 28 | public string ecdsaSignature { get; set; } 29 | public string? giftNumbers { get; set; } 30 | public LuckyToken luckyToken { get; set; } 31 | public string memo { get; set; } 32 | public string nftData { get; set; } 33 | public string numbers { get; set; } 34 | public bool signerFlag { get; set; } 35 | public int templateId { get; set; } 36 | public Type type { get; set; } 37 | public long validSince { get; set; } 38 | public long validUntil { get; set; } 39 | 40 | 41 | } 42 | 43 | public class Type 44 | { 45 | public int partition { get; set; } 46 | public int mode { get; set; } 47 | public int scope { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /MaizeUI/Views/ScriptingAirdropInputFileWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /MaizeUI/Views/ScriptingCryptoAirdropInputFileWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /MaizeUI/Views/AppsettingsNoticeWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | using Avalonia.Interactivity; 4 | using MaizeUI.ViewModels; 5 | using System.Threading.Tasks; 6 | using System.Collections.Generic; 7 | using MaizeUI.Helpers; 8 | 9 | namespace MaizeUI.Views 10 | { 11 | public partial class AppsettingsNoticeWindow : Window 12 | { 13 | public AppsettingsNoticeWindow() 14 | { 15 | InitializeComponent(); 16 | } 17 | public void OnHelpButtonClicked(object sender, RoutedEventArgs args) 18 | { 19 | Maize.Helpers.Things.OpenUrl("https://maizehelps.art/docs/tutorials/setup-maize"); 20 | } 21 | public async void BrowseButton_Click(object sender, RoutedEventArgs e) 22 | { 23 | string filePath = await OpenImageFileDialog(); 24 | if (!string.IsNullOrWhiteSpace(filePath)) 25 | { 26 | ((AppsettingsNoticeWindowViewModel)DataContext).ImagePath = filePath; // Assuming your ViewModel is set as DataContext 27 | } 28 | } 29 | 30 | public async Task OpenImageFileDialog() 31 | { 32 | var dialog = new OpenFileDialog 33 | { 34 | Title = "Select an image file", 35 | Filters = new List 36 | { 37 | new FileDialogFilter { Name = "Image Files", Extensions = new List { "png", "jpg", "jpeg", "bmp" } }, 38 | }, 39 | }; 40 | var result = await dialog.ShowAsync(this); 41 | 42 | if (result != null && result.Length > 0) 43 | { 44 | return result[0]; 45 | } 46 | else 47 | { 48 | return null; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ContributionGuide.md: -------------------------------------------------------------------------------- 1 | # Maize Contribution Guide 2 | 3 | **Table of contents:** 4 | 5 | - [Make a contribution](#make-a-contribution) 6 | - [Claim a Maize Contributor NFT](#claim-a-maize-contributor-nft) 7 | - [Documentation standards](#documentation-standards) 8 | 9 | # Make a contribution 10 | 11 | Here are some ways you can contribute: 12 | 13 | - Open a new issue [here](https://github.com/cobmin/Maize/issues) (please check the issue does not already exist). 14 | - Work on an existing issue [here](https://github.com/cobmin/Maize/issues). 15 | 16 | > Check out the [documentation standards](#documentation-standards) before you start working on a pull request. 17 | 18 | # Claim a Maize Contributor NFT 19 | 20 | A Maize Contributor NFT is rewarded to anyone that merges in a pull request the Maize GitHub repository. 21 | 22 | After your pull request is merged, I will reach out to you to get you your NFT. You only receive a Maize Contributor NFT for the first pull request you merge in a given year. 23 | 24 | # Documentation standards 25 | 26 | Use the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) as a base point of reference for writing style. 27 | 28 | ### Philosophy 29 | 30 | - Create the minimum viable documentation. 31 | - Don't repeat yourself, use links to existing documentation or inherit it. 32 | - Keep documentation close to what it's describing (for example, in the source code). 33 | 34 | ### Document types 35 | 36 | Group documentation under one of the four categories (adopted from [Diátaxis](https://diataxis.fr/)): 37 | 38 | - Concepts 39 | - Guides 40 | - Reference 41 | - Resources 42 | 43 | ### Creating content 44 | 45 | If you are interested in creating content (video, blog post, tweet thread, visuals, etc.), you are absolutely free to do so. If review is needed on these, please reach out to me on the [Maize Discord](https://discord.gg/gKxvUjRpvw). 46 | -------------------------------------------------------------------------------- /Maize/Models/Responses/CommonCollectionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models.Responses 2 | { 3 | public class Cached 4 | { 5 | public string avatar { get; set; } 6 | public string banner { get; set; } 7 | public string tileUri { get; set; } 8 | public string thumbnail { get; set; } 9 | } 10 | public class ExtraCollection 11 | { 12 | public Properties properties { get; set; } 13 | public string mintChannel { get; set; } 14 | } 15 | public class Properties 16 | { 17 | public bool isLegacy { get; set; } 18 | public bool isPublic { get; set; } 19 | public bool isCounterFactualNFT { get; set; } 20 | public bool isMintable { get; set; } 21 | public bool isEditable { get; set; } 22 | public bool isDeletable { get; set; } 23 | } 24 | public class CollectionInformation 25 | { 26 | public int id { get; set; } 27 | public string owner { get; set; } 28 | public string name { get; set; } 29 | public string contractAddress { get; set; } 30 | public string collectionAddress { get; set; } 31 | public string baseUri { get; set; } 32 | public string nftFactory { get; set; } 33 | public string description { get; set; } 34 | public string avatar { get; set; } 35 | public string banner { get; set; } 36 | public string thumbnail { get; set; } 37 | public string tileUri { get; set; } 38 | public Cached cached { get; set; } 39 | public string deployStatus { get; set; } 40 | public string nftType { get; set; } 41 | public Times times { get; set; } 42 | public ExtraCollection extra { get; set; } 43 | } 44 | public class Times 45 | { 46 | public long createdAt { get; set; } 47 | public long updatedAt { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Maize/Models/Responses/UserTransactionsResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Maize.Models 8 | { 9 | public class UserTransactionsBlockIdInfo 10 | { 11 | public int blockId { get; set; } 12 | public int indexInBlock { get; set; } 13 | } 14 | 15 | public class UserTransactionResponse 16 | { 17 | public int totalNum { get; set; } 18 | public List transactions { get; set; } 19 | } 20 | 21 | public class UserTransactionsStorageInfo 22 | { 23 | public int accountId { get; set; } 24 | public int tokenId { get; set; } 25 | public int storageId { get; set; } 26 | } 27 | 28 | public class Transaction 29 | { 30 | public int id { get; set; } 31 | public string txType { get; set; } 32 | public string hash { get; set; } 33 | public string symbol { get; set; } 34 | public string amount { get; set; } 35 | public int receiver { get; set; } 36 | public string txHash { get; set; } 37 | public string feeTokenSymbol { get; set; } 38 | public string feeAmount { get; set; } 39 | public string status { get; set; } 40 | public string progress { get; set; } 41 | public object timestamp { get; set; } 42 | public int blockNum { get; set; } 43 | public object updatedAt { get; set; } 44 | public string receiverAddress { get; set; } 45 | public string senderAddress { get; set; } 46 | public string memo { get; set; } 47 | public int requestId { get; set; } 48 | public WithdrawalInfo withdrawalInfo { get; set; } 49 | public UserTransactionsBlockIdInfo blockIdInfo { get; set; } 50 | public UserTransactionsStorageInfo storageInfo { get; set; } 51 | } 52 | 53 | public class WithdrawalInfo 54 | { 55 | public string recipient { get; set; } 56 | public string fastStatus { get; set; } 57 | public string distributeHash { get; set; } 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /MaizeUI/Views/MetadataUploadToInfuraWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | 37 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Services/ILoopringMintService.cs: -------------------------------------------------------------------------------- 1 | using LoopMintSharp.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LoopMintSharp 9 | { 10 | public interface ILoopringMintService 11 | { 12 | Task GetNextStorageId(string apiKey, int accountId, int sellTokenId); 13 | Task ComputeTokenAddress(string apiKey, CounterFactualNftInfo counterFactualNftInfo); 14 | Task GetOffChainFee(string apiKey, int accountId, int requestType, string tokenAddress); 15 | Task GetOffChainFeeWithAmount(string apiKey, int accountId, int amount, int requestType, string tokenAddress); 16 | Task MintNft( 17 | string apiKey, 18 | string exchange, 19 | int minterId, 20 | string minterAddress, 21 | int toAccountId, 22 | string toAddress, 23 | int nftType, 24 | string tokenAddress, 25 | string nftId, 26 | string amount, 27 | long validUntil, 28 | int royaltyPercentage, 29 | int storageId, 30 | int maxFeeTokenId, 31 | string maxFeeAmount, 32 | bool forceToMint, 33 | CounterFactualNftInfo counterFactualNftInfo, 34 | string eddsaSignature, 35 | string royaltyAddress); 36 | 37 | Task MintRedPacketNft 38 | ( 39 | string apiKey, 40 | string apiSig, 41 | RedPacketNft redPacketNft 42 | ); 43 | 44 | Task GetTokenIdWithCheck(string apiKey, int accountId, string nftData); 45 | 46 | Task CreateNftCollection( 47 | string apiKey, 48 | CreateCollectionRequest createCollectionRequest, 49 | string apiSig); 50 | 51 | Task FindNftCollection( 52 | string apiKey, 53 | int limit, 54 | int offset, 55 | string owner, 56 | string tokenAddress); 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Maize.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32811.315 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maize", "Maize\Maize.csproj", "{0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaizeUI", "MaizeUI\MaizeUI.csproj", "{A374CEEB-3EBC-4702-9B98-91611A79F723}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD} = {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD} 11 | EndProjectSection 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{3E64A957-CB81-4D86-B2A3-4C40C8CF42AD}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {0D82DFD9-21D4-4EAA-BA2E-384EAE4530BD}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {A374CEEB-3EBC-4702-9B98-91611A79F723}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {A374CEEB-3EBC-4702-9B98-91611A79F723}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {A374CEEB-3EBC-4702-9B98-91611A79F723}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {A374CEEB-3EBC-4702-9B98-91611A79F723}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {3E64A957-CB81-4D86-B2A3-4C40C8CF42AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {3E64A957-CB81-4D86-B2A3-4C40C8CF42AD}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {3E64A957-CB81-4D86-B2A3-4C40C8CF42AD}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {3E64A957-CB81-4D86-B2A3-4C40C8CF42AD}.Release|Any CPU.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | GlobalSection(ExtensibilityGlobals) = postSolution 38 | SolutionGuid = {633EF42E-70DB-48CF-BA3B-493BAEA84F90} 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /Maize/Maize.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | LogoClose.ico 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Always 35 | 36 | 37 | Always 38 | 39 | 40 | Always 41 | 42 | 43 | Always 44 | 45 | 46 | Always 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /MaizeUI/Views/AppsettingsNoticeWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindHoldersFromNftDataWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindNftDataFromAWalletWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Helpers/NftMetadataModify.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using System.Text.RegularExpressions; 4 | 5 | public class MetadataModifier 6 | { 7 | public static (int, string, string) UpdateAndFetchRoyalty(string metadataFilePath, string nftCid, string animationCid, string selectedCollectionAddress) 8 | { 9 | // Read the JSON metadata file into a string 10 | string jsonMetadata = File.ReadAllText(metadataFilePath); 11 | 12 | // Deserialize the JSON string to a Metadata object 13 | Metadata metadataObj = JsonConvert.DeserializeObject(jsonMetadata); 14 | 15 | // Replace the placeholders 16 | metadataObj.image = $"ipfs://{nftCid}"; 17 | metadataObj.animation_url = animationCid == null ? $"ipfs://{nftCid}" : $"ipfs://{animationCid}"; 18 | metadataObj.collection_metadata = $"https://nftinfos.loopring.io/{selectedCollectionAddress}"; 19 | 20 | // Extract the royalty percentage and name 21 | int royaltyPercentage = metadataObj.royalty_percentage; 22 | string name = metadataObj.name; 23 | 24 | // Serialize the updated Metadata object back to a JSON string 25 | string updatedJsonMetadata = JsonConvert.SerializeObject(metadataObj, Formatting.Indented); 26 | 27 | // Return the extracted royalty percentage, name, and updatedJsonMetadata 28 | return (royaltyPercentage, name, updatedJsonMetadata); 29 | } 30 | public static string RemoveCollectionMetadataAndMintChannel(string metadataTemplate) 31 | { 32 | try 33 | { 34 | // Parse the JSON string into a JObject 35 | JObject metadataObject = JObject.Parse(metadataTemplate); 36 | 37 | // Remove the "collection_metadata" and "mint_channel" properties 38 | metadataObject.Remove("collection_metadata"); 39 | metadataObject.Remove("mint_channel"); 40 | 41 | // Convert the modified JObject back to a JSON string 42 | string modifiedMetadata = metadataObject.ToString(); 43 | 44 | return modifiedMetadata; 45 | } 46 | catch (JsonReaderException) 47 | { 48 | // Handle JSON parsing errors 49 | return null; 50 | } 51 | } 52 | public class Metadata 53 | { 54 | public string image { get; set; } 55 | public string animation_url { get; set; } 56 | public string name { get; set; } 57 | public int royalty_percentage { get; set; } 58 | public string description { get; set; } 59 | public string collection_metadata { get; set; } 60 | public string mint_channel { get; set; } 61 | public Dictionary properties { get; set; } 62 | public List> attributes { get; set; } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Maize/Models/Responses/NftResponseByCollection.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Maize.Models.Responses 4 | { 5 | public class Base 6 | { 7 | public string name { get; set; } 8 | public int decimals { get; set; } 9 | public string description { get; set; } 10 | public string image { get; set; } 11 | public string properties { get; set; } 12 | public string localization { get; set; } 13 | public object createdAt { get; set; } 14 | public object updatedAt { get; set; } 15 | } 16 | 17 | public class ExtraNft 18 | { 19 | public string imageData { get; set; } 20 | public string externalUrl { get; set; } 21 | public string attributes { get; set; } 22 | public string backgroundColor { get; set; } 23 | public string animationUrl { get; set; } 24 | public string youtubeUrl { get; set; } 25 | public string minter { get; set; } 26 | } 27 | 28 | public class ImageSize 29 | { 30 | [JsonProperty("240-240")] 31 | public string _240240 { get; set; } 32 | 33 | [JsonProperty("332-332")] 34 | public string _332332 { get; set; } 35 | public string original { get; set; } 36 | } 37 | 38 | public class Metadata 39 | { 40 | public string uri { get; set; } 41 | [JsonProperty("base")] 42 | public Base basename { get; set; } 43 | public ImageSize imageSize { get; set; } 44 | public ExtraNft extra { get; set; } 45 | public int status { get; set; } 46 | public int nftType { get; set; } 47 | public int network { get; set; } 48 | public string tokenAddress { get; set; } 49 | public string nftId { get; set; } 50 | } 51 | 52 | public class NftTokenInfo 53 | { 54 | public string nftData { get; set; } 55 | public string minter { get; set; } 56 | public string nftType { get; set; } 57 | public string tokenAddress { get; set; } 58 | public string nftId { get; set; } 59 | public int creatorFeeBips { get; set; } 60 | public int royaltyPercentage { get; set; } 61 | public int originalRoyaltyPercentage { get; set; } 62 | public bool status { get; set; } 63 | public string nftFactory { get; set; } 64 | public string nftOwner { get; set; } 65 | public string nftBaseUri { get; set; } 66 | public string royaltyAddress { get; set; } 67 | public string originalMinter { get; set; } 68 | public object createdAt { get; set; } 69 | public Metadata metadata { get; set; } 70 | public int total { get; set; } 71 | } 72 | 73 | public class NftResponseFromCollection 74 | { 75 | public int totalNum { get; set; } 76 | public List nftTokenInfos { get; set; } 77 | } 78 | 79 | 80 | 81 | 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /MaizeUI/Things/Minting/Helpers/TokenAmountConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LoopMintSharp 9 | { 10 | public static class TokenAmountConverter 11 | { 12 | //maybe some day use clients Culture? for now invariant 13 | public static CultureInfo Culture = CultureInfo.InvariantCulture; 14 | 15 | public static decimal ToDecimal(double? balance, int? decimals, decimal conversionRate = 1) 16 | { 17 | if (balance == null) return 0; 18 | return (decimal)(((decimals ?? 0) > 0) ? balance / Math.Pow(10, (double)decimals!) : balance) * conversionRate; 19 | } 20 | 21 | public static string ToString(double? balance, int? decimals, decimal conversionRate = 1) 22 | { 23 | if (balance == null) return ""; 24 | 25 | decimal floatBalance = ToDecimal(balance, decimals, conversionRate); 26 | string format = ""; 27 | if (decimals != null) 28 | { 29 | //reduce digits, the larger balance is, i.e. exponent (never reduce digits, if sub zero) 30 | int formatDecimals = Math.Max(decimals.Value - Math.Max((int)Math.Log10(Math.Abs((double)floatBalance)), 0), 0); 31 | format = $"#,###0.{new string('#', formatDecimals)}"; 32 | } 33 | return floatBalance.ToString(format, Culture); 34 | } 35 | 36 | public static decimal ToDecimalWithExponent(decimal amount, out string exponentPrefix) 37 | { 38 | exponentPrefix = ""; 39 | if (amount == 0) return amount; 40 | 41 | //get the exponent - sign doesn't matter, i.e. 6 for 1,000,000 aka 1E6 42 | var exponent = Math.Log10((double)Math.Abs(amount)); 43 | 44 | //we since we're only interested in k, M and B, keep it simple 45 | if (exponent >= 9) 46 | { 47 | exponentPrefix = "B"; 48 | return amount / (decimal)1E9; 49 | } 50 | else if (exponent >= 6) 51 | { 52 | exponentPrefix = "M"; 53 | return amount / (decimal)1E6; 54 | } 55 | else if (exponent >= 3) 56 | { 57 | exponentPrefix = "k"; 58 | return amount / (decimal)1E3; 59 | } 60 | else 61 | return amount; 62 | } 63 | 64 | public static string ToStringWithExponent(double num, int decimals, decimal conversionRate, string format = "N3") 65 | { 66 | string expPrefix = ""; 67 | decimal amount = ToDecimalWithExponent(ToDecimal(num, decimals, conversionRate), out expPrefix); 68 | return amount.ToString(format, Culture) + expPrefix; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Maize/Models/ApplicationSpecific/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Maize.Models.ApplicationSpecific 2 | { 3 | public class Constants 4 | { 5 | public const int NftType = 0; 6 | public const string MaxFeeToken = "LRC"; 7 | public const string AccessLogo = "0x08dccae9dac82c69e6836977c932bb55e608d548d19e95addee8817f7edb5f8d"; 8 | public const string AccessPremiumContent = "0x22829c359ca1f7b1e9bbb2d95992e33bc92394f8f22254d340daa2769c0a2494"; 9 | public const string MaizeLdsLogo = "0x2fa975f47dc5929980a8bc01ad5173302a9f6f246ae219ac7a0a4592547cdf87"; 10 | public static string BaseDirectory = (AppDomain.CurrentDomain.BaseDirectory).Replace("\\", "/"); 11 | public const string InputFolder = "Input/"; 12 | public const string OutputFolder = "Output/"; 13 | public const string EnvironmentPath = "Input/Environment/"; 14 | public const string InputFile = "Input.txt"; 15 | public const string BanishFile = "Banish.txt"; 16 | public const decimal LcrTransactionFee = 0.002m; 17 | public static Environment GetNetworkConfig(int variable) 18 | { 19 | if (variable == 1) 20 | { 21 | return new Environment 22 | { 23 | Url = "https://api3.loopring.io/", 24 | Exchange = "0x0BABA1Ad5bE3a5C0a66E7ac838a129Bf948f1eA4", 25 | NftFactory = "0xc852aC7aAe4b0f0a0Deb9e8A391ebA2047d80026", 26 | NftFactoryCollection = "0x97BE94250AEF1Df307749aFAeD27f9bc8aB911db", 27 | MyAccountId = 79142, 28 | MyAccountAddress = "0x37EA02537f3A7A7fFC221125245905Be3D5423e6", 29 | ChainId = variable, 30 | }; 31 | } 32 | else if (variable == 5) 33 | { 34 | return new Environment 35 | { 36 | Url = "https://uat2.loopring.io/", 37 | Exchange = "0x12b7cccF30ba360e5041C6Ce239C9a188B709b2B", 38 | NftFactory = "0x0ad87482a1bfd0B3036Bb4b13708C88ACAe1b8bA", 39 | NftFactoryCollection = "0x0ad87482a1bfd0B3036Bb4b13708C88ACAe1b8bA", 40 | MyAccountId = 15504, 41 | MyAccountAddress = "0x37EA02537f3A7A7fFC221125245905Be3D5423e6", 42 | ChainId = variable, 43 | }; 44 | } 45 | else 46 | { 47 | throw new ArgumentException("Invalid variable value."); 48 | } 49 | } 50 | public class Environment 51 | { 52 | public string? Url { get; set; } 53 | public string? Exchange { get; set; } 54 | public string? NftFactory { get; set; } 55 | public string? NftFactoryCollection { get; set; } 56 | public int MyAccountId { get; set; } 57 | public string? MyAccountAddress { get; set; } 58 | public int ChainId { get; set; } 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /MaizeUI/Views/FindNftDataFromACollectionWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropMigrateWalletWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 36 | 39 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropCryptoToUsersWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 34 | 37 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MaizeUI/Views/AirdropNftsToUsersWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 34 | 37 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MaizeUI/Things/ImageModifier/OpenAi.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using RestSharp; 3 | using System.Text; 4 | 5 | namespace MaizeUI.Things 6 | { 7 | public class OpenAi 8 | { 9 | readonly RestClient _client; 10 | public OpenAi() 11 | { 12 | _client = new RestClient("https://api.openai.com/v1/chat/completions"); 13 | } 14 | 15 | private const string OpenAiApiKey = "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"; 16 | public async Task QueryOpenAi(string prompt) 17 | { 18 | var request = new RestRequest(); 19 | 20 | request.AddHeader("Content-Type", "application/json"); 21 | request.AddHeader("Authorization", $"Bearer {OpenAiApiKey}"); 22 | var payload = new 23 | { 24 | model = "gpt-3.5-turbo", 25 | messages = new[] 26 | { 27 | new 28 | { 29 | role = "user", 30 | content = prompt 31 | } 32 | }, 33 | temperature = 0.7 34 | }; 35 | request.AddJsonBody(payload); 36 | try 37 | { 38 | var response = await _client.GetAsync(request); 39 | var data = JsonConvert.DeserializeObject(response.Content!); 40 | return data; 41 | } 42 | catch (HttpRequestException httpException) 43 | { 44 | Console.WriteLine(httpException.Message); 45 | return null; 46 | } 47 | } 48 | 49 | public class Choice 50 | { 51 | public int index { get; set; } 52 | public Message message { get; set; } 53 | public string finish_reason { get; set; } 54 | } 55 | 56 | public class Message 57 | { 58 | public string role { get; set; } 59 | public string content { get; set; } 60 | } 61 | 62 | public class OpenAiResponse 63 | { 64 | public string id { get; set; } 65 | public string @object { get; set; } 66 | public int created { get; set; } 67 | public string model { get; set; } 68 | public List choices { get; set; } 69 | public Usage usage { get; set; } 70 | } 71 | 72 | public class Usage 73 | { 74 | public int prompt_tokens { get; set; } 75 | public int completion_tokens { get; set; } 76 | public int total_tokens { get; set; } 77 | } 78 | public static string GenerateNamePrompt(Dictionary attributes) 79 | { 80 | StringBuilder prompt = new StringBuilder("Given the following attributes, what would be a fitting name for a character?\n"); 81 | 82 | foreach (var entry in attributes) 83 | { 84 | prompt.AppendLine($"{entry.Key}: {entry.Value}"); 85 | } 86 | 87 | return prompt.ToString(); 88 | } 89 | public static string GenerateDescriptionPrompt(Dictionary attributes) 90 | { 91 | StringBuilder prompt = new StringBuilder("Describe a character with the following attributes:\n"); 92 | 93 | foreach (var entry in attributes) 94 | { 95 | prompt.AppendLine($"{entry.Key}: {entry.Value}"); 96 | } 97 | 98 | return prompt.ToString(); 99 | } 100 | 101 | 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /MaizeUI/Views/GenerateOneOfOnesWindow.axaml: -------------------------------------------------------------------------------- 1 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /MaizeUI/Views/MetadataRefreshCollectionWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Maize/Services/InfuraClient.cs: -------------------------------------------------------------------------------- 1 | using RestSharp; 2 | using RestSharp.Authenticators; 3 | using Newtonsoft.Json; 4 | using System.Text; 5 | using Nethereum.Web3; 6 | using System.Net.NetworkInformation; 7 | using System; 8 | using System.Buffers; 9 | 10 | namespace Maize.Services 11 | { 12 | public class InfuraClient : IInfuraClient, IDisposable 13 | { 14 | private readonly RestClient _client; 15 | private readonly string _baseUrl; 16 | private readonly string _apiKey; 17 | private readonly string _apiKeySecret; 18 | 19 | public InfuraClient(string apiKey, string apiKeySecret, string url) 20 | { 21 | var options = new RestClientOptions(url) 22 | { 23 | Authenticator = new HttpBasicAuthenticator(apiKey, apiKeySecret) 24 | }; 25 | _client = new RestClient(options); 26 | _baseUrl = url; 27 | _apiKey = apiKey; 28 | _apiKeySecret = apiKeySecret; 29 | } 30 | public async Task FileAdd(string filePath) 31 | { 32 | //string directoryPath = Path.GetDirectoryName(filePath).Replace("\\", "/"); 33 | //string fileName = Path.GetFileName(filePath); 34 | try 35 | { 36 | var request = new RestRequest($"/api/v0/add"); 37 | request.AddFile("file", filePath); 38 | request.AddQueryParameter("quite", "true"); 39 | 40 | var response = await _client.ExecutePostAsync(request); 41 | if (response.Content == "basic auth failure: invalid project id or project secret\n") 42 | { 43 | var error = new FileAddResponse 44 | { 45 | Hash = response.Content 46 | }; 47 | return error; 48 | } 49 | var data = JsonConvert.DeserializeObject(response.Content!); 50 | 51 | return data; 52 | } 53 | catch (Exception e) 54 | { 55 | return null; 56 | } 57 | } 58 | public async Task PinAdd() 59 | { 60 | try 61 | { 62 | var request = new RestRequest($"/api/v0/pin/add"); 63 | request.AddQueryParameter("arg", "QmPbNQ2QPsqSGuLQ4W3iPddDHhPNdGfjmT4xi83afdKgcq"); 64 | request.AddQueryParameter("recursive", "true"); 65 | request.AddQueryParameter("progress", "true"); 66 | 67 | var response = await _client.ExecutePostAsync(request); 68 | var jsonObjects = response.Content.Split('\n'); 69 | 70 | var progressObj = JsonConvert.DeserializeObject(jsonObjects[0]); 71 | var pinsObj = JsonConvert.DeserializeObject(jsonObjects[1]); 72 | 73 | var pinAddResponse = new PinAddResponse 74 | { 75 | Progress = progressObj.Progress, 76 | Pins = pinsObj.Pins 77 | }; 78 | 79 | return pinAddResponse; 80 | } 81 | catch (Exception e) 82 | { 83 | return null; 84 | } 85 | } 86 | public async Task PinView() 87 | { 88 | try 89 | { 90 | var request = new RestRequest($"/api/v0/pin/ls"); 91 | request.AddQueryParameter("arg", "QmPbNQ2QPsqSGuLQ4W3iPddDHhPNdGfjmT4xi83afdKgcq"); 92 | request.AddQueryParameter("type ", "all"); 93 | request.AddQueryParameter("quiet", "true"); 94 | request.AddQueryParameter("stream", "false"); 95 | 96 | var response = await _client.ExecutePostAsync(request); 97 | var jsonObjects = response.Content.Split('\n'); 98 | 99 | var progressObj = JsonConvert.DeserializeObject(jsonObjects[0]); 100 | var pinsObj = JsonConvert.DeserializeObject(jsonObjects[1]); 101 | 102 | var pinAddResponse = new PinAddResponse 103 | { 104 | Progress = progressObj.Progress, 105 | Pins = pinsObj.Pins 106 | }; 107 | 108 | return pinAddResponse; 109 | } 110 | catch (Exception e) 111 | { 112 | return null; 113 | } 114 | } 115 | 116 | 117 | public void Dispose() 118 | { 119 | _client?.Dispose(); 120 | GC.SuppressFinalize(this); 121 | } 122 | } 123 | } -------------------------------------------------------------------------------- /MaizeUI/Views/LooperLandsGenerateOneOfOnesWindow.axaml: -------------------------------------------------------------------------------- 1 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /MaizeUI/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Maize/Models/NftBalance.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Maize 9 | { 10 | public class Pending 11 | { 12 | public string withdraw { get; set; } 13 | public string deposit { get; set; } 14 | } 15 | 16 | public class NftBalance 17 | { 18 | public int totalNum { get; set; } 19 | public List data { get; set; } 20 | } 21 | 22 | public class CoinBalance 23 | { 24 | public int accountId { get; set; } 25 | public int tokenId { get; set; } 26 | public string total { get; set; } 27 | public string locked { get; set; } 28 | public Pending pending { get; set; } 29 | } 30 | public class NftBase 31 | { 32 | public string name { get; set; } 33 | public int decimals { get; set; } 34 | public string description { get; set; } 35 | public string image { get; set; } 36 | public string properties { get; set; } 37 | public string localization { get; set; } 38 | public object createdAt { get; set; } 39 | public object updatedAt { get; set; } 40 | } 41 | 42 | public class Cached 43 | { 44 | public string avatar { get; set; } 45 | public string banner { get; set; } 46 | public string tileUri { get; set; } 47 | public string thumbnail { get; set; } 48 | } 49 | 50 | public class CollectionInfo 51 | { 52 | public int id { get; set; } 53 | public string owner { get; set; } 54 | public string name { get; set; } 55 | public string contractAddress { get; set; } 56 | public string collectionAddress { get; set; } 57 | public string baseUri { get; set; } 58 | public string nftFactory { get; set; } 59 | public string description { get; set; } 60 | public string avatar { get; set; } 61 | public string banner { get; set; } 62 | public string thumbnail { get; set; } 63 | public string tileUri { get; set; } 64 | public Cached cached { get; set; } 65 | public string deployStatus { get; set; } 66 | public string nftType { get; set; } 67 | public Times times { get; set; } 68 | public Extra extra { get; set; } 69 | } 70 | 71 | public class Datum 72 | { 73 | public int id { get; set; } 74 | public int accountId { get; set; } 75 | public int tokenId { get; set; } 76 | public string nftData { get; set; } 77 | public string tokenAddress { get; set; } 78 | public string nftId { get; set; } 79 | public string nftType { get; set; } 80 | public string total { get; set; } 81 | public string locked { get; set; } 82 | public Pending pending { get; set; } 83 | public string deploymentStatus { get; set; } 84 | public bool isCounterFactualNFT { get; set; } 85 | public Metadata? metadata { get; set; } 86 | public string? minter { get; set; } 87 | public int? royaltyPercentage { get; set; } 88 | public Preference? preference { get; set; } 89 | public CollectionInfo? collectionInfo { get; set; } 90 | } 91 | 92 | public class Extra 93 | { 94 | public string imageData { get; set; } 95 | public string externalUrl { get; set; } 96 | public string attributes { get; set; } 97 | public string backgroundColor { get; set; } 98 | public string animationUrl { get; set; } 99 | public string youtubeUrl { get; set; } 100 | public string minter { get; set; } 101 | public Properties properties { get; set; } 102 | public string mintChannel { get; set; } 103 | } 104 | 105 | public class ImageSize 106 | { 107 | [JsonProperty("240-240")] 108 | public string _240240 { get; set; } 109 | 110 | [JsonProperty("332-332")] 111 | public string _332332 { get; set; } 112 | public string original { get; set; } 113 | } 114 | 115 | public class Metadata 116 | { 117 | public string uri { get; set; } 118 | [JsonProperty("base")] 119 | public NftBase nftBase { get; set; } 120 | public ImageSize imageSize { get; set; } 121 | public Extra extra { get; set; } 122 | public int status { get; set; } 123 | public int nftType { get; set; } 124 | public int network { get; set; } 125 | public string tokenAddress { get; set; } 126 | public string nftId { get; set; } 127 | } 128 | 129 | public class Preference 130 | { 131 | public bool favourite { get; set; } 132 | public bool hide { get; set; } 133 | } 134 | 135 | public class Properties 136 | { 137 | public bool isLegacy { get; set; } 138 | public bool isPublic { get; set; } 139 | public bool isCounterFactualNFT { get; set; } 140 | public bool isMintable { get; set; } 141 | public bool isEditable { get; set; } 142 | public bool isDeletable { get; set; } 143 | } 144 | 145 | public class Times 146 | { 147 | public object createdAt { get; set; } 148 | public object updatedAt { get; set; } 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /MaizeUI/MaizeUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | net6.0 5 | enable 6 | 7 | copyused 8 | true 9 | Assets\LogoClose.ico 10 | True 11 | False 12 | 13 | $(MSBuildProjectName) 14 | $(MSBuildProjectName.Replace(" ", "_")) 15 | enable 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | MSBuild:Compile 53 | 54 | 55 | 56 | 57 | ExpressAirdropNftsWindow.axaml 58 | 59 | 60 | AirdropCryptoToUsersWindow.axaml 61 | 62 | 63 | AirdropMigrateWalletWindow.axaml 64 | 65 | 66 | AirdropNftsToUsersWindow.axaml 67 | 68 | 69 | MintWindow.axaml 70 | 71 | 72 | GenerateOneOfOnesWindow.axaml 73 | 74 | 75 | LooperLandsGenerateOneOfOnesWindow.axaml 76 | 77 | 78 | MetadataUploadToInfuraWindow.axaml 79 | 80 | 81 | MetadataRefreshCollectionWindow.axaml 82 | 83 | 84 | FindNftDataFromACollectionWindow.axaml 85 | 86 | 87 | FindHoldersFromNftDataWindow.axaml 88 | 89 | 90 | ScriptingCryptoAirdropInputFileWindow.axaml 91 | 92 | 93 | ScriptingAirdropInputFileWindow.axaml 94 | 95 | 96 | FindNftDataFromAWalletWindow.axaml 97 | 98 | 99 | 100 | 101 | Always 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /MaizeUI/ViewModels/FindNftDataFromAWalletWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using Maize; 2 | using Maize.Services; 3 | using Maize.Helpers; 4 | using ReactiveUI; 5 | using System.Diagnostics; 6 | using System.Reactive; 7 | using Nethereum.Model; 8 | 9 | namespace MaizeUI.ViewModels 10 | { 11 | public class FindNftDataFromAWalletWindowViewModel : ViewModelBase 12 | { 13 | public string HelpButtonText { get; set; } = "Help"; 14 | public string FindButtonText { get; set; } = "Find"; 15 | public string MeButtonText { get; set; } = "Me"; 16 | public string TitleText { get; set; } = "NFT Info From a Wallet"; 17 | public string MainContent { get; set; } = "Here you will find relevant information about the NFTs in a wallet."; 18 | public string WatermarkOne { get; set; } = "wallet address..."; 19 | public string ToolTipOne { get; set; } = "0x address or ens"; 20 | 21 | public string walletAddress; 22 | 23 | public string WalletAddress 24 | { 25 | get => walletAddress; 26 | set => this.RaiseAndSetIfChanged(ref walletAddress, value); 27 | } 28 | 29 | public bool isEnabled = true; 30 | 31 | public bool IsEnabled 32 | { 33 | get => isEnabled; 34 | set => this.RaiseAndSetIfChanged(ref isEnabled, value); 35 | } 36 | 37 | public string log; 38 | 39 | public string Log 40 | { 41 | get => log; 42 | set => this.RaiseAndSetIfChanged(ref log, value); 43 | } 44 | 45 | public LoopringServiceUI loopringService; 46 | 47 | public LoopringServiceUI LoopringService 48 | { 49 | get => loopringService; 50 | set => this.RaiseAndSetIfChanged(ref loopringService, value); 51 | } 52 | 53 | public Settings settings; 54 | 55 | public Settings Settings 56 | { 57 | get => settings; 58 | set => this.RaiseAndSetIfChanged(ref settings, value); 59 | } 60 | 61 | public ReactiveCommand FindNftDataFromAWalletCommand { get; } 62 | public ReactiveCommand FindMyNftDataFromAWalletCommand { get; } 63 | 64 | public FindNftDataFromAWalletWindowViewModel() 65 | { 66 | FindNftDataFromAWalletCommand = ReactiveCommand.CreateFromTask(() => RetrieveNFTs(WalletAddress)); 67 | FindMyNftDataFromAWalletCommand = ReactiveCommand.CreateFromTask(() => RetrieveNFTs(settings.LoopringAddress, true)); 68 | } 69 | private async Task RetrieveNFTs(string address, bool isMyData = false) 70 | { 71 | Log = "Retrieving NFTs, please give me a moment..."; 72 | IsEnabled = false; 73 | var sw = Stopwatch.StartNew(); 74 | 75 | string checkedAddress = await loopringService.CheckForEthAddress(loopringService, settings.LoopringApiKey, address); 76 | AccountInformationResponse accountInformation = await loopringService.GetUserAccountInformationFromOwner(checkedAddress); 77 | 78 | if (accountInformation == null) 79 | { 80 | Log = "Invalid address/ENS! Try Again..."; 81 | sw.Stop(); 82 | IsEnabled = true; 83 | return; 84 | } 85 | 86 | var allNfts = await GetAllNfts(accountInformation.accountId); 87 | var fileName = WriteNftInfoToCsv(allNfts); 88 | 89 | sw.Stop(); 90 | UpdateLog(sw.ElapsedMilliseconds, allNfts.Count, fileName, isMyData); 91 | 92 | IsEnabled = true; 93 | } 94 | 95 | private async Task> GetAllNfts(int accountId) 96 | { 97 | List> allNfts = new List>(); 98 | int offset = 0; 99 | 100 | while (true) 101 | { 102 | var nfts = await loopringService.GetWalletsNftsOffset(settings.LoopringApiKey, accountId, offset); 103 | if (nfts.Item1.Count > 0) 104 | { 105 | allNfts.Add(nfts.Item1); 106 | Log = $"Gathering NFTs {allNfts.SelectMany(x => x).Count()}/{nfts.Item2}"; 107 | offset += 50; 108 | } 109 | else 110 | { 111 | break; 112 | } 113 | } 114 | 115 | return allNfts.SelectMany(d => d).ToList(); 116 | } 117 | 118 | private string WriteNftInfoToCsv(List allNfts) 119 | { 120 | var walletsNftsBasicInformation = allNfts.Select(m => new { m.metadata.nftBase.name, m.total, m.nftData, m.nftId, m.minter, m.tokenAddress }).ToList(); 121 | return ApplicationUtilitiesUI.WriteDataToCsvFile("NftDataFromWallet", walletsNftsBasicInformation); 122 | } 123 | 124 | private void UpdateLog(long elapsedMs, int nftCount, string fileName, bool isMyData) 125 | { 126 | var swTime = $"This took {(elapsedMs > (1 * 60 * 1000) ? Math.Round(Convert.ToDecimal(elapsedMs) / 1000m / 60, 3) : Convert.ToDecimal(elapsedMs) / 1000m)} {(elapsedMs > (1 * 60 * 1000) ? "minutes" : "seconds")} to complete."; 127 | Log = $"{swTime}\r\n\r\n{(isMyData ? "You have" : $"{WalletAddress} has")} {nftCount} NFTs.\r\n\r\nYour file is here:\r\n{fileName}"; 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /MaizeUI/Helpers/Calculations.cs: -------------------------------------------------------------------------------- 1 | using Maize; 2 | using Maize.Models; 3 | using Maize.Models.ApplicationSpecific; 4 | using Nethereum.Model; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace MaizeUI.Helpers 12 | { 13 | public class Calculations 14 | { 15 | public static async Task CurrentTokenPriceInUsd(ILoopringService LoopringService, string maizeFee) 16 | { 17 | var varHexAddress = await LoopringService.GetTokens(); 18 | var currentFeePrice = (await LoopringService.GetTokenPrice()).data.Where(x => x.token == varHexAddress.FirstOrDefault(x => x.symbol == maizeFee).address).FirstOrDefault().price; 19 | 20 | return decimal.Parse(currentFeePrice); 21 | } 22 | public static async Task CalculateMaizeFee(ILoopringService LoopringService, decimal totalTransactions, string MaizeFeeSelectedOption) 23 | { 24 | return Math.Round((await CurrentTokenPriceToOneUsd(LoopringService, MaizeFeeSelectedOption)) * (totalTransactions * Constants.LcrTransactionFee), 14); 25 | } 26 | public static async Task CurrentTokenPriceToOneUsd(ILoopringService LoopringService, string maizeFee) 27 | { 28 | var varHexAddress = await LoopringService.GetTokens(); 29 | var currentFeePrice = (await LoopringService.GetTokenPrice()).data.Where(x => x.token == varHexAddress.FirstOrDefault(x => x.symbol == maizeFee).address).FirstOrDefault().price; 30 | var convertToOneUsd = 1 / decimal.Parse(currentFeePrice); 31 | 32 | return convertToOneUsd; 33 | } 34 | public static async Task<(bool, decimal userEth, decimal userLrc, decimal userPepe)> CanUserAfford(ILoopringService LoopringService, Settings settings, 35 | string MaizeFeeSelectedOption, string LoopringFeeSelectedOption, decimal maizeFee, decimal loopringFee) 36 | { 37 | 38 | var userAssets = await LoopringService.GetUserAssetsForFees(settings.LoopringApiKey, settings.LoopringAccountId); 39 | var eth = userAssets.FirstOrDefault(asset => asset.tokenId == 0); 40 | var lrc = userAssets.FirstOrDefault(asset => asset.tokenId == 1); 41 | var pepe = userAssets.FirstOrDefault(asset => asset.tokenId == 272); 42 | decimal userLrc = 0; 43 | decimal userEth = 0; 44 | decimal userPepe = 0; 45 | if (lrc != null) 46 | userLrc = decimal.Parse(lrc.total) / 1000000000000000000; 47 | if (eth != null) 48 | userEth = decimal.Parse(eth.total) / 1000000000000000000; 49 | if (pepe != null) 50 | userPepe = decimal.Parse(pepe.total) / 1000000000000000000; 51 | 52 | var canAfford = true; 53 | switch (MaizeFeeSelectedOption) 54 | { 55 | case "ETH": 56 | if (LoopringFeeSelectedOption == "ETH") 57 | { 58 | if (userEth < (loopringFee + maizeFee)) 59 | { 60 | canAfford = false; 61 | return (canAfford, userEth, userLrc, userPepe); 62 | } 63 | } 64 | else 65 | { 66 | if ((userEth < maizeFee) || loopringFee > userLrc) 67 | { 68 | canAfford = false; 69 | return (canAfford, userEth, userLrc, userPepe); 70 | } 71 | } 72 | break; 73 | 74 | case "LRC": 75 | if (LoopringFeeSelectedOption == "LRC") 76 | { 77 | if (userLrc < (loopringFee + maizeFee)) 78 | { 79 | canAfford = false; 80 | return (canAfford, userEth, userLrc, userPepe); 81 | } 82 | } 83 | else 84 | { 85 | if (userLrc < maizeFee || loopringFee > userEth) 86 | { 87 | canAfford = false; 88 | return (canAfford, userEth, userLrc, userPepe); 89 | } 90 | } 91 | break; 92 | 93 | case "PEPE": 94 | if (LoopringFeeSelectedOption == "ETH") 95 | { 96 | if (userPepe < maizeFee || loopringFee > userEth) 97 | { 98 | canAfford = false; 99 | return (canAfford, userEth, userLrc, userPepe); 100 | } 101 | } 102 | else 103 | { 104 | if (userPepe < maizeFee || loopringFee > userLrc) 105 | { 106 | canAfford = false; 107 | return (canAfford, userEth, userLrc, userPepe); 108 | } 109 | } 110 | break; 111 | 112 | 113 | } 114 | return (canAfford, userEth, userLrc, userPepe); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /MaizeUI/Things/ImageModifier/Helpers.cs: -------------------------------------------------------------------------------- 1 | using SixLabors.ImageSharp.Processing.Processors.Transforms; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | using System.Text.RegularExpressions; 5 | 6 | namespace MaizeUI.Things 7 | { 8 | public class Helpers 9 | { 10 | private static readonly Random rng = new Random(); 11 | private const int RandomChanceThreshold = 32; 12 | private const string ImageExtension = "*.png"; 13 | 14 | public static void ResizeImage(string filePath) 15 | { 16 | using (Image image = Image.Load(filePath)) 17 | { 18 | image.Mutate(x => x.Resize(new ResizeOptions 19 | { 20 | Size = new Size(600, 600), 21 | Sampler = new NearestNeighborResampler() 22 | })); 23 | image.Save(filePath); 24 | } 25 | } 26 | public static void SaveResizedSprite(Image original, int multiplier, string outputFileName, string baseDirectory) 27 | { 28 | var newWidth = original.Width * multiplier; 29 | var newHeight = original.Height * multiplier; 30 | 31 | using (var resizedSprite = original.Clone(ctx => ctx.Resize(new ResizeOptions 32 | { 33 | Size = new Size(newWidth, newHeight), 34 | Mode = ResizeMode.Max, 35 | Sampler = new NearestNeighborResampler() 36 | }))) 37 | { 38 | string outputPath = Path.Combine(baseDirectory, outputFileName); 39 | resizedSprite.Save(outputPath); 40 | } 41 | } 42 | public static string RemoveTextAfterEquals(string input) 43 | { 44 | int indexOfEquals = input.IndexOf('='); 45 | if (indexOfEquals != -1) 46 | { 47 | return input.Substring(0, indexOfEquals); 48 | } 49 | return input; 50 | } 51 | public static Rgba32 GetDominantColor(string filePath) 52 | { 53 | using (Image image = (Image)Image.Load(filePath)) 54 | { 55 | return image[0, 0]; 56 | } 57 | } 58 | public static int GetIterationNumberFromFilePath(string spriteFilePath) 59 | { 60 | return int.Parse(Regex.Match(spriteFilePath, @"Iteration_(\d+)").Groups[1].Value); 61 | } 62 | public static string HashDictionary(Dictionary dict) 63 | { 64 | // Sort the dictionary by keys to ensure consistency 65 | var sortedDict = dict.OrderBy(kvp => kvp.Key); 66 | 67 | StringBuilder sb = new StringBuilder(); 68 | foreach (var kvp in sortedDict) 69 | { 70 | sb.Append($"{kvp.Key}:{kvp.Value},"); 71 | } 72 | 73 | // Create a SHA256 hash of the string 74 | using (SHA256 sha256 = SHA256.Create()) 75 | { 76 | byte[] bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString())); 77 | 78 | StringBuilder hashBuilder = new StringBuilder(); 79 | for (int i = 0; i < bytes.Length; i++) 80 | { 81 | hashBuilder.Append(bytes[i].ToString("x2")); 82 | } 83 | return hashBuilder.ToString(); 84 | } 85 | } 86 | public static List SelectSpritesFromDirectory(string directory) 87 | { 88 | List selectedSprites = new List(); 89 | var subDirectories = Directory.GetDirectories(directory).ToList(); 90 | 91 | selectedSprites.AddRange(subDirectories.Count == 3 ? 92 | HandleThreeSubDirectories(subDirectories) : 93 | HandleGeneralCase(directory)); 94 | 95 | return selectedSprites; 96 | } 97 | private static List HandleThreeSubDirectories(List subDirectories) 98 | { 99 | List selected = new List(); 100 | var pairedDirectories = subDirectories.Where(dir => dir.EndsWith("&")).ToList(); 101 | var standaloneDirectory = subDirectories.Except(pairedDirectories).FirstOrDefault(); 102 | 103 | if (rng.Next(100) <= RandomChanceThreshold && standaloneDirectory != null) 104 | { 105 | selected.AddRange(SelectRandomFromDirectory(standaloneDirectory)); 106 | } 107 | else if (pairedDirectories.Count == 2) 108 | { 109 | selected.AddRange(SelectRandomFromDirectory(pairedDirectories[0])); 110 | selected.AddRange(SelectRandomFromDirectory(pairedDirectories[1])); 111 | } 112 | 113 | return selected; 114 | } 115 | private static List HandleGeneralCase(string directory) 116 | { 117 | return SelectRandomFromDirectory(directory); 118 | } 119 | private static List SelectRandomFromDirectory(string directory) 120 | { 121 | List selected = new List(); 122 | var allFiles = Directory.GetFiles(directory, ImageExtension) 123 | .Where(file => !Path.GetFileName(file).Contains("=")) 124 | .ToArray(); 125 | 126 | if (allFiles.Length > 0) 127 | { 128 | int randomIndex = rng.Next(allFiles.Length); 129 | if (randomIndex >= 0 && randomIndex < allFiles.Length) 130 | { 131 | selected.Add(allFiles[randomIndex]); 132 | } 133 | } 134 | 135 | return selected; 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /MaizeUI/Views/ExpressAirdropNftsWindow.axaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 49 | 54 | 55 | 56 | 57 | 58 | 65 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 95 | 96 | 102 | 103 | 85 | 86 | 87 | 88 | 89 |