Skip to content
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

Feat/translate block #12

Merged
merged 2 commits into from
Jul 19, 2023
Merged
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
122 changes: 122 additions & 0 deletions rpc_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash


echo "////////////////////////////////////////GET_TRANSACTION_RECEIPT//////////////////////////////////////////////"


# Faire la première requête curl
response1=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionReceipt","params":["0x585a43c4df382ff17bc6079c2747dc017fe71d0aca9c34cac890b835e90786e"],"id":0}' \
http://127.0.0.1:9956/ | jq '.')

# Faire la deuxième requête curl
response2=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionReceipt","params":["0x585a43c4df382ff17bc6079c2747dc017fe71d0aca9c34cac890b835e90786e"],"id":0}' \
https://starknet-mainnet.g.alchemy.com/v2/hnj_DGevqpyoyeoEs9Vfx-6qSTHOnaIu | jq '.')

# Extraire les champs pour comparaison
fields=$(echo "$response1" | jq -r '.result | keys[]')

# Comparer les champs et afficher les différences
diff_output=""

for field in $fields; do
value1=$(echo "$response1" | jq -r ".result.$field")
value2=$(echo "$response2" | jq -r ".result.$field")
diff_output=$(diff -u <(echo "$value1") <(echo "$value2") | colordiff)
if [ -z "$diff_output" ]; then
echo ""
else
echo "$field"
echo "$diff_output"
fi
done


echo "////////////////////////////////////////////GET_TRANSACTION_BY_HASH//////////////////////////////////////////"

# Faire la première requête curl
response1=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionByHash","params":["0x585a43c4df382ff17bc6079c2747dc017fe71d0aca9c34cac890b835e90786e"],"id":0}' \
http://127.0.0.1:9956/ | jq '.')

# Faire la deuxième requête curl
response2=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionByHash","params":["0x585a43c4df382ff17bc6079c2747dc017fe71d0aca9c34cac890b835e90786e"],"id":0}' \
https://starknet-mainnet.g.alchemy.com/v2/hnj_DGevqpyoyeoEs9Vfx-6qSTHOnaIu | jq '.')

# Extraire les champs pour comparaison
fields=$(echo "$response1" | jq -r '.result | keys[]')

# Comparer les champs et afficher les différences
diff_output=""

for field in $fields; do
value1=$(echo "$response1" | jq -r ".result.$field")
value2=$(echo "$response2" | jq -r ".result.$field")
diff_output=$(diff -u <(echo "$value1") <(echo "$value2") | colordiff)
if [ -z "$diff_output" ]; then
echo ""
else
echo "$field"
echo "$diff_output"
fi
done


echo "////////////////////////////////////////////CHAIN ID//////////////////////////////////////////"

# Faire la première requête curl
response1=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_chainId","id":0}' \
http://127.0.0.1:9956/ | jq '.')

# Faire la deuxième requête curl
response2=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_chainId","id":0}' \
https://starknet-mainnet.g.alchemy.com/v2/hnj_DGevqpyoyeoEs9Vfx-6qSTHOnaIu | jq '.')


# Comparer les champs et afficher les différences
diff_output=""

diff_output=$(diff -u <(echo "$response1") <(echo "$response2") | colordiff)
echo "$diff_output"

echo "////////////////////////////////////////////GET_TRANSACTION_BY_BLOCKID_AND_INDEX//////////////////////////////////////////"

# Faire la première requête curl
response1=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionByBlockIdAndIndex","params":[{"block_number": 9100}, 4],"id":0}' \
http://127.0.0.1:9956/ | jq '.')

# Faire la deuxième requête curl
response2=$(curl -s -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"starknet_getTransactionByBlockIdAndIndex","params":[{"block_number": 9100}, 4],"id":0}' \
https://starknet-mainnet.g.alchemy.com/v2/hnj_DGevqpyoyeoEs9Vfx-6qSTHOnaIu | jq '.')

# Extraire les champs pour comparaison
fields=$(echo "$response1" | jq -r '.result | keys[]')

# Comparer les champs et afficher les différences
diff_output=""

for field in $fields; do
value1=$(echo "$response1" | jq -r ".result.$field")
value2=$(echo "$response2" | jq -r ".result.$field")
diff_output=$(diff -u <(echo "$value1") <(echo "$value2") | colordiff)
if [ -z "$diff_output" ]; then
echo ""
else
echo "$field"
echo "$diff_output"
fi
done