forked from helius-labs/helius-rpc-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c909713
Showing
13 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
tab_width = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.yml] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build | ||
on: | ||
push: | ||
pull_request: | ||
repository_dispatch: | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Publish | ||
uses: cloudflare/[email protected] | ||
with: | ||
apiToken: ${{ secrets.CF_API_TOKEN }} | ||
env: | ||
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.DS_Store | ||
/node_modules | ||
*-lock.* | ||
*.lock | ||
*.log | ||
|
||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"semi": true, | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"bracketSpacing": true, | ||
"insertPragma": false, | ||
"requirePragma": false, | ||
"jsxSingleQuote": false, | ||
"bracketSameLine": false, | ||
"embeddedLanguageFormatting": "auto", | ||
"htmlWhitespaceSensitivity": "css", | ||
"vueIndentScriptAndStyle": true, | ||
"quoteProps": "consistent", | ||
"proseWrap": "preserve", | ||
"trailingComma": "es5", | ||
"arrowParens": "avoid", | ||
"useTabs": true, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Helius RPC Proxy | ||
|
||
> NOTE: You must have an existing Helius account and API key for this to work! Get one for free at https://helius.xyz. | ||
This repo hosts a one-click-deploy Cloudflare worker that proxies RPC requests to Helius. | ||
|
||
|
||
## Step 1 | ||
|
||
Press the button below to deploy this to your own Cloudflare account: | ||
|
||
[](https://deploy.workers.cloudflare.com/?url=https://github.com/helius-labs/helius-rpc-proxy) | ||
|
||
## Step 2 | ||
|
||
Navigate to your newly deployed worker, and click "Settings" and then "Variables": | ||
 | ||
|
||
## Step 3 | ||
Add a new variable with the key name `HELIUS_API_KEY` and your Helius API key as the value: | ||
 | ||
|
||
***NOTE:*** We recommend selecting "Encrypt". This will hide your key from the UI and API responses, and redact them from logs. | ||
 | ||
|
||
## Step 4 | ||
Refresh the page and confirm that your key is now saved and encrypted: | ||
 | ||
|
||
You can now use your worker URL as an the RPC endpoint in all SDK and client side configurations without your API key leaking! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"deploy": "wrangler publish src/index.ts", | ||
"dev": "wrangler dev src/index.ts --local", | ||
"test": "vitest", | ||
"start-stackblitz": "WRANGLER_SEND_METRICS=false wrangler dev src/index.ts --local" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^3.0.0", | ||
"vitest": "^0.24.5", | ||
"wrangler": "^2.1.14" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
interface Env { | ||
HELIUS_API_KEY: string; | ||
} | ||
|
||
export default { | ||
async fetch(request: Request, env: Env) { | ||
const proxyRequest = new Request(`https://rpc.helius.xyz/?api-key=${env.HELIUS_API_KEY}`, { | ||
method: request.method, | ||
headers: request.headers, | ||
body: request.body, | ||
}); | ||
|
||
return fetch(proxyRequest); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"module": "esnext", | ||
"target": "es2020", | ||
"lib": ["es2020"], | ||
"strict": true, | ||
"alwaysStrict": true, | ||
"preserveConstEnums": true, | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"types": ["@cloudflare/workers-types"] | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name = "rpc-proxy" # todo | ||
main = "./src/index.ts" | ||
compatibility_date = "2022-05-03" |