Skip to content

Commit

Permalink
Refactor after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Oct 23, 2023
1 parent dbf55cc commit 7477752
Show file tree
Hide file tree
Showing 31 changed files with 162 additions and 143 deletions.
Binary file removed public/images/creator-staking/choose-account.png
Binary file not shown.
12 changes: 4 additions & 8 deletions public/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,10 @@ video {
color: rgb(34 34 34 / var(--tw-text-opacity));
}

.text-\[\#6C727F33\]\/20 {
color: rgb(108 114 127 / 0.2);
}

.text-\[\#7B4511\] {
--tw-text-opacity: 1;
color: rgb(123 69 17 / var(--tw-text-opacity));
Expand Down Expand Up @@ -1688,10 +1692,6 @@ video {
color: rgb(var(--text-muted));
}

.text-text-muted\/20 {
color: rgb(var(--text-muted) / 0.2);
}

.text-text-on-primary {
--tw-text-opacity: 1;
color: rgb(var(--text-on-primary) / var(--tw-text-opacity));
Expand Down Expand Up @@ -1719,10 +1719,6 @@ video {
color: rgb(255 255 255 / 0.8);
}

.text-\[\#6C727F33\]\/20 {
color: rgb(108 114 127 / 0.2);
}

.opacity-0 {
opacity: 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { sendGetRequest } from './utils'
export const getAssets = async () => (
sendGetRequest({
params: { url: 'statemine/assets' },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get assets'
})
)

export const getAssetsBalancesByAccount = async (account: string) => (
sendGetRequest({
params: { url: `statemine/assets/${account}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get assets balances by account'
})
)
2 changes: 1 addition & 1 deletion src/api/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getAccountBalancesByNetwork = async ({
}: BalanceByNetworkProps) => {
const res = await sendGetRequest({
params: { url: `${account}/balances/${network}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: `Failed to get balances by account: ${account}`
})

Expand Down
2 changes: 1 addition & 1 deletion src/api/chainsInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendGetRequest } from './utils'
export const getChainsInfo = async () => (
sendGetRequest({
params: { url: '/chains/properties' },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get chain info'
})
)
2 changes: 1 addition & 1 deletion src/api/connectedStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendGetRequest } from './utils'
export const getConnectedStatus = async (chainName: string) => (
sendGetRequest({
params: { url: `check/${chainName}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch chain status'
})
)
18 changes: 9 additions & 9 deletions src/api/creatorStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { sendGetRequest } from './utils'
export const getCreatorsList = async () =>
sendGetRequest({
params: { url: 'staking/creator/list' },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch creators list',
})

export const getGeneralEraInfo = async () =>
sendGetRequest({
params: { url: 'staking/creator/era/info' },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch general era info',
})

Expand All @@ -24,7 +24,7 @@ export const getCreatorsSpaces = async (ids: string[]) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch creators spaces',
})

Expand All @@ -39,7 +39,7 @@ export const getEraStakesBySpaceIds = async (ids: string[], era: string) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: `Failed to fetch era stakes by space ids: ${ids.join(',')}`,
})

Expand All @@ -54,7 +54,7 @@ export const getBackerInfoBySpaces = async (ids: string[], account: string) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: `Failed to fetch backer info by spaces: ${ids.join(',')}`,
})

Expand All @@ -68,7 +68,7 @@ export const getBackerLedger = async (account: string) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: `Failed to fetch backer ledger: ${account}`,
})

Expand All @@ -77,7 +77,7 @@ export const getStakingConsts = async () =>
params: {
url: 'staking/creator/consts',
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch staking consts',
})

Expand All @@ -92,7 +92,7 @@ export const getBackerRewards = async (account: string, spaceIds: string[]) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to fetch backer rewards',
})

Expand All @@ -106,6 +106,6 @@ export const getCreatorRewards = async (spaceId: string) =>
},
},
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: `Failed to fetch creator rewards by space id: ${spaceId}`,
})
6 changes: 3 additions & 3 deletions src/api/crowdloans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getCrowdloans = async ({
}: GetCrowdloansProps) => (
sendGetRequest({
params: { url: `crowdloans/contributions/${relayChain}/${account}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get crowdloans'
})
)
Expand All @@ -25,7 +25,7 @@ export const getCrowdloansInfoByRelayChain = async (
): Promise<CrowdloanInfo[]> => (
sendGetRequest({
params: { url: `crowdloans/${relayChain}` },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get crowdloans info by relay chain ${relayChain}`
})
)
Expand Down Expand Up @@ -58,7 +58,7 @@ export const getVestingData = async ({

return res
},
onFaileReturnedValue: {},
onFailReturnedValue: {},
onFailedText: `Failed to get vesting data for account ${account}`
})
)
2 changes: 1 addition & 1 deletion src/api/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendGetRequest } from './utils'
export const getOwnerByDomain = async (domain: string) => (
sendGetRequest({
params: { url: `domains/${domain}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get address by domain'
})
)
2 changes: 1 addition & 1 deletion src/api/fee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getTransferFee = (
url: 'fees/transfer',
config: { params: { token, from: source, to: dest } }
},
onFaileReturnedValue: { amount: '0', token: '' },
onFailReturnedValue: { amount: '0', token: '' },
onFailedText: `Failed to get transfer token ${token} fee from network ${source} ${
dest ? 'to network' + dest : ''
}`
Expand Down
2 changes: 1 addition & 1 deletion src/api/identities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getAccountIdentities = async (accounts: string[]) => (
},
}
},
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get identities info'
})
)
12 changes: 6 additions & 6 deletions src/api/interestingAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const getValidatorsByChain = async (
url: getAccountsApiUrl(`${relayChain}/validators`),
config: { params: { offset, limit } }
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get validators by relay chain'
})

Expand All @@ -34,7 +34,7 @@ export const getAllInterestingAccounts = async (
params: { offset, limit },
}
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get all interesting accounts'
})

Expand All @@ -44,7 +44,7 @@ export const getAllInterestingAccounts = async (
export const getAllAccountsLength = async (): Promise<number> => {
const res = await sendGetRequest({
params: { url: getAccountsApiUrl('length') },
onFaileReturnedValue: 0,
onFailReturnedValue: 0,
onFailedText: 'Failed to get all accounts length'
})

Expand All @@ -56,7 +56,7 @@ export const getAccountsOverviewItems = async (): Promise<
> => {
const res = await sendGetRequest({
params: { url: getAccountsApiUrl('overview') },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get overview items for accounts'
})

Expand All @@ -73,7 +73,7 @@ export const getCouncilMembersByChain = async (
url: getAccountsApiUrl(`${relayChain}/council`),
config: { params: { offset, limit } }
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get council members'
})

Expand All @@ -90,7 +90,7 @@ export const getCrowdloanContributorsByChain = async (
url: getAccountsApiUrl(`${relayChain}/contributors`),
config: { params: { offset, limit } }
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: 'Failed to get validators info'
})

Expand Down
2 changes: 1 addition & 1 deletion src/api/nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendGetRequest } from './utils'
export const getNtfsByAccount = async (account: string) => (
sendGetRequest({
params: { url: `${account}/nfts` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get nfts by account'
})
)
2 changes: 1 addition & 1 deletion src/api/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendGetRequest } from './utils'
export const getTokenPrice = async (chains: string) => (
sendGetRequest({
params: { url: `prices?ids=${chains}` },
onFaileReturnedValue: undefined,
onFailReturnedValue: undefined,
onFailedText: 'Failed to get token price'
})
)
14 changes: 7 additions & 7 deletions src/api/staking/collator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const COLLATOR_STAKING_PATH = 'staking/collator'
export const getCandidatesListByNetwork = async (network: string) => (
sendGetRequest({
params: { url: `${COLLATOR_STAKING_PATH}/candidates/list/${network}` },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get candidates list by network ${network}`
})
)

export const getStakingRoundByNetwork = async (network: string) => (
sendGetRequest({
params: { url: `${COLLATOR_STAKING_PATH}/round/${network}` },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get staking round by network ${network}`
})
)
Expand All @@ -22,15 +22,15 @@ export const getStakingRoundByNetwork = async (network: string) => (
export const getStakingConstsByNetwork = async (network: string) => (
sendGetRequest({
params: { url: `${COLLATOR_STAKING_PATH}/consts/${network}` },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get staking consts by network ${network}`
})
)

export const getSelectedCandidatesByNetwork = async (network: string) => (
sendGetRequest({
params: { url: `${COLLATOR_STAKING_PATH}/selected/${network}` },
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get selected candidates by network ${network}`
})
)
Expand All @@ -49,7 +49,7 @@ export const getCandidatesInfoByNetwork = async (
},
}
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get candidates info by network ${network}`
})
)
Expand All @@ -68,7 +68,7 @@ export const getDelegatorsStateByNetwork = async (
},
}
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get delegator state by network ${network}`
})
)
Expand All @@ -87,7 +87,7 @@ export const getScheduledRequestsByNetwork = async (
},
}
},
onFaileReturnedValue: [],
onFailReturnedValue: [],
onFailedText: `Failed to get scheduled requests by network ${network}`
})
)
Loading

0 comments on commit 7477752

Please sign in to comment.