private static bool VASPIsRegistered(
            VASPCredentialsRefAndHash vaspCredentialsRefAndHash)
        {
            var(@ref, hash) = vaspCredentialsRefAndHash;

            return(!(VASPCredentialsRef.IsEmpty(@ref) && VASPCredentialsHash.IsEmpty(hash)));
        }
        public override async Task <string> GetCredentialsAsync(
            VASPId vaspId,
            VASPCredentialsRef vaspCredentialsRef,
            ConfirmationLevel minimalConfirmationLevel = default)
        {
            var vaspCredentialsRefString = vaspCredentialsRef.ToString();

            if (!_vaspCredentialsRefRegex.IsMatch(vaspCredentialsRefString))
            {
                throw new FormatException("Specified VASP credentials ref is not properly formatted to be used with a VASP directory.");
            }

            var credentialsInsertedEventHandler = Web3.Eth.GetEvent <CredentialsInsertedEvent>(ContractAddress);
            var credentialsInsertedEventFilter  = credentialsInsertedEventHandler.CreateFilterInput
                                                  (
                firstIndexedParameterValue: (byte[])vaspId,
                secondIndexedParameterValue: vaspCredentialsRefString.HexToByteArray(),
                fromBlock: BlockParameter.CreateEarliest(),
                toBlock: await Web3.GetBestTrustedBlockAsync(minimalConfirmationLevel)
                                                  );

            var latestCredentials = (await credentialsInsertedEventHandler.GetAllChanges(credentialsInsertedEventFilter))
                                    .OrderBy(x => x.Log.BlockNumber)
                                    .Select(x => x.Event.Credentials)
                                    .LastOrDefault() ?? string.Empty;

            return(latestCredentials);
        }
 public VASPCredentialsRefAndHash(
     VASPCredentialsHash hash,
     VASPCredentialsRef @ref)
 {
     Hash = hash;
     Ref  = @ref;
 }
 public void Deconstruct(
     out VASPCredentialsRef @ref,
     out VASPCredentialsHash hash)
 {
     hash = Hash;
     @ref = Ref;
 }
        public override async Task <VASPCredentialsRefAndHash> GetCredentialsRefAndHashAsync(
            VASPId vaspId,
            ConfirmationLevel minimalConfirmationLevel = default)
        {
            var vaspCredentialsRefAndHash = await base.GetCredentialsRefAndHashAsync(vaspId, minimalConfirmationLevel);

            var(@ref, hash) = vaspCredentialsRefAndHash;

            if (VASPCredentialsRef.IsEmpty(@ref) != VASPCredentialsHash.IsEmpty(hash))
            {
                throw new Exception("Smart contract returned an unexpected combination of VASP credentials reference and hash.");
            }

            return(vaspCredentialsRefAndHash);
        }
 public abstract Task <string> GetCredentialsAsync(
     VASPId vaspId,
     VASPCredentialsRef vaspCredentialsRef,
     ConfirmationLevel minimalConfirmationLevel = default);