public Task <byte[]> ForgeOperationAsync(string branch, OperationContent content) { var branchBytes = Base58.Parse(branch, Prefix.B.Length); var contentBytes = ForgeOperation(content); return(Task.FromResult(branchBytes.Concat(contentBytes))); }
private void SaveOperation(OperationContent operationContent, OperationContractModel operation) { _operationUnitOfWork.AccountRepository.Update(operationContent.ToAccount); _operationUnitOfWork.AccountRepository.Update(operationContent.FromAccount); operationContent.ToStorages.ForEach(x => { _operationUnitOfWork.StorageRepository.Update(x); }); operationContent.FromStorages.ForEach(x => { _operationUnitOfWork.StorageRepository.Update(x); }); SaveInOperationArchive(operationContent.FromAccount, operationContent.ToAccount, operation); }
static byte[] ForgeOperation(OperationContent content) { switch (content) { case EndorsementContent endorsement: return(ForgeEndorsement(endorsement)); case PreendorsementContent preendorsement: return(ForgePreendorsement(preendorsement)); case BallotContent ballot: return(ForgeBallot(ballot)); case ProposalsContent proposals: return(ForgeProposals(proposals)); case ActivationContent activation: return(ForgeActivation(activation)); case DoubleBakingContent doubleBaking: return(ForgeDoubleBaking(doubleBaking)); case DoubleEndorsementContent doubleEndorsement: return(ForgeDoubleEndorsement(doubleEndorsement)); case DoublePreendorsementContent doublePreendorsement: return(ForgeDoublePreendorsement(doublePreendorsement)); case SeedNonceRevelationContent seed: return(ForgeSeedNonceRevelaion(seed)); case DelegationContent delegation: return(ForgeDelegation(delegation)); case OriginationContent origination: return(ForgeOrigination(origination)); case TransactionContent transaction: return(ForgeTransaction(transaction)); case RevealContent reveal: return(ForgeReveal(reveal)); case RegisterConstantContent registerConstant: return(ForgeRegisterConstant(registerConstant)); case SetDepositsLimitContent setDepositsLimit: return(ForgeSetDepositsLimit(setDepositsLimit)); default: throw new ArgumentException($"Invalid operation content kind {content.Kind}"); } }
private OperationContent InitializeOperationContent(OperationContractModel operation) { var operationContent = new OperationContent { Rates = GetCurrentRates(operation.Items), ToAccount = GetAccountInfoByAccoundId(operation.AccountOwnerToAccountId), ToStorages = GetStoragesByAccountNumber(operation.AccountOwnerToAccountId), FromAccount = GetAccountInfoByAccoundId(operation.AccountOwnerFromAccountId), FromStorages = GetStoragesByAccountNumber(operation.AccountOwnerFromAccountId), }; return(operationContent); }
static byte[] ForgeOperation(OperationContent content) { switch (content) { case TransactionContent transaction: return(ForgeTransaction(transaction)); case RevealContent reveal: return(ForgeRevelation(reveal)); case ActivationContent activation: return(ForgeActivation(activation)); case OriginationContent origination: return(ForgeOrigination(origination)); case DelegationContent delegation: return(ForgeDelegation(delegation)); case EndorsementContent endorsement: return(ForgeEndorsement(endorsement)); case SeedNonceRevelationContent seed: return(ForgeSeedNonceRevelaion(seed)); case ProposalsContent proposals: return(ForgeProposals(proposals)); case BallotContent ballot: return(ForgeBallot(ballot)); case DoubleEndorsementEvidenceContent doubleEndorsementEvidence: return(ForgeDoubleEndorsementEvidence(doubleEndorsementEvidence)); case DoubleBakingEvidenceContent doubleBakingEvidence: return(ForgeDoubleBakingEvidence(doubleBakingEvidence)); default: throw new NotImplementedException($"{content.Kind} is not implemented"); } }
static byte[] ForgeOperation(OperationContent content) { switch (content) { case EndorsementContent op: return(ForgeEndorsement(op)); case PreendorsementContent op: return(ForgePreendorsement(op)); case BallotContent op: return(ForgeBallot(op)); case ProposalsContent op: return(ForgeProposals(op)); case ActivationContent op: return(ForgeActivation(op)); case DoubleBakingContent op: return(ForgeDoubleBaking(op)); case DoubleEndorsementContent op: return(ForgeDoubleEndorsement(op)); case DoublePreendorsementContent op: return(ForgeDoublePreendorsement(op)); case SeedNonceRevelationContent op: return(ForgeSeedNonceRevelaion(op)); case VdfRevelationContent op: return(ForgeVdfRevelaion(op)); case DelegationContent op: return(ForgeDelegation(op)); case OriginationContent op: return(ForgeOrigination(op)); case TransactionContent op: return(ForgeTransaction(op)); case RevealContent op: return(ForgeReveal(op)); case RegisterConstantContent op: return(ForgeRegisterConstant(op)); case SetDepositsLimitContent op: return(ForgeSetDepositsLimit(op)); case IncreasePaidStorageContent op: return(ForgeIncreasePaidStorage(op)); case FailingNoopContent op: return(ForgeFailingNoop(op)); case TransferTicketContent op: return(ForgeTransferTicket(op)); case TxRollupCommitContent op: return(ForgeTxRollupCommit(op)); case TxRollupDispatchTicketsContent op: return(ForgeTxRollupDispatchTickets(op)); case TxRollupFinalizeCommitmentContent op: return(ForgeTxRollupFinalizeCommitment(op)); case TxRollupOriginationContent op: return(ForgeTxRollupOrigination(op)); case TxRollupRejectionContent op: return(ForgeTxRollupRejection(op)); case TxRollupRemoveCommitmentContent op: return(ForgeTxRollupRemoveCommitment(op)); case TxRollupReturnBondContent op: return(ForgeTxRollupReturnBond(op)); case TxRollupSubmitBatchContent op: return(ForgeTxRollupSubmitBatch(op)); default: throw new ArgumentException($"Invalid operation content kind {content.Kind}"); } }
public Task <byte[]> ForgeOperationAsync(string branch, OperationContent content) { var res = string.IsNullOrWhiteSpace(branch) ? new byte[] {} : Base58.Parse(branch, BranchPrefix); return(Task.FromResult(res.Concat(ForgeOperation(content)))); }
public Task <byte[]> ForgeOperationAsync(string branch, OperationContent content) => ForgeAsync(branch, new List <object> { content });
public Task <byte[]> ForgeOperationAsync(OperationContent content) => ForgeAsync(new List <object> { content });