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); }
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); }
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 static Task <(VaspInformation VaspInformation, VaspContractInfo VaspContractInfo)> CreateForBankAsync( IEthereumRpc ethereumRpc, string vaspSmartContractAddress, string settingsBic) { var vaspInformationBuilder = new VaspInformationBuilder(ethereumRpc); return(vaspInformationBuilder.CreateForBankAsync(vaspSmartContractAddress, settingsBic)); }
public static Task <(VaspInformation VaspInformation, VaspContractInfo VaspContractInfo)> CreateForJuridicalPersonAsync( IEthereumRpc ethereumRpc, string vaspSmartContractAddress, JuridicalPersonId[] juridicalIds) { var vaspInformationBuilder = new VaspInformationBuilder(ethereumRpc); return(vaspInformationBuilder.CreateForJuridicalPersonAsync(vaspSmartContractAddress, juridicalIds)); }
public static Task <(VaspInformation VaspInformation, VaspContractInfo VaspContractInfo)> CreateForNaturalPersonAsync( IEthereumRpc ethereumRpc, string vaspSmartContractAddress, NaturalPersonId[] settingsNaturalPersonIds, PlaceOfBirth settingsPlaceOfBirth) { var vaspInformationBuilder = new VaspInformationBuilder(ethereumRpc); return(vaspInformationBuilder.CreateForNaturalPersonAsync(vaspSmartContractAddress, settingsNaturalPersonIds, settingsPlaceOfBirth)); }
//TODO: Get rid of Whisper completely private VaspClient( ECDH_Key handshakeKey, string signatureHexKey, VaspContractInfo vaspContractInfo, VaspInformation vaspInfo, IEthereumRpc nodeClientEthereumRpc, IWhisperRpc nodeClientWhisperRpc, IEnsProvider ensProvider, ITransportClient transportClient, ISignService signService) { this._handshakeKey = handshakeKey; this._signatureKey = signatureHexKey; this._vaspContractInfo = vaspContractInfo; this.VaspInfo = vaspInfo; this._ethereumRpc = nodeClientEthereumRpc; this._whisperRpc = nodeClientWhisperRpc; this._cancellationTokenSource = new CancellationTokenSource(); this._ensProvider = ensProvider; this._transportClient = transportClient; this._signService = signService; }
/// <summary> /// C-tor /// </summary> public TransactionsManager( VaspCode vaspCode, string handshakePrivateKeyHex, string signaturePrivateKeyHex, IEthereumRpc ethereumRpc, ISignService signService, IEnsProvider ensProvider, ITransportClient transportClient, ITransactionDataService transactionDataService, ISessionsRepository sessionsRepository, ITransactionsRepository transactionsRepository, IVaspCodeManager vaspCodeManager, VaspInformation vaspInformation, ILoggerFactory loggerFactory) { _vaspClient = VaspClient.Create( vaspCode, handshakePrivateKeyHex, signaturePrivateKeyHex, ethereumRpc, ensProvider, signService, transportClient, loggerFactory); _vaspClient.SessionRequestMessageReceived += SessionRequestMessageReceivedAsync; _vaspClient.SessionReplyMessageReceived += SessionReplyMessageReceivedAsync; _vaspClient.TransferReplyMessageReceived += TransferReplyMessageReceivedAsync; _vaspClient.TransferConfirmationMessageReceived += TransferConfirmationMessageReceivedAsync; _vaspClient.TransferRequestMessageReceived += TransferRequestMessageReceivedAsync; _vaspClient.TransferDispatchMessageReceived += TransferDispatchMessageReceivedAsync; _vaspClient.BeneficiarySessionCreated += BeneficiarySessionCreatedAsync; _transactionDataService = transactionDataService; _sessionsRepository = sessionsRepository; _transactionsRepository = transactionsRepository; _vaspCodeManager = vaspCodeManager; _vaspInformation = vaspInformation; }
public VaspInformationBuilder(IEthereumRpc nodeClientEthereumRpc) { this._nodeClientEthereumRpc = nodeClientEthereumRpc; }