-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No use subscribe to preview disconnected issue
- Loading branch information
Showing
10 changed files
with
60 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...ges/next-common/components/summary/polkadotTreasurySummary/context/treasuryOnHydration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...xt-common/components/summary/polkadotTreasurySummary/hook/useQueryAssetHubTreasuryFree.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useAssetHubApi } from "next-common/context/assetHub"; | ||
import useCall from "next-common/utils/hooks/useCall"; | ||
|
||
export function useQueryAccountFree(api, address) { | ||
const { loaded, value } = useCall(api?.query.system?.account, [address]); | ||
|
||
return { | ||
free: value?.data?.free?.toJSON() || 0, | ||
isLoading: !loaded, | ||
}; | ||
} | ||
|
||
export function useQueryAssetHubTreasuryFree(address) { | ||
const api = useAssetHubApi(); | ||
return useQueryAccountFree(api, address); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
...ommon/components/summary/polkadotTreasurySummary/hook/useSubscribeAssetHubTreasuryFree.js
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ages/next-common/components/summary/polkadotTreasurySummary/treasuryOnHydration/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/next-common/hooks/assetHub/useQueryAssetHubAssets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useAssetHubApi } from "next-common/context/assetHub"; | ||
import useCall from "next-common/utils/hooks/useCall"; | ||
|
||
export default function useQueryAssetHubAssets(assetId, address) { | ||
const api = useAssetHubApi(); | ||
|
||
const { loaded: isAccountLoaded, value: account } = useCall( | ||
api?.query.assets?.account, | ||
[assetId, address], | ||
); | ||
const { loaded: isMetaLoaded, value: meta } = useCall( | ||
api?.query.assets?.metadata, | ||
[assetId], | ||
); | ||
|
||
return { | ||
isLoading: !isAccountLoaded || !isMetaLoaded, | ||
balance: account?.toJSON()?.balance || 0, | ||
decimals: meta?.toJSON()?.decimals || 0, | ||
}; | ||
} |
33 changes: 0 additions & 33 deletions
33
packages/next-common/hooks/assetHub/useSubscribeAssetHubAssets.js
This file was deleted.
Oops, something went wrong.