Esempio n. 1
0
        public static FlowClient Create(string target)
        {
            //TODO: Update this to not be insecure
            var channel    = new Channel(target, ChannelCredentials.Insecure);
            var client     = new Access.AccessAPI.AccessAPIClient(channel);
            var flowClient = new FlowClient(client);

            flowClient.CurrentChannel = target;
            return(flowClient);
        }
Esempio n. 2
0
        /// <summary>
        /// This will find the correct spork for the blockheight and allow it to auto change channels
        /// </summary>
        /// <param name="blockHeight"></param>
        public void ChangeChannel(ulong blockHeight)
        {
            var target = blockHeight switch
            {
                _ when blockHeight >= Sporks.MainNet.ROOT_HEIGHT => Sporks.MainNet.NODE,
                _ when blockHeight >= Sporks.MainNet5.ROOT_HEIGHT && blockHeight < Sporks.MainNet.ROOT_HEIGHT => Sporks.MainNet5.NODE,
                _ when blockHeight >= Sporks.MainNet4.ROOT_HEIGHT && blockHeight < Sporks.MainNet5.ROOT_HEIGHT => Sporks.MainNet4.NODE,
                _ when blockHeight >= Sporks.MainNet3.ROOT_HEIGHT && blockHeight < Sporks.MainNet4.ROOT_HEIGHT => Sporks.MainNet3.NODE,
                _ when blockHeight >= Sporks.MainNet2.ROOT_HEIGHT && blockHeight < Sporks.MainNet3.ROOT_HEIGHT => Sporks.MainNet2.NODE,
                _ when blockHeight >= Sporks.MainNet1.ROOT_HEIGHT && blockHeight < Sporks.MainNet2.ROOT_HEIGHT => Sporks.MainNet1.NODE,
            };

            if (target == CurrentChannel)
            {
                return;
            }

            var channel = new Channel(target, ChannelCredentials.Insecure);

            this.client    = new Access.AccessAPI.AccessAPIClient(channel);
            CurrentChannel = target;
        }
Esempio n. 3
0
 private FlowClient(Access.AccessAPI.AccessAPIClient client)
 {
     this.client = client;
 }