From af52050573beaa111325dfb2602f149b60cda510 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:29:42 -0300 Subject: [PATCH 1/7] feat(custom manifest) - implement method to verify if the file is a custom manifest - add checkbox on upload form to user set the file as a manifest - upload file with the manifest content type --- lib/blocs/upload/upload_cubit.dart | 33 +++++++++- lib/blocs/upload/upload_state.dart | 10 ++- lib/components/upload_form.dart | 19 +++++- lib/utils/is_custom_manifest.dart | 22 +++++++ test/utils/is_custom_manifest_test.dart | 83 +++++++++++++++++++++++++ 5 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 lib/utils/is_custom_manifest.dart create mode 100644 test/utils/is_custom_manifest_test.dart diff --git a/lib/blocs/upload/upload_cubit.dart b/lib/blocs/upload/upload_cubit.dart index 61ce3c505..97ee77f3d 100644 --- a/lib/blocs/upload/upload_cubit.dart +++ b/lib/blocs/upload/upload_cubit.dart @@ -11,6 +11,7 @@ import 'package:ardrive/core/activity_tracker.dart'; import 'package:ardrive/core/upload/domain/repository/upload_repository.dart'; import 'package:ardrive/core/upload/uploader.dart'; import 'package:ardrive/core/upload/view/blocs/upload_manifest_options_bloc.dart'; +import 'package:ardrive/entities/constants.dart'; import 'package:ardrive/main.dart'; import 'package:ardrive/manifest/domain/manifest_repository.dart'; import 'package:ardrive/models/forms/cc.dart'; @@ -21,6 +22,7 @@ import 'package:ardrive/services/config/config_service.dart'; import 'package:ardrive/services/license/license.dart'; import 'package:ardrive/turbo/services/upload_service.dart'; import 'package:ardrive/utils/constants.dart'; +import 'package:ardrive/utils/is_custom_manifest.dart'; import 'package:ardrive/utils/logger.dart'; import 'package:ardrive/utils/plausible_event_tracker/plausible_custom_event_properties.dart'; import 'package:ardrive/utils/plausible_event_tracker/plausible_event_tracker.dart'; @@ -110,6 +112,7 @@ class UploadCubit extends Cubit { UploadMethod? _manifestUploadMethod; bool _isManifestsUploadCancelled = false; + bool _isUploadingCustomManifest = false; void updateManifestSelection(List selections) { _selectedManifestModels.clear(); @@ -126,6 +129,11 @@ class UploadCubit extends Cubit { _manifestUploadMethod = method; } + void setIsUploadingCustomManifest(bool value) { + _isUploadingCustomManifest = value; + emit((state as UploadReady).copyWith(isUploadingCustomManifest: value)); + } + Future prepareManifestUpload() async { final manifestModels = _selectedManifestModels .map((e) => UploadManifestModel( @@ -150,7 +158,7 @@ class UploadCubit extends Cubit { fileId: manifestModels[i].existingManifestFileId, ) .getSingle(); - + await _createManifestCubit.prepareManifestTx( manifestName: manifestFileEntry.name, folderId: manifestFileEntry.parentFolderId, @@ -441,6 +449,10 @@ class UploadCubit extends Cubit { bool showArnsCheckbox = false; if (_targetDrive.isPublic && _files.length == 1) { + final isACustomManifest = await isCustomManifest(_files.first.ioFile); + + logger.d('Is a custom manifest: $isACustomManifest'); + emit( UploadReady( params: (state as UploadReadyToPrepare).params, @@ -461,6 +473,8 @@ class UploadCubit extends Cubit { arnsRecords: _ants, showReviewButtonText: false, selectedManifestSelections: _selectedManifestModels, + isCustomManifest: isACustomManifest, + isUploadingCustomManifest: false, ), ); @@ -505,6 +519,8 @@ class UploadCubit extends Cubit { canShowSettings: showSettings, showReviewButtonText: false, selectedManifestSelections: _selectedManifestModels, + isCustomManifest: false, // only applies for single file uploads + isUploadingCustomManifest: false, ), ); } @@ -1083,6 +1099,21 @@ class UploadCubit extends Cubit { return; } + if (_isUploadingCustomManifest) { + final fileWithCustomContentType = await IOFile.fromData( + await _files.first.ioFile.readAsBytes(), + name: _files.first.ioFile.name, + lastModifiedDate: _files.first.ioFile.lastModifiedDate, + contentType: ContentType.manifest, + ); + + _files.first = UploadFile( + ioFile: fileWithCustomContentType, + parentFolderId: _files.first.parentFolderId, + relativeTo: _files.first.relativeTo, + ); + } + _uploadIsInProgress = true; UploadPlan uploadPlan; diff --git a/lib/blocs/upload/upload_state.dart b/lib/blocs/upload/upload_state.dart index c71c3f7db..ea89a5b35 100644 --- a/lib/blocs/upload/upload_state.dart +++ b/lib/blocs/upload/upload_state.dart @@ -115,7 +115,8 @@ class UploadReady extends UploadState { final bool isArConnect; final bool showReviewButtonText; - + final bool isCustomManifest; + final bool isUploadingCustomManifest; UploadReady({ required this.paymentInfo, required this.uploadIsPublic, @@ -136,6 +137,8 @@ class UploadReady extends UploadState { required this.arnsRecords, required this.showReviewButtonText, required this.selectedManifestSelections, + required this.isCustomManifest, + required this.isUploadingCustomManifest, }); // copyWith @@ -160,6 +163,8 @@ class UploadReady extends UploadState { List? arnsRecords, bool? showReviewButtonText, List? selectedManifestSelections, + bool? isCustomManifest, + bool? isUploadingCustomManifest, }) { return UploadReady( loadingArNSNames: loadingArNSNames ?? this.loadingArNSNames, @@ -184,6 +189,9 @@ class UploadReady extends UploadState { showReviewButtonText: showReviewButtonText ?? this.showReviewButtonText, selectedManifestSelections: selectedManifestSelections ?? this.selectedManifestSelections, + isCustomManifest: isCustomManifest ?? this.isCustomManifest, + isUploadingCustomManifest: + isUploadingCustomManifest ?? this.isUploadingCustomManifest, ); } diff --git a/lib/components/upload_form.dart b/lib/components/upload_form.dart index d8878d085..e29037a74 100644 --- a/lib/components/upload_form.dart +++ b/lib/components/upload_form.dart @@ -1,5 +1,3 @@ -// ignore_for_file: use_build_context_synchronously - import 'dart:async'; import 'dart:math'; @@ -1977,6 +1975,23 @@ class _UploadReadyWidget extends StatelessWidget { ), ), ], + if (state.isCustomManifest) ...[ + const SizedBox(height: 8), + ArDriveCheckBox( + title: + 'We identified a custom manifest. Do you want to upload this file as a arweave manifest?', + checked: state.isUploadingCustomManifest, + useNewIcons: true, + titleStyle: typography.paragraphNormal( + fontWeight: ArFontWeight.semiBold, + ), + onChange: (value) { + context + .read() + .setIsUploadingCustomManifest(value); + }, + ), + ], ], ); }, diff --git a/lib/utils/is_custom_manifest.dart b/lib/utils/is_custom_manifest.dart new file mode 100644 index 000000000..a5793778a --- /dev/null +++ b/lib/utils/is_custom_manifest.dart @@ -0,0 +1,22 @@ +import 'dart:convert'; + +import 'package:ardrive_io/ardrive_io.dart'; + +/// Checks if a file is an Arweave manifest file by examining its content type and contents. +/// +/// Returns true if the file has JSON content type and contains the string "arweave/paths", +/// which indicates it follows the Arweave path manifest specification. +Future isCustomManifest(IOFile file) async { + if (file.contentType == 'application/json') { + /// Read the first 100 bytes of the file + final first100Bytes = file.openReadStream(0, 100); + + await for (var bytes in first100Bytes) { + // verify if file contains "arweave/paths"f + if (utf8.decode(bytes).contains('arweave/paths')) { + return true; + } + } + } + return false; +} diff --git a/test/utils/is_custom_manifest_test.dart b/test/utils/is_custom_manifest_test.dart new file mode 100644 index 000000000..8d5e4d71a --- /dev/null +++ b/test/utils/is_custom_manifest_test.dart @@ -0,0 +1,83 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:ardrive/utils/is_custom_manifest.dart'; +import 'package:ardrive_io/ardrive_io.dart'; +import 'package:mocktail/mocktail.dart'; +import 'package:test/test.dart'; + +class MockIOFile extends Mock implements IOFile {} + +void main() { + late MockIOFile mockFile; + + setUp(() { + mockFile = MockIOFile(); + registerFallbackValue(0); + registerFallbackValue(100); + }); + + group('isCustomManifest', () { + test('returns true when file is JSON and contains arweave/paths', () async { + // Arrange + const jsonContent = + '{"manifest":"arweave/paths","version":"0.1.0","index":{"path":"hello_world.html"},"paths":{"hello_world.html":{"id":"KlwrMWFW9ckVKa8pCGk9a8EjwzYZ7jNVUVHdcE2YkHo"}}}'; + final bytes = utf8.encode(jsonContent); + + when(() => mockFile.contentType).thenReturn('application/json'); + when(() => mockFile.openReadStream(any(), any())) + .thenAnswer((_) => Stream.value(Uint8List.fromList(bytes))); + + // Act + final result = await isCustomManifest(mockFile); + + // Assert + expect(result, true); + verify(() => mockFile.openReadStream(0, 100)).called(1); + }); + + test('returns false when file is JSON but does not contain arweave/paths', + () async { + // Arrange + const jsonContent = '{"version": 1, "type": "regular"}'; + final bytes = utf8.encode(jsonContent); + + when(() => mockFile.contentType).thenReturn('application/json'); + when(() => mockFile.openReadStream(any(), any())) + .thenAnswer((_) => Stream.value(Uint8List.fromList(bytes))); + + // Act + final result = await isCustomManifest(mockFile); + + // Assert + expect(result, false); + verify(() => mockFile.openReadStream(0, 100)).called(1); + }); + + test('returns false when file is not JSON', () async { + // Arrange + when(() => mockFile.contentType).thenReturn('text/plain'); + + // Act + final result = await isCustomManifest(mockFile); + + // Assert + expect(result, false); + verifyNever(() => mockFile.openReadStream(any(), any())); + }); + + test('returns false when stream is empty', () async { + // Arrange + when(() => mockFile.contentType).thenReturn('application/json'); + when(() => mockFile.openReadStream(any(), any())) + .thenAnswer((_) => Stream.value(Uint8List(0))); + + // Act + final result = await isCustomManifest(mockFile); + + // Assert + expect(result, false); + verify(() => mockFile.openReadStream(0, 100)).called(1); + }); + }); +} From 8ff7d80d1c5811e41ce659123cab46c70a3e6544 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:51:43 -0300 Subject: [PATCH 2/7] Update upload_form.dart --- lib/components/upload_form.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/components/upload_form.dart b/lib/components/upload_form.dart index e29037a74..9db202434 100644 --- a/lib/components/upload_form.dart +++ b/lib/components/upload_form.dart @@ -1978,8 +1978,7 @@ class _UploadReadyWidget extends StatelessWidget { if (state.isCustomManifest) ...[ const SizedBox(height: 8), ArDriveCheckBox( - title: - 'We identified a custom manifest. Do you want to upload this file as a arweave manifest?', + title: 'Convert this file to an Arweave manifest.', checked: state.isUploadingCustomManifest, useNewIcons: true, titleStyle: typography.paragraphNormal( From 09e816da4ca9e365a70851817d32b4059d2a97ea Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:26:49 -0300 Subject: [PATCH 3/7] feat(custom manifest) - rename variables - add validations on isCustomManifest method - update tests --- lib/blocs/upload/upload_cubit.dart | 22 +++++++++-------- lib/blocs/upload/upload_state.dart | 16 +++++++------ lib/components/upload_form.dart | 4 ++-- lib/utils/is_custom_manifest.dart | 32 +++++++++++++++++++------ test/utils/is_custom_manifest_test.dart | 11 +++++---- 5 files changed, 54 insertions(+), 31 deletions(-) diff --git a/lib/blocs/upload/upload_cubit.dart b/lib/blocs/upload/upload_cubit.dart index 97ee77f3d..8362bafbb 100644 --- a/lib/blocs/upload/upload_cubit.dart +++ b/lib/blocs/upload/upload_cubit.dart @@ -112,7 +112,9 @@ class UploadCubit extends Cubit { UploadMethod? _manifestUploadMethod; bool _isManifestsUploadCancelled = false; - bool _isUploadingCustomManifest = false; + + /// if true, the file will change its content type to `application/x.arweave-manifest+json` + bool _uploadFileAsCustomManifest = false; void updateManifestSelection(List selections) { _selectedManifestModels.clear(); @@ -130,7 +132,7 @@ class UploadCubit extends Cubit { } void setIsUploadingCustomManifest(bool value) { - _isUploadingCustomManifest = value; + _uploadFileAsCustomManifest = value; emit((state as UploadReady).copyWith(isUploadingCustomManifest: value)); } @@ -449,9 +451,8 @@ class UploadCubit extends Cubit { bool showArnsCheckbox = false; if (_targetDrive.isPublic && _files.length == 1) { - final isACustomManifest = await isCustomManifest(_files.first.ioFile); - - logger.d('Is a custom manifest: $isACustomManifest'); + final fileIsACustomManifest = + await isCustomManifest(_files.first.ioFile); emit( UploadReady( @@ -473,8 +474,8 @@ class UploadCubit extends Cubit { arnsRecords: _ants, showReviewButtonText: false, selectedManifestSelections: _selectedManifestModels, - isCustomManifest: isACustomManifest, - isUploadingCustomManifest: false, + shouldShowCustomManifestCheckbox: fileIsACustomManifest, + uploadFileAsCustomManifest: false, ), ); @@ -519,8 +520,9 @@ class UploadCubit extends Cubit { canShowSettings: showSettings, showReviewButtonText: false, selectedManifestSelections: _selectedManifestModels, - isCustomManifest: false, // only applies for single file uploads - isUploadingCustomManifest: false, + uploadFileAsCustomManifest: false, + // only applies for single file uploads + shouldShowCustomManifestCheckbox: false, ), ); } @@ -1099,7 +1101,7 @@ class UploadCubit extends Cubit { return; } - if (_isUploadingCustomManifest) { + if (_uploadFileAsCustomManifest) { final fileWithCustomContentType = await IOFile.fromData( await _files.first.ioFile.readAsBytes(), name: _files.first.ioFile.name, diff --git a/lib/blocs/upload/upload_state.dart b/lib/blocs/upload/upload_state.dart index ea89a5b35..2f24e32df 100644 --- a/lib/blocs/upload/upload_state.dart +++ b/lib/blocs/upload/upload_state.dart @@ -115,8 +115,9 @@ class UploadReady extends UploadState { final bool isArConnect; final bool showReviewButtonText; - final bool isCustomManifest; - final bool isUploadingCustomManifest; + final bool shouldShowCustomManifestCheckbox; + final bool uploadFileAsCustomManifest; + UploadReady({ required this.paymentInfo, required this.uploadIsPublic, @@ -137,8 +138,8 @@ class UploadReady extends UploadState { required this.arnsRecords, required this.showReviewButtonText, required this.selectedManifestSelections, - required this.isCustomManifest, - required this.isUploadingCustomManifest, + required this.shouldShowCustomManifestCheckbox, + required this.uploadFileAsCustomManifest, }); // copyWith @@ -189,9 +190,10 @@ class UploadReady extends UploadState { showReviewButtonText: showReviewButtonText ?? this.showReviewButtonText, selectedManifestSelections: selectedManifestSelections ?? this.selectedManifestSelections, - isCustomManifest: isCustomManifest ?? this.isCustomManifest, - isUploadingCustomManifest: - isUploadingCustomManifest ?? this.isUploadingCustomManifest, + shouldShowCustomManifestCheckbox: + isCustomManifest ?? this.shouldShowCustomManifestCheckbox, + uploadFileAsCustomManifest: + isUploadingCustomManifest ?? this.uploadFileAsCustomManifest, ); } diff --git a/lib/components/upload_form.dart b/lib/components/upload_form.dart index 9db202434..46300290d 100644 --- a/lib/components/upload_form.dart +++ b/lib/components/upload_form.dart @@ -1975,11 +1975,11 @@ class _UploadReadyWidget extends StatelessWidget { ), ), ], - if (state.isCustomManifest) ...[ + if (state.shouldShowCustomManifestCheckbox) ...[ const SizedBox(height: 8), ArDriveCheckBox( title: 'Convert this file to an Arweave manifest.', - checked: state.isUploadingCustomManifest, + checked: state.uploadFileAsCustomManifest, useNewIcons: true, titleStyle: typography.paragraphNormal( fontWeight: ArFontWeight.semiBold, diff --git a/lib/utils/is_custom_manifest.dart b/lib/utils/is_custom_manifest.dart index a5793778a..41e2201bb 100644 --- a/lib/utils/is_custom_manifest.dart +++ b/lib/utils/is_custom_manifest.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:ardrive/utils/logger.dart'; import 'package:ardrive_io/ardrive_io.dart'; /// Checks if a file is an Arweave manifest file by examining its content type and contents. @@ -7,16 +8,33 @@ import 'package:ardrive_io/ardrive_io.dart'; /// Returns true if the file has JSON content type and contains the string "arweave/paths", /// which indicates it follows the Arweave path manifest specification. Future isCustomManifest(IOFile file) async { - if (file.contentType == 'application/json') { - /// Read the first 100 bytes of the file - final first100Bytes = file.openReadStream(0, 100); + try { + if (file.contentType == 'application/json') { + final fileLength = await file.length; - await for (var bytes in first100Bytes) { - // verify if file contains "arweave/paths"f - if (utf8.decode(bytes).contains('arweave/paths')) { + int bytesToRead = 100; + + if (fileLength < bytesToRead) { + bytesToRead = fileLength; + } + + /// Read the first 100 bytes of the file + final first100Bytes = file.openReadStream(0, bytesToRead); + + String content = ''; + + await for (var bytes in first100Bytes) { + content += utf8.decode(bytes); + } + + /// verify if file contains "arweave/paths" + if (content.contains('arweave/paths')) { return true; } } + return false; + } catch (e) { + logger.e('Error checking if file is a custom manifest', e); + return false; } - return false; } diff --git a/test/utils/is_custom_manifest_test.dart b/test/utils/is_custom_manifest_test.dart index 8d5e4d71a..23fbfebaf 100644 --- a/test/utils/is_custom_manifest_test.dart +++ b/test/utils/is_custom_manifest_test.dart @@ -27,7 +27,7 @@ void main() { when(() => mockFile.contentType).thenReturn('application/json'); when(() => mockFile.openReadStream(any(), any())) .thenAnswer((_) => Stream.value(Uint8List.fromList(bytes))); - + when(() => mockFile.length).thenReturn(bytes.length); // Act final result = await isCustomManifest(mockFile); @@ -45,19 +45,20 @@ void main() { when(() => mockFile.contentType).thenReturn('application/json'); when(() => mockFile.openReadStream(any(), any())) .thenAnswer((_) => Stream.value(Uint8List.fromList(bytes))); + when(() => mockFile.length).thenReturn(bytes.length); // Act final result = await isCustomManifest(mockFile); // Assert expect(result, false); - verify(() => mockFile.openReadStream(0, 100)).called(1); + verify(() => mockFile.openReadStream(0, 33)).called(1); }); test('returns false when file is not JSON', () async { // Arrange when(() => mockFile.contentType).thenReturn('text/plain'); - + when(() => mockFile.length).thenReturn(0); // Act final result = await isCustomManifest(mockFile); @@ -71,13 +72,13 @@ void main() { when(() => mockFile.contentType).thenReturn('application/json'); when(() => mockFile.openReadStream(any(), any())) .thenAnswer((_) => Stream.value(Uint8List(0))); - + when(() => mockFile.length).thenReturn(0); // Act final result = await isCustomManifest(mockFile); // Assert expect(result, false); - verify(() => mockFile.openReadStream(0, 100)).called(1); + verify(() => mockFile.openReadStream(0, 0)).called(1); }); }); } From 6f763c67bf5e00cf1e48d3d88b3cee411cd20433 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:44:40 -0300 Subject: [PATCH 4/7] Update upload_state.dart fix lint --- lib/blocs/upload/upload_state.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/blocs/upload/upload_state.dart b/lib/blocs/upload/upload_state.dart index 2f24e32df..abd64dde4 100644 --- a/lib/blocs/upload/upload_state.dart +++ b/lib/blocs/upload/upload_state.dart @@ -164,8 +164,8 @@ class UploadReady extends UploadState { List? arnsRecords, bool? showReviewButtonText, List? selectedManifestSelections, - bool? isCustomManifest, - bool? isUploadingCustomManifest, + bool? shouldShowCustomManifestCheckbox, + bool? uploadFileAsCustomManifest, }) { return UploadReady( loadingArNSNames: loadingArNSNames ?? this.loadingArNSNames, @@ -190,10 +190,10 @@ class UploadReady extends UploadState { showReviewButtonText: showReviewButtonText ?? this.showReviewButtonText, selectedManifestSelections: selectedManifestSelections ?? this.selectedManifestSelections, - shouldShowCustomManifestCheckbox: - isCustomManifest ?? this.shouldShowCustomManifestCheckbox, + shouldShowCustomManifestCheckbox: shouldShowCustomManifestCheckbox ?? + this.shouldShowCustomManifestCheckbox, uploadFileAsCustomManifest: - isUploadingCustomManifest ?? this.uploadFileAsCustomManifest, + uploadFileAsCustomManifest ?? this.uploadFileAsCustomManifest, ); } From 8ceaba192c7d33e93b64cf03f616c4e29a67c8ab Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:46:19 -0300 Subject: [PATCH 5/7] Update upload_cubit.dart --- lib/blocs/upload/upload_cubit.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blocs/upload/upload_cubit.dart b/lib/blocs/upload/upload_cubit.dart index 8362bafbb..6bb67fa45 100644 --- a/lib/blocs/upload/upload_cubit.dart +++ b/lib/blocs/upload/upload_cubit.dart @@ -133,7 +133,7 @@ class UploadCubit extends Cubit { void setIsUploadingCustomManifest(bool value) { _uploadFileAsCustomManifest = value; - emit((state as UploadReady).copyWith(isUploadingCustomManifest: value)); + emit((state as UploadReady).copyWith(uploadFileAsCustomManifest: value)); } Future prepareManifestUpload() async { From c025e66cb9ebaae902d7ac388e2569b433cf334b Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:36:51 -0300 Subject: [PATCH 6/7] fix(license) - remove NEQ operator and filter the licenses in the client --- lib/services/arweave/arweave_service.dart | 1 + lib/services/arweave/graphql/queries/LicenseDataBundled.graphql | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/arweave/arweave_service.dart b/lib/services/arweave/arweave_service.dart index 0c1ff7f72..ad22d8248 100644 --- a/lib/services/arweave/arweave_service.dart +++ b/lib/services/arweave/arweave_service.dart @@ -262,6 +262,7 @@ class ArweaveService { yield licenseComposedQuery.data!.transactions.edges .map((e) => e.node) + .where(e) .toList(); } } diff --git a/lib/services/arweave/graphql/queries/LicenseDataBundled.graphql b/lib/services/arweave/graphql/queries/LicenseDataBundled.graphql index c6fe7719f..5a2ddf97a 100644 --- a/lib/services/arweave/graphql/queries/LicenseDataBundled.graphql +++ b/lib/services/arweave/graphql/queries/LicenseDataBundled.graphql @@ -1,7 +1,6 @@ query LicenseComposed($transactionIds: [ID!]) { transactions( ids: $transactionIds - tags: [{ name: "License", values: [""], op: NEQ }] ) { edges { node { From a9ebf05123eb2c32e81ea740dc8f42e7886d3ec8 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:40:23 -0300 Subject: [PATCH 7/7] Update arweave_service.dart --- lib/services/arweave/arweave_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/arweave/arweave_service.dart b/lib/services/arweave/arweave_service.dart index ad22d8248..be80d6ecc 100644 --- a/lib/services/arweave/arweave_service.dart +++ b/lib/services/arweave/arweave_service.dart @@ -262,7 +262,7 @@ class ArweaveService { yield licenseComposedQuery.data!.transactions.edges .map((e) => e.node) - .where(e) + .where((e) => e.tags.any((t) => t.name == 'License')) .toList(); } }