Пример #1
0
        public static VaspClient Create(
            VaspInformation vaspInfo,
            VaspContractInfo vaspContractInfo,
            string handshakePrivateKeyHex,
            string signaturePrivateKeyHex,
            IEthereumRpc nodeClientEthereumRpc,
            IWhisperRpc nodeClientWhisperRpc,
            IEnsProvider ensProvider,
            ISignService signService,
            ITransportClient transportClient)
        {
            var handshakeKey = ECDH_Key.ImportKey(handshakePrivateKeyHex);

            var vaspClient = new VaspClient(
                handshakeKey,
                signaturePrivateKeyHex,
                vaspContractInfo,
                vaspInfo,
                nodeClientEthereumRpc,
                nodeClientWhisperRpc,
                ensProvider,
                transportClient,
                signService);

            return(vaspClient);
        }
Пример #2
0
        public static VaspClient Create(VaspClientSettings settings)
        {
            var signService = new MessageSignService(settings.PrivateSigningKey);

            var messageFormatterService = new MessageFormatterService(signService, settings.VaspId);

            var whisperService = new WhisperService(new Web3(settings.WhisperRpc), settings.LoggerFactory);

            var outboundEnvelopeService = new OutboundEnvelopeService(
                whisperService, settings.EnvelopeExpirySeconds,
                settings.EnvelopeMaxRetries, settings.LoggerFactory);

            var vaspCodesService = new VaspCodesService(new Web3(settings.EthereumRpc), settings.IndexSmartContractAddress);

            var transportService = new TransportClient(settings.VaspId, settings.PrivateTransportKey, whisperService,
                                                       vaspCodesService, outboundEnvelopeService, settings.LoggerFactory);

            var sessionsService = new SessionsService(messageFormatterService, vaspCodesService, transportService,
                                                      settings.PrivateMessageKey, settings.LoggerFactory);

            var vaspClient = new VaspClient(sessionsService);

            return(vaspClient);
        }