Example #1
0
        // ReSharper disable once InconsistentNaming
        public Task ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient(
            string vaspCodeOrContractAddress,
            int minimalConfirmationLevel)
        {
            var vaspIndex       = _scenarioContext.GetContractByType <VASPIndex>();
            var vaspIndexClient = new EtherGate.VASPIndexClient(vaspIndex.RealAddress, _web3);

            // ReSharper disable once ConvertSwitchStatementToSwitchExpression
            switch (vaspCodeOrContractAddress.Length)
            {
            case 8:
                return(ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient
                       (
                           vaspIndexClient,
                           VASPCode.Parse(vaspCodeOrContractAddress),
                           minimalConfirmationLevel
                       ));

            case 42:
                return(ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient
                       (
                           vaspIndexClient,
                           Address.Parse(vaspCodeOrContractAddress),
                           minimalConfirmationLevel
                       ));

            default:
                throw new ArgumentException
                      (
                          "Is definitely neither VASP code, nor VASP contract address",
                          nameof(vaspCodeOrContractAddress)
                      );
            }
        }
Example #2
0
        // ReSharper disable once InconsistentNaming
        public async Task ICallTryGetVASPContractAddressAsyncMethodOfVASPIndexClient(
            string vaspCode,
            int minimalConfirmationLevel)
        {
            var vaspIndex       = _scenarioContext.GetContractByType <VASPIndex>();
            var vaspIndexClient = new EtherGate.VASPIndexClient(vaspIndex.RealAddress, _web3);

            var callResult = await vaspIndexClient.TryGetVASPContractAddressAsync
                             (
                vaspCode : VASPCode.Parse(vaspCode),
                minimalConfirmationLevel : new ConfirmationLevel(minimalConfirmationLevel)
                             );

            _scenarioContext.SetCallResult(callResult);
        }