Skip to content

Commit

Permalink
Merge pull request #895 from 0xp3gasus/886-env-var-names
Browse files Browse the repository at this point in the history
886 Standarize var names
  • Loading branch information
0xp3gasus authored Nov 21, 2023
2 parents b7bc965 + 9c343d9 commit 7a936ac
Show file tree
Hide file tree
Showing 44 changed files with 171 additions and 97 deletions.
18 changes: 14 additions & 4 deletions packages/xchain-avax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ Etherscan API rate limits: https://snowtrace.io/apis

- This package uses `etherjs` library, by default it uses several providers. (`https://docs.ethers.io/v5/api-keys/`)

// set in env variables so default config can access.
`SNOWTRACE_API_KEY={YOURKEY}`
### Enviroment variables


```sh
SNOWTRACE_API_KEY={YOUR_SNOWTRACE_API_KEY}
COVALENT_API_KEY={YOUR_COVALENT_API_KEY}
```

Default config can access.

```sh
process.env.SNOWTRACE_API_KEY
process.env.COVALENT_API_KEY
```

//Default config can access.
process.env["SNOWTRACE_API_KEY"]
2 changes: 1 addition & 1 deletion packages/xchain-avax/__e2e__/avax-client.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const fakeProviders = {
}

defaultAvaxParams.network = Network.Testnet
defaultAvaxParams.phrase = process.env.PHRASE
defaultAvaxParams.phrase = process.env.TESTNET_PHRASE
// eslint-disable-next-line @typescript-eslint/no-explicit-any
defaultAvaxParams.dataProviders = [fakeProviders as any, avaxProviders]
const client = new AvaxClient(defaultAvaxParams)
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-avax/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ const ethersJSProviders = {
const AVAX_ONLINE_PROVIDER_TESTNET = new EtherscanProvider(
AVALANCHE_TESTNET_ETHERS_PROVIDER,
'https://api-testnet.snowtrace.io',
process.env['SNOWTRACE_API_KEY'] || '',
process.env.SNOWTRACE_API_KEY || '',
AVAXChain,
AssetAVAX,
18,
)
const AVAX_ONLINE_PROVIDER_MAINNET = new EtherscanProvider(
AVALANCHE_MAINNET_ETHERS_PROVIDER,
'https://api.snowtrace.io',
process.env['SNOWTRACE_API_KEY'] || '',
process.env.SNOWTRACE_API_KEY || '',
AVAXChain,
AssetAVAX,
18,
Expand Down
6 changes: 6 additions & 0 deletions packages/xchain-bitcoin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.23.5 (2023-11-21)

## Update

- BlOCKCYPHER_API_KEY renamed to BLOCKCYPHER_API_KEY

# v0.23.4 (2023-11-16)

## Update
Expand Down
12 changes: 6 additions & 6 deletions packages/xchain-bitcoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ import { SochainNetwork, SochainProvider } from '@xchainjs/xchain-utxo-provider
import { Network, UtxoClientParams } from '@xchainjs/xchain-client'

// override with your API key
SochainDataProviders[Network.Mainnet].apiKey = 'YOU_SOCHAIN_API_KEY'
SochainDataProviders[Network.Mainnet].apiKey = 'YOUR_SOCHAIN_API_KEY'

// or set in env variables so default config can access.
`SOCHAIN_API_KEY={YOURKEY}`
`BLOCKCYPHER_API_KEY={YOURKEY}`
`SOCHAIN_API_KEY={YOUR_SOCHAIN_API_KEY}`
`BLOCKCYPHER_API_KEY={YOUR_BLOCKCYPHER_API_KEY}`
//Default config can access.
process.env["BLOCKCYPHER_API_KEY"]
process.env["SOCHAIN_API_KEY"]
process.env.BLOCKCYPHER_API_KEY
process.env.SOCHAIN_API_KEY

//overridde the default init params with your onfig
const initParams: UtxoClientParams = {
...defaultBTCParams,
dataProviders: [SochainDataProviders, BlockcypherDataProviders]// use sochain first and blockcypher as fallback
phrase: process.env.YOURPHRASE,
phrase: process.env.PHRASE,
}
const btcClient = new Client(sochainParams)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const btcClient = new Client({
const btcClientTestnet = new Client({
...defaultBTCParams,
network: Network.Testnet,
phrase: process.env.TESTNETPHRASE,
phrase: process.env.TESTNET_PHRASE,
})
describe('Bitcoin Integration Tests for BlockCypher', () => {
it('should fetch correct asset ', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const btcClient = new Client({
const btcClientTestnet = new Client({
...defaultBTCParams,
network: Network.Testnet,
phrase: process.env.TESTNETPHRASE,
phrase: process.env.TESTNET_PHRASE,
})
describe('Bitcoin Integration Tests for Haskoin', () => {
it('should fetch address balance using haskoin', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const btcClient = new Client(sochainParams)
const btcClientTestnet = new Client({
...sochainParams,
network: Network.Testnet,
phrase: process.env.TESTNETPHRASE || '',
phrase: process.env.TESTNET_PHRASE,
})
describe('Bitcoin Integration Sochain Tests', () => {
it('should fetch address balance', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-bitcoin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xchainjs/xchain-bitcoin",
"version": "0.23.4",
"version": "0.23.5",
"description": "Custom Bitcoin client and utilities used by XChainJS clients",
"keywords": [
"XChain",
Expand Down Expand Up @@ -57,4 +57,4 @@
"publishConfig": {
"access": "public"
}
}
}
8 changes: 4 additions & 4 deletions packages/xchain-bitcoin/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ export const blockstreamExplorerProviders = {

const testnetSochainProvider = new SochainProvider(
'https://sochain.com/api/v3',
process.env['SOCHAIN_API_KEY'] || '',
process.env.SOCHAIN_API_KEY || '',
BTCChain,
AssetBTC,
8,
SochainNetwork.BTCTEST,
)
const mainnetSochainProvider = new SochainProvider(
'https://sochain.com/api/v3',
process.env['SOCHAIN_API_KEY'] || '',
process.env.SOCHAIN_API_KEY || '',
BTCChain,
AssetBTC,
8,
Expand Down Expand Up @@ -103,7 +103,7 @@ const testnetBlockcypherProvider = new BlockcypherProvider(
AssetBTC,
8,
BlockcypherNetwork.BTCTEST,
process.env['BlOCKCYPHER_API_KEY'] || '',
process.env.BLOCKCYPHER_API_KEY || '',
)

const mainnetBlockcypherProvider = new BlockcypherProvider(
Expand All @@ -112,7 +112,7 @@ const mainnetBlockcypherProvider = new BlockcypherProvider(
AssetBTC,
8,
BlockcypherNetwork.BTC,
process.env['BlOCKCYPHER_API_KEY'] || '',
process.env.BLOCKCYPHER_API_KEY || '',
)
export const BlockcypherDataProviders: UtxoOnlineDataProviders = {
[Network.Testnet]: testnetBlockcypherProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AssetBCH, HaskoinDataProviders, LOWER_FEE_BOUND, UPPER_FEE_BOUND, explo

const defaultBCHParams: UtxoClientParams = {
network: Network.Mainnet,
phrase: process.env.PHRASE,
phrase: process.env.MAINNET_PHRASE,
explorerProviders: explorerProviders,
dataProviders: [HaskoinDataProviders],
rootDerivationPaths: {
Expand All @@ -27,7 +27,7 @@ const bchClient = new Client({
const bchClientTestnet = new Client({
...defaultBCHParams,
network: Network.Testnet,
phrase: process.env.TESTNETPHRASE,
phrase: process.env.TESTNET_PHRASE,
})

// const bchAddress = 'qqqmwluxjte4u83lkqmare5klap5t38eyq8gdzxhhm'
Expand Down
6 changes: 6 additions & 0 deletions packages/xchain-bsc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.4.2 (2023-11-21)

## Update

- BSCCHAIN_API_KEY renamed to BSCSCAN_API_KEY

# v0.4.1 (2023-11-16)

## Update
Expand Down
14 changes: 10 additions & 4 deletions packages/xchain-bsc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ BscScan API rate limits: https://bscscan.com/apis

- This package uses `etherjs` library, by default it uses several providers. (`https://docs.ethers.io/v5/api-keys/`)

// set in env variables so default config can access.
`BSCCHAIN_API_KEY={YOURKEY}`
### Enviroment variables

//Default config can access.
process.env["BSCCHAIN_API_KEY"]
```sh
BSCSCAN_API_KEY={YOUR_BSCSCAN_API_KEY}
```

Default config can access.

```sh
process.env.BSCSCAN_API_KEY
```
2 changes: 1 addition & 1 deletion packages/xchain-bsc/__e2e__/bsc-client.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const AssetBNB: Asset = {

defaultBscParams.network = Network.Testnet
// defaultBscParams.network = Network.Mainnet
defaultBscParams.phrase = process.env.PHRASE
defaultBscParams.phrase = process.env.TESTNET_PHRASE

//const clientMainnet = new BscClient(defaultBscParams)
const clientTestnet = new BscClient(defaultBscParams)
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-bsc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xchainjs/xchain-bsc",
"version": "0.4.1",
"version": "0.4.2",
"description": "Binance Smart Chain EVM client for XChainJS",
"keywords": [
"XChain",
Expand Down Expand Up @@ -52,4 +52,4 @@
"axios": "^1.3.6",
"ethers": "^5.7.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-bsc/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ const ethersJSProviders = {
const BSC_ONLINE_PROVIDER_TESTNET = new EtherscanProvider(
BSC_TESTNET_ETHERS_PROVIDER,
'https://api-testnet.bscscan.com',
process.env['BSCCHAIN_API_KEY'] || '',
process.env.BSCSCAN_API_KEY || '',
BSCChain,
AssetBSC,
BSC_GAS_ASSET_DECIMAL,
)
const BSC_ONLINE_PROVIDER_MAINNET = new EtherscanProvider(
BSC_MAINNET_ETHERS_PROVIDER,
'https://api.bscscan.com',
process.env['BSCCHAIN_API_KEY'] || '',
process.env.BSCSCAN_API_KEY || '',
BSCChain,
AssetBSC,
BSC_GAS_ASSET_DECIMAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Cosmos SDK client Integration Tests', () => {
beforeEach(() => {
const settings = {
network: Network.Testnet,
phrase: process.env.MAINNETPHRASE,
phrase: process.env.TESTNET_PHRASE,
chain: AssetKUJI.chain,
defaultDecimals: 6,
prefix: 'kujira',
Expand Down
6 changes: 4 additions & 2 deletions packages/xchain-cosmos/__e2e__/cosmos-client.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let xchainClient: CosmosClient = new CosmosClient({})

describe('Cosmos Integration Tests', () => {
beforeEach(() => {
const settings = { network: Network.Testnet, phrase: process.env.PHRASE }
const settings = { network: Network.Testnet, phrase: process.env.TESTNET_PHRASE }
xchainClient = new CosmosClient(settings)
})
it('should fetch cosmos balances', async () => {
Expand Down Expand Up @@ -86,7 +86,9 @@ describe('Cosmos Integration Tests', () => {
Buffer.from(unsignedTxData.rawUnsignedTx, 'base64'),
)

const privKey = xchainClient.getSDKClient().getPrivKeyFromMnemonic(process.env.PHRASE as string, "44'/118'/0'/0/2")
const privKey = xchainClient
.getSDKClient()
.getPrivKeyFromMnemonic(process.env.TESTNET_PHRASE as string, "44'/118'/0'/0/2")
const authInfo = cosmosClientCore.proto.cosmos.tx.v1beta1.AuthInfo.decode(decodedTx.auth_info_bytes)

if (!authInfo.signer_infos[0].public_key) {
Expand Down
2 changes: 1 addition & 1 deletion packages/xchain-dash/__e2e__/dash-client.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const dashClient = new Client({
const dashClientTestnet = new Client({
...defaultDashParams,
network: Network.Testnet,
phrase: process.env.PHRASE,
phrase: process.env.TESTNET_PHRASE,
})

describe('Dash Integration Tests', () => {
Expand Down
6 changes: 6 additions & 0 deletions packages/xchain-doge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.7.6 (2023-11-21)

## Update

- BlOCKCYPHER_API_KEY renamed to BLOCKCYPHER_API_KEY

# v0.7.5 (2023-11-16)

## Update
Expand Down
12 changes: 6 additions & 6 deletions packages/xchain-doge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ import { SochainNetwork, SochainProvider } from '@xchainjs/xchain-utxo-provider
import { Network, UtxoClientParams } from '@xchainjs/xchain-client'

// override with your API key
SochainDataProviders[Network.Mainnet].apiKey = 'YOU_SOCHAIN_API_KEY'
SochainDataProviders[Network.Mainnet].apiKey = 'YOUR_SOCHAIN_API_KEY'

// or set in env variables so default config can access.
`SOCHAIN_API_KEY={YOURKEY}`
`BLOCKCYPHER_API_KEY={YOURKEY}`
`SOCHAIN_API_KEY={YOUR_BLOCKCYPHER_API_KEY}`
`BLOCKCYPHER_API_KEY={YOUR_SOCHAIN_API_KEY}`
//Default config can access.
process.env["BLOCKCYPHER_API_KEY"]
process.env["SOCHAIN_API_KEY"]
process.env.BLOCKCYPHER_API_KEY
process.env.SOCHAIN_API_KEY

//overridde the default init params with your onfig
const initParams: UtxoClientParams = {
...defaultDogeParams,
dataProviders: [SochainDataProviders, BlockcypherDataProviders]// use sochain first and blockcypher as fallback
phrase: process.env.YOURPHRASE,
phrase: process.env.PHRASE,
}
const DOGEClient = new Client(sochainParams)

Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-doge/__e2e__/doge-client.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AssetDOGE } from '../src/const'

const dogeClient = new Client({
...defaultDogeParams,
phrase: process.env.PHRASE,
phrase: process.env.MAINNET_PHRASE,
})

describe('Dogecoin Integration Tests', () => {
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('Dogecoin Integration Tests', () => {
try {
const dogeclient = new Client({
...defaultDogeParams,
phrase: process.env.PHRASE,
phrase: process.env.MAINNET_PHRASE,
network: Network.Mainnet,
})
const amount = assetToBase(assetAmount('10'))
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-doge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xchainjs/xchain-doge",
"version": "0.7.5",
"version": "0.7.6",
"description": "Custom Doge client and utilities used by XChain clients",
"keywords": [
"Xchain",
Expand Down Expand Up @@ -59,4 +59,4 @@
"publishConfig": {
"access": "public"
}
}
}
6 changes: 3 additions & 3 deletions packages/xchain-doge/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ export const blockstreamExplorerProviders = {

const testnetSochainProvider = new SochainProvider(
'https://sochain.com/api/v3',
process.env['SOCHAIN_API_KEY'] || '',
process.env.SOCHAIN_API_KEY || '',
DOGEChain,
AssetDOGE,
8,
SochainNetwork.DOGETEST,
)
const mainnetSochainProvider = new SochainProvider(
'https://sochain.com/api/v3',
process.env['SOCHAIN_API_KEY'] || '',
process.env.SOCHAIN_API_KEY || '',
DOGEChain,
AssetDOGE,
8,
Expand All @@ -84,7 +84,7 @@ const mainnetBlockcypherProvider = new BlockcypherProvider(
AssetDOGE,
8,
BlockcypherNetwork.DOGE,
process.env['BlOCKCYPHER_API_KEY'] || '',
process.env.BLOCKCYPHER_API_KEY || '',
)
export const blockcypherDataProviders = {
[Network.Testnet]: undefined, //no provider here
Expand Down
Loading

0 comments on commit 7a936ac

Please sign in to comment.