Skip to content

Commit 839bb6f

Browse files
committed
add doppler scripts
1 parent d37d194 commit 839bb6f

File tree

7 files changed

+51
-12
lines changed

7 files changed

+51
-12
lines changed

.env.template

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@ CORS_ORIGIN="http://localhost:*" # Allowed CORS origin, adjust as necessary
1010
COMMON_RATE_LIMIT_WINDOW_MS="1000" # Window size for rate limiting (ms)
1111
COMMON_RATE_LIMIT_MAX_REQUESTS="20" # Max number of requests per window per IP
1212

13-
# RPC
14-
RPC_URL_1="" # mainnet
15-
RPC_URL_11155111="" # sepolia
16-
RPC_URL_8453="", # base
17-
RPC_URL_42161="", # arbitrum
18-
RPC_URL_80084="" # bartio
19-
RPC_URL_31337="" # foundry
13+
# RPCs
14+
# mainnet
15+
RPC_URL_1=""
16+
# sepolia
17+
RPC_URL_11155111=""
18+
# base
19+
RPC_URL_8453=""
20+
# arbitrum
21+
RPC_URL_42161=""
22+
# bartio
23+
RPC_URL_80084=""
24+
# foundry
25+
RPC_URL_31337=""
26+
27+
# Provider API keys
28+
LIFI_API_KEY=""
29+
ONEINCH_API_KEY=""
30+
PENDLE_API_KEY=""

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "euler-swap-api",
33
"version": "1.0.0",
4-
"description": "API for fetching swap quotes and building swap TXs for Euler V2",
4+
"description": "API for fetching swap quotes and building swap txs for Euler V2",
55
"author": "Euler labs",
66
"repository": "euler-xyz/euler-swap-api",
77
"license": "MIT",

scripts/dopplerLogin.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# colors calculation -> https://stackoverflow.com/a/43204824/6719761
3+
4+
YELLOW=`tput setaf 3`
5+
BOLD=`tput bold`
6+
RESET=`tput sgr0`
7+
8+
doppler login
9+
EXITCODE=$?
10+
11+
# Error 127 is thrown when doppler is not installed | command not found
12+
if [ "$EXITCODE" = "127" ]; then
13+
echo "${YELLOW}${BOLD}Doppler CLI is probably not installed. Please go to https://docs.doppler.com/docs/install-cli and follow the instructions for your OS.${RESET}"
14+
exit $EXITCODE
15+
fi

scripts/dopplerSync.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
TOKENS=("local")
3+
PROJECT_NAME="euler-swap-api"
4+
5+
6+
for TOKEN in ${TOKENS[@]}; do
7+
# Download secrets and store them in a temporary file
8+
doppler setup -p $PROJECT_NAME --config $TOKEN && doppler secrets download --no-file --format env > .env.${TOKEN}
9+
done
10+
11+
# .env.${ENV/-/.} => ${string/substring/replacement} | replaces the - with a dot.
12+
# In doppler UI those can't use dots in the env naming but locally we want them

src/common/utils/envConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ export const env = cleanEnv(process.env, {
99
choices: ["development", "production", "test"],
1010
}),
1111
HOST: host({ devDefault: testOnly("localhost") }),
12-
PORT: port({ devDefault: testOnly(3000) }),
13-
CORS_ORIGIN: str({ devDefault: testOnly("http://localhost:3000") }),
12+
PORT: port({ devDefault: testOnly(3001) }),
13+
CORS_ORIGIN: str({ devDefault: testOnly("http://localhost:3001") }),
1414
COMMON_RATE_LIMIT_MAX_REQUESTS: num({ devDefault: testOnly(1000) }),
1515
COMMON_RATE_LIMIT_WINDOW_MS: num({ devDefault: testOnly(1000) }),
16+
// TODO
1617
})

src/swap/quoters/quoter1Inch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function fetch1InchQuote(
2121

2222
const url = `https://api.1inch.dev/swap/v6.0/${swapParams.chainId}/swap?${params.toString()}`
2323
const requestHeaders = new Headers()
24-
requestHeaders.set("Authorization", `Bearer ${process.env.ONEINCH_KEY}`)
24+
requestHeaders.set("Authorization", `Bearer ${process.env.ONEINCH_API_KEY}`)
2525
const response = await fetch(url, { headers: requestHeaders })
2626

2727
if (!response.ok) {

src/swap/strategies/strategyBalmySDK.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class StrategyBalmySDK {
6262
},
6363
custom: {
6464
"1inch": {
65-
apiKey: String(process.env.ONEINCH_KEY),
65+
apiKey: String(process.env.ONEINCH_API_KEY),
6666
},
6767
"li-fi": {
6868
apiKey: String(process.env.LIFI_API_KEY),

0 commit comments

Comments
 (0)