Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-7141: Release ArDrive v2.57.2 #1921

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/blocs/upload/upload_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class UploadCubit extends Cubit<UploadState> {
fileId: manifestModels[i].existingManifestFileId,
)
.getSingle();

await _createManifestCubit.prepareManifestTx(
manifestName: manifestFileEntry.name,
folderId: manifestFileEntry.parentFolderId,
Expand Down Expand Up @@ -886,6 +886,10 @@ class UploadCubit extends Cubit<UploadState> {
if (state is UploadReady) {
emit((state as UploadReady).copyWith(arnsRecords: value));
}
}).catchError((e) {
logger.e(
'Error getting ant records for wallet. Proceeding with the upload...',
e);
});

_files
Expand Down Expand Up @@ -1032,9 +1036,14 @@ class UploadCubit extends Cubit<UploadState> {
}

if (manifestFileEntries.isNotEmpty) {
// load arns names
await _arnsRepository
.getAntRecordsForWallet(_auth.currentUser.walletAddress);
try {
await _arnsRepository
.getAntRecordsForWallet(_auth.currentUser.walletAddress);
} catch (e) {
logger.e(
'Error getting ant records for wallet. Proceeding with the upload...',
e);
}
}

emit(
Expand Down
6 changes: 5 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ late ConfigService configService;
late ArweaveService arweave;
late TurboUploadService _turboUpload;
late PaymentService _turboPayment;
late Database db;

void main() async {
await runZonedGuarded(() async {
Expand Down Expand Up @@ -129,11 +130,14 @@ Future<void> _initializeServices() async {

final config = configService.config;

db = Database();

arweave = ArweaveService(
Arweave(
gatewayUrl: Uri.parse(config.defaultArweaveGatewayForDataRequest.url),
),
ArDriveCrypto(),
db.driveDao,
configService,
);
_turboUpload = config.useTurboUpload
Expand Down Expand Up @@ -395,7 +399,7 @@ class AppState extends State<App> {
),
),
),
RepositoryProvider<Database>(create: (_) => Database()),
RepositoryProvider<Database>(create: (_) => db),
RepositoryProvider<ProfileDao>(
create: (context) => context.read<Database>().profileDao),
RepositoryProvider<DriveDao>(
Expand Down
31 changes: 22 additions & 9 deletions lib/services/arweave/arweave_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

import 'package:ardrive/core/crypto/crypto.dart';
import 'package:ardrive/entities/entities.dart';
import 'package:ardrive/models/daos/drive_dao/drive_dao.dart';
import 'package:ardrive/services/arweave/arweave_service_exception.dart';
import 'package:ardrive/services/arweave/error/gateway_error.dart';
import 'package:ardrive/services/arweave/get_segmented_transaction_from_drive_strategy.dart';
Expand Down Expand Up @@ -42,12 +43,13 @@ const kMaxNumberOfTransactionsPerPage = 100;
class ArweaveService {
Arweave client;
final ArDriveCrypto _crypto;

final DriveDao _driveDao;
final ArtemisClient _gql;

ArweaveService(
this.client,
this._crypto,
this._driveDao,
ConfigService configService, {
ArtemisClient? artemisClient,
}) : _gql = artemisClient ??
Expand Down Expand Up @@ -588,15 +590,26 @@ class ArweaveService {
continue;
}

final driveKey =
driveTx.getTag(EntityTag.drivePrivacy) == DrivePrivacyTag.private
? await _crypto.deriveDriveKey(
wallet,
driveTx.getTag(EntityTag.driveId)!,
password,
)
: null;
SecretKey? driveKey;

if (driveTx.getTag(EntityTag.drivePrivacy) == DrivePrivacyTag.private) {
driveKey = await _driveDao.getDriveKeyFromMemory(
driveTx.getTag(EntityTag.driveId)!,
);

if (driveKey == null) {
driveKey = await _crypto.deriveDriveKey(
wallet,
driveTx.getTag(EntityTag.driveId)!,
password,
);

_driveDao.putDriveKeyInMemory(
driveID: driveTx.getTag(EntityTag.driveId)!,
driveKey: driveKey,
);
}
}
try {
final drive = await DriveEntity.fromTransaction(
driveTx,
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.1
version: 2.57.2

environment:
sdk: '>=3.2.0 <4.0.0'
Expand Down
Loading