-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rakshith G
committed
Jun 12, 2020
1 parent
5067915
commit a455450
Showing
5 changed files
with
348 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -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 | ||
|
This file contains 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
Oops, something went wrong.