Example #1
0
        public async Task ShouldPassWeb4bCallTest()
        {
            // web4b_getTime
            {
                (long unixtime, string error) = await be4.GetTimeAsync();

                Assert.True(string.IsNullOrEmpty(error));
                Assert.True(Math.Abs(NetTime.Timestamp - unixtime) < 1000);
            }

            // web4b_getVersion
            {
                (string actual, string error) = await be4.GetVersionAsync();

                Assert.Equal("web4b/" + Version.Ver, actual);
            }

            // web4b_sha3
            {
                (string actual, string error) = await be4.GetSha3Async("");

                Assert.Equal("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", actual);
                (actual, error) = await be4.GetSha3Async("0x68656c6c6f20776f726c64");

                Assert.Equal("0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad", actual);
            }

            // web4b_mining
            {
                (bool?mining, string error) = await be4.GetMiningAsync();

                Assert.NotNull(mining);
                Assert.True(string.IsNullOrEmpty(error));
            }
        }
Example #2
0
        public WalletApp(string[] args) : base(args)
        {
            // web4b api
            web4b = new Be4Helper(config["web4b"].Value <string>("provider"));

            // wallets
            wallets = new WalletService();

            Task.Run(async() =>
            {
                await web4b.GetTimeAsync();
            });
        }