Closed Nick-1979 closed 1 week ago
The changes in this pull request introduce a new context, WorkerContext
, and several modifications across multiple components and hooks to integrate worker functionality for asynchronous operations. Key updates include the addition of a useWorker
hook, enhancements to the useAssetsBalances
hook to utilize a worker, and the introduction of new asset-fetching functions. The refactor also includes the removal of outdated functions related to asset retrieval, streamlining the overall architecture for managing asset data in a Polkadot-based application.
File | Change Summary |
---|---|
packages/extension-polkagate/src/components/contexts.tsx |
Added new context WorkerContext and updated the export statement. |
packages/extension-polkagate/src/fullscreen/accountDetails/components/AOC.tsx |
Introduced useSelectedChains hook for filtering accountAssets based on selectedChains . Updated method signature for AOC component. |
packages/extension-polkagate/src/hooks/useAssetsBalances.ts |
Added optional worker parameter to the useAssetsBalances function. Updated asset fetching logic and state management for worker integration. |
packages/extension-polkagate/src/hooks/useWorker.ts |
Created a new hook useWorker to access WorkerContext . |
packages/extension-polkagate/src/util/workers/getAssetOnRelayChain.js |
Removed file containing asset retrieval functions for relay chains. |
packages/extension-polkagate/src/util/workers/shared-helpers/getAssetOnAssetHub.js |
Added new function getAssetOnAssetHub for fetching asset information from asset hubs. |
packages/extension-polkagate/src/util/workers/shared-helpers/getAssetOnMultiAssetChain.js |
Updated getAssetOnMultiAssetChain function signature and streamlined logic. |
packages/extension-polkagate/src/util/workers/shared-helpers/getAssetOnRelayChain.js |
Introduced new function getAssetOnRelayChain for retrieving asset information on relay chains. |
packages/extension-polkagate/src/util/workers/shared-helpers/getAssets.js |
Updated getAssets function to enhance error handling and remove the getAssetOnAssetHub function. |
packages/extension-polkagate/src/util/workers/shared-helpers/getBalances.js |
Added new function getBalances to retrieve balance information for addresses. |
packages/extension-polkagate/src/util/workers/shared-helpers/getPooledBalance.js |
Added new function getPooledBalance for calculating pooled balances in nomination pools. |
packages/extension-polkagate/src/util/workers/sharedWorker.js |
Implemented a shared web worker for handling asset-related requests. |
packages/extension-ui/src/Popup/index.tsx |
Integrated WorkerContext into the Popup component and updated the structure for worker access. |
tsconfig.json |
Added path to include array to expand TypeScript compiler scope. |
AccountInformationForDetails
component may connect with the new context introduced in the main PR, as both involve rendering account-related information.FormatPrice
component may relate to the new context management in the main PR, as both involve displaying financial data.useAssetsBalances
hook may relate to the context management in the main PR, as both involve managing financial data.change requested
, new feature
🐰 In the fields where the data flows,
A new worker hops where the context grows.
With assets fetched and balances bright,
The rabbit's code shines with delight!
So let us cheer for the changes made,
In the world of code, let joy cascade! 🌼
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
Release Notes
New Features
WorkerContext
for better management of worker instances across components.useWorker
hook to access the worker context easily.AOC
component based on selected chains.Bug Fixes
Documentation
Chores