diff --git a/android/fastlane/metadata/android/en-US/changelogs/160.txt b/android/fastlane/metadata/android/en-US/changelogs/160.txt new file mode 100644 index 000000000..1870c4090 --- /dev/null +++ b/android/fastlane/metadata/android/en-US/changelogs/160.txt @@ -0,0 +1 @@ +- Enable uploads even if contract state retrieval fails diff --git a/lib/core/upload/bundle_signer.dart b/lib/core/upload/bundle_signer.dart index ab82c4b09..20ef26c9e 100644 --- a/lib/core/upload/bundle_signer.dart +++ b/lib/core/upload/bundle_signer.dart @@ -59,7 +59,11 @@ class ArweaveBundleTransactionSigner implements BundleTransactionSigner { logger.i('Adding tip...'); - await pstService.addCommunityTipToTx(bundleTx); + try { + await pstService.addCommunityTipToTx(bundleTx); + } catch (e) { + logger.e('Error adding community tip to transaction. Proceeding.', e); + } logger.i('Tip added'); diff --git a/lib/core/upload/cost_calculator.dart b/lib/core/upload/cost_calculator.dart index 0304280d6..f2fa323d9 100644 --- a/lib/core/upload/cost_calculator.dart +++ b/lib/core/upload/cost_calculator.dart @@ -1,6 +1,7 @@ import 'package:ardrive/services/arweave/arweave.dart'; import 'package:ardrive/turbo/turbo.dart'; import 'package:ardrive/utils/logger.dart'; +import 'package:ardrive_utils/ardrive_utils.dart'; import 'package:arweave/utils.dart'; import 'package:equatable/equatable.dart'; import 'package:pst/pst.dart'; @@ -64,7 +65,12 @@ class UploadCostEstimateCalculatorForAR extends ArDriveUploadCostCalculator { }) async { final costInAR = await _arweaveService.getPrice(byteSize: totalSize); - final pstFee = await _pstService.getPSTFee(costInAR); + Winston pstFee = Winston(BigInt.zero); + try { + pstFee = await _pstService.getPSTFee(costInAR); + } catch (e) { + logger.e('Error adding community tip to transaction. Proceeding.', e); + } final totalCostAR = costInAR + pstFee.value; diff --git a/lib/core/upload/transaction_signer.dart b/lib/core/upload/transaction_signer.dart index 886258357..038a45c9d 100644 --- a/lib/core/upload/transaction_signer.dart +++ b/lib/core/upload/transaction_signer.dart @@ -65,7 +65,11 @@ class ArweaveTransactionSigner implements TransactionSigner { ..addApplicationTags(version: version) ..addUTags(); - await pstService.addCommunityTipToTx(dataTx); + try { + await pstService.addCommunityTipToTx(dataTx); + } catch (e) { + logger.e('Error adding community tip to transaction. Proceeding.', e); + } // Don't include the file's Content-Type tag if it is meant to be private. if (!isPrivate) { diff --git a/lib/sync/domain/repositories/sync_repository.dart b/lib/sync/domain/repositories/sync_repository.dart index 4874e3445..190e5bfec 100644 --- a/lib/sync/domain/repositories/sync_repository.dart +++ b/lib/sync/domain/repositories/sync_repository.dart @@ -245,16 +245,20 @@ class _SyncRepository implements SyncRepository { logger.i('Syncing licenses...'); - final licenseTxIds = {}; - final revisionsToSyncLicense = (await _driveDao - .allFileRevisionsWithLicenseReferencedButNotSynced() - .get()) - ..retainWhere((rev) => licenseTxIds.add(rev.licenseTxId!)); - logger.d('Found ${revisionsToSyncLicense.length} licenses to sync'); - - await _updateLicenses( - revisionsToSyncLicense: revisionsToSyncLicense, - ); + try { + final licenseTxIds = {}; + final revisionsToSyncLicense = (await _driveDao + .allFileRevisionsWithLicenseReferencedButNotSynced() + .get()) + ..retainWhere((rev) => licenseTxIds.add(rev.licenseTxId!)); + logger.d('Found ${revisionsToSyncLicense.length} licenses to sync'); + + await _updateLicenses( + revisionsToSyncLicense: revisionsToSyncLicense, + ); + } catch (e) { + logger.e('Error syncing licenses. Proceeding.', e); + } logger.i('Licenses synced'); diff --git a/packages/ardrive_uploader/lib/src/cost_calculator.dart b/packages/ardrive_uploader/lib/src/cost_calculator.dart index 4c1e9499b..348ea8f77 100644 --- a/packages/ardrive_uploader/lib/src/cost_calculator.dart +++ b/packages/ardrive_uploader/lib/src/cost_calculator.dart @@ -1,10 +1,10 @@ +import 'package:ardrive_uploader/src/utils/logger.dart'; import 'package:ardrive_utils/ardrive_utils.dart'; import 'package:arweave/arweave.dart'; import 'package:arweave/utils.dart'; // ignore: depend_on_referenced_packages import 'package:equatable/equatable.dart'; import 'package:pst/pst.dart'; -import 'package:ardrive_uploader/src/utils/logger.dart'; abstract class ArDriveUploadCostCalculator { Future calculateCost({required int totalSize}); @@ -67,7 +67,14 @@ class UploadCostEstimateCalculatorForAR extends ArDriveUploadCostCalculator { .get('/price/$totalSize') .then((res) => BigInt.parse(res.body)); - final pstFee = await _pstService.getPSTFee(costInAR); + late final Winston pstFee; + + try { + pstFee = await _pstService.getPSTFee(costInAR); + } catch (e) { + logger.e('Error adding community tip to transaction. Proceeding.', e); + pstFee = Winston(BigInt.zero); + } final totalCostAR = costInAR + pstFee.value; diff --git a/pubspec.yaml b/pubspec.yaml index 73c39ad21..686aa3a0c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Secure, permanent storage publish_to: 'none' -version: 2.57.0 +version: 2.57.1 environment: sdk: '>=3.2.0 <4.0.0'