Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lumerin/wallet-core",
"version": "1.0.69",
"version": "1.0.70",
"author": {
"name": "Lumerin",
"email": "developer@lumerin.io",
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/explorer/api/arbiscan-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const createArbiscanApi = (chainId) => {
case '421613':
baseURL = 'https://api-goerli.arbiscan.io/api'
break
case '42161':
baseURL = 'https://api.arbiscan.io/api'
break
default:
throw new Error(`Unsupported chain ${chainId}`)
Comment on lines 7 to 14
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The current approach of hardcoding the URLs for different chains is not maintainable. If the URLs change in the future, or if new chains are added, the code will need to be updated and redeployed. A more maintainable approach would be to store these URLs in a configuration file or environment variables. This way, changes can be made without modifying the code.

}
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/explorer/api/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const createExplorerApis = (chainId) => {
const etherscanApi = createEtherscanApi(chainId)
const blockscoutApi = createBlockscoutApi(chainId)
apis.push(etherscanApi, blockscoutApi)
break;
break
case '421613':
case '42161':
const arbiscanApi = createArbiscanApi(chainId)
apis.push(arbiscanApi)
break
Comment on lines 15 to 23
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The current implementation creates multiple API instances regardless of the chainId. This could lead to unnecessary memory usage and potential performance issues if the number of APIs grows. It would be more efficient to create only the API instance that corresponds to the provided chainId.
To improve this, consider refactoring the code to create and push the API instance into the apis array only when the chainId matches the specific case. This way, you only instantiate the necessary API, which can help optimize memory usage and improve performance.

Expand Down