Skip to content

Commit 732a0f6

Browse files
authored
Merge pull request #98 from codescalers/tfchain_graphql_pre-commit
2 parents 6e5ce8e + 1ece787 commit 732a0f6

File tree

6 files changed

+77
-39
lines changed

6 files changed

+77
-39
lines changed

git_hooks/pre-commit

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
3+
result=$(dart format .)
4+
exitCode=$? # If the exitCode is zero, then command executed successfully.
5+
6+
if [ $exitCode -ne 0 ]; then
7+
echo "$result"
8+
echo "Dart format found issues, please fix them."
9+
exit 1
10+
fi
11+
echo "Finished running dart format command."
12+
13+
################################################################
14+
15+
result=$(dart analyze .)
16+
exitCode=$? # If the exitCode is zero, then command executed successfully.
17+
18+
if [ $exitCode -ne 0 ]; then
19+
echo "$result"
20+
fi
21+
echo "Finished running dart analyze command."
22+
23+
################################################################
24+
25+
# Run `dart dry --apply` to auto-fix basic issues.
26+
result=$(dart fix --apply)
27+
exitCode=$?
28+
29+
# Adding the files updated by `dart fix` command to git.
30+
git add .
31+
32+
echo "$result"
33+
34+
if [ $exitCode -ne 0 ]; then
35+
echo "dart fix command failed to execute."
36+
exit 1
37+
fi
38+
echo "Finished running dart fix command."

packages/graphql_client/lib/models/contracts.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ class BaseContractReturnOptions {
7878
this.solutionProviderID = false,
7979
});
8080

81-
factory BaseContractReturnOptions.fromJson(Map<String, dynamic> json) {
82-
return fromJson(json);
83-
}
84-
85-
@override
86-
String toString() {
87-
return generateToString(this);
88-
}
81+
factory BaseContractReturnOptions.fromJson(Map<String, dynamic> json) {
82+
return fromJson(json);
83+
}
84+
85+
@override
86+
String toString() {
87+
return generateToString(this);
88+
}
8989
}
9090

9191
@reflector
@@ -1322,7 +1322,7 @@ class ResourcesUsedQueryOptions {
13221322

13231323
@override
13241324
String toString() {
1325-
List<String> queryOptions = [];
1325+
List<String> queryOptions = [];
13261326

13271327
_addToQueryList(queryOptions, "id_eq", idEq);
13281328
_addToQueryList(queryOptions, "id_gt", idGt);
@@ -1550,16 +1550,16 @@ class RentContractQueryOptions extends BaseContractQueryOptions {
15501550
String toString() {
15511551
String queryString = super.toString();
15521552

1553-
List<String> queryOptions = [];
1554-
_addToQueryList(queryOptions, "nodeID_isNull", nodeIDIsNull);
1555-
_addToQueryList(queryOptions, "nodeID_eq", nodeIDEq);
1556-
_addToQueryList(queryOptions, "nodeID_not_eq", nodeIDNotEq);
1557-
_addToQueryList(queryOptions, "nodeID_gt", nodeIDGt);
1558-
_addToQueryList(queryOptions, "nodeID_gte", nodeIDGte);
1559-
_addToQueryList(queryOptions, "nodeID_lt", nodeIDLt);
1560-
_addToQueryList(queryOptions, "nodeID_lte", nodeIDLte);
1561-
_addToQueryList(queryOptions, "nodeID_in", nodeIDIn);
1562-
_addToQueryList(queryOptions, "nodeID_not_in", nodeIDNotIn);
1553+
List<String> queryOptions = [];
1554+
_addToQueryList(queryOptions, "nodeID_isNull", nodeIDIsNull);
1555+
_addToQueryList(queryOptions, "nodeID_eq", nodeIDEq);
1556+
_addToQueryList(queryOptions, "nodeID_not_eq", nodeIDNotEq);
1557+
_addToQueryList(queryOptions, "nodeID_gt", nodeIDGt);
1558+
_addToQueryList(queryOptions, "nodeID_gte", nodeIDGte);
1559+
_addToQueryList(queryOptions, "nodeID_lt", nodeIDLt);
1560+
_addToQueryList(queryOptions, "nodeID_lte", nodeIDLte);
1561+
_addToQueryList(queryOptions, "nodeID_in", nodeIDIn);
1562+
_addToQueryList(queryOptions, "nodeID_not_in", nodeIDNotIn);
15631563

15641564
if (queryOptions.isNotEmpty) {
15651565
if (queryString.isNotEmpty) {

packages/graphql_client/lib/models/nodes.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,6 @@ class NodeEdgeInfo {
10401040
}
10411041
}
10421042

1043-
10441043
@reflector
10451044
class NodeConnectionsInfo {
10461045
List<NodeEdgeInfo>? edges;

packages/stellar_client/lib/models/balance.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class BalanceData implements BalanceInfo {
1111

1212
BalanceData({required this.assetCode, required this.balance});
1313

14-
@override
14+
@override
1515
String toString() {
1616
return 'BalanceData(assetCode: $assetCode, balance: $balance)';
1717
}

packages/stellar_client/lib/src/client.dart

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ class Client {
357357
Uri.parse(
358358
'${_serviceUrls[_network.toString()]}/transactionfunding_service/fund_transaction'),
359359
headers: {'Content-Type': 'application/json'},
360-
body: jsonEncode({'transaction': fundedTransaction.toEnvelopeXdrBase64()}),
360+
body: jsonEncode(
361+
{'transaction': fundedTransaction.toEnvelopeXdrBase64()}),
361362
);
362363

363364
print(response.body);
@@ -366,8 +367,7 @@ class Client {
366367
}
367368
}
368369

369-
Future<List<ITransaction>> getTransactions(
370-
{String? assetCodeFilter}) async {
370+
Future<List<ITransaction>> getTransactions({String? assetCodeFilter}) async {
371371
Page<OperationResponse> payments = await _sdk.payments
372372
.forAccount(accountId)
373373
.order(RequestBuilderOrder.DESC)
@@ -377,22 +377,23 @@ class Client {
377377
if (payments.records != null && payments.records!.isNotEmpty) {
378378
for (OperationResponse response in payments.records!) {
379379
if (response is PaymentOperationResponse) {
380-
final memoText = await this.getMemoText(response.links?.transaction?.toJson()["href"]);
380+
final memoText = await this
381+
.getMemoText(response.links?.transaction?.toJson()["href"]);
381382
String assetCode = response.assetCode ?? 'XLM';
382383
if (assetCodeFilter == null || assetCode == assetCodeFilter) {
383384
final details = PaymentTransaction(
384-
hash: response.transactionHash!,
385-
from: response.from!.accountId,
386-
to: response.to!.accountId,
387-
asset: response.assetCode.toString(),
388-
amount: response.amount!,
389-
type: response.to!.accountId == this.accountId
390-
? TransactionType.Receive
391-
: TransactionType.Payment,
392-
status: response.transactionSuccessful!,
393-
date: DateTime.parse(response.createdAt!).toLocal().toString(),
394-
memo: memoText);
395-
385+
hash: response.transactionHash!,
386+
from: response.from!.accountId,
387+
to: response.to!.accountId,
388+
asset: response.assetCode.toString(),
389+
amount: response.amount!,
390+
type: response.to!.accountId == this.accountId
391+
? TransactionType.Receive
392+
: TransactionType.Payment,
393+
status: response.transactionSuccessful!,
394+
date: DateTime.parse(response.createdAt!).toLocal().toString(),
395+
memo: memoText);
396+
396397
transactionDetails.add(details);
397398
}
398399
} else {
@@ -458,7 +459,8 @@ class Client {
458459
Future<String> getMemoText(String url) async {
459460
try {
460461
final response = await http.get(
461-
Uri.parse(url), headers: {'Content-Type': 'application/json'},
462+
Uri.parse(url),
463+
headers: {'Content-Type': 'application/json'},
462464
);
463465
final body = jsonDecode(response.body);
464466
final memoText = body['memo'] ?? "";

packages/tfchain_client/test/client_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,5 @@ void main() {
6565
await setupManager.client.disconnect();
6666
expect(false, setupManager.client.provider!.isConnected());
6767
});
68-
6968
});
7069
}

0 commit comments

Comments
 (0)