Exemplo n.º 1
0
        public async Task <ResultWrapper <Keccak> > ndm_makeDeposit(MakeDepositForRpc deposit)
        {
            var depositId = await _consumerService.MakeDepositAsync(deposit.DataAssetId, deposit.Units, deposit.Value);

            return(depositId is null
                ? ResultWrapper <Keccak> .Fail("Deposit couldn't be made.")
                : ResultWrapper <Keccak> .Success(depositId));
        }
        public async Task <ResultWrapper <Keccak> > ndm_makeDeposit(MakeDepositForRpc deposit, UInt256?gasPrice = null)
        {
            if (deposit.DataAssetId == null)
            {
                return(ResultWrapper <Keccak> .Fail("Deposit couldn't be made - asset ID unknown."));
            }

            Keccak?depositId = await _consumerService.MakeDepositAsync(deposit.DataAssetId, deposit.Units, deposit.Value,
                                                                       gasPrice);

            return(depositId is null
                ? ResultWrapper <Keccak> .Fail("Deposit couldn't be made.")
                : ResultWrapper <Keccak> .Success(depositId));
        }
Exemplo n.º 3
0
        public async Task make_deposit_should_return_deposit_id()
        {
            var request = new MakeDepositForRpc
            {
                DataAssetId = Keccak.Zero,
                Units       = 10,
                Value       = 100
            };
            var depositId = TestItem.KeccakA;

            _consumerService.MakeDepositAsync(request.DataAssetId, request.Units, request.Value).Returns(depositId);
            var result = await _rpc.ndm_makeDeposit(request);

            await _consumerService.Received().MakeDepositAsync(request.DataAssetId, request.Units, request.Value);

            result.Data.Should().Be(depositId);
        }