CHAINCODE_SOURCE_DIR=$1
CHAINCODE_METADATA_DIR=$2
>&2 echo "Detect"
TYPE=$(tr -d '\n' < "$CHAINCODE_METADATA_DIR/metadata.json" | awk -F':' '{ for (i = 1; i < NF; i++){ if ($i~/type/) { print $(i+1); break }}}'| cut -d\" -f2)
>&2 echo "$TYPE"
if [ "$TYPE" = "rust" ]; then
>&2 echo "Successfull detected rust"
exit 0
fi
if [ "$TYPE" = "binary" ]; then
>&2 echo "Successfull detected binary"
exit 0
fi
exit 1