Skip to content

Commit

Permalink
Merge pull request #402 from hummingbot/development
Browse files Browse the repository at this point in the history
sync / gateway development -> staging v2.3.0
  • Loading branch information
rapcmia authored Jan 30, 2025
2 parents 52dcf08 + 3732b57 commit 3f3715a
Show file tree
Hide file tree
Showing 1,971 changed files with 85,172 additions and 284,135 deletions.
43 changes: 0 additions & 43 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Bug Report
description: Create a bug report to help us improve
title: "Bug Report"
labels: bug
body:
- type: markdown
attributes:
value: |
## **Before Submitting:**
* Please edit the "Bug Report" to the title of the bug or issue
* Please make sure to look on our GitHub issues to avoid duplicate tickets
* You can add additional `Labels` to support this ticket (connectors, strategies, etc)
* If this is something to do with installation and how to's we would recommend to visit our [Hummingbot docs](https://hummingbot.org/docs/) and [Discord server](https://discord.gg/hummingbot)
- type: textarea
id: what-happened
attributes:
label: Describe the bug
description: A clear and concise description of the bug or issue. Please make sure to add screenshots and error message to help us investigate
placeholder: Tell us what happened?
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: A concise description of the steps to reproduce the buggy behavior
value: |
1.
2.
3.
validations:
required: true
- type: input
id: version
attributes:
label: Release version
description: Include your bot version number (Can be found at the upper left corner of your CLI)
validations:
required: true
- type: dropdown
id: build
attributes:
label: Type of installation
description: What type of installation did you use?
options:
- Source
- Docker
validations:
required: true
- type: textarea
id: attachment
attributes:
label: Attach required files
description: Please attach your config file and log file located on the "../gateway/logs/" folder. It would be really helpful to triage the issue.
validations:
required: false
28 changes: 0 additions & 28 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Feature request
description: Suggest an idea that will improve the Hummingbot codebase
title: "Feature Request"
labels: enhancement
body:
- type: markdown
attributes:
value: |
## **Before Submitting:**
* Please edit the "Feature Request" to the title of the feature
* Please make sure to look on our GitHub issues to avoid duplicate tickets
* You can add additional `Labels` to support this ticket (connectors, strategies, etc)
* If this is something to do with installation and how to's we would recommend to visit our [Discord server](https://discord.gg/hummingbot) and [Hummingbot docs](https://hummingbot.org/docs/)
- type: textarea
id: feature-suggestion
attributes:
label: Feature Suggestion
description: A clear and concise description of the feature request. If you have looked at the code and know exactly what code changes are needed then please consider submitting a pull request instead.
placeholder: How you want to achieve the desired behavior
validations:
required: true
- type: textarea
id: feature-impact
attributes:
label: Impact
description: A succinct description of why you want the desired behavior specified above.
placeholder: The desired behavior will allow me to..
validations:
required: true
- type: textarea
id: feature-additional-context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here (optional)
6 changes: 2 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,15 @@ jobs:
mkdir conf db
cp -rf src/templates/* conf
sed -i 's|/home/gateway/conf/lists/|conf/lists/|g' ./conf/*.yml
sed -i 's/https:\/\/rpc.ankr.com\/eth_goerli/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
sed -i 's/https:\/\/etc.rivet.link/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum-classic.yml
sed -i 's/https:\/\/rpc.ankr.com\/eth_sepolia/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
- name: Run unit test coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
git fetch --all -q
git checkout -b $GITHUB_SHA
NODE_OPTIONS=--max-old-space-size=10240 node ./node_modules/.bin/jest --runInBand --coverage ./test/
# git diff origin/$GITHUB_BASE_REF | yarn diff-test-coverage -c ./coverage/lcov.info -t lcov -b 50 -l 60
GATEWAY_TEST_MODE=dev ./node_modules/.bin/jest --runInBand --coverage ./test/
docker_build_and_push:
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ package-lock.json
.history

# Yarn
yarn-error.log
yarn-error.log

# Larp
.env
15 changes: 0 additions & 15 deletions .postman/api

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Gateway may be used alongside the main [Hummingbot client](https://github.com/hu

## Installation via Docker

If you are installing Gateway alongside Hummingbot, check out the [Deploy Examples](https://github.com/hummingbot/deploy-examples) repository that helps you deploy various types of Hummingbot and Gateway configurations. For most new users, we recommend following the [Hummingbot Gateway Compose](https://github.com/hummingbot/deploy-examples/tree/main/hummingbot_gateway_compose) deployment.
If you are installing Gateway alongside Hummingbot, check out the [Deploy Examples](https://github.com/hummingbot/deploy-examples) repository that helps you deploy various types of Hummingbot and Gateway configurations. For most new users, we recommend following the [Hummingbot Gateway Compose](https://hummingbot.org/gateway/installation/) deployment.

The repo also contains [Bash Scripts](https://github.com/hummingbot/deploy-examples/tree/main/bash_scripts#gateway) that help you install the Gateway Docker image on a standalone basis.

Expand Down Expand Up @@ -71,7 +71,7 @@ There are a number of ways to contribute to gateway.

### Configuration

- If you want to turn off `https`, set `unsafeDevModeWithHTTP` to `true` in [conf/server.yml](./conf/server.yml).
- To run in HTTP mode (for development), use `yarn start --dev`. By default, Gateway runs in secure HTTPS mode.

- If you want Gateway to log to standard out, set `logToStdOut` to `true` in [conf/server.yml](./conf/server.yml).

Expand Down Expand Up @@ -131,3 +131,4 @@ You can run the prettifier before committing with:
yarn run prettier
```


135 changes: 135 additions & 0 deletions add-token.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

SCRIPT_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

prompt_proceed() {
read -p "Do you want to proceed? [Y/N] >>> " PROCEED
if [ "$PROCEED" == "" ]; then
prompt_proceed
else
if [[ "$PROCEED" != "Y" && "$PROCEED" != "y" ]]; then
PROCEED="N"
fi
fi
}

validate_address() {
if [[ ! "$1" =~ ^0x[a-fA-F0-9]{40}$ ]]; then
return 1
fi
return 0
}

validate_decimals() {
if [[ ! "$1" =~ ^[0-9]+$ ]] || [ "$1" -lt 1 ] || [ "$1" -gt 18 ]; then
return 1
fi
return 0
}

add_token() {
INPUT_PATH=$1

# Check if input file exists
if [ ! -f "$INPUT_PATH" ]; then
echo "Error: Input file $INPUT_PATH does not exist"
exit 1
fi

# Get chainId from existing tokens
CHAIN_ID=$(jq -r '.[0].chainId' "$INPUT_PATH")
if [ -z "$CHAIN_ID" ] || [ "$CHAIN_ID" = "null" ]; then
echo "Error: Could not determine chainId from existing tokens"
exit 1
fi

# Prompt for token details
while true; do
read -p "Enter token address (0x...) >>> " ADDRESS
if validate_address "$ADDRESS"; then
# Check for duplicate address
if jq -e --arg addr "$ADDRESS" '.[] | select(.address == $addr)' "$INPUT_PATH" > /dev/null; then
echo "Error: Token with this address already exists"
continue
fi
break
else
echo "Error: Invalid address format. Must be 0x followed by 40 hex characters"
fi
done

while true; do
read -p "Enter token symbol >>> " SYMBOL
if [ -z "$SYMBOL" ]; then
echo "Error: Symbol is required"
continue
fi
# Check for duplicate symbol
if jq -e --arg sym "$SYMBOL" '.[] | select(.symbol == $sym)' "$INPUT_PATH" > /dev/null; then
echo "Error: Token with this symbol already exists"
continue
fi
break
done

read -p "Enter token name (press Enter to use symbol) >>> " NAME
NAME=${NAME:-$SYMBOL}

while true; do
read -p "Enter token decimals (1-18) >>> " DECIMALS
if validate_decimals "$DECIMALS"; then
break
else
echo "Error: Decimals must be a number between 1 and 18"
fi
done

# Create new token JSON
NEW_TOKEN=$(cat <<EOF
{
"chainId": $CHAIN_ID,
"address": "$ADDRESS",
"symbol": "$SYMBOL",
"name": "$NAME",
"decimals": $DECIMALS
}
EOF
)

# Show confirmation
echo
echo "Review new token entry:"
echo "$NEW_TOKEN" | jq .
echo

prompt_proceed
if [[ "$PROCEED" == "Y" || "$PROCEED" == "y" ]]; then
# Add new token to list
jq --argjson newToken "$NEW_TOKEN" '. + [$newToken]' "$INPUT_PATH" > "${INPUT_PATH}.tmp"
mv "${INPUT_PATH}.tmp" "$INPUT_PATH"
echo "Token successfully added to $INPUT_PATH"
else
echo "Operation cancelled"
exit 1
fi
}

# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed."
echo "Please install jq first:"
echo " Ubuntu/Debian: sudo apt-get install jq"
echo " MacOS: brew install jq"
exit 1
fi

echo
echo
echo "=============== ADD TOKEN TO LIST ==============="
echo
echo

# Get input path
read -p "Enter path to the token list file >>> " INPUT_PATH

add_token "$INPUT_PATH"
Loading

0 comments on commit 3f3715a

Please sign in to comment.