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

feat: support Etherscan API keys #27611

Merged
merged 8 commits into from
Oct 7, 2024
Merged
4 changes: 4 additions & 0 deletions .metamaskrc.dist
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ BLOCKAID_PUBLIC_KEY=
; Enable/disable why did you render debug tool: https://github.com/welldone-software/why-did-you-render
; This should NEVER be enabled in production since it slows down react
; ENABLE_WHY_DID_YOU_RENDER=false

; API key used in Etherscan requests to prevent rate limiting.
; Only applies to Mainnet and Sepolia.
; ETHERSCAN_API_KEY=
4 changes: 4 additions & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,10 @@ export default class MetamaskController extends EventEmitter {
getCurrentChainId({ metamask: this.networkController.state })
],
incomingTransactions: {
etherscanApiKeysByChainId: {
[CHAIN_IDS.MAINNET]: process.env.ETHERSCAN_API_KEY,
[CHAIN_IDS.SEPOLIA]: process.env.ETHERSCAN_API_KEY,
},
includeTokenTransfers: false,
isEnabled: () =>
Boolean(
Expand Down
5 changes: 4 additions & 1 deletion builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ env:
- SECURITY_ALERTS_API_ENABLED: ''
# URL of security alerts API used to validate dApp requests
- SECURITY_ALERTS_API_URL: 'http://localhost:3000'
# API key to authenticate Etherscan requests to avoid rate limiting
- ETHERSCAN_API_KEY: ''

# Enables the notifications feature within the build:
# Enables the notifications feature within the build:
- NOTIFICATIONS: ''

- METAMASK_RAMP_API_CONTENT_BASE_URL: https://on-ramp-content.api.cx.metamask.io
Expand All @@ -291,6 +293,7 @@ env:
###

- EIP_4337_ENTRYPOINT: null

###
# Enable/disable why did you render debug tool: https://github.com/welldone-software/why-did-you-render
# This should NEVER be enabled in production since it slows down react
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
"@metamask/snaps-rpc-methods": "^11.1.1",
"@metamask/snaps-sdk": "^6.5.1",
"@metamask/snaps-utils": "^8.1.1",
"@metamask/transaction-controller": "^37.1.0",
"@metamask/transaction-controller": "^37.2.0",
"@metamask/user-operation-controller": "^13.0.0",
"@metamask/utils": "^9.1.0",
"@ngraveio/bc-ur": "^1.1.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
},
"TxController": {
"methodData": "object",
"submitHistory": "object",
"transactions": "object",
"lastFetchedBlockNumbers": "object",
"submitHistory": "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"isSignedIn": "boolean",
"isProfileSyncingEnabled": null,
"isProfileSyncingUpdateLoading": "boolean",
"submitHistory": "object",
"subscriptionAccountsSeen": "object",
"isMetamaskNotificationsFeatureSeen": "boolean",
"isNotificationServicesEnabled": "boolean",
Expand Down
3 changes: 0 additions & 3 deletions ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ function setupStateHooks(store) {
// for more info)
state.version = global.platform.getVersion();
state.browser = window.navigator.userAgent;
state.completeTxList = await actions.getTransactions({
filterToCurrentNetwork: false,
});
return state;
};
window.stateHooks.getSentryAppState = function () {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6462,9 +6462,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/transaction-controller@npm:^37.1.0":
version: 37.1.0
resolution: "@metamask/transaction-controller@npm:37.1.0"
"@metamask/transaction-controller@npm:^37.2.0":
version: 37.2.0
resolution: "@metamask/transaction-controller@npm:37.2.0"
dependencies:
"@ethereumjs/common": "npm:^3.2.0"
"@ethereumjs/tx": "npm:^4.2.0"
Expand All @@ -6491,7 +6491,7 @@ __metadata:
"@metamask/approval-controller": ^7.0.0
"@metamask/gas-fee-controller": ^20.0.0
"@metamask/network-controller": ^21.0.0
checksum: 10/b265c73f3410660ca2021f091508d6dec5e6b9cce240e420f91dd87f48d846ccca68d23892860fabd32dba62551476a9a7476d240679d58a50c1eab4cd04ab82
checksum: 10/0850797efb2157de41eaec153d31f8f63d194d2290fa41a3d439a28f95a35436f47d56546b0fa64427294280476d11ab4a7ed6161a13ad6f8215a3bc052a41e2
languageName: node
linkType: hard

Expand Down Expand Up @@ -26103,7 +26103,7 @@ __metadata:
"@metamask/snaps-utils": "npm:^8.1.1"
"@metamask/test-bundler": "npm:^1.0.0"
"@metamask/test-dapp": "npm:^8.4.0"
"@metamask/transaction-controller": "npm:^37.1.0"
"@metamask/transaction-controller": "npm:^37.2.0"
"@metamask/user-operation-controller": "npm:^13.0.0"
"@metamask/utils": "npm:^9.1.0"
"@ngraveio/bc-ur": "npm:^1.1.12"
Expand Down