public async Task <IActionResult> CreateWallet([FromRoute] string blockchainType, [FromRoute] string assetId, [FromRoute] Guid clientId, [FromQuery] WalletType?walletType) { blockchainType = blockchainType.TrimAllSpacesAroundNullSafe(); assetId = assetId.TrimAllSpacesAroundNullSafe(); if (!ValidateRequest(out var badRequest, ParamsToValidate.UnsupportedAssetId | ParamsToValidate.EmptyClientId | ParamsToValidate.EmptyBlockchainType, blockchainType: blockchainType, assetId: assetId, clientId: clientId)) { return(badRequest); } if (blockchainType == SpecialBlockchainTypes.FirstGenerationBlockchain && !await _walletService.DoesAssetExistAsync(assetId)) { return(BadRequest ( BlockchainWalletsErrorResponse.Create($"Asset [{assetId}] does not exist.") )); } if (await _walletService.DefaultWalletExistsAsync(blockchainType, assetId, clientId)) { return(StatusCode ( (int)HttpStatusCode.Conflict, BlockchainWalletsErrorResponse.Create($"Wallet for specified client [{clientId}] has already been created.") )); } var wallet = await _walletService.CreateWalletAsync(blockchainType, assetId, clientId); return(Ok(new WalletResponse { Address = wallet.Address, AddressExtension = wallet.AddressExtension, BaseAddress = wallet.BaseAddress, BlockchainType = wallet.BlockchainType, ClientId = wallet.ClientId, IntegrationLayerId = wallet.BlockchainType, IntegrationLayerAssetId = wallet.AssetId, CreatedBy = wallet.CreatorType })); }