Skip to content

Commit 73be1fe

Browse files
authored
Remove all reference to INFURA_ID (#687)
1 parent 2ada97d commit 73be1fe

File tree

7 files changed

+34
-33
lines changed

7 files changed

+34
-33
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ env:
2828
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
2929
BASE_RPC_URL: $${{ secrets.BASE_RPC_URL }}
3030
FOUNDRY_PROFILE: ci
31-
INFURA_ID: ${{ secrets.INFURA_ID }}
3231
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
3332

3433
jobs:

contracts-core/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
INFURA_ID=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
21
MNEMONIC=here is where your twelve words mnemonic should be put my friend
32
DEPLOY_GSN=false
43
ETHERSCAN_VERIFICATION_API_KEY="YOUR_API_KEY"

frontend/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ OPTIMISTIC_ETHERSCAN_API_KEY=yourOptimisticEtherscanApiKey
33
POLYGONSCAN_API_KEY=yourPolygonscanApiKey
44
ARBISCAN_API_KEY=yourArbiscanApiKey
55

6-
INFURA_ID=yourKeyHere
76
BLOCKNATIVE_API_KEY=yourKeyHere
87
FORTMATIC_API_KEY=yourKeyHere
98
PORTIS_API_KEY=yourKeyHere

umbra-js/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ OPTIMISTIC_ETHERSCAN_API_KEY=yourOptimisticEtherscanApiKey
33
POLYGONSCAN_API_KEY=yourPolygonscanApiKey
44
ARBISCAN_API_KEY=yourArbiscanApiKey
55
GNOSISSCAN_API_KEY=yourGnosisSafeScanApiKey
6-
INFURA_ID=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
76
MAINNET_RPC_URL=yourMainnetRpcUrl
87
OPTIMISM_RPC_URL=yourOptimismRpcUrl
98
GNOSIS_CHAIN_RPC_URL=yourGnosisChainRpcUrl

umbra-js/hardhat.config.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ const chainIds = {
1919
// Ensure that we have all the environment variables we need.
2020
const mnemonic = 'test test test test test test test test test test test junk';
2121

22-
const infuraApiKey = process.env.INFURA_ID;
23-
if (!infuraApiKey) throw new Error('Please set your INFURA_ID in a .env file');
24-
2522
function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig {
26-
const url = `https://${network}.infura.io/v3/${infuraApiKey as string}`;
23+
const rpcUrlString = `${network.toUpperCase()}_RPC_URL`;
24+
const url = process.env[rpcUrlString];
25+
if (!url) throw new Error(`Please set the ${url} in a .env file`);
2726
return {
2827
accounts: {
2928
count: 10,
@@ -36,12 +35,14 @@ function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig
3635
};
3736
}
3837

38+
const rpcUrlString = process.env.SEPOLIA_RPC_URL;
39+
if (!rpcUrlString) throw new Error('Please set the SEPOLIA_RPC_URL in a .env file');
3940
const config: HardhatUserConfig = {
4041
defaultNetwork: 'hardhat',
4142
networks: {
4243
hardhat: {
4344
forking: {
44-
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
45+
url: rpcUrlString,
4546
},
4647
chainId: chainIds.hardhat,
4748
accounts: {

umbra-js/test/cns.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const resolution = new Resolution({
1111
uns: {
1212
locations: {
1313
Layer1: {
14-
url: `https://mainnet.infura.io/v3/${String(process.env.INFURA_ID)}`,
14+
url: `${String(process.env.MAINNET_RPC_URL)}`,
1515
network: 'mainnet',
1616
},
1717
Layer2: {
18-
url: `https://polygon-mainnet.infura.io/v3/${String(process.env.INFURA_ID)}`,
18+
url: `${String(process.env.POLYGON_RPC_URL)}`,
1919
network: 'polygon-mainnet',
2020
},
2121
},
@@ -43,9 +43,7 @@ describe('СNS functions', () => {
4343

4444
it('gets the public keys associated with a CNS address', async () => {
4545
const address = await resolution.addr(name, 'ETH');
46-
const ethersProvider = new StaticJsonRpcProvider(
47-
`https://polygon-mainnet.infura.io/v3/${String(process.env.INFURA_ID)}`
48-
);
46+
const ethersProvider = new StaticJsonRpcProvider(`${String(process.env.POLYGON_RPC_URL)}`);
4947
const keys = await utils.lookupRecipient(address, ethersProvider);
5048
expect(keys.spendingPublicKey).to.equal(nameSpendingPublicKey);
5149
expect(keys.viewingPublicKey).to.equal(nameViewingPublicKey);

umbra-js/test/utils.test.ts

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@ import { Event } from '../src/ethers';
88

99
const ethersProvider = ethers.provider;
1010

11-
const INFURA_ID = <string>process.env.INFURA_ID;
12-
if (!INFURA_ID) throw new Error('Please set your INFURA_ID in a .env file');
11+
const MAINNET_RPC_URL = <string>process.env.MAINNET_RPC_URL;
12+
if (!MAINNET_RPC_URL) throw new Error('Please set your MAINNET_RPC_URL in a .env file');
13+
14+
const SEPOLIA_RPC_URL = <string>process.env.SEPOLIA_RPC_URL;
15+
if (!SEPOLIA_RPC_URL) throw new Error('Please set your SEPOLIA_RPC_URL in a .env file');
16+
17+
const POLYGON_RPC_URL = <string>process.env.POLYGON_RPC_URL;
18+
if (!POLYGON_RPC_URL) throw new Error('Please set your POLYGON_RPC_URL in a .env file');
19+
20+
const OPTIMISM_RPC_URL = <string>process.env.OPTIMISM_RPC_URL;
21+
if (!OPTIMISM_RPC_URL) throw new Error('Please set your OPTIMISM_RPC_URL in a .env file');
22+
23+
const ARBITRUM_ONE_RPC_URL = <string>process.env.ARBITRUM_ONE_RPC_URL;
24+
if (!ARBITRUM_ONE_RPC_URL) throw new Error('Please set your ARBITRUM_ONE_RPC_URL in a .env file');
1325

1426
// Public key and address corresponding to stratus4.eth
1527
const publicKey = '0x04458465db23fe07d148c8c9078d8b67497998a66f4f2aa479973a9cbaaf8b5a96e6ba166a389b8f794b68010849b64b91343e72c7fa4cfcc178607c4b1d4870ed'; // prettier-ignore
@@ -109,29 +121,29 @@ describe('Utilities', () => {
109121

110122
// --- Address, advanced mode on (i.e. don't use the StealthKeyRegistry) ---
111123
it('looks up recipients by address, advanced mode on', async () => {
112-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${String(process.env.INFURA_ID)}`);
124+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL);
113125
const keys = await utils.lookupRecipient(address, ethersProvider, { advanced: true });
114126
expect(keys.spendingPublicKey).to.equal(pubKeysWallet.spendingPublicKey);
115127
expect(keys.viewingPublicKey).to.equal(pubKeysWallet.viewingPublicKey);
116128
});
117129

118130
it('looks up recipients by ENS, advanced mode on', async () => {
119-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${String(process.env.INFURA_ID)}`);
131+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL);
120132
const keys = await utils.lookupRecipient('stratus4.eth', ethersProvider, { advanced: true });
121133
expect(keys.spendingPublicKey).to.equal(pubKeysWallet.spendingPublicKey);
122134
expect(keys.viewingPublicKey).to.equal(pubKeysWallet.viewingPublicKey);
123135
});
124136

125137
it.skip('looks up recipients by CNS, advanced mode on', async () => {
126-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${INFURA_ID}`);
138+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL);
127139
const keys = await utils.lookupRecipient('udtestdev-msolomon.crypto', ethersProvider, { advanced: true });
128140
expect(keys.spendingPublicKey).to.equal(pubKeysWallet.spendingPublicKey);
129141
expect(keys.viewingPublicKey).to.equal(pubKeysWallet.viewingPublicKey);
130142
});
131143

132144
// --- Address, advanced mode off (i.e. use the StealthKeyRegistry) ---
133145
it('looks up recipients by address, advanced mode off', async () => {
134-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${INFURA_ID}`); // otherwise throws with unsupported network since we're on localhost
146+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL); // otherwise throws with unsupported network since we're on localhost
135147
const keys = await utils.lookupRecipient(address, ethersProvider);
136148
expect(keys.spendingPublicKey).to.equal(pubKeysUmbra.spendingPublicKey);
137149
expect(keys.viewingPublicKey).to.equal(pubKeysUmbra.viewingPublicKey);
@@ -143,7 +155,7 @@ describe('Utilities', () => {
143155
});
144156

145157
it('looks up recipients by ENS, advanced mode off', async () => {
146-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${INFURA_ID}`);
158+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL);
147159
const keys = await utils.lookupRecipient('stratus4.eth', ethersProvider);
148160
// These values are set on the Sepolia resolver
149161
expect(keys.spendingPublicKey).to.equal(pubKeysUmbra.spendingPublicKey);
@@ -181,37 +193,31 @@ describe('Utilities', () => {
181193

182194
// --- Address history by network ---
183195
it('looks up transaction history on mainnet', async () => {
184-
const ethersProvider = new StaticJsonRpcProvider(`https://mainnet.infura.io/v3/${INFURA_ID}`);
196+
const ethersProvider = new StaticJsonRpcProvider(MAINNET_RPC_URL);
185197
const txHash = await utils.getSentTransaction(address, ethersProvider);
186198
expect(txHash).to.have.lengthOf(66);
187199
});
188200

189201
it('looks up transaction history on sepolia', async () => {
190-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${INFURA_ID}`);
202+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL);
191203
const txHash = await utils.getSentTransaction(address, ethersProvider);
192204
expect(txHash).to.have.lengthOf(66);
193205
});
194206

195207
it('looks up transaction history on polygon', async () => {
196-
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(
197-
`https://polygon-mainnet.infura.io/v3/${INFURA_ID}`
198-
) as EthersProvider;
208+
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(POLYGON_RPC_URL) as EthersProvider;
199209
const txHash = await utils.getSentTransaction(address, ethersProvider);
200210
expect(txHash).to.have.lengthOf(66);
201211
});
202212

203213
it('looks up transaction history on optimism', async () => {
204-
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(
205-
`https://optimism-mainnet.infura.io/v3/${INFURA_ID}`
206-
) as EthersProvider;
214+
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(OPTIMISM_RPC_URL) as EthersProvider;
207215
const txHash = await utils.getSentTransaction(address, ethersProvider);
208216
expect(txHash).to.have.lengthOf(66);
209217
});
210218

211219
it('looks up transaction history on arbitrum one', async () => {
212-
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(
213-
`https://arbitrum-mainnet.infura.io/v3/${INFURA_ID}`
214-
) as EthersProvider;
220+
const ethersProvider = new ethers.providers.StaticJsonRpcProvider(ARBITRUM_ONE_RPC_URL) as EthersProvider;
215221
const txHash = await utils.getSentTransaction(address, ethersProvider);
216222
expect(txHash).to.have.lengthOf(66);
217223
});
@@ -238,7 +244,7 @@ describe('Utilities', () => {
238244

239245
it('throws when looking up an address that has not sent a transaction', async () => {
240246
const address = '0x0000000000000000000000000000000000000002';
241-
const ethersProvider = new StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${INFURA_ID}`); // otherwise throws with unsupported network since we're on localhost
247+
const ethersProvider = new StaticJsonRpcProvider(SEPOLIA_RPC_URL); // otherwise throws with unsupported network since we're on localhost
242248
const errorMsg = `Address ${address} has not registered stealth keys. Please ask them to setup their Umbra account`;
243249
await expectRejection(utils.lookupRecipient(address, ethersProvider), errorMsg);
244250
});

0 commit comments

Comments
 (0)