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

fix: accounts transaction loading [web-archway] #1306

Merged
merged 11 commits into from
Oct 6, 2023
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
5 changes: 5 additions & 0 deletions .changeset/fuzzy-baboons-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ui': patch
---

fix: accounts transaction loading
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
env:
PROJECT_NAME: ${{ matrix.project }}
NEXT_PUBLIC_CHAIN_TYPE: ${{ github.event.inputs.chain_type }}
- name: Insall Vercel CLI
- name: Install Vercel CLI
run: npm i -g vercel
- name: Generate vercel.json
run: |
Expand Down
34 changes: 20 additions & 14 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/web-emoney/src/screens/account_details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AccountDetails = () => {
/>
<OtherTokens className={classes.otherTokens} otherTokens={state.otherTokens} />
<Staking className={classes.staking} rewards={state.rewards} />
<Transactions className={classes.transactions} />
<Transactions className={classes.transactions} loading={state.balanceLoading} />
</span>
</LoadAndExist>
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion apps/web-evmos/src/screens/account_details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AccountDetails = () => {
/>
<OtherTokens className={classes.otherTokens} otherTokens={state.otherTokens} />
<Staking className={classes.staking} rewards={state.rewards} />
<Transactions className={classes.transactions} />
<Transactions className={classes.transactions} loading={state.balanceLoading} />
</span>
</LoadAndExist>
</Layout>
Expand Down
6 changes: 4 additions & 2 deletions apps/web-osmosis/src/screens/account_details/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const defaultTokenUnit: TokenUnit = {

const initialState: AccountDetailState = {
loading: true,
balanceLoading: true,
exists: true,
desmosProfile: null,
overview: {
Expand Down Expand Up @@ -125,7 +126,7 @@ const formatBalance = (data?: Data) => {
// ==========================
const formatAllBalance = (data?: Data) => {
const stateChange: Partial<AccountDetailState> = {
loading: false,
balanceLoading: false,
};

stateChange.rewards = formatRewards(data);
Expand Down Expand Up @@ -177,7 +178,7 @@ const formatOtherTokens = (data?: Data) => {
const availableAmount = formatToken(availableRawAmount.amount, x);
const rewardsRawAmount = rewards.reduce((a, b) => {
if (!b) return a;
const coins = R.pathOr<NonNullable<typeof b['coins']>>([], ['coins'], b);
const coins = R.pathOr<NonNullable<(typeof b)['coins']>>([], ['coins'], b);
const denom = getDenom(coins, x);
return Big(a).plus(denom.amount).toPrecision();
}, '0');
Expand Down Expand Up @@ -263,6 +264,7 @@ export const useAccountDetails = () => {
useEffect(() => {
handleSetState((prevState) => ({
...prevState,
loading: false,
overview: {
address: address ?? '',
withdrawalAddress: withdrawalAddress.withdrawalAddress?.address ?? '',
Expand Down
2 changes: 1 addition & 1 deletion apps/web-osmosis/src/screens/account_details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AccountDetails = () => {
/>
<OtherTokens className={classes.otherTokens} otherTokens={state.otherTokens} />
<Staking className={classes.staking} rewards={state.rewards} />
<Transactions className={classes.transactions} />
<Transactions className={classes.transactions} loading={state.balanceLoading} />
</span>
</LoadAndExist>
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion apps/web-persistence/src/screens/account_details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AccountDetails = () => {
/>
<OtherTokens className={classes.otherTokens} otherTokens={state.otherTokens} />
<Staking className={classes.staking} rewards={state.rewards} />
<Transactions className={classes.transactions} />
<Transactions className={classes.transactions} loading={state.balanceLoading} />
</span>
</LoadAndExist>
</Layout>
Expand Down
3 changes: 2 additions & 1 deletion apps/web-stride/src/screens/account_details/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const formatOtherTokens = (data: Data) => {
const availableRawAmount = getDenom(available, x);
const availableAmount = formatToken(availableRawAmount.amount, x);
const rewardsRawAmount = rewards.reduce((a, b) => {
const coins = R.pathOr<NonNullable<typeof b['coins']>>([], ['coins'], b);
const coins = R.pathOr<NonNullable<(typeof b)['coins']>>([], ['coins'], b);
const denom = getDenom(coins, x);
return Big(a).plus(denom.amount).toPrecision();
}, '0');
Expand Down Expand Up @@ -308,6 +308,7 @@ export const useAccountDetails = () => {
useEffect(() => {
handleSetState((prevState) => ({
...prevState,
loading: false,
overview: {
address: address ?? '',
withdrawalAddress: address ?? withdrawalAddress?.withdrawalAddress?.address ?? '',
Expand Down
Binary file removed bun.lockb
Binary file not shown.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@
"eslint-plugin-turbo": "^1.9.3",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"next": "^13.4.1",
"prettier": "2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"turbo": "^1.9.3",
"typescript": "^5.0.4"
},
"packageManager": "yarn@3.5.0",
"engines": {
"yarn": ">=1.22"
"yarn": ">=3.5",
"node": ">=18.17.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs,css,md}": "npx prettier --write"
Expand Down
15 changes: 8 additions & 7 deletions packages/ui/src/screens/account_details/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const formatBalance = (data: Data): BalanceType => {
const rewardsAmount = formatToken(rewards, primaryTokenUnit);

const commission = getDenom(
R.pathOr<NonNullable<NonNullable<typeof data['commission']>['coins']>>(
R.pathOr<NonNullable<NonNullable<(typeof data)['commission']>['coins']>>(
[],
['commission', 'coins'],
data
Expand Down Expand Up @@ -170,7 +170,7 @@ const formatOtherTokens = (data: Data) => {
const availableRawAmount = getDenom(available, x);
const availableAmount = formatToken(availableRawAmount.amount, x);
const rewardsRawAmount = rewards.reduce((a, b) => {
const coins = R.pathOr<NonNullable<typeof b['coins']>>([], ['coins'], b);
const coins = R.pathOr<NonNullable<(typeof b)['coins']>>([], ['coins'], b);
const denom = getDenom(coins, x);
return Big(a).plus(denom.amount).toPrecision();
}, '0');
Expand Down Expand Up @@ -248,11 +248,11 @@ export const useAccountDetails = () => {

useEffect(() => {
const formattedRawData: {
commission?: typeof commission['commission'];
accountBalances?: typeof available['accountBalances'];
delegationBalance?: typeof delegation['delegationBalance'];
unbondingBalance?: typeof unbonding['unbondingBalance'];
delegationRewards?: typeof rewards['delegationRewards'];
commission?: (typeof commission)['commission'];
accountBalances?: (typeof available)['accountBalances'];
delegationBalance?: (typeof delegation)['delegationBalance'];
unbondingBalance?: (typeof unbonding)['unbondingBalance'];
delegationRewards?: (typeof rewards)['delegationRewards'];
} = {};
formattedRawData.commission = R.pathOr({ coins: [] }, ['commission'], commission);
formattedRawData.accountBalances = R.pathOr({ coins: [] }, ['accountBalances'], available);
Expand All @@ -270,6 +270,7 @@ export const useAccountDetails = () => {
useEffect(() => {
handleSetState((prevState) => ({
...prevState,
loading: false,
overview: {
address: address ?? '',
withdrawalAddress: withdrawalAddress.withdrawalAddress?.address ?? '',
Expand Down
3 changes: 3 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6275,7 +6275,10 @@ __metadata:
eslint-plugin-turbo: ^1.9.3
husky: ^8.0.3
lint-staged: ^13.2.2
next: ^13.4.1
prettier: 2.8.8
react: ^18.2.0
react-dom: ^18.2.0
turbo: ^1.9.3
typescript: ^5.0.4
languageName: unknown
Expand Down