Example #1
0
 public override void Awake()
 {
     base.Awake();
     networkManager    = GetComponent <NetworkManager>();
     networkManagerHud = GetComponent <NetworkManagerHUD>();
     tpcTransport      = GetComponent <TelepathyTransport>();
     wsTransport       = GetComponent <WebsocketTransport>();
 }
        private void Awake()
        {
            _manager   = FindObjectOfType <NetworkManager>();
            _transport = _manager.GetComponent <WebsocketTransport>();

            // Load the previously set values
            securedToggle.isOn = _transport.Secure;
            addressInput.text  = RealServer.Equals(_manager.networkAddress) ? "" : _manager.networkAddress;
        }
Example #3
0
        public WalletConnect(ClientMeta clientMeta, ITransport transport = null,
                             ICipher cipher   = null,
                             int?chainId      = 1,
                             string bridgeUrl = "https://bridge.walletconnect.org",
                             EventDelegator eventDelegator = null
                             )
        {
            if (eventDelegator == null)
            {
                eventDelegator = new EventDelegator();
            }

            this.Events = eventDelegator;

            this.ClientMetadata = clientMeta;
            this.ChainId        = chainId;

            if (bridgeUrl.StartsWith("https"))
            {
                bridgeUrl = bridgeUrl.Replace("https", "wss");
            }
            else if (bridgeUrl.StartsWith("http"))
            {
                bridgeUrl = bridgeUrl.Replace("http", "ws");
            }

            var topicGuid = Guid.NewGuid();

            _handshakeTopic = topicGuid.ToString();

            clientId = Guid.NewGuid().ToString();

            if (transport == null)
            {
                transport = new WebsocketTransport(eventDelegator);
            }

            this._bridgeUrl = bridgeUrl;
            this.Transport  = transport;

            if (cipher == null)
            {
                cipher = new AESCipher();
            }

            this.Cipher = cipher;

            GenerateKey();
        }
        public WalletConnect(ClientMeta clientMeta, ITransport transport = null,
                             ICipher cipher   = null,
                             int?chainId      = 1,
                             string bridgeUrl = "https://bridge.walletconnect.org",
                             EventDelegator eventDelegator = null
                             )
        {
            if (clientMeta == null)
            {
                throw new ArgumentException("clientMeta cannot be null!");
            }

            if (string.IsNullOrWhiteSpace(clientMeta.Description))
            {
                throw new ArgumentException("clientMeta must include a valid Description");
            }

            if (string.IsNullOrWhiteSpace(clientMeta.Name))
            {
                throw new ArgumentException("clientMeta must include a valid Name");
            }

            if (string.IsNullOrWhiteSpace(clientMeta.URL))
            {
                throw new ArgumentException("clientMeta must include a valid URL");
            }

            if (clientMeta.Icons == null || clientMeta.Icons.Length == 0)
            {
                throw new ArgumentException("clientMeta must include an array of Icons the Wallet app can use. These Icons must be URLs to images. You must include at least one image URL to use");
            }

            if (eventDelegator == null)
            {
                eventDelegator = new EventDelegator();
            }

            this.Events = eventDelegator;

            this.ClientMetadata = clientMeta;
            this.ChainId        = chainId;

            if (bridgeUrl.StartsWith("https"))
            {
                bridgeUrl = bridgeUrl.Replace("https", "wss");
            }
            else if (bridgeUrl.StartsWith("http"))
            {
                bridgeUrl = bridgeUrl.Replace("http", "ws");
            }

            var topicGuid = Guid.NewGuid();

            _handshakeTopic = topicGuid.ToString();

            clientId = Guid.NewGuid().ToString();

            if (transport == null)
            {
                transport = new WebsocketTransport(eventDelegator);
            }

            this._bridgeUrl = bridgeUrl;
            this.Transport  = transport;

            if (cipher == null)
            {
                cipher = new AESCipher();
            }

            this.Cipher = cipher;

            GenerateKey();
        }