Skip to content

Commit

Permalink
Merge pull request #1913 from ardriveapp/dev
Browse files Browse the repository at this point in the history
PE-7111: Release ArDrive v2.57.1
  • Loading branch information
thiagocarvalhodev authored Nov 13, 2024
2 parents 17bbca1 + b981fe3 commit 656eb02
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 16 deletions.
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/160.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Enable uploads even if contract state retrieval fails
6 changes: 5 additions & 1 deletion lib/core/upload/bundle_signer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
8 changes: 7 additions & 1 deletion lib/core/upload/cost_calculator.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion lib/core/upload/transaction_signer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 14 additions & 10 deletions lib/sync/domain/repositories/sync_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,20 @@ class _SyncRepository implements SyncRepository {

logger.i('Syncing licenses...');

final licenseTxIds = <String>{};
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 = <String>{};
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');

Expand Down
11 changes: 9 additions & 2 deletions packages/ardrive_uploader/lib/src/cost_calculator.dart
Original file line number Diff line number Diff line change
@@ -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<UploadCostEstimate> calculateCost({required int totalSize});
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 656eb02

Please sign in to comment.