-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1820 from ardriveapp/PE-6472-implement-ario-sdk-i…
…ntegration-gar PE-6472: implement ario sdk integration gar
- Loading branch information
Showing
185 changed files
with
120,821 additions
and
1,426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"flutter": "3.19.6", | ||
"flavors": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:ardrive/models/database/database.dart'; | ||
import 'package:drift/drift.dart'; | ||
import 'package:uuid/uuid.dart'; | ||
|
||
part 'arns_dao.g.dart'; | ||
|
||
@DriftAccessor(include: {'./queries/arns_queries.drift'}) | ||
class ARNSDao extends DatabaseAccessor<Database> with _$ARNSDaoMixin { | ||
ARNSDao(super.attachedDatabase); | ||
|
||
Future<void> saveARNSRecord({ | ||
required String domain, | ||
required String transactionId, | ||
String? undername, | ||
bool isActive = true, | ||
int ttl = 3600, | ||
required String fileId, | ||
}) async { | ||
// Create a companion object with the values to insert | ||
final arnsRecord = ArnsRecordsCompanion( | ||
domain: Value(domain), | ||
transactionId: Value(transactionId), | ||
name: Value(undername ?? '@'), // Nullable value | ||
isActive: Value(isActive), | ||
ttl: Value(ttl), | ||
id: Value(const Uuid().v4()), | ||
fileId: Value(fileId), | ||
); | ||
|
||
// Insert the new record into the table | ||
await into(arnsRecords).insertOnConflictUpdate(arnsRecord); | ||
} | ||
|
||
Future<void> saveAntRecords(List<AntRecord> records) async { | ||
await batch((batch) { | ||
batch.insertAllOnConflictUpdate(antRecords, records); | ||
}); | ||
} | ||
|
||
Future<void> saveARNSRecords(List<ArnsRecord> records) async { | ||
await batch((batch) { | ||
batch.insertAllOnConflictUpdate(arnsRecords, records); | ||
}); | ||
} | ||
|
||
Future<void> updateARNSRecordActiveStatus({ | ||
required String id, | ||
required bool isActive, | ||
}) async { | ||
final record = await getARNSRecordById(id: id).getSingle(); | ||
|
||
await into(arnsRecords) | ||
.insertOnConflictUpdate(record.copyWith(isActive: Value(isActive))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import '../../../models/tables/arns_records.drift'; | ||
import '../../../models/tables/ant_records.drift'; | ||
|
||
getARNSRecordByName as ARNSRecordQueryResult: | ||
SELECT * FROM arns_records | ||
WHERE domain = :domain AND name = :name; | ||
|
||
getActiveARNSRecordsForFileId as ARNSRecordQueryResult: | ||
SELECT * FROM arns_records | ||
WHERE file_id = :fileId | ||
AND is_active = TRUE; | ||
|
||
getARNSRecordByDomain as ARNSRecordQueryResult: | ||
SELECT * FROM arns_records WHERE domain = :domain; | ||
|
||
getAllARNSRecords as ARNSRecordQueryResult: | ||
SELECT * FROM arns_records; | ||
|
||
getAllANTRecords as ANTRecordQueryResult: | ||
SELECT * FROM ant_records; | ||
|
||
getANTRecordByDomain as ANTRecordQueryResult: | ||
SELECT * FROM ant_records WHERE domain = :domain; | ||
|
||
getARNSRecordById as ANTRecordQueryResult: | ||
SELECT * FROM arns_records WHERE id = :id; | ||
|
||
getARNSRecordByNameAndFileId | ||
as ARNSRecordQueryResult: | ||
SELECT * FROM arns_records | ||
WHERE domain = :domain | ||
AND name = :name | ||
AND file_id = :fileId; |
Oops, something went wrong.