Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support More Web3 Providers #47

Merged
merged 15 commits into from
Jun 5, 2022

Conversation

raghava-pamula
Copy link
Contributor

Initial Commit for adding support for web3 providers outside of infura. Currently, the project only supports infura web3 providers, and more flexibility is needed since infura has had outages.

#38

@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from efee6f6 to 5c78503 Compare June 2, 2022 08:14
Copy link
Contributor

@willpote willpote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One minor comment, and then just let me know when you are able to get the integ tests passing then I'll approve

Also please update the PR title!

Comment on lines 118 to 121
case 'alchemy':
// todo: add logic to generate alchemy rpc urls
case 'moralis':
// todo: todo: add logic to generate moralis rpc urls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fill in alchemy just so its ready if we need to switch out?

Think we can remove moralis too for now

case 'moralis':
// todo: todo: add logic to generate moralis rpc urls
default:
throw Error('Fatal: Unknown Provider Not Supported')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should default be infura to keep old behavior if no provider_name set?

@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from bb54087 to 61eb791 Compare June 2, 2022 16:44
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from ac5d3bf to 27aa63d Compare June 3, 2022 01:39
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 2577323 to c2be7fb Compare June 3, 2022 02:03
@raghava-pamula
Copy link
Contributor Author

Integ tests are failing :'(

@raghava-pamula raghava-pamula changed the title Initial Commit Support More Web3 Providers Jun 3, 2022
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 4962f92 to 430687e Compare June 4, 2022 22:39
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from a6509db to d5a8ef4 Compare June 4, 2022 22:54
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 353ef73 to 08634ae Compare June 4, 2022 23:00
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from fbd5666 to 70fc8ea Compare June 4, 2022 23:04
bin/app.ts Outdated
let jsonRpcProviders = {} as { [chainId: string]: string }
SUPPORTED_CHAINS.forEach((chainId: ChainId) => {
const key = `WEB3_RPC_${chainId}`
jsonRpcProviders[key] = jsonRpcProvidersSecret.secretValueFromJson(key) as unknown as string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use .toString() like we do below

Comment on lines +219 to +238
WEB3_RPC_1: process.env.WEB3_RPC_1!,
WEB3_RPC_3: process.env.WEB3_RPC_3!,
WEB3_RPC_4: process.env.WEB3_RPC_4!,
WEB3_RPC_5: process.env.WEB3_RPC_5!,
WEB3_RPC_42: process.env.WEB3_RPC_42!,
WEB3_RPC_10: process.env.WEB3_RPC_10!,
WEB3_RPC_69: process.env.WEB3_RPC_69!,
WEB3_RPC_42161: process.env.WEB3_RPC_42161!,
WEB3_RPC_421611: process.env.WEB3_RPC_421611!,
WEB3_RPC_137: process.env.WEB3_RPC_137!,
WEB3_RPC_80001: process.env.WEB3_RPC_80001!,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the package README so people know to do this?

const projectId = process.env.PROJECT_ID
const url = `https://${chainName}.infura.io/v3/${projectId}`
const url = process.env[`WEB3_RPC_${chainId.toString()}`]!
log.info({ url: url }, `GENERATED URL`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove this log

const url = process.env[`WEB3_RPC_${chainId.toString()}`]!
log.info({ url: url }, `GENERATED URL`)

if (typeof url == undefined || url == '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just !url is fine

bin/app.ts Outdated
const jsonRpcProvidersSecret = sm.Secret.fromSecretAttributes(this, 'RPCProviderUrls', {
secretCompleteArn:
'arn:aws:secretsmanager:us-east-2:644039819003:secret:routing-api-rpc-urls-json-primary-ixS8mw',
//backup Arn: arn:aws:secretsmanager:us-east-2:644039819003:secret:routing-api-rpc-urls-json-backup-D2sWoe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a bit more context to this comment so other people know why this exists?

Also add a note that you must update the multicall chunk size to 50 for optimism when switching to the backup

@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from e8602e7 to c8a9fe5 Compare June 5, 2022 04:39
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 683c6c7 to 8c5e06d Compare June 5, 2022 04:48
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 06678d0 to bb73b04 Compare June 5, 2022 05:34
@raghava-pamula raghava-pamula force-pushed the Raghava/feature1-Support_More_Web3_Providers branch from 3a58b18 to 8ab345b Compare June 5, 2022 17:23
@raghava-pamula raghava-pamula merged commit 8e64a1a into main Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants