From 7a72ee2cc44be75eb42bb5132547dce81c02fab7 Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Wed, 23 Jun 2021 22:16:50 +0530 Subject: [PATCH 01/10] Updated Readme to include Python and Javascript example code --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/README.md b/README.md index 4d229aa..fd5aed1 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,24 @@ Output: } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenList') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenList'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` + + ### Information about a token Get information about a token on the FLO blockchain ``` @@ -67,6 +85,23 @@ Output: } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=rmt') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=rmt'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` + ### Information about a token's transactions Get information about a token's related transactions on the blockchain ``` @@ -99,6 +134,22 @@ Output: } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt'){ + .then(response => response.json()) + .then(data => console.log(data)); +} + ### Information about a token's address balances Get information about a token's address balances ``` From aed07a49b10434fa9b921a72b6176f9830ec7a2f Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 10:36:54 +0530 Subject: [PATCH 02/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd5aed1..a480dfe 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The above API provides details about the token and smart contract system on the ``` git clone https://github.com/ranchimall/ranchimallflo-api cd ranchimallflo-api -python3 -m venv py3 +python3 -m venv py3.. source py3/bin/activate pip install requests quart quart_cors ecdsa config arrow ``` From 4daeb0df9654a2385158fd472d207d703eccd10a Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 10:43:06 +0530 Subject: [PATCH 03/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a480dfe..fd9f6be 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt .then(response => response.json()) .then(data => console.log(data)); } - +``` ### Information about a token's address balances Get information about a token's address balances ``` From 1179ffef4e9a1f662df85cbd2157b44510c90d9c Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 10:46:40 +0530 Subject: [PATCH 04/10] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index fd9f6be..f58b326 100644 --- a/README.md +++ b/README.md @@ -778,3 +778,10 @@ Output: "result": "ok" } ``` +### Latest Block Transactions +Get information about block transactions +``` + /api/v1.0/getBlockTransactions +``` +Output: +``` From 1cbf5ee1581bb12f5c25b8468566d571d38630b9 Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 10:50:02 +0530 Subject: [PATCH 05/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f58b326..6953770 100644 --- a/README.md +++ b/README.md @@ -781,7 +781,7 @@ Output: ### Latest Block Transactions Get information about block transactions ``` - /api/v1.0/getBlockTransactions + /api/v1.0/getBlockTransactions/ ``` Output: ``` From b372d10f698ed09cb717b7a7346f91ab3ecb55e8 Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 11:06:17 +0530 Subject: [PATCH 06/10] Update README.md --- README.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/README.md b/README.md index 6953770..e351540 100644 --- a/README.md +++ b/README.md @@ -785,3 +785,86 @@ Get information about block transactions ``` Output: ``` + +{ + + "blockKeyword": "3454503", + "result": "ok", + "transactions": { + "b57cf412c8cb16e473d04bae44214705c64d2c25146be22695bf1ac36e166ee0": { + "parsedFloData": { + "contractName": "india-elections-2019", + "triggerCondition": "narendra modi wins", + "type": "smartContractPays" + }, + "transactionDetails": { + "blockhash": "5036019f878cdd22cbd1563cc25b999fe103931a7784a6d67c9f6548f44076a3", + "blockheight": 3454503, + "blocktime": 1558862083, + "confirmations": 1342505, + "fees": 0.0005, + "floData": "india-elections-2019@ winning-choice:'narendra modi wins'", + "locktime": 0, + "size": 283, + "time": 1558862083, + "txid": "b57cf412c8cb16e473d04bae44214705c64d2c25146be22695bf1ac36e166ee0", + "valueIn": 0.001, + "valueOut": 0.0005, + "version": 2, + "vin": [ + { + "addr": "FRwwCqbP7DN4z5guffzzhCSgpD8Q33hUG8", + "confirmations": null, + "doubleSpentTxID": null, + "isConfirmed": null, + "n": 0, + "scriptSig": { + "asm": "304402206c414be1ad91eb32603c696b2fde7836585573371f25be742b1a88fa9215a8fd0220035932fe3286973267c3e9467bad6ca7237bcd0aa8a4e6607b076274ad5e78cd01 03eb349253a45fe086cf9594825d1dbd7bf50b348bc1cccb921485acf06811b982", + "hex": "47304402206c414be1ad91eb32603c696b2fde7836585573371f25be742b1a88fa9215a8fd0220035932fe3286973267c3e9467bad6ca7237bcd0aa8a4e6607b076274ad5e78cd012103eb349253a45fe086cf9594825d1dbd7bf50b348bc1cccb921485acf06811b982" + }, + "sequence": 4294967295, + "txid": "6a49fd8fcdf557845788ac4d578568aac7c675c27ac3a57a09807a55ce9b56fa", + "unconfirmedInput": null, + "value": 0.001, + "valueSat": 100000, + "vout": 0 + } + ], + "vout": [ + { + "n": 0, + "scriptPubKey": { + "addresses": [ + "F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1" + ], + "asm": "OP_DUP OP_HASH160 15b3eb460d593f74775167d589a3a443eb78b55b OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a91415b3eb460d593f74775167d589a3a443eb78b55b88ac", + "type": "pubkeyhash" + }, + "spentHeight": null, + "spentIndex": null, + "spentTxId": null, + "value": "0.00010000" + }, + { + "n": 1, + "scriptPubKey": { + "addresses": [ + "FRwwCqbP7DN4z5guffzzhCSgpD8Q33hUG8" + ], + "asm": "OP_DUP OP_HASH160 dcacdd4e7c523b9ee05e980e9fc2ced5fb343669 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a914dcacdd4e7c523b9ee05e980e9fc2ced5fb34366988ac", + "type": "pubkeyhash" + }, + "spentHeight": null, + "spentIndex": null, + "spentTxId": null, + "value": "0.00040000" + } + ] + } + } + } + +} +``` From c8999f0369c64dfb4b048c6d9acad9d4178c1f45 Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 11:32:09 +0530 Subject: [PATCH 07/10] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index e351540..1eceb89 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?token=rmt') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?token=rmt'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Information about a FLO address Get information about a FLO address ``` From d38f38fd5f7f382c12f0a6ec845515729bca1200 Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 11:34:32 +0530 Subject: [PATCH 08/10] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 1eceb89..addec1d 100644 --- a/README.md +++ b/README.md @@ -211,7 +211,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressDetails?floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressDetails?floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Information about a FLO address of a particular token Get information about a FLO address of a particular token ``` From 7003eba17a25c7f2e3eaa342ec90e12e15be70ae Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Thu, 24 Jun 2021 11:57:11 +0530 Subject: [PATCH 09/10] Update README.md --- README.md | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/README.md b/README.md index addec1d..75a0cbd 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,22 @@ Output: "token": "rmt" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=rmt&floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=rmt&floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Information about a FLO address's transactions Get information about a FLO address's transactions @@ -277,7 +293,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?floAddress=F6WPx2WFdmVQ6AMutZ2FJzpyiwdxqLyd2z'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Get list of all active smart contracts Get list of all active smart contracts ``` @@ -303,7 +334,22 @@ Output: ] } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractList') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractList'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Smart Contract's information Get information about a specified Smart Contract ``` @@ -333,7 +379,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractInfo?contractName=india-elections-2019&contractAddress=F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractInfo?contractName=india-elections-2019&contractAddress=F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Smart Contract's participants Get information about a specified Smart Contract's participants ``` @@ -368,7 +429,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractParticipants?contractName=india-elections-2019&contractAddress=F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractParticipants?contractName=india-elections-2019&contractAddress=F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Smart Contract's participant details Get information about a specified Smart Contract's participants ``` @@ -403,7 +479,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractParticipantDetails?floAddress=') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractParticipantDetails?floAddress='){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Block details Get information about a block by specifying its blockno ``` @@ -433,7 +524,22 @@ Output: "version": 1 } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getBlockDetails/') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getBlockDetails/'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Transaction details Get information about a transaction ``` @@ -537,7 +643,22 @@ Output: } } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTransactionDetails/') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTransactionDetails/'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Latest Blocks details Get information about latest blocks ``` @@ -655,7 +776,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getLatestBlockDetails') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getLatestBlockDetails'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Latest Transactions details Get information about latest transactions ``` @@ -808,6 +944,22 @@ Output: "result": "ok" } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getLatestTransactionDetails') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getLatestTransactionDetails'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` ### Latest Block Transactions Get information about block transactions ``` @@ -898,3 +1050,19 @@ Output: } ``` +Python example code +``` +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getBlockTransactions/') +if response.status_code == 200: + json_response = response.json() +elif response.status_code == 404: + print('Not Found.') +``` + +Javascript example code +``` +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getBlockTransactions/'){ + .then(response => response.json()) + .then(data => console.log(data)); +} +``` From e95cc43d91d23aee14250a9d3bbe0ef25b7fe75e Mon Sep 17 00:00:00 2001 From: Shivam Pandey Date: Sun, 27 Jun 2021 14:23:01 +0530 Subject: [PATCH 10/10] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 75a0cbd..3586388 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenList'){ ### Information about a token Get information about a token on the FLO blockchain ``` - /api/v1.0/getTokenInfo?token=rmt + /api/v1.0/getTokenInfo? ``` Output: ``` @@ -87,7 +87,7 @@ Output: Python example code ``` -response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=rmt') +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?') if response.status_code == 200: json_response = response.json() elif response.status_code == 404: @@ -96,7 +96,7 @@ elif response.status_code == 404: Javascript example code ``` -fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=rmt'){ +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?'){ .then(response => response.json()) .then(data => console.log(data)); } @@ -105,7 +105,7 @@ fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=rmt'){ ### Information about a token's transactions Get information about a token's related transactions on the blockchain ``` - /api/v1.0/getTokenTransactions?token=rmt + /api/v1.0/getTokenTransactions? ``` Optional URL parameters : senderFloAddress @@ -136,7 +136,7 @@ Output: Python example code ``` -response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt') +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?') if response.status_code == 200: json_response = response.json() elif response.status_code == 404: @@ -145,7 +145,7 @@ elif response.status_code == 404: Javascript example code ``` -fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt'){ +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?'){ .then(response => response.json()) .then(data => console.log(data)); } @@ -153,7 +153,7 @@ fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenTransactions?token=rmt ### Information about a token's address balances Get information about a token's address balances ``` - /api/v1.0/getTokenBalances?token=rmt + /api/v1.0/getTokenBalances? ``` Output: @@ -178,7 +178,7 @@ Output: ``` Python example code ``` -response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?token=rmt') +response = requests.get('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?') if response.status_code == 200: json_response = response.json() elif response.status_code == 404: @@ -187,7 +187,7 @@ elif response.status_code == 404: Javascript example code ``` -fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?token=rmt'){ +fetch('https://ranchimallflo.duckdns.org/api/v1.0/getTokenBalances?'){ .then(response => response.json()) .then(data => console.log(data)); }