From 0408688debd063ea116c916431dde1e7eb9ed26d Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Thu, 25 Jan 2024 22:24:29 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20TransactionChain=20graphql=20reques?= =?UTF-8?q?t=20has=20new=20criteria=20'from'=20to=20get=20transactions=20f?= =?UTF-8?q?rom=20a=20specific=20timestamp=20in=20the=20transactionChain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 + lib/src/services/api_service.dart | 11 ++-- pubspec.lock | 96 +++++++++++++++---------------- pubspec.yaml | 2 +- test/api_test.dart | 17 ++++++ 5 files changed, 76 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc551c1..9ee6d21e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ Changelog ========= +#### Version 3.3.5 +* TransactionChain graphql request has new criteria 'from' to get transactions from a specific timestamp in the transactionChain + #### Version 3.3.4 * Fix `toBigInt` and `fromBigInt` calculations diff --git a/lib/src/services/api_service.dart b/lib/src/services/api_service.dart index d500a544..6ec59156 100644 --- a/lib/src/services/api_service.dart +++ b/lib/src/services/api_service.dart @@ -294,10 +294,10 @@ class ApiService with JsonRPCUtil { /// Query the network to find transaction chains from a map of addresses and pagingAddress /// Returns the content scalar type represents transaction content [List]. Depending if the content can displayed it will be rendered as plain text otherwise in hexadecimal Future>> getTransactionChain( - Map addresses, { - String request = Transaction.kTransactionQueryAllFields, - bool orderAsc = true, - }) async { + Map addresses, + {String request = Transaction.kTransactionQueryAllFields, + bool orderAsc = true, + int? fromCriteria}) async { if (addresses.isEmpty) { return {}; } @@ -313,6 +313,9 @@ class ApiService with JsonRPCUtil { if (value.isNotEmpty) { body.write(' pagingAddress:"$value"'); } + if (fromCriteria != null) { + body.write(' from:$fromCriteria'); + } body.write(') { ...fields }'); }); diff --git a/pubspec.lock b/pubspec.lock index ae0313ce..aec4c8fa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" url: "https://pub.dev" source: hosted - version: "64.0.0" + version: "65.0.0" adaptive_number: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.3.0" args: dependency: transitive description: @@ -69,26 +69,26 @@ packages: dependency: transitive description: name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "0713a05b0386bd97f9e63e78108805a4feca5898a4b821d6610857f10c91e975" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + sha256: "67d591d602906ef9201caf93452495ad1812bea2074f04e25dbd7c133785821b" url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.7" build_runner_core: dependency: transitive description: @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: a8de5955205b4d1dbbbc267daddf2178bd737e4bab8987c04a500478c9651e74 + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 url: "https://pub.dev" source: hosted - version: "8.6.3" + version: "8.8.1" checked_yaml: dependency: transitive description: @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + sha256: feee43a5c05e7b3199bb375a86430b8ada1b04104f2923d0e03cc01ca87b6d84 url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.9.0" collection: dependency: "direct main" description: @@ -149,10 +149,10 @@ packages: dependency: transitive description: name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" url: "https://pub.dev" source: hosted - version: "1.6.3" + version: "1.7.2" crypto: dependency: "direct main" description: @@ -173,10 +173,10 @@ packages: dependency: transitive description: name: dart_style - sha256: abd7625e16f51f554ea244d090292945ec4d4be7bfbaf2ec8cccea568919d334 + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.4" decimal: dependency: "direct main" description: @@ -245,10 +245,10 @@ packages: dependency: "direct dev" description: name: freezed - sha256: be7826ed5d87e98c924a839542674fc14edbcb3e4fc0adbc058d680f2b241837 + sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba" url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.4.6" freezed_annotation: dependency: "direct main" description: @@ -277,50 +277,50 @@ packages: dependency: "direct main" description: name: gql - sha256: "56c5707f84128dfad2db16f513bbfe011f0dae96073bbdc4e6a9925915641a03" + sha256: aa3e0be4548353007b6e6fd24fcad0ce8c1179f9cb2ae5239d392fddb84a5ce5 url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1691943394579" + version: "1.0.1-alpha+1700868214564" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link - sha256: "80419ab0618dea72a0961617cf24fba690ff4e63fffdd57a701b0c7de08b8360" + sha256: e97e3f9490add43ba96cf5cc02d9d10a3723965c0bcc7bb1e04ef4f2e7a31a00 url: "https://pub.dev" source: hosted - version: "2.0.4-alpha+1691943394662" + version: "2.0.4-alpha+1700868214643" gql_error_link: dependency: transitive description: name: gql_error_link - sha256: bfdb543137da89448cc5d003fd029c2e8718931d39d4a7dedb16f9169862fbb9 + sha256: "93901458f3c050e33386dedb0ca7173e08cebd7078e4e0deca4bf23ab7a71f63" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.0+1" gql_exec: dependency: transitive description: name: gql_exec - sha256: "7b8c816f1d4830a21ae37e107bb035073b2f5613acde8f76a7768a7eb23322d3" + sha256: "394944626fae900f1d34343ecf2d62e44eb984826189c8979d305f0ae5846e38" url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1691943394588" + version: "1.1.1-alpha+1699813812660" gql_http_link: dependency: transitive description: name: gql_http_link - sha256: "0789d397d46ce274942fcc73e18a080cd2584296dadc33d8ae53d0666d7fe981" + sha256: "1f922eed1b7078fdbfd602187663026f9f659fe9a9499e2207b5d5e01617f658" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.1+1" gql_link: dependency: transitive description: name: gql_link - sha256: "255a0262425b6efd9df2312fd90546105baaad22a98a9873dfca56efbe9163eb" + sha256: "48dbf63b4831d800a2ce9675c9fecea3c9f2801de92072c7644a4bc52aa26c13" url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1691943394596" + version: "1.0.1-alpha+1700868214578" gql_transform_link: dependency: transitive description: @@ -429,18 +429,18 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: @@ -485,10 +485,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" pedantic: dependency: transitive description: @@ -605,10 +605,10 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.5.0" source_helper: dependency: transitive description: @@ -685,26 +685,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "9b0dd8e36af4a5b1569029949d50a52cb2a2a2fdaa20cebb96e6603b9ae241f9" + sha256: "3d028996109ad5c253674c7f347822fb994a087614d6f353e6039704b4661ff2" url: "https://pub.dev" source: hosted - version: "1.24.6" + version: "1.25.0" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: "4bef837e56375537055fdbbbf6dd458b1859881f4c7e6da936158f77d61ab265" + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.5.6" + version: "0.6.0" timing: dependency: transitive description: @@ -733,10 +733,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "14.0.0" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2274517a..f71ee8a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ name: archethic_lib_dart description: Archethic dart library for Flutter for Node and Browser. This library aims to provide a easy way to create Archethic transaction and to send them over the network homepage: https://github.com/archethic-foundation/libdart -version: 3.3.4 +version: 3.3.5 environment: sdk: ">=3.1.0 <4.0.0" diff --git a/test/api_test.dart b/test/api_test.dart index 33c06485..248e2f17 100644 --- a/test/api_test.dart +++ b/test/api_test.dart @@ -92,6 +92,23 @@ void main() { ); }); + test('getTransactions', () async { + final transactionChainListMap = + await ApiService('http://localhost:4000').getTransactionChain( + { + '0000A69458FB78517CFA1C61B506D2447506101ACBEC064ED2239BD79910C4FEFDDE': + '', + }, + fromCriteria: 1706171686, + ); + + expect( + transactionChainListMap.values.first[0].address!.address! + .toUpperCase(), + '00008F5503E7AA05B5FAA56C10A7AA3DE916CD36499B090F91112D62BF37961C51C2', + ); + }); + test('getNodeList', () async { final nodes = await ApiService('https://mainnet.archethic.net').getNodeList();