#!/bin/bash set -Eeuo pipefail BROWSER=firefox PASTE_CMD=wl-paste lg() { printf "\033[1;32m%s\033[0m\n" "$*" } debug() { printf "\033[1;34m%s\033[0m\n" "$*" >&2 } notify() { dunstify -u normal -t 3000 "$*" } get_token_name() { jq -r '.pairs[0].baseToken.name' <<< "$(curl --no-progress-meter "https://api.dexscreener.com/latest/dex/tokens/$1")" } get_ticker() { jq -r '.pairs[0].baseToken.symbol' <<< "$(curl --no-progress-meter "https://api.dexscreener.com/latest/dex/tokens/$1")" } CONTRACT_ADDRESS="$($PASTE_CMD)" if [ -z "$CONTRACT_ADDRESS" ]; then notify "No contract address in clipboard" exit 1 fi TOKEN_NAME="$(get_token_name "$CONTRACT_ADDRESS")" TICKER="$(get_ticker "$CONTRACT_ADDRESS")" lg "Opening dexscreener page for $TOKEN_NAME (\$$TICKER)" notify "Opening dexscreener page for $TOKEN_NAME (\$$TICKER)" if ! $BROWSER "https://dexscreener.com/solana/$CONTRACT_ADDRESS"; then notify "Failed to open browser tab/window" exit 1 fi