From d91882207e2d739829d9b5607d6e13e18299f3bb Mon Sep 17 00:00:00 2001 From: FiveMovesAhead Date: Wed, 26 Feb 2025 23:35:27 +0800 Subject: [PATCH] Fix scripts. --- scripts/list_algorithms.sh | 2 +- scripts/list_block_benchmark_ids.sh | 2 +- scripts/list_players.sh | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/list_algorithms.sh b/scripts/list_algorithms.sh index bdbe2c8a..a4c9d74e 100644 --- a/scripts/list_algorithms.sh +++ b/scripts/list_algorithms.sh @@ -5,7 +5,7 @@ BLOCK_ID=$(curl -s https://mainnet-api.tig.foundation/get-block | jq -r '.block. RESP=$(curl -s "https://mainnet-api.tig.foundation/get-algorithms?block_id=$BLOCK_ID") ALGORITHMS=$(echo $RESP | jq -c '.algorithms[]' | jq -s 'sort_by(.id)') -WASMS_DICT=$(echo $RESP | jq -c '[.wasms[] | {key: .algorithm_id, value: .}] | from_entries') +WASMS_DICT=$(echo $RESP | jq -c '[.binarys[] | {key: .algorithm_id, value: .}] | from_entries') for ALGO in $(echo $ALGORITHMS | jq -c '.[]'); do ID=$(echo $ALGO | jq -r '.id') diff --git a/scripts/list_block_benchmark_ids.sh b/scripts/list_block_benchmark_ids.sh index 68a718a3..697dbf05 100644 --- a/scripts/list_block_benchmark_ids.sh +++ b/scripts/list_block_benchmark_ids.sh @@ -1,3 +1,3 @@ #!/bin/bash set -e -curl -s https://mainnet-api.tig.foundation/get-block?include_data | jq -r '.block.data.active_benchmark_ids[]' | nl \ No newline at end of file +curl -s https://mainnet-api.tig.foundation/get-block?include_data | jq -r '.block.data.active_ids.benchmark[]' | nl \ No newline at end of file diff --git a/scripts/list_players.sh b/scripts/list_players.sh index 674ee4c6..6f4f56e3 100644 --- a/scripts/list_players.sh +++ b/scripts/list_players.sh @@ -2,13 +2,12 @@ set -e BLOCK_ID=$(curl -s https://mainnet-api.tig.foundation/get-block | jq -r '.block.id') -RESP=$(curl -s "https://mainnet-api.tig.foundation/get-players?player_type=benchmarker&block_id=$BLOCK_ID") +RESP=$(curl -s "https://mainnet-api.tig.foundation/get-opow?block_id=$BLOCK_ID") -PLAYERS=$(echo $RESP | jq -c '[.players[] | .block_data.reward = (if .block_data.reward == null then 0 else (.block_data.reward | tonumber) end)] | sort_by(.block_data.reward) | reverse') +PLAYERS=$(echo $RESP | jq -c '[.opow[] | .block_data.reward = (if .block_data.reward == null then 0 else (.block_data.reward | tonumber) end)] | sort_by(.block_data.reward) | reverse') for PLAYER in $(echo $PLAYERS | jq -c '.[]'); do - ID=$(echo $PLAYER | jq -r '.id') - ROUND_EARNINGS=$(echo $PLAYER | jq -r '.block_data.round_earnings | tonumber / 1e18') + ID=$(echo $PLAYER | jq -r '.player_id') REWARD=$(echo $PLAYER | jq -r '.block_data.reward | if . == null then "null" else tonumber / 1e18 end') - printf "Player ID: %-25s Round Earnings: %-20s Reward: %-20s\n" "$ID" "$ROUND_EARNINGS" "$REWARD" + printf "Player ID: %-25s Reward: %-20s\n" "$ID" "$REWARD" done \ No newline at end of file