protected override void Load(ContainerBuilder builder)
        {
            _fakeEnsProvider = new FakeEnsProvider();
            _signService     = new WhisperSignService();
            _whisperRpc      = new WhisperRpc(new Web3(_appSettings.WhisperRpcUri), new WhisperMessageFormatter());
            _ethereumRpc     = new EthereumRpc(new Web3(_appSettings.EthereumRpcUri));
            _transportClient = new TransportClient(_whisperRpc, _signService, new WhisperMessageFormatter());

            var vaspInformationBuilder = new VaspInformationBuilder(_ethereumRpc);

            var(vaspInfo, vaspContractInfo) = vaspInformationBuilder.Create(
                _appSettings.VaspSmartContractAddress);

            var originator = VaspClient.Create(
                vaspInfo,
                vaspContractInfo,
                _appSettings.HandshakePrivateKeyHex,
                _appSettings.SignaturePrivateKeyHex,
                _ethereumRpc,
                _whisperRpc,
                _fakeEnsProvider,
                _signService,
                _transportClient);

            builder.RegisterInstance(vaspInfo);
            builder.RegisterInstance(vaspContractInfo);
            builder.RegisterInstance(originator);

            builder.RegisterType <TransactionsManager>()
            .SingleInstance()
            .AsSelf()
            .AutoActivate();

            base.Load(builder);
        }
Exemple #2
0
 public VaspSessionService()
 {
     _fakeEnsProvider = new FakeEnsProvider();
     _signService     = new WhisperSignService();
     _whisperRpc      = new WhisperRpc(new Web3(_whisperRpcUrl), new WhisperMessageFormatter());
     _ethereumRpc     = new EthereumRpc(new Web3(_ethereumRpcUrl));
     _transportClient = new TransportClient(_whisperRpc, _signService, new WhisperMessageFormatter());
 }
        public ClientExampleTest(ITestOutputHelper testOutputHelper)
        {
            var    all            = Environment.GetEnvironmentVariables();
            string whisperRpcUrl  = Environment.GetEnvironmentVariable("WHISPER_RPC_URL");
            string ethereumRpcUrl = Environment.GetEnvironmentVariable("ETHEREUM_RPC_URL");

            this._fakeEnsProvider  = new FakeEnsProvider();
            this._testOutputHelper = testOutputHelper;
            this._signService      = new WhisperSignService();
            this._whisperRpc       = new WhisperRpc(new Web3(whisperRpcUrl), new WhisperMessageFormatter());

            NodeClient = new NodeClient()
            {
                EthereumRpc     = new EthereumRpc(new Web3(ethereumRpcUrl)),
                WhisperRpc      = _whisperRpc,
                TransportClient = new TransportClient(_whisperRpc, _signService, new WhisperMessageFormatter())
            };
            Settings = new VaspTestSettings()
            {
                PersonHandshakePrivateKeyHex      = "0xe7578145d518e5272d660ccfdeceedf2d55b90867f2b7a6e54dc726662aebac2",
                PersonSignaturePrivateKeyHex      = "0x790a3437381e0ca44a71123d56dc64a6209542ddd58e5a56ecdb13134e86f7c6",
                VaspSmartContractAddressPerson    = "0x6befaf0656b953b188a0ee3bf3db03d07dface61",
                VaspSmartContractAddressJuridical = "0x08FDa931D64b17c3aCFfb35C1B3902e0BBB4eE5C",
                VaspSmartContractAddressBank      = "0x4Dd7E1E2d5640a06ed81f155f171012F1CD48DAA",
                JuridicalSignaturePrivateKeyHex   = "0x6854a4e4f8945d9fa215646a820fe9a866b5635ffc7cfdac29711541f7b913f9",
                JuridicalHandshakePrivateKeyHex   = "0x502eb0b1a40d5b788b2395394bc6ae47adae61e9f0a9584c4700132914a8ed04",
                BankHandshakePrivateKeyHex        = "0x909aa47d973d34adf9bc44d6e1d755f89b9ca2972da77966336972a602a243db",
                BankSignaturePrivateKeyHex        = "0x9b3aaa8e802a1d42cf112dfc0e035440c451102d358163d345f6b3968415b077",
                PlaceOfBirth     = new PlaceOfBirth(DateTime.UtcNow, "Town X", Country.List["DE"]),
                NaturalPersonIds = new NaturalPersonId[]
                {
                    new NaturalPersonId("ID", NaturalIdentificationType.PassportNumber, Country.List["DE"]),
                },
                Bic          = "AUZDDEM1XXX",
                JuridicalIds = new JuridicalPersonId[]
                {
                    new JuridicalPersonId("ID", JuridicalIdentificationType.BankPartyIdentification, Country.List["DE"]),
                },
            };
        }
        public ClientExampleTest(ITestOutputHelper testOutputHelper)
        {
            var    all            = Environment.GetEnvironmentVariables();
            string whisperRpcUrl  = "http://144.76.25.187:8025";                                     //Environment.GetEnvironmentVariable( "WHISPER_RPC_URL");
            string ethereumRpcUrl = "https://ropsten.infura.io/v3/fb49e892176d413d85f993d0352a0971"; //Environment.GetEnvironmentVariable("ETHEREUM_RPC_URL");

            this._fakeEnsProvider  = new FakeEnsProvider();
            this._testOutputHelper = testOutputHelper;
            this._signService      = new WhisperSignService();
            this._whisperRpc       = new WhisperRpc(new Web3(whisperRpcUrl), new WhisperMessageFormatter());

            var ethRpc = new EthereumRpc(new Web3(ethereumRpcUrl));

            NodeClient = new NodeClient()
            {
                EthereumRpc     = ethRpc,
                WhisperRpc      = _whisperRpc,
                TransportClient = new TransportClient(_whisperRpc, _signService, new WhisperMessageFormatter())
            };
            Settings = new VaspTestSettings()
            {
                PersonHandshakePrivateKeyHex      = "0xe7578145d518e5272d660ccfdeceedf2d55b90867f2b7a6e54dc726662aebac2",
                PersonSignaturePrivateKeyHex      = "0x790a3437381e0ca44a71123d56dc64a6209542ddd58e5a56ecdb13134e86f7c6",
                VaspSmartContractAddressPerson    = "0x6befaf0656b953b188a0ee3bf3db03d07dface61",
                VaspSmartContractAddressJuridical = "0x08FDa931D64b17c3aCFfb35C1B3902e0BBB4eE5C",
                JuridicalSignaturePrivateKeyHex   = "0x6854a4e4f8945d9fa215646a820fe9a866b5635ffc7cfdac29711541f7b913f9",
                JuridicalHandshakePrivateKeyHex   = "0x502eb0b1a40d5b788b2395394bc6ae47adae61e9f0a9584c4700132914a8ed04",
                PlaceOfBirth     = new PlaceOfBirth(DateTime.UtcNow, "Town X", Country.List["DE"]),
                NaturalPersonIds = new NaturalPersonId[]
                {
                    new NaturalPersonId("ID", NaturalIdentificationType.PassportNumber, Country.List["DE"]),
                },
                JuridicalIds = new JuridicalPersonId[]
                {
                    new JuridicalPersonId("ID", JuridicalIdentificationType.BankPartyIdentification, Country.List["DE"]),
                },
            };
        }