Skip to content

Commit

Permalink
chore(toolbox): add support for Alchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed Mar 1, 2023
1 parent bf2f542 commit fbada00
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/ethereum-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
`@requestnetwork/ethereum-storage` is a package part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is an implementation of the Storage layer of Request Network protocol that uses IPFS to immutably store the data and uses the Ethereum network to persist the IPFS hash of the data and make them permanently available to everyone.

To use Infura to connect to an Ethereum node, get an infura token on [infura.io](infura.io) and
To use Infura to connect to an Ethereum node, get an Infura token on [infura.io](infura.io) and
use as provider `"NETWORK_YOU_WANT.infura.io/v3/YOUR_INFURA_TOKEN"`.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion packages/request-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Therefore, the Node receives request transactions from users, batches them into

Once received by the Node, other request actors connecting to this Node can directly read the request transaction before it is persisted into the storage layer.

To use Infura to connect to an Ethereum node, get an infura token on [infura.io](infura.io) and
To use Infura to connect to an Ethereum node, get an Infura token on [infura.io](infura.io) and
use as provider `"NETWORK_YOU_WANT.infura.io/v3/YOUR_INFURA_TOKEN"`.

## Usage
Expand Down
4 changes: 3 additions & 1 deletion packages/toolbox/src/commands/transaction/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const getWallet = async ({
export const getProvider = async (chainName: string) => {
const chain = await getChainConfig(chainName);
if (chain) {
const rpc = chain.rpcUrls[0].replace('{INFURA_API_KEY}', process.env.INFURA_API_KEY || '');
const rpc = chain.rpcUrls[0]
.replace('{ALCHEMY_API_KEY}', process.env.ALCHEMY_API_KEY || '')
.replace('{INFURA_API_KEY}', process.env.INFURA_API_KEY || '');
return new providers.StaticJsonRpcProvider(rpc);
}
return getDefaultProvider(chainName);
Expand Down
8 changes: 4 additions & 4 deletions packages/utils/src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ type CurrentProviderFactory = (
) => providers.Provider | string;

/**
* Default API_KEYS configuration, can be overriden using initPaymentDetectionApiKeys
* Default API_KEYS configuration, can be overridden using initPaymentDetectionApiKeys
*/
let providersApiKeys: Record<string, string | (() => string)> = {
// fallback to Ethers v4 default projectId
infura: () => process.env.RN_INFURA_KEY || '7d0d81d0919f4f05b9ab6634be01ee73',
// fallback to Ethers v5 default projectId
infura: () => process.env.RN_INFURA_KEY || '84842078b09946638c03157f83405213',
};

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ const defaultProviderFactory: ProviderFactory = (network: string | undefined) =>
return networkRpcs[network];
}

// use infura, if supported
// use Infura, if supported
try {
// try getting the URL for the given network. Will throw if not supported.
providers.InfuraProvider.getUrl(providers.getNetwork(network), {});
Expand Down

0 comments on commit fbada00

Please sign in to comment.