public async Task Init(Block block, RawOperation op, RawTransactionContent content) { var sender = await Cache.Accounts.GetAsync(content.Source); sender.Delegate ??= Cache.Accounts.GetDelegate(sender.DelegateId); var target = await Cache.Accounts.GetAsync(content.Destination); if (target != null) { target.Delegate ??= Cache.Accounts.GetDelegate(target.DelegateId); } Transaction = new TransactionOperation { Id = Cache.AppState.NextOperationId(), Block = block, Level = block.Level, Timestamp = block.Timestamp, OpHash = op.Hash, Amount = content.Amount, BakerFee = content.Fee, Counter = content.Counter, GasLimit = content.GasLimit, StorageLimit = content.StorageLimit, Sender = sender, Target = target, Parameters = OperationParameters.Parse(content.Parameters), Status = content.Metadata.Result.Status switch { "applied" => OperationStatus.Applied, "failed" => OperationStatus.Failed, _ => throw new NotImplementedException() },
public async Task Init(Block block, RawOperation op, RawTransactionContent content) { var sender = await Cache.Accounts.GetAsync(content.Source); sender.Delegate ??= Cache.Accounts.GetDelegate(sender.DelegateId); var target = await Cache.Accounts.GetAsync(content.Destination) ?? block.Originations?.FirstOrDefault(x => x.Contract.Address == content.Destination)?.Contract; if (target != null) { target.Delegate ??= Cache.Accounts.GetDelegate(target.DelegateId); } Transaction = new TransactionOperation { Id = Cache.AppState.NextOperationId(), Block = block, Level = block.Level, Timestamp = block.Timestamp, OpHash = op.Hash, Amount = content.Amount, BakerFee = content.Fee, Counter = content.Counter, GasLimit = content.GasLimit, StorageLimit = content.StorageLimit, Sender = sender, Target = target, Parameters = OperationParameters.Parse(content.Parameters), Status = content.Metadata.Result.Status switch { "applied" => OperationStatus.Applied, "backtracked" => OperationStatus.Backtracked, "failed" => OperationStatus.Failed, "skipped" => OperationStatus.Skipped, _ => throw new Exception($"Invalid status '{content.Metadata.Result.Status}'") },