Skip to content

Commit

Permalink
Refactor getAccountInfo to fetchAccountInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidTranDucVL committed Oct 18, 2021
1 parent 51767e3 commit bf8b341
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/frontend/actions/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default (store: Store) => {
try {
loadingAction(state, 'Loading account')
const nextAccount = await getWallet().exploreNextAccount()
const accountInfo = await nextAccount.getAccountInfo(state.validStakepoolDataProvider)
const accountInfo = await nextAccount.fetchAccountInfo(state.validStakepoolDataProvider)
// TODO: remove the type conversion
const accountsInfo = [...state.accountsInfo, accountInfo] as AccountInfo[]
// TODO: how about other states? is big delegator etc.
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/wallet/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ const Account = ({config, cryptoProvider, blockchainExplorer, accountIndex}: Acc
return config.isShelleyCompatible && myAddresses.areAddressesUsed()
}

async function getAccountInfo(validStakepoolDataProvider: StakepoolDataProvider) {
async function fetchAccountInfo(validStakepoolDataProvider: StakepoolDataProvider) {
const accountXpubs = await getAccountXpubs()
const stakingXpub = await getStakingXpub(cryptoProvider, accountIndex)
const stakingAddress = await myAddresses.getStakingAddress()
Expand Down Expand Up @@ -487,7 +487,7 @@ const Account = ({config, cryptoProvider, blockchainExplorer, accountIndex}: Acc
getVisibleAddresses,
prepareTxAux,
verifyAddress,
getAccountInfo,
fetchAccountInfo,
getStakingInfo,
accountIndex,
getPoolRecommendation,
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/wallet/shelley-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const ShelleyWallet = ({config, cryptoProvider}: WalletParams) => {
const accounts = await accountManager.discoverAccounts()
//@ts-ignore TODO: refactor type AccountInfo
return Promise.all(
accounts.map((account) => account.getAccountInfo(validStakepoolDataProvider))
accounts.map((account) => account.fetchAccountInfo(validStakepoolDataProvider))
)
}

Expand Down
2 changes: 1 addition & 1 deletion app/tests/src/actions/transaction-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before(() => {
ADALITE_CONFIG.ADALITE_NETWORK = 'MAINNET'
const mockNet = mockNetwork(ADALITE_CONFIG)
mockNet.mockBulkAddressSummaryEndpoint()
mockNet.mockGetAccountInfo()
mockNet.mockFetchAccountInfo()
mockNet.mockGetStakePools()
mockNet.mockGetConversionRates()
mockNet.mockUtxoEndpoint()
Expand Down
2 changes: 1 addition & 1 deletion app/tests/src/actions/wallet-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ it('Should properly load shelley wallet', async () => {
ADALITE_CONFIG.ADALITE_NETWORK = 'MAINNET'
const mockNet = mockNetwork(ADALITE_CONFIG)
mockNet.mockBulkAddressSummaryEndpoint()
mockNet.mockGetAccountInfo()
mockNet.mockFetchAccountInfo()
mockNet.mockGetStakePools()
mockNet.mockGetConversionRates()
mockNet.mockPoolMeta()
Expand Down
4 changes: 2 additions & 2 deletions app/tests/src/common/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const mock = (ADALITE_CONFIG) => {
})
}

function mockGetAccountInfo() {
function mockFetchAccountInfo() {
fetchMock.config.overwriteRoutes = true
const acctInfoMock = {
delegation: {},
Expand Down Expand Up @@ -314,7 +314,7 @@ const mock = (ADALITE_CONFIG) => {

return {
mockBulkAddressSummaryEndpoint,
mockGetAccountInfo,
mockFetchAccountInfo,
mockGetStakePools,
mockGetConversionRates,
mockTransactionSubmitter,
Expand Down
2 changes: 1 addition & 1 deletion app/tests/src/wallet/account/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ before(async () => {
ADALITE_CONFIG.ADALITE_NETWORK = 'MAINNET'
const mockNet = mockNetwork(ADALITE_CONFIG)
mockNet.mockBulkAddressSummaryEndpoint()
mockNet.mockGetAccountInfo()
mockNet.mockFetchAccountInfo()
mockNet.mockGetStakePools()
mockNet.mockGetConversionRates()
mockNet.mockUtxoEndpoint()
Expand Down

0 comments on commit bf8b341

Please sign in to comment.