public Session Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var depositId = context.DecodeKeccak(); var dataHeaderId = context.DecodeKeccak(); var consumerAddress = context.DecodeAddress(); var consumerNodeId = new PublicKey(context.DecodeByteArray()); var providerAddress = context.DecodeAddress(); var providerNodeId = new PublicKey(context.DecodeByteArray()); var state = (SessionState)context.DecodeInt(); var startUnitsFromProvider = context.DecodeUInt(); var startUnitsFromConsumer = context.DecodeUInt(); var startTimestamp = context.DecodeUlong(); var finishTimestamp = context.DecodeUlong(); var consumedUnits = context.DecodeUInt(); var unpaidUnits = context.DecodeUInt(); var paidUnits = context.DecodeUInt(); var settledUnits = context.DecodeUInt(); return(new Session(id, depositId, dataHeaderId, consumerAddress, consumerNodeId, providerAddress, providerNodeId, state, startUnitsFromProvider, startUnitsFromConsumer, startTimestamp, finishTimestamp, consumedUnits, unpaidUnits, paidUnits, settledUnits)); }
public DepositDetails Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { try { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var deposit = Nethermind.Core.Encoding.Rlp.Decode <Deposit>(context); var dataHeader = Nethermind.Core.Encoding.Rlp.Decode <DataHeader>(context); var pepper = context.DecodeByteArray(); var timestamp = context.DecodeUInt(); var transactionHash = context.DecodeKeccak(); var verificationTimestamp = context.DecodeUInt(); var earlyRefundTicket = Nethermind.Core.Encoding.Rlp.Decode <EarlyRefundTicket>(context); var claimedRefundTransactionHash = context.DecodeKeccak(); return(new DepositDetails(deposit, dataHeader, pepper, timestamp, transactionHash, verificationTimestamp, earlyRefundTicket, claimedRefundTransactionHash)); } catch (Exception) { context.Position = 0; var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var deposit = Nethermind.Core.Encoding.Rlp.Decode <Deposit>(context); var dataHeader = Nethermind.Core.Encoding.Rlp.Decode <DataHeader>(context); var pepper = context.DecodeByteArray(); var transactionHash = context.DecodeKeccak(); var verificationTimestamp = context.DecodeUInt(); var earlyRefundTicket = Nethermind.Core.Encoding.Rlp.Decode <EarlyRefundTicket>(context); var claimedRefundTransactionHash = context.DecodeKeccak(); uint timestamp = 0; if (context.Position != context.Data.Length) { timestamp = context.DecodeUInt(); } return(new DepositDetails(deposit, dataHeader, pepper, timestamp, transactionHash, verificationTimestamp, earlyRefundTicket, claimedRefundTransactionHash)); } }
public DataHeader Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var name = context.DecodeString(); var description = context.DecodeString(); var unitPrice = context.DecodeUInt256(); var unitType = (DataHeaderUnitType)context.DecodeInt(); var minUnits = context.DecodeUInt(); var maxUnits = context.DecodeUInt(); var rules = Nethermind.Core.Encoding.Rlp.Decode <DataHeaderRules>(context); var provider = Nethermind.Core.Encoding.Rlp.Decode <DataHeaderProvider>(context); var file = context.DecodeString(); var queryType = (QueryType)context.DecodeInt(); var state = (DataHeaderState)context.DecodeInt(); var termsAndConditions = context.DecodeString(); var kycRequired = context.DecodeBool(); return(new DataHeader(id, name, description, unitPrice, unitType, minUnits, maxUnits, rules, provider, file, queryType, state, termsAndConditions, kycRequired)); }
public EthRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var host = context.DecodeString(); var address = context.DecodeAddress(); var value = context.DecodeUInt256(); var requestedAt = DateTimeOffset.FromUnixTimeSeconds(context.DecodeLong()).UtcDateTime; var transactionHash = context.DecodeKeccak(); return(new EthRequest(id, host, address, value, requestedAt, transactionHash)); }
public DepositApproval Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var headerId = context.DecodeKeccak(); var headerName = context.DecodeString(); var kyc = context.DecodeString(); var consumer = context.DecodeAddress(); var provider = context.DecodeAddress(); var timestamp = context.DecodeUlong(); var state = (DepositApprovalState)context.DecodeInt(); return(new DepositApproval(id, headerId, headerName, kyc, consumer, provider, timestamp, state)); }
public DataDeliveryReceiptDetails Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var sessionId = context.DecodeKeccak(); var dataHeaderId = context.DecodeKeccak(); var consumerNodeId = new PublicKey(context.DecodeByteArray()); var request = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceiptRequest>(context); var receipt = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceipt>(context); var timestamp = context.DecodeUlong(); var isClaimed = context.DecodeBool(); return(new DataDeliveryReceiptDetails(id, sessionId, dataHeaderId, consumerNodeId, request, receipt, timestamp, isClaimed)); }
public EarlyRefundTicket Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var depositId = context.DecodeKeccak(); var claimableAfter = context.DecodeUInt(); var signature = SignatureDecoder.DecodeSignature(context); return(new EarlyRefundTicket(depositId, claimableAfter, signature)); }
public Deposit Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = context.DecodeKeccak(); var units = context.DecodeUInt(); var expiryTime = context.DecodeUInt(); var value = context.DecodeUInt256(); return(new Deposit(id, units, expiryTime, value)); }
public DataDeliveryReceiptRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var number = context.DecodeUInt(); var depositId = context.DecodeKeccak(); var unitsRange = Nethermind.Core.Encoding.Rlp.Decode <UnitsRange>(context); var isSettlement = context.DecodeBool(); var receipts = Nethermind.Core.Encoding.Rlp.DecodeArray <DataDeliveryReceiptToMerge>(context); return(new DataDeliveryReceiptRequest(number, depositId, unitsRange, isSettlement, receipts)); }
public DataRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = context.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var headerId = context.DecodeKeccak(); var units = context.DecodeUInt(); var value = context.DecodeUInt256(); var expiryTime = context.DecodeUInt(); var salt = context.DecodeByteArray(); var provider = context.DecodeAddress(); var consumer = context.DecodeAddress(); var signature = SignatureDecoder.DecodeSignature(context); return(new DataRequest(headerId, units, value, expiryTime, salt, provider, consumer, signature)); }