-
Notifications
You must be signed in to change notification settings - Fork 0
add stellar client #15
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
Merged
Merged
Changes from 62 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
9e7e24b
add stellar client
AlaaElattar f4906ee
use switch on network type instead of if condition
AlaaElattar e042b14
Merge branch 'main' of https://github.com/codescalers/tfgrid-sdk-dart…
AlaaElattar 34f4610
fix workflow
AlaaElattar 9efdb8a
fix coverage workflow
AlaaElattar aeedf47
fix sdk version
AlaaElattar 0265a5b
specify dart version in workflow
AlaaElattar 557570a
return version to stable
AlaaElattar 2df5c8b
change version to 3.4.4
AlaaElattar 775dbc7
change version to 3.4.4.
AlaaElattar e1c664d
undo changes of coverage workflow
AlaaElattar 65cf67d
update client && support listing transactions && loading from secretSeed
AlaaElattar 100c485
update listing transaction && apply dart format
AlaaElattar f75f46d
update sendTransaction function
AlaaElattar 87a4655
specify dart version to fix workflow
AlaaElattar 0a192ec
comment setup dart sdk part
AlaaElattar aa4808e
Merge branch 'main' of https://github.com/codescalers/tfgrid-sdk-dart…
AlaaElattar ff97ddd
undo coverage changes
AlaaElattar 4a34f3d
add readme && fix workflow
AlaaElattar 4444c57
clear cache
AlaaElattar bd790cc
verify dart version
AlaaElattar 3263fe5
debug what's wrong with versions
AlaaElattar 826999d
debug what's wrong with versions
AlaaElattar 3ddae2f
update sdk version of stellar
AlaaElattar 48c663e
run melos with specific sdk
AlaaElattar d7a0f73
debug version of melos
AlaaElattar 77c20cd
separate dependencies of dart from flutter ones
AlaaElattar f83fb7a
exclude stellar client from melos unit tests7
AlaaElattar aa68935
exclude stellar client from melos unit tests
AlaaElattar 8eecd65
fix excluding stellar client
AlaaElattar 757f285
remove test dir from stellar
AlaaElattar 99a00d8
add flutter setup in coverage
AlaaElattar fa7b4c6
add flutter setup in coverage
AlaaElattar b78f06c
setting flutter after dart version
AlaaElattar 359a3d6
remove verify melos
AlaaElattar e96e39a
export dart path
AlaaElattar cca5bc3
update flutter version
AlaaElattar 511768c
Delete .vscode/settings.json
AlaaElattar c87f951
Delete melos_tfgrid_sdk_dart_monorepo.iml
AlaaElattar 37cbb21
Delete packages/tfchain_client/pubspec_overrides.yaml
AlaaElattar eec522b
Delete packages/signer/coverage/lcov.info
AlaaElattar c61be1f
Delete packages/tfchain_client/coverage/filtered.lcov.info
AlaaElattar 51709ba
Delete packages/tfchain_client/coverage/result.txt
AlaaElattar 701bdda
Delete packages/tfchain_client/coverage/lcov.info
AlaaElattar 94fc0d7
remove models && rename the file && prepare main file with example
AlaaElattar 4495b2c
Delete packages/tfchain_client/.dart_tool/package_config.json
AlaaElattar f9a52d4
Delete packages/zos/.dart_tool/package_config.json
AlaaElattar 758be0f
Delete packages/zos/pubspec.lock
AlaaElattar 204485f
Delete packages/rmb_client/.dart_tool/package_config.json
AlaaElattar 4debc34
Delete packages/rmb_client/pubspec.lock
AlaaElattar 4a4ca4f
remove bin files
AlaaElattar a550724
return .dart_tool in gitignore
AlaaElattar d5403f3
Delete .dart_tool/package_config.json
AlaaElattar ea50510
remove tfchain files
AlaaElattar e1a8fdc
return .dart_tool in gitignore
AlaaElattar 62da5c0
fix dart version
AlaaElattar 7a738fc
fix dart version
AlaaElattar aaf5e67
change dart version to 3.2.0
AlaaElattar 8d401b1
update dart version in tfchian
AlaaElattar c6cdf86
add listing files in coverage workflow
AlaaElattar 4c7627c
run flutter pub get in stellar directory
AlaaElattar df32829
change flutter version to 3.16
AlaaElattar e3a0274
change flutter, dart versions && update client constructors && fix wo…
AlaaElattar c9932eb
update analyze command
AlaaElattar 43aec2a
fix renaming of activation functions
AlaaElattar bd3b287
remove network coditions and add it as param
AlaaElattar 36446a4
change createAccountFromSecret to be activation only
AlaaElattar d20acde
check workflow
AlaaElattar eac5ee7
add setup flutter in analyze workflow
AlaaElattar 53bd1b1
remove unnecessary null assertion
AlaaElattar ed83a3c
remove spaces
AlaaElattar 90e955e
fix bug
AlaaElattar b3637b0
apply comments
AlaaElattar 282b488
update readme file and bin file
AlaaElattar fd4129f
modify 2 sentences in readme
AlaaElattar 2c3f378
modify example
AlaaElattar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 @@ | ||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ |
This file contains hidden or 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,3 @@ | ||
## 1.0.0 | ||
|
||
- Initial version. |
AhmedHanafy725 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,63 @@ | ||
# Stellar Client | ||
|
||
This Dart client allows you to communicate with the Stellar network, enabling the creation or loading of existing Stellar accounts. It supports interactions with both the testnet and public network, and the assets currently supported are TFT (Threefold Token) and XLM (Stellar Lumens). | ||
|
||
## Installation | ||
|
||
To install the necessary dependencies, run: | ||
|
||
```bash | ||
dart pub get | ||
``` | ||
|
||
## Usage | ||
|
||
This client enables you to create new Stellar accounts or load existing ones on the testnet or public network. Once an account is created or loaded, you can manage assets such as TFT and XLM. | ||
|
||
### TESTNET | ||
|
||
Create new testnet account: | ||
|
||
- If no mnemonic provided, it will be created by the client. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it depends on which method is called |
||
- By default the account activated by threefold activation service, will contains both assets TFT and XLM. | ||
|
||
```dart | ||
import 'package:stellar_client/stellar_client.dart'; | ||
|
||
final stellarClient = Client(NetworkType.TESTNET); | ||
final keypair = stellarClient.createThreefoldAccount(mnemonic: ""); | ||
final balance = await stellarClient.getBalance(); | ||
print(balance); | ||
|
||
await stellarClient.getTransactions(); | ||
``` | ||
|
||
Load previously created account: | ||
|
||
- Accounts can be loaded from public key or secret seed. | ||
- If user wants to make any transactions, account should be loaded from secret seed. | ||
|
||
```dart | ||
import 'package:stellar_client/stellar_client.dart'; | ||
|
||
final stellarClient = Client(NetworkType.TESTNET); | ||
final account = stellarClient.loadAccountFromPublicKey(accountId: "account_id"); | ||
``` | ||
|
||
### PUBLIC | ||
|
||
```dart | ||
import 'package:stellar_client/stellar_client.dart'; | ||
|
||
final stellarClient = Client(NetworkType.PUBLIC); | ||
final keypair = stellarClient.createThreefoldAccount(mnemonic: ""); | ||
await stellarClient.sendTransaction( | ||
sourceKeyPair: account, | ||
destinationAddress: | ||
"destination-public-key", | ||
amount: "20", | ||
currency: "TFT", | ||
memoText: "Memo Text"); | ||
|
||
await stellarClient.getTransactions(); | ||
``` |
AlaaElattar marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,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 |
This file contains hidden or 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,10 @@ | ||
import 'package:stellar_client/stellar_client.dart'; | ||
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; | ||
|
||
void main() async { | ||
final stellarClient = Client(NetworkType.TESTNET); | ||
final mnemonic = await Wallet.generate24WordsMnemonic(); | ||
final keyPair = | ||
await stellarClient.createThreefoldAccount(mnemonic: mnemonic); | ||
print(keyPair!.accountId); | ||
} |
This file contains hidden or 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,27 @@ | ||
class Currency { | ||
final String assetCode; | ||
final String issuer; | ||
|
||
Currency({required this.assetCode, required this.issuer}); | ||
|
||
Map<String, dynamic> toJson() { | ||
return { | ||
'asset_code': assetCode, | ||
'issuer': issuer, | ||
}; | ||
} | ||
} | ||
|
||
class Currencies { | ||
late final Map<String, Currency> currencies; | ||
|
||
Currencies(this.currencies); | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> jsonMap = {}; | ||
currencies.forEach((key, value) { | ||
jsonMap[key] = value.toJson(); | ||
}); | ||
return jsonMap; | ||
} | ||
} |
This file contains hidden or 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,24 @@ | ||
class TransactionData { | ||
final String asset; | ||
final String feeAccountId; | ||
final String feeFixed; | ||
|
||
TransactionData({ | ||
required this.asset, | ||
required this.feeAccountId, | ||
required this.feeFixed, | ||
}); | ||
|
||
factory TransactionData.fromJson(Map<String, dynamic> json) { | ||
return TransactionData( | ||
asset: json['asset'], | ||
feeAccountId: json['fee_account_id'], | ||
feeFixed: json['fee_fixed'], | ||
); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'TransactionData{asset: $asset, feeAccountId: $feeAccountId, feeFixed: $feeFixed}'; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.