Fix scripts.
Some checks failed
Test Workspace / Test Workspace (push) Has been cancelled

This commit is contained in:
FiveMovesAhead 2025-02-26 23:35:27 +08:00
parent 136dd3fd8e
commit d91882207e
3 changed files with 6 additions and 7 deletions

View File

@ -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')

View File

@ -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
curl -s https://mainnet-api.tig.foundation/get-block?include_data | jq -r '.block.data.active_ids.benchmark[]' | nl

View File

@ -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