public async Task <TransferReplyMessage> TransferRequestAsync(TransferInstruction instruction) { if (_transferReplyCompletionSource.Task.Status == TaskStatus.WaitingForActivation) { var transferRequest = new TransferRequestMessage( this.SessionId, _originator, new Beneficiary("", _beneficiaryVaan.Vaan), new TransferRequest( instruction.VirtualAssetTransfer.VirtualAssetType, instruction.VirtualAssetTransfer.TransferType, instruction.VirtualAssetTransfer.TransferAmount), _vaspInfo ); await _transportClient.SendAsync(new MessageEnvelope() { Topic = this.CounterPartyTopic, SigningKey = _privateSigningKey, EncryptionType = EncryptionType.Symmetric, EncryptionKey = _sharedSymKeyId }, transferRequest); } return(await _transferReplyCompletionSource.Task); }
private static GetTransferInstructionByIdContract.Response Map(TransferInstruction transferInstruction) { return(new() { Id = transferInstruction.Id, EngagingClubId = transferInstruction.EngagingClubId, ReleasingClubId = transferInstruction.ReleasingClubId, PlayerId = transferInstruction.PlayerId, PlayersContract = PlayerContractMapper.Map(transferInstruction.PlayersContract), Type = (Contract.Shared.TransferInstructionType)transferInstruction.Type, }); }
public async Task TransferRequestAsync(TransferInstruction instruction) { var transferRequest = new TransferRequestMessage( this.SessionId, _originator, new Beneficiary(instruction.BeneficiaryName ?? string.Empty, _beneficiaryVaan.Vaan), new TransferRequest( instruction.VirtualAssetTransfer.VirtualAssetType, instruction.VirtualAssetTransfer.TransferType, instruction.VirtualAssetTransfer.TransferAmount), _vaspInfo ); await _transportClient.SendAsync(new MessageEnvelope() { Topic = this.CounterPartyTopic, SigningKey = _privateSigningKey, EncryptionType = EncryptionType.Symmetric, EncryptionKey = _sharedSymKeyId }, transferRequest); }
static void RunCommand(string command, KeyPair keys) { var args = command.Split(' '); var ownAddress = _addressEncoder.EncodeAddress(keys.PublicKey, 0); switch (args[0]) { case "help": PrintHelp(); break; case "mine-genesis": Console.WriteLine("Mining..."); _miner.Start(keys, true); break; case "mine": Console.WriteLine("Mining..."); _miner.Start(keys, false); break; case "stop-mining": Console.WriteLine("Stopping..."); _miner.Stop(); break; case "peers": var peersIn = _network.GetPeersIn(); var peersOut = _network.GetPeersOut(); Console.WriteLine("Incoming peers"); PrintPeerList(peersIn); Console.WriteLine("Outgoing peers"); PrintPeerList(peersOut); break; case "balance": if (args.Length == 1) { Console.WriteLine($"Balance = {_txnRepo.GetAccountBalance(ownAddress)}"); } else { Console.WriteLine($"Balance = {_txnRepo.GetAccountBalance(args[1])}"); } break; case "best-block": var header = _blockRepo.GetBestBlockHeader().Result; Console.WriteLine($"Height: {header.Height}, Id: {BitConverter.ToString(header.BlockId)}"); break; case "gen-key": var genkeys = _sigService.GetKeyPairFromPhrase(args[1]); var address = _addressEncoder.EncodeAddress(genkeys.PublicKey, 0); Console.WriteLine($"{address}"); break; case "avg-time": var avgTime = _blockRepo.GetAverageBlockTimeInSecs(DateTime.UtcNow.AddHours(-1), DateTime.UtcNow).Result; Console.WriteLine($"Avg time: {avgTime}s"); break; case "send": if (args.Length != 3) { Console.WriteLine("invalid command"); return; } var instruction = new TransferInstruction() { PublicKey = keys.PublicKey, Amount = Convert.ToInt32(args[2]), Destination = _addressEncoder.ExtractPublicKeyHash(args[1]) }; Console.WriteLine($"Signing instruction"); _sigService.SignInstruction(instruction, keys.PrivateKey); var txn = _txnBuilder.Build(new List <Instruction>() { instruction }).Result; Console.WriteLine($"Sending transaction {BitConverter.ToString(txn.TransactionId)}"); _host.SendTransaction(txn); break; default: Console.WriteLine("invalid command"); break; } }
private bool CompareTransferInstructions(TransferInstruction a, TransferInstruction b) { return(Equals(a, b)); }