static async Task Main(string[] args)
        {
            var phantasmaService = new PhantasmaRpcService(new RpcClient(new Uri("http://localhost:7077/rpc"), httpClientHandler: new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            }));

            var test = await phantasmaService.GetAddressTxs.SendRequestAsync("P2f7ZFuj6NfZ76ymNMnG3xRBT5hAMicDrQRHE4S7SoxEr", 1, 20);

            var soul = await phantasmaService.GetTokenTransfers.SendRequestAsync("SOUL", 1, 60);
        }
Beispiel #2
0
        private static async Task StartWallet()
        {
            Console.WriteLine("Welcome to Phantasma Wallet sample.");
            Console.WriteLine("Initializing...");
            Console.WriteLine("Fetching data...");

            _phantasmaApiService = new PhantasmaRpcService(new RpcClient(new Uri("http://localhost:7077/rpc")));

            _chains = (List <ChainDto>) await _phantasmaApiService.GetChains.SendRequestAsync();

            _tokens = await _phantasmaApiService.GetTokens.SendRequestAsync();

            Console.WriteLine("Enter your WIF:");

            var loggedIn = false;

            while (!loggedIn)
            {
                try
                {
                    var wif = Console.ReadLine();
                    _key     = KeyPair.FromWIF(wif); //KeyPair.Generate();
                    loggedIn = true;
                }
                catch (Exception)
                {
                    Console.WriteLine("Incorrect wif, enter again:");
                }
            }
            try
            {
                await RunConsole();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"An error occured: {ex.Message}");
                StartWallet().Wait();
            }
        }