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 async Task <VaspContractInfo> GetVaspContractInfoAync(string vaspSmartContracAddress) { var pathToAbi = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VASP.abi"); var abi = File.ReadAllText(pathToAbi); var contract = _web3.Eth.GetContract(abi, vaspSmartContracAddress); var name = await contract.GetFunction("name").CallAsync <string>(); var vaspCode = await contract.GetFunction("code").CallAsync <byte[]>(); var handshakeKey = await contract.GetFunction("handshakeKey").CallAsync <string>(); var signingKey = await contract.GetFunction("signingKey").CallAsync <string>(); var postalAddress = await contract.GetFunction("postalAddress").CallDeserializingToObjectAsync <PostalAddressDTO>(); Country.List.TryGetValue(postalAddress.Country, out var country); var vaspSmartContractInfo = new VaspContractInfo() { Name = name, VaspCode = VaspCode.Create(vaspCode.ToHex()), HandshakeKey = handshakeKey, Address = new PostalAddress( postalAddress.StreetName, int.Parse(postalAddress.BuildingNumber), postalAddress.AddressLine, postalAddress.PostCode, postalAddress.Town, country), SigningKey = signingKey, Channgels = null, Email = null, OwnerAddress = null, Website = null }; return(vaspSmartContractInfo); }
//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; }