-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve environment variable documentation (#346)
* docs: improve environment variable documentation - Add centralized environment variables guide - Add detailed format descriptions and examples - Add API key source information - Add security warnings and best practices - Update all plugin READMEs with standardized env var docs - Update example .env.template files with descriptive comments - Add environment variable validation utilities Link to Devin run: https://app.devin.ai/sessions/b6892fb4ad9347969f37b0991a89b48b Co-Authored-By: [email protected] <[email protected]> * docs: update viem env template with better descriptions Co-Authored-By: [email protected] <[email protected]> * fix: use template literal for error message Co-Authored-By: [email protected] <[email protected]> * fix: update code formatting in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix formatting in env.ts Co-Authored-By: [email protected] <[email protected]> * style: remove extra newline in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix spacing in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix indentation in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix indentation in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix indentation in env.ts Co-Authored-By: [email protected] <[email protected]> * style: fix indentation in env.ts Co-Authored-By: [email protected] <[email protected]> * style: add trailing commas to template literals Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
- Loading branch information
1 parent
181a318
commit 2741f3d
Showing
23 changed files
with
450 additions
and
18 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,89 @@ | ||
--- | ||
title: Environment Variables Guide | ||
--- | ||
|
||
# Environment Variables Guide | ||
|
||
This guide explains all environment variables used across the GOAT SDK, their purposes, and how to properly configure them. | ||
|
||
## RPC Endpoints | ||
|
||
### Ethereum/EVM | ||
- Format: `https://<network>.<provider>.com/v2/<YOUR_API_KEY>` | ||
- Examples: | ||
- Alchemy: `https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY` | ||
- Infura: `https://mainnet.infura.io/v3/YOUR-API-KEY` | ||
- Mode: `https://mainnet.mode.network` | ||
- Base: `https://mainnet.base.org` | ||
|
||
### Solana | ||
- Format: `https://api.mainnet-beta.solana.com` or provider URL | ||
- Examples: | ||
- Public RPC: `https://api.mainnet-beta.solana.com` | ||
- Alchemy: `https://solana-mainnet.g.alchemy.com/v2/YOUR-API-KEY` | ||
- GenesysGo: `https://ssc-dao.genesysgo.net` | ||
|
||
## API Keys | ||
|
||
### Chain-Specific | ||
- `ETHERSCAN_API_KEY`: Etherscan API access for transaction data | ||
- Get from: https://etherscan.io/apis | ||
- Format: 34-character string | ||
|
||
- `SOLSCAN_API_KEY`: Solana explorer access | ||
- Get from: https://public-api.solscan.io | ||
- Format: 32-character string | ||
|
||
### Protocol APIs | ||
- `ZEROEX_API_KEY`: 0x Protocol API access | ||
- Get from: https://dashboard.0x.org | ||
- Format: UUID string | ||
|
||
- `ONEINCH_API_KEY`: 1inch Protocol API access | ||
- Get from: https://portal.1inch.dev | ||
- Format: 32-character string | ||
|
||
- `COINGECKO_API_KEY`: Coingecko market data access | ||
- Get from: https://www.coingecko.com/api/pricing | ||
- Format: 32-character string | ||
|
||
- `UNISWAP_API_KEY`: Uniswap API access | ||
- Get from: https://docs.uniswap.org/api/quickstart | ||
- Format: 32-character string | ||
|
||
### Wallet Configuration | ||
- `WALLET_PRIVATE_KEY`: EVM wallet private key | ||
- Format: 64-character hex string with '0x' prefix | ||
- Example: `0x1234...5678` | ||
- ⚠️ Never share or commit your private key | ||
|
||
- `SOLANA_PRIVATE_KEY`: Solana wallet private key | ||
- Format: Base58 encoded string | ||
- Example: `4vJ9JU1bJJE96FbxRF5ukBwwYHFJ2nWPiCSz4TWxWqbf` | ||
- ⚠️ Never share or commit your private key | ||
|
||
- `WALLET_MNEMONICS`: BIP39 mnemonic phrase | ||
- Format: 12 or 24 words separated by spaces | ||
- Example: `word1 word2 word3 ... word12` | ||
- ⚠️ Never share or commit your mnemonic phrase | ||
|
||
## Framework Variables | ||
- `OPENAI_API_KEY`: OpenAI API access | ||
- Get from: https://platform.openai.com/api-keys | ||
- Format: "sk-" followed by random characters | ||
|
||
- `ELEVEN_LABS_API_KEY`: ElevenLabs API access | ||
- Get from: https://elevenlabs.io/docs/api-reference/authentication | ||
- Format: 32-character string | ||
|
||
## Security Best Practices | ||
1. Never commit `.env` files to version control | ||
2. Use `.env.template` files to document required variables without values | ||
3. Store sensitive values securely using environment variables or secrets management | ||
4. Rotate API keys regularly and if accidentally exposed | ||
5. Use separate API keys for development and production | ||
|
||
## Validation | ||
The SDK includes built-in validation for environment variables. If required variables are missing or incorrectly formatted, you'll receive helpful error messages directing you to this guide. | ||
|
||
For more information about specific plugins and their environment variable requirements, see the README files in the respective plugin directories. |
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
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# EVM RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Base: https://mainnet.base.org | ||
# - Alchemy: https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= |
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 |
---|---|---|
@@ -1,5 +1,26 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# Allora API base URL | ||
# Format: Full URL with protocol and version | ||
# See: docs/environment-variables.mdx for details | ||
ALLORA_API_URL= | ||
|
||
# Your Allora API key | ||
# Get from: https://allora.network/api-access | ||
# Format: 32-character string | ||
# Required for: Accessing price predictions and market analysis | ||
ALLORA_API_KEY= | ||
|
||
# Your Coingecko API key | ||
# Get from: https://www.coingecko.com/api/pricing | ||
# Format: 32-character string | ||
# Required for: Accessing market data and price information | ||
COINGECKO_API_KEY= |
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 |
---|---|---|
@@ -1,4 +1,23 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# EVM RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Base: https://mainnet.base.org | ||
# - Alchemy: https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= | ||
COINGECKO_API_KEY= | ||
|
||
# Your Coingecko API key | ||
# Get from: https://www.coingecko.com/api/pricing | ||
# Format: 32-character string | ||
# Required for: Accessing market data and price information | ||
COINGECKO_API_KEY= |
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 |
---|---|---|
@@ -1,4 +1,23 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# EVM RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Base: https://mainnet.base.org | ||
# - Alchemy: https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= | ||
OPENSEA_API_KEY= | ||
|
||
# Your OpenSea API key | ||
# Get from: https://docs.opensea.io/reference/api-keys | ||
# Format: 32-character string | ||
# Required for: Accessing NFT collection data and marketplace information | ||
OPENSEA_API_KEY= |
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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# Polygon RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Public: https://polygon-rpc.com | ||
# - Alchemy: https://polygon-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= | ||
|
||
# Polymarket (get an API key by running the `pnpm create-api-key` command) | ||
POLYMARKET_API_KEY= | ||
POLYMARKET_SECRET= | ||
POLYMARKET_PASSPHRASE= | ||
# Polymarket API credentials | ||
# Get these by running: pnpm polymarket:api-key | ||
# ⚠️ Keep these values secure and never share them | ||
POLYMARKET_API_KEY= # Format: UUID string | ||
POLYMARKET_SECRET= # Format: Base64 encoded string | ||
POLYMARKET_PASSPHRASE= # Format: String | ||
|
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
18 changes: 18 additions & 0 deletions
18
typescript/examples/vercel-ai/send-nft-to-twitter/.env.template
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 |
---|---|---|
@@ -1,4 +1,22 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# EVM RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Base: https://mainnet.base.org | ||
# - Alchemy: https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= | ||
|
||
# Your Crossmint API key | ||
# Get from: https://www.crossmint.com/developers | ||
# Format: 32-character string | ||
CROSSMINT_API_KEY= |
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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Solana RPC endpoint URL | ||
# Format: Full URL (e.g., https://api.mainnet-beta.solana.com) | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
SOLANA_RPC_URL= | ||
SOLANA_PRIVATE_KEY= | ||
|
||
# Your Solana wallet's private key | ||
# Format: Base58 encoded string | ||
# ⚠️ Never share or commit your private key | ||
SOLANA_PRIVATE_KEY= |
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
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 |
---|---|---|
@@ -1,5 +1,28 @@ | ||
# OpenAI API key for AI model interaction | ||
# Get from: https://platform.openai.com/api-keys | ||
# Format: "sk-" followed by random characters | ||
OPENAI_API_KEY= | ||
|
||
# Your EVM wallet's private key | ||
# Format: 64-character hex string with '0x' prefix | ||
# ⚠️ Never share or commit your private key | ||
WALLET_PRIVATE_KEY= | ||
|
||
# EVM RPC endpoint URL | ||
# Format: Full URL with API key (if using Alchemy/Infura) | ||
# Examples: | ||
# - Base: https://mainnet.base.org | ||
# - Alchemy: https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY | ||
# See: docs/environment-variables.mdx for provider-specific formats | ||
RPC_PROVIDER_URL= | ||
UNISWAP_API_KEY=kHEhfIPvCE3PO5PeT0rNb1CA3JJcnQ8r7kJDXN5X | ||
UNISWAP_BASE_URL=https://trade-api.gateway.uniswap.org/v1 | ||
|
||
# Your Uniswap API key | ||
# Get from: https://hub.uniswap.org | ||
# Format: 32-character string | ||
# Required for: Accessing Uniswap's API for quotes and swaps | ||
UNISWAP_API_KEY= | ||
|
||
# Uniswap API base URL | ||
# Format: Full URL with protocol and version | ||
# Default: https://api.uniswap.org/v1 | ||
UNISWAP_BASE_URL= |
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
Oops, something went wrong.