trueblocks-core
trueblocks-core copied to clipboard
chifra names: Incorporate the functionality of addName into chifra names
In order to add or edit names I use this terrible shell script:
#!/usr/bin/env bash
# addName - adds a name to the names database
defSource="Etherscan"
defDecimals=""
ADDRESS=$1
echo -n "Enter an address: "
if [[ -z ${ADDRESS} ]]
then
read ADDRESS
else
echo $ADDRESS
fi
NAME=$2
echo -n "Enter a name: "
if [[ -z ${NAME} ]]
then
read NAME
else
echo $NAME
fi
TAG=$3
echo -n "Enter a tag (def: 30-Contracts): "
if [[ -z ${TAG} ]]
then
read TAG
if [[ -z ${TAG} ]]
then
TAG="30-Contracts"
fi
else
echo $TAG
fi
SOURCE=$4
echo -n "Enter a source (def: EtherScan.io): "
if [[ -z ${SOURCE} ]]
then
read SOURCE
if [[ -z ${SOURCE} ]]
then
SOURE="EtherScan.io"
fi
else
echo $SOURCE
fi
# These will be set by querying the chain
SYMBOL=$5
DECIMALS=${6:-$defDecimals}
DESCR=$7
echo "---------------------- Adding -----------------------"
echo "Address: " $ADDRESS
echo "Name: " $NAME
echo "TAG: " $TAG
echo "SOURCE: " $SOURCE
echo "DECIMALS: " $DECIMALS
echo "SYMBOL: " $SYMBOL
echo "DESCR: " $DESCR
export TB_NAME_ADDRESS=$ADDRESS
export TB_NAME_NAME=$NAME
export TB_NAME_TAG=$TAG
export TB_NAME_SOURCE=$SOURCE
export TB_NAME_SYMBOL=$SYMBOL
export TB_NAME_DECIMALS=$DECIMALS
export TB_NAME_DESCR=$DESCR
~/.local/bin/chifra/ethNames --create
cp -pf "$HOME/Library/Application Support/TrueBlocks/names/names.tab" "$HOME/Development/trueblocks-core/src/other/install/names/names.tab"
chifra names --all --expand $ADDRESS
This was always supposed to be part of chifra, but we never added in a --add
(or --edit
) option to chifra names
. Documenting here as this will be part of the port to Go code for ethNames
.