Skip to content

Commit

Permalink
tezosNodeReader dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakshith G committed Jun 12, 2020
1 parent 5067915 commit a455450
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 25 deletions.
151 changes: 128 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,161 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {

example() async {
//Generate mnemonic
String mnemonic = TezsterDart.generateMnemonic(); // strength is optional, by default it's 256 ==> Generates 24 words.
//Generate mnemonic
String mnemonic = TezsterDart
.generateMnemonic(); // strength is optional, by default it's 256 ==> Generates 24 words.
print("mnemonic ===> $mnemonic");
//mnemonic ===> 24 random words, [If strength parameter is changed the words length differs.]
//Generate keys from mnemonic
//mnemonic ===> 24 random words, [If strength parameter is changed the words length differs.]

//Generate keys from mnemonic
List<String> keys = await TezsterDart.getKeysFromMnemonic(
mnemonic: "luxury bulb roast timber sense stove sugar sketch goddess host meadow decorate gather salmon funny person canoe daring machine network camp moment wrong dice",
mnemonic:
"luxury bulb roast timber sense stove sugar sketch goddess host meadow decorate gather salmon funny person canoe daring machine network camp moment wrong dice",
);
print("keys ===> $keys");
//keys ===> [privateKey, publicKey, publicKeyHash]
//Accessing: private key ===> keys[0] | public key ===> keys[1] | public Key Hash ===> identity[2] all of type string
//Create / Unlock identity from mnemonic and passphrase.
//keys ===> [privateKey, publicKey, publicKeyHash]
//Accessing: private key ===> keys[0] | public key ===> keys[1] | public Key Hash ===> identity[2] all of type string

//Create / Unlock identity from mnemonic and passphrase.
List<String> identity = await TezsterDart.getKeysFromMnemonicAndPassphrase(
mnemonic:
"cannon rabbit obvious drama slogan net acoustic donor core acoustic clinic poem travel plunge winter",
passphrase: "5tjpU0cimq",
);
print("identity ===> $identity");
// identityWithMnemonic ===> [privateKey, publicKey, publicKeyHash]
// Accessing: private key ===> identity[0] | public key ===> identity[1] | public Key Hash ===> identity[2] all of type string.
// identityWithMnemonic ===> [privateKey, publicKey, publicKeyHash]
// Accessing: private key ===> identity[0] | public key ===> identity[1] | public Key Hash ===> identity[2] all of type string.

//Sign operation with public-Key and forged operation
//Sign operation with public-Key and forged operation
List<String> signOpGrp = await TezsterDart.signOperationGroup(
privateKey: "edskRdVS5H9YCRAG8yqZkX2nUTbGcaDqjYgopkJwRuPUnYzCn3t9ZGksncTLYe33bFjq29pRhpvjQizCCzmugMGhJiXezixvdC",
forgedOperation: "713cb068fe3ac078351727eb5c34279e22b75b0cf4dc0a8d3d599e27031db136040cb9f9da085607c05cac1ca4c62a3f3cfb8146aa9b7f631e52f877a1d363474404da8130b0b940ee",
privateKey:
"edskRdVS5H9YCRAG8yqZkX2nUTbGcaDqjYgopkJwRuPUnYzCn3t9ZGksncTLYe33bFjq29pRhpvjQizCCzmugMGhJiXezixvdC",
forgedOperation:
"713cb068fe3ac078351727eb5c34279e22b75b0cf4dc0a8d3d599e27031db136040cb9f9da085607c05cac1ca4c62a3f3cfb8146aa9b7f631e52f877a1d363474404da8130b0b940ee",
);
print("signOperationGroup ===> $signOpGrp");
//signOperationGroup ===> [hexSignature, signedOpBytes]
//Accessing: hex signature ===> signOpGrp[0] | signed Operation bytes ===> signOpGrp[1] all of type string
//signOperationGroup ===> [hexSignature, signedOpBytes]
//Accessing: hex signature ===> signOpGrp[0] | signed Operation bytes ===> signOpGrp[1] all of type string

//Unlock fundraiser identity.
List<String> identityFundraiser = await TezsterDart.unlockFundraiserIdentity(
//Unlock fundraiser identity.
List<String> identityFundraiser =
await TezsterDart.unlockFundraiserIdentity(
mnemonic:
"cannon rabbit obvious drama slogan net acoustic donor core acoustic clinic poem travel plunge winter",
email: "[email protected]",
passphrase: "5tjpU0cimq",
);
print("identityFundraiser ===> $identityFundraiser");
//identityFundraiser ===> [privateKey, publicKey, publicKeyHash]
//Accessing: private key ===> identityFundraiser[0] | public key ===> identityFundraiser[1] | public Key Hash ===> identityFundraiser[2] all of type string.
//identityFundraiser ===> [privateKey, publicKey, publicKeyHash]
//Accessing: private key ===> identityFundraiser[0] | public key ===> identityFundraiser[1] | public Key Hash ===> identityFundraiser[2] all of type string.
}

request() async {
String testNetServer = "https://testnet.tezster.tech";

dynamic response = await TezsterDart.performGetRequest(
server: testNetServer,
command: "chains/main/blocks",
);
print("Response ===> $response");

dynamic getBlock = await TezsterDart.getBlock(
server: testNetServer,
hash: "",
chainid: "",
);
print("GET-Block ===> $getBlock");

dynamic blockhead = await TezsterDart.getBlockHead(
server: testNetServer,
);
print("Block-Head ===> $blockhead");

dynamic getAccForBlock = await TezsterDart.getAccountForBlock(
server: testNetServer,
accountHash: "",
blockHash: "",
chainid: "",
);
print("GET-Acc-ForBlock ===> $getAccForBlock");

// dynamic getCounterForAccount = await TezsterDart.getCounterForAccount(
// server: testNetServer,
// accountHash: "",
// chainid: "",
// );
// print("GET-Counter-ForAccount ===> $getCounterForAccount");

// dynamic getSpendableBalanceForAccount =
// await TezsterDart.getSpendableBalanceForAccount(
// server: testNetServer,
// accountHash: "",
// chainid: "",
// );
// print(
// "GET-SpendableBalance-ForAccount ===> $getSpendableBalanceForAccount");

dynamic getAccountManagerForBlock =
await TezsterDart.getAccountManagerForBlock(
server: testNetServer,
chainid: "",
accountHash: "",
block: "",
);
print("GET-Account-Manager-ForBlock ===> $getAccountManagerForBlock");

// dynamic isImplicitAndEmpty = await TezsterDart.isImplicitAndEmpty(
// server: testNetServer,
// accountHash: "",
// );
// print("Is-ImplicitAndEmpty ===> $isImplicitAndEmpty");

dynamic isManagerKeyRevealedForAccount =
await TezsterDart.isManagerKeyRevealedForAccount(
server: testNetServer,
accountHash: "",
);
print(
"Is-ManagerKey-Revealed-ForAccount ===> $isManagerKeyRevealedForAccount");

dynamic getContractStorage = await TezsterDart.getContractStorage(
server: testNetServer,
accountHash: "",
block: "",
chainid: "",
);
print("GET-Contract-Storage ===> $getContractStorage");

dynamic getValueForBigMapKey = await TezsterDart.getValueForBigMapKey(
server: testNetServer,
key: "",
block: "",
chainid: "",
index: 1,
);
print("GET-Value-ForBigMapKey ===> $getValueForBigMapKey");

dynamic getMempoolOperation = await TezsterDart.getMempoolOperation(
server: testNetServer,
chainid: "",
operationGroupId: "",
);
print("GET-MempoolOperation ===> $getMempoolOperation");

dynamic getMempoolOperationsForAccount =
await TezsterDart.getMempoolOperationsForAccount(
server: testNetServer,
chainid: "",
);
print("GET-MempoolOperations-ForAccount ===> $getMempoolOperationsForAccount");
}

@override
void initState() {
super.initState();
example();
// example();
request();
}

@override
Expand Down
21 changes: 21 additions & 0 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
Expand Down Expand Up @@ -151,6 +165,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit a455450

Please sign in to comment.