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));
        }
Esempio n. 2
0
        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 NdmConfig Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var enabled = context.DecodeBool();
            var storeConfigInDatabase = context.DecodeBool();
            var id                        = context.DecodeString();
            var filesPath                 = context.DecodeString();
            var fileMaxSize               = context.DecodeUlong();
            var providerName              = context.DecodeString();
            var persistence               = context.DecodeString();
            var verifyP2PSignature        = context.DecodeBool();
            var providerAddress           = context.DecodeString();
            var providerColdWalletAddress = context.DecodeString();
            var consumerAddress           = context.DecodeString();
            var contractAddress           = context.DecodeString();
            var receiptRequestThreshold   = context.DecodeUInt256();
            var receiptsMergeThreshold    = context.DecodeUInt256();
            var paymentClaimThreshold     = context.DecodeUInt256();
            var blockConfirmations        = context.DecodeUInt();

            return(new NdmConfig
            {
                Enabled = enabled,
                StoreConfigInDatabase = storeConfigInDatabase,
                Id = id,
                FilesPath = filesPath,
                FileMaxSize = fileMaxSize,
                ProviderName = providerName,
                Persistence = persistence,
                VerifyP2PSignature = verifyP2PSignature,
                ProviderAddress = providerAddress,
                ProviderColdWalletAddress = providerColdWalletAddress,
                ConsumerAddress = consumerAddress,
                ContractAddress = contractAddress,
                ReceiptRequestThreshold = receiptRequestThreshold,
                ReceiptsMergeThreshold = receiptsMergeThreshold,
                PaymentClaimThreshold = paymentClaimThreshold,
                BlockConfirmations = blockConfirmations
            });
        }
        public DataHeaderProvider Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                         RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var address = context.DecodeAddress();
            var name    = context.DecodeString();

            return(new DataHeaderProvider(address, name));
        }
Esempio n. 5
0
        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));
        }