Skip to content

Main rmb client #17

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

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
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
23 changes: 21 additions & 2 deletions .dart_tool/package_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "hashlib",
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/hashlib-1.16.0",
"packageUri": "lib/",
"languageVersion": "2.14"
},
{
"name": "hashlib_codecs",
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/hashlib_codecs-2.2.0",
Expand Down Expand Up @@ -391,6 +397,12 @@
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "protobuf",
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/protobuf-3.1.0",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "pub_semver",
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/pub_semver-2.1.4",
Expand Down Expand Up @@ -433,6 +445,12 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "rmb_client",
"rootUri": "../packages/rmb_client",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "secp256k1_ecdsa",
"rootUri": "file:///home/alaa/.pub-cache/hosted/pub.dev/secp256k1_ecdsa-0.4.0",
Expand Down Expand Up @@ -656,7 +674,8 @@
"languageVersion": "3.2"
}
],
"generated": "2024-04-18T09:13:15.973441Z",
"generated": "2024-06-02T07:16:24.662504Z",
"generator": "pub",
"generatorVersion": "3.3.3"
"generatorVersion": "3.4.0",
"pubCache": "file:///home/alaa/.pub-cache"
}
1 change: 1 addition & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: tfgrid_sdk_dart_monorepo
packages:
- ./packages/rmb_client
- packages/**
- ./packages/signer
- ./packages/tfchain_client
Expand Down
3 changes: 3 additions & 0 deletions packages/rmb_client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
3 changes: 3 additions & 0 deletions packages/rmb_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
2 changes: 2 additions & 0 deletions packages/rmb_client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
30 changes: 30 additions & 0 deletions packages/rmb_client/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
28 changes: 28 additions & 0 deletions packages/rmb_client/bin/rmb_client.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'dart:io';

import 'package:rmb_client/rmb_client.dart';

void main() async {
final client = Client(
relayUrl: "wss://relay.dev.grid.tf/",
chainUrl: "wss://tfchain.dev.grid.tf/ws",
mnemonic:
"valid end trumpet hunt produce close hire virus fee rebel gentle claim",
session: "testclient",
retries: 3,
keypairType: "sr25519");

await client.connect();
// final ID = await client.send("zos.statistics.get", "{}", 17, 5, 3);

final ID =
await client.send("twinserver.balance.getMyBalance", "{}", 7845, 5, 3);

// sleep(Duration(seconds: 20));

// await client.read(ID!);

// await client.send("requestCommand", "requestData", 17, 5, 0);

// client.closeConnection();
}
24 changes: 24 additions & 0 deletions packages/rmb_client/lib/rmb_client.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
library rmb_client;

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:fixnum/fixnum.dart';
import 'package:polkadart_keyring/polkadart_keyring.dart';
import 'package:rmb_client/src/envelope.dart';
import 'package:rmb_client/src/sign.dart';
import 'package:rmb_client/src/utils.dart';
import 'package:rmb_client/types/generated/types.pbserver.dart';
import 'package:tfchain_client/generated/dev/types/pallet_collective/raw_origin.dart';
import 'package:tfchain_client/generated/dev/types/pallet_tfgrid/types/twin.dart';
import 'package:tfchain_client/generated/dev/types/tfchain_runtime/runtime_event.dart';
import 'package:tfchain_client/models/twins.dart';
import 'package:uuid/uuid.dart';
import 'package:web_socket_channel/status.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import 'package:tfchain_client/tfchain_client.dart' as TFClient;
import 'package:async_locks/async_locks.dart';
import 'dart:async';

part 'src/client.dart';
Loading
Loading