Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/core-connectors #380

Merged
merged 92 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
4b57984
(fix) remove non-core connectors
fengtality Jan 1, 2025
223f79b
added larp
fengtality Jan 2, 2025
e3e8dc3
removed deps
fengtality Jan 2, 2025
b2a2baf
replace express with fastify
fengtality Jan 2, 2025
eb8fd0b
use response obj in routes
fengtality Jan 3, 2025
8adbb10
use approve and allowance responses
fengtality Jan 3, 2025
48d0e75
use fastify swagger
fengtality Jan 3, 2025
8ed23b7
moved wallet folder
fengtality Jan 3, 2025
753ab38
(fix) available networks
fengtality Jan 3, 2025
1725748
misc cleanups
fengtality Jan 4, 2025
18e46d5
Fix code scanning alert no. 30: Missing rate limiting
fengtality Jan 4, 2025
1b39bf2
Revert "Fix code scanning alert no. 30: Missing rate limiting"
fengtality Jan 5, 2025
1bb14b7
skip confirm by address, add logging
fengtality Jan 9, 2025
6f015d8
refactor fee calcs
fengtality Jan 10, 2025
7904c49
fixed poll
fengtality Jan 10, 2025
6182519
removed larp
fengtality Jan 10, 2025
53fd964
Merge branch 'development' into core
fengtality Jan 10, 2025
d559c09
removed legacy solana code
fengtality Jan 10, 2025
0601688
finish removing legacy code
fengtality Jan 10, 2025
e6e3af1
(wip) refactored fee calcs
fengtality Jan 11, 2025
54ab926
correct jupiter fees
fengtality Jan 11, 2025
ce33947
improved fee stepup
fengtality Jan 11, 2025
4bc5bd2
fee config values in solana template
fengtality Jan 11, 2025
c4efec5
clean up jupiter configs
fengtality Jan 11, 2025
503234c
add balance check to jupiter trade
fengtality Jan 11, 2025
067123c
add tx simulation
fengtality Jan 11, 2025
64802a5
add retry to jupiter swap obj fetch
fengtality Jan 11, 2025
ceb3506
correct gas price and limit
fengtality Jan 11, 2025
da8eb7c
removed telemetry
fengtality Jan 12, 2025
dac232b
remove legacy files
fengtality Jan 12, 2025
4a6fac3
added chain and connector specific routes
fengtality Jan 12, 2025
602c6cc
removed chain param from chain routes
fengtality Jan 12, 2025
1ba77ba
cleaned lists
fengtality Jan 12, 2025
df30655
fixed token list parsing
fengtality Jan 12, 2025
cfc0321
remove unused imports
fengtality Jan 12, 2025
3462c0c
update postman
fengtality Jan 12, 2025
4d6be4d
add jupiter swap obj error handling
fengtality Jan 13, 2025
f64f4b1
fix issue with adding ethereum wallets
fengtality Jan 13, 2025
86fd56c
remove redundant swap obj fetch in jupiter
fengtality Jan 13, 2025
907244b
fix solana and base nodeUrl
fengtality Jan 14, 2025
1732b96
refactored route structure
fengtality Jan 14, 2025
f1343ed
fixed uniswap gas fetch
fengtality Jan 14, 2025
fa62c0b
clean up swagger
fengtality Jan 14, 2025
077bb01
improve devHTTPMode and docs server
fengtality Jan 14, 2025
6f3d985
remove chain_type
fengtality Jan 15, 2025
3738b8e
update config routes
fengtality Jan 15, 2025
84fd321
better swagger info
fengtality Jan 15, 2025
5e58701
fix uniswap error, improve app
fengtality Jan 15, 2025
61ecccf
clean up connector typing
fengtality Jan 15, 2025
1b9f7a4
fix typing for config routes
fengtality Jan 15, 2025
3fd4937
improve docs for connectors, config
fengtality Jan 16, 2025
023af47
fixed wallet routes
fengtality Jan 16, 2025
7fd1509
expand eth token lists
fengtality Jan 16, 2025
7c7d4f5
added add-token script
fengtality Jan 16, 2025
a18d02e
updated solana class
fengtality Jan 17, 2025
243c884
fixed solana token list handling
fengtality Jan 17, 2025
7b423df
clean up solana
fengtality Jan 17, 2025
ce8d9f2
remove connection pool from solana
fengtality Jan 21, 2025
38df678
remove ethereumish, simplify chain
fengtality Jan 22, 2025
1642009
add bsc as ethereum network
fengtality Jan 22, 2025
40f51fa
fixed typing
fengtality Jan 22, 2025
9d80b52
add avalanche, polygon, celo
fengtality Jan 23, 2025
08bdb39
enforce stricter ts
fengtality Jan 23, 2025
8224e6f
(wip) initial meteora routes
fengtality Jan 23, 2025
b78b9b9
(wip) meteora positioned owned working
fengtality Jan 23, 2025
9c6796b
(wip) new route structure
fengtality Jan 24, 2025
4b5bd4e
add fastify type
fengtality Jan 24, 2025
f76f07a
improve init
fengtality Jan 24, 2025
274a75c
working meteora routes using new structure
fengtality Jan 25, 2025
09e62ef
added execute swap route
fengtality Jan 25, 2025
8e52874
fixed active bins
fengtality Jan 25, 2025
ccd66ad
all meteora endpoints from larp
fengtality Jan 25, 2025
577c34e
better logging for tx landing
fengtality Jan 25, 2025
bb2210f
improve route params
fengtality Jan 25, 2025
ab335f1
add default wallet to fees
fengtality Jan 25, 2025
40147b9
fix solana tx send
fengtality Jan 25, 2025
3ce3ef8
Merge branch 'development' into core
fengtality Jan 26, 2025
1c77f9b
open and close position are now smarter
fengtality Jan 26, 2025
c3bcf32
Merge branch 'core' of github.com:hummingbot/gateway into core
fengtality Jan 26, 2025
bd3f006
simplified meteora
fengtality Jan 26, 2025
8661331
express fees in sol
fengtality Jan 26, 2025
c08da0f
fixed sendAndConfirm
fengtality Jan 26, 2025
9f8b2a0
fixed priority fees
fengtality Jan 26, 2025
0408927
improve comments
fengtality Jan 26, 2025
a72ea11
update base fee var name
fengtality Jan 26, 2025
a8b8d71
changed WMATIC to WPOL
fengtality Jan 28, 2025
c1a9b53
update version number
fengtality Jan 28, 2025
bf7ecb4
Merge branch 'development' into core
rapcmia Jan 28, 2025
c1adcbf
fixed some tests
fengtality Jan 29, 2025
8a5ced3
update all tests
fengtality Jan 29, 2025
051b47e
use dev flag instead of devHTTPMode
fengtality Jan 29, 2025
be43493
update jest path
fengtality Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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).
- If you want to turn off `https`, set `devHTTPMode` to `true` in [conf/server.yml](./conf/server.yml).

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

Expand Down
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"
132 changes: 132 additions & 0 deletions clean-tokenlist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/bin/bash
# init

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

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
}

clean_token_list () {
INPUT_PATH=$1
CHAIN_ID=$2

# Create output path with _CLEANED suffix and chainId
OUTPUT_PATH="${INPUT_PATH%.*}_CLEANED${CHAIN_ID:+_$CHAIN_ID}.json"

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

# Create output directory if it doesn't exist
OUTPUT_DIR=$(dirname "$OUTPUT_PATH")
mkdir -p "$OUTPUT_DIR"

# Use jq to clean the token list and remove duplicates
jq --arg chainid "$CHAIN_ID" '
(if type == "object" then .tokens else . end) |
map({
chainId: .chainId,
name: .name,
symbol: .symbol,
address: .address,
decimals: .decimals
} | select(
.chainId != null and
($chainid == "" or .chainId == ($chainid|tonumber)) and
.name != null and
.symbol != null and
.address != null and
.decimals != null
)) as $all |

# Group by symbol and process duplicates
($all | group_by(.symbol) | map(select(length > 1)) | map({
symbol: .[0].symbol,
kept: .[0],
removed: .[1:]
})) as $duplicates |

# Output cleaned list and duplicate info
{
"tokens": ($all | unique_by(.symbol)),
"duplicates": $duplicates
}
' "$INPUT_PATH" > "${OUTPUT_PATH}.tmp"

# Extract the cleaned token list
jq '.tokens' "${OUTPUT_PATH}.tmp" > "$OUTPUT_PATH"

# Report duplicates if any exist
echo "Checking for duplicate symbols..."
DUPLICATES=$(jq -r '.duplicates[] | "Symbol: \(.symbol)\n Kept: \(.kept.address)\n Removed: \(.removed | map(.address) | join(", "))"' "${OUTPUT_PATH}.tmp")
if [ ! -z "$DUPLICATES" ]; then
echo "Found tokens with duplicate symbols:"
echo "$DUPLICATES"
else
echo "No duplicate symbols found"
fi

# Remove temporary file
rm "${OUTPUT_PATH}.tmp"

# Check if the operation was successful
if [ $? -eq 0 ]; then
echo "Token list successfully cleaned and saved to $OUTPUT_PATH"
else
echo "Error cleaning token list"
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 "=============== CLEAN TOKEN LIST ==============="
echo
echo

# Get input path and chainId
read -p "Enter path to the raw token list file >>> " INPUT_PATH
read -p "Enter chainId to filter (leave blank for all chains) >>> " CHAIN_ID

# Set output path using TEMPLATE_DIR
OUTPUT_PATH="$TEMPLATE_DIR/lists/token_list.json"

# Ask user to confirm and proceed
echo
echo "ℹ️ Confirm if this is correct:"
echo
printf "%30s %5s\n" "Clean token list FROM:" "$INPUT_PATH"
printf "%30s %5s\n" "Filter for chainId:" "$CHAIN_ID"
printf "%30s %5s\n" "Save cleaned list TO:" "${INPUT_PATH%.*}_CLEANED.json"
echo

prompt_proceed
if [[ "$PROCEED" == "Y" || "$PROCEED" == "y" ]]
then
clean_token_list "$INPUT_PATH" "$CHAIN_ID"
else
echo "Exiting..."
exit
fi
Loading
Loading