Skip to content

Commit

Permalink
Merge pull request #1926 from ardriveapp/fix-txids
Browse files Browse the repository at this point in the history
fix-txids
  • Loading branch information
thiagocarvalhodev authored Dec 3, 2024
2 parents be31841 + 7c42946 commit 30ab778
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions packages/ardrive_uploader/lib/src/data_bundler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,26 @@ class DataTransactionBundler implements DataBundler<TransactionResult> {
Function? onStartBundleCreation,
Function? onFinishBundleCreation,
}) async {
final uploadPreparation = await prepareDataItems(
file: file,
metadata: metadata,
wallet: wallet,
driveKey: driveKey,
onStartMetadataCreation: onStartMetadataCreation,
onFinishMetadataCreation: onFinishMetadataCreation,
);
List<DataItemFile> dataItemFilesToUse = [];
if (dataItemFiles == null) {
final uploadPreparation = await prepareDataItems(
file: file,
metadata: metadata,
wallet: wallet,
driveKey: driveKey,
onStartMetadataCreation: onStartMetadataCreation,
onFinishMetadataCreation: onFinishMetadataCreation,
);

dataItemFiles ??= uploadPreparation.dataItemFiles;
dataItemFilesToUse = uploadPreparation.dataItemFiles;
} else {
dataItemFilesToUse = dataItemFiles;
}

onStartBundleCreation?.call();

final transactionResult = await createDataBundleTransaction(
dataItemFiles: dataItemFiles,
dataItemFiles: dataItemFilesToUse,
wallet: wallet,
tags: getBundleTags(AppInfoServices(), customBundleTags)
.map((e) => createTag(e.name, e.value))
Expand Down Expand Up @@ -442,6 +447,8 @@ Future<DataItemFile> _generateMetadataDataItem({
print(StackTrace.current);
throw l;
}, (metadataDataItem) {
logger.d(
'Metadata tx id: on _generateMetadataDataItem ${metadataDataItem.id}');
metadata.setMetadataTxId = metadataDataItem.id;
return metadataDataItem;
});
Expand Down Expand Up @@ -520,6 +527,8 @@ Future<DataItemFile> _generateFileMetadataDataItem({
metadataTaskEither.match((l) {
throw l;
}, (metadataDataItem) {
logger.d(
'Metadata tx id on _generateFileMetadataDataItem: ${metadataDataItem.id}');
metadata.setMetadataTxId = metadataDataItem.id;
return metadataDataItem;
});
Expand Down Expand Up @@ -791,6 +800,7 @@ Future<DataItemResult> _getDataItemResult({
return fileDataItemResult.match((l) {
throw l;
}, (r) {
logger.d('Data tx id: ${r.id}');
metadata.updateDataTxId(r.id);

return r;
Expand Down

0 comments on commit 30ab778

Please sign in to comment.