Skip to content

Commit fcdb918

Browse files
committed
fix: configure helius endpoint credentials through env variables
1 parent 570ca02 commit fcdb918

File tree

3 files changed

+34
-50
lines changed

3 files changed

+34
-50
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Helius RPC API Configuration
2+
# Optional: Helius RPC API key for enhanced Solana RPC performance
3+
# If not provided, the app will fall back to public Solana RPC endpoints
4+
# Get your API key from: https://www.helius.dev/
5+
HELIUS_API_KEY=your_helius_api_key_here

playground/multichain-react/README.md

Lines changed: 21 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,37 @@ A test dapp for the MetaMask Multichain API.
66

77
`yarn`
88

9-
## Usage
10-
11-
To start the development server:
12-
13-
`yarn start`
14-
15-
This will launch the test dapp, allowing you to interact with the MetaMask Multichain API.
16-
17-
## Contributing
18-
19-
#### This project uses the [MetaMask Module Template](https://github.com/MetaMask/metamask-module-template)
20-
21-
### Setup
22-
23-
- Install the current LTS version of [Node.js](https://nodejs.org)
24-
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm install` will install the latest version and running `nvm use` will automatically choose the right node version for you.
25-
- Install [Yarn](https://yarnpkg.com) v4 via [Corepack](https://github.com/nodejs/corepack?tab=readme-ov-file#how-to-install)
26-
- Run `yarn install` to install dependencies and run any required post-install scripts
9+
## Configuration
2710

28-
### Testing and Linting
11+
### Environment Variables
2912

30-
Run `yarn test` to run the tests once. To run tests on file changes, run `yarn test:watch`.
13+
This project supports optional environment variables for enhanced functionality:
3114

32-
Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.
15+
#### Helius RPC API Key (Optional)
16+
For improved Solana RPC performance, you can configure a Helius API key:
3317

34-
### Release & Publishing
18+
1. Copy the example environment file:
19+
```bash
20+
cp .env.example .env.local
21+
```
3522

36-
The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) are used to automate the release process; see those repositories for more information about how they work.
23+
2. Get a free API key from [Helius](https://www.helius.dev/)
3724

38-
1. Choose a release version.
25+
3. Add your API key to `.env.local`:
26+
```
27+
HELIUS_API_KEY=your_actual_api_key_here
28+
```
3929

40-
- The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See [the SemVer specification](https://semver.org/) for more information.
30+
**Note:** If no Helius API key is provided, the app will automatically fall back to public Solana RPC endpoints.
4131

42-
2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. `1.x` for a `v1` backport release).
43-
44-
- The major version branch should be set to the most recent release with that major version. For example, when backporting a `v1.0.2` release, you'd want to ensure there was a `1.x` branch that was set to the `v1.0.1` tag.
45-
46-
3. Trigger the [`workflow_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) event [manually](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) for the `Create Release Pull Request` action to create the release PR.
47-
48-
- For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value).
49-
- This should trigger the [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) workflow to create the release PR.
50-
51-
4. Update the changelog to move each change entry into the appropriate change category ([See here](https://keepachangelog.com/en/1.0.0/#types) for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package.
52-
53-
- Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
54-
- Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).
55-
- Consolidate related changes into one change entry if it makes it easier to explain.
56-
- Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted.
57-
58-
5. Review and QA the release.
32+
## Usage
5933

60-
- If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it's probably best to avoid merging other PRs into the base branch while review is underway.
34+
To start the development server:
6135

62-
6. Squash & Merge the release.
36+
`yarn start`
6337

64-
- This should trigger the [`action-publish-release`](https://github.com/MetaMask/action-publish-release) workflow to tag the final release commit and publish the release on GitHub.
38+
This will launch the test dapp, allowing you to interact with the MetaMask Multichain API.
6539

66-
7. Publish the release on npm.
40+
## Contributing
6741

68-
- Wait for the `publish-release` GitHub Action workflow to finish. This should trigger a second job (`publish-npm`), which will wait for a run approval by the [`npm publishers`](https://github.com/orgs/MetaMask/teams/npm-publishers) team.
69-
- Approve the `publish-npm` job (or ask somebody on the npm publishers team to approve it for you).
70-
- Once the `publish-npm` job has finished, check npm to verify that it has been published.
42+
#### This project uses the [MetaMask Module Template](https://github.com/MetaMask/metamask-module-template)

playground/multichain-react/src/helpers/solana-method-signatures.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ import { FEATURED_NETWORKS } from "../constants/networks";
88
window.Buffer = Buffer;
99

1010
const SOLANA_RPC_CONFIG = {
11-
endpoints: ["https://api.helius-rpc.com/?api-key=15319146-89d5-4685-a3c4-811991e5212f", "https://api.devnet.solana.com", "https://api.mainnet-beta.solana.com"],
11+
endpoints: [
12+
...(process.env.HELIUS_API_KEY
13+
? [`https://api.helius-rpc.com/?api-key=${process.env.HELIUS_API_KEY}`]
14+
: []
15+
),
16+
"https://api.devnet.solana.com",
17+
"https://api.mainnet-beta.solana.com"
18+
],
1219
commitment: "confirmed" as Commitment,
1320
fallbackBlockhash: "EETubP5AKHgjPAhzPAFcb8BAY1hMH639CWCFTqi3hq1k",
1421
};

0 commit comments

Comments
 (0)