Skip to content

Commit 8a95e65

Browse files
committed
add rmb client
1 parent e3b0557 commit 8a95e65

File tree

6 files changed

+147
-25
lines changed

6 files changed

+147
-25
lines changed

.dart_tool/package_config.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,10 @@
434434
"languageVersion": "3.0"
435435
},
436436
{
437-
"name": "ristretto255",
438-
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/ristretto255-1.0.2",
437+
"name": "rmb_client",
438+
"rootUri": "../packages/rmb_client",
439439
"packageUri": "lib/",
440-
"languageVersion": "3.0"
441-
},
442-
{
443-
"name": "secp256k1_ecdsa",
444-
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/secp256k1_ecdsa-0.4.0",
445-
"packageUri": "lib/",
446-
"languageVersion": "3.0"
440+
"languageVersion": "3.2"
447441
},
448442
{
449443
"name": "shelf",
@@ -627,9 +621,9 @@
627621
},
628622
{
629623
"name": "web_socket_channel",
630-
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/web_socket_channel-2.4.5",
624+
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/web_socket_channel-2.4.3",
631625
"packageUri": "lib/",
632-
"languageVersion": "3.3"
626+
"languageVersion": "3.2"
633627
},
634628
{
635629
"name": "webkit_inspection_protocol",
@@ -662,7 +656,7 @@
662656
"languageVersion": "3.2"
663657
}
664658
],
665-
"generated": "2024-04-18T09:13:15.973441Z",
659+
"generated": "2024-01-10T13:39:16.827881Z",
666660
"generator": "pub",
667661
"generatorVersion": "3.3.3"
668662
}

melos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: tfgrid_sdk_dart_monorepo
22
packages:
3-
- packages/**
3+
- ./packages/rmb_client
44
- ./packages/signer
55
- ./packages/tfchain_client
66

packages/tfchain_client/bin/tfchain_client.dart

Lines changed: 129 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,136 @@ void main() async {
1010
// final queryClient = QueryClient("wss://tfchain.dev.grid.tf/ws");
1111
// await queryClient.connect();
1212

13-
// final twin = await queryClient.twins.get(QueryTwinsGetOptions(id: 214));
13+
// QueryBalances Module
14+
final signer = Signer();
15+
await signer.fromMnemonic(
16+
'picnic flip cigar rival risk scatter slide aware trust garlic solution token');
17+
final pair = await signer
18+
.keypairFromAddress("5CoYEiMb2ePY4cAW7f18HM7rozePwtQ8Ny5yKx8qYUGWxdgi");
19+
final balance =
20+
await queryClient.balances.get(publicKey: pair.publicKey.bytes);
21+
print(balance!.toJson());
1422

15-
// final twinId = await queryClient.twins.getTwinIdByAccountId(
16-
// QueryTwinsGetTwinByAccountIdOptions(accountId: twin!.accountId));
17-
// print(twinId);
23+
print("==================");
24+
25+
// // QueryContracts Module
26+
// final contract =
27+
// await queryClient.contracts.get(contractId: BigInt.from(49130));
28+
// print(contract!.toJson());
29+
30+
// print("==================");
31+
32+
// final contractId =
33+
// await queryClient.contracts.getContractIdByActiveRentForNode(nodeId: 85);
34+
// print(contractId);
35+
36+
// print("==================");
37+
38+
// final activeContracts =
39+
// await queryClient.contracts.getActiveContracts(nodeId: 85);
40+
// print(activeContracts);
41+
42+
// print("==================");
43+
44+
// final id = await queryClient.contracts
45+
// .getContractIdByNodeIdAndHash(nodeId: 11, hash: [
46+
// 53,
47+
// 50,
48+
// 57,
49+
// 102,
50+
// 53,
51+
// 99,
52+
// 50,
53+
// 55,
54+
// 97,
55+
// 50,
56+
// 99,
57+
// 97,
58+
// 51,
59+
// 50,
60+
// 48,
61+
// 49,
62+
// 48,
63+
// 97,
64+
// 98,
65+
// 102,
66+
// 102,
67+
// 102,
68+
// 49,
69+
// 52,
70+
// 100,
71+
// 56,
72+
// 54,
73+
// 51,
74+
// 52,
75+
// 102,
76+
// 53,
77+
// 51
78+
// ]);
79+
// print(id);
80+
81+
// print("==================");
82+
83+
// final contractLock =
84+
// await queryClient.contracts.contractLock(id: BigInt.from(49130));
85+
// print(contractLock!.toJson());
86+
87+
// print("==================");
88+
89+
// // Farms Module
90+
// final farm = await queryClient.farms.get(id: 115);
91+
// print(farm!.toJson());
92+
93+
// print("==================");
94+
95+
// // Nodes Module
96+
// final node = await queryClient.nodes.get(id: 85);
97+
// print(node!.toJson());
98+
99+
// print("==================");
100+
101+
// // Twins Module
102+
// final twin = await queryClient.twins.get(id: 214);
103+
// print(twin!.toJson());
104+
105+
// print("==================");
106+
107+
final twinId = await queryClient.twins.getTwinIdByAccountId(accountId: [
108+
12,
109+
58,
110+
221,
111+
236,
112+
167,
113+
151,
114+
69,
115+
84,
116+
126,
117+
190,
118+
116,
119+
100,
120+
140,
121+
251,
122+
60,
123+
149,
124+
249,
125+
60,
126+
238,
127+
70,
128+
203,
129+
93,
130+
75,
131+
150,
132+
70,
133+
130,
134+
0,
135+
28,
136+
253,
137+
137,
138+
178,
139+
63
140+
]);
141+
142+
print(twinId);
18143

19144
// await queryClient.disconnect();
20145

packages/tfchain_client/pubspec.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ dependencies:
1313
hex: ^0.2.0
1414
bip39: ^1.0.6
1515
convert: ^3.1.1
16-
moment_dart: ^2.0.2
17-
signer:
18-
path: ../signer
19-
hashlib: ^1.13.1
2016

2117
dev_dependencies:
2218
lints: ^3.0.0

pubspec.lock

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,13 @@ packages:
593593
url: "https://pub.dev"
594594
source: hosted
595595
version: "0.4.0"
596+
rmb_client:
597+
dependency: "direct main"
598+
description:
599+
path: "packages/rmb_client"
600+
relative: true
601+
source: path
602+
version: "1.0.0"
596603
shelf:
597604
dependency: transitive
598605
description:
@@ -835,10 +842,10 @@ packages:
835842
dependency: transitive
836843
description:
837844
name: web_socket_channel
838-
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
845+
sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23"
839846
url: "https://pub.dev"
840847
source: hosted
841-
version: "2.4.5"
848+
version: "2.4.3"
842849
webkit_inspection_protocol:
843850
dependency: transitive
844851
description:

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ dev_dependencies:
1212

1313
dependencies:
1414
coverage: ^1.7.1
15-
melos: ^4.1.0
16-
signer:
15+
melos: ^3.2.0
16+
signer:
1717
path: ./packages/signer
1818
substrate_bip39: ^0.4.0
1919
tfchain_client:

0 commit comments

Comments
 (0)