-
Notifications
You must be signed in to change notification settings - Fork 9
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
Keep eth address to fetch runtimes data #1564
base: master
Are you sure you want to change the base?
Changes from all commits
9741359
d570061
22ec480
afb4adb
95ffd9a
2a8b270
7cfb88f
b0f5d12
fd87ba1
245634d
5bbd54f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Keep eth address to fetch runtimes data | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import { AppErrors } from '../../../types/errors' | |
import { useSearchParamsPagination } from '../../components/Table/useSearchParamsPagination' | ||
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE as limit } from '../../config' | ||
import { SearchScope } from '../../../types/searchScope' | ||
import { getOasisAddressOrNull } from '../../utils/helpers' | ||
|
||
export const useAccount = (scope: SearchScope, address: string) => { | ||
const { network, layer } = scope | ||
|
@@ -34,19 +33,13 @@ export const useAccountTransactions = (scope: SearchScope, address: string) => { | |
// We should use useGetConsensusTransactions() | ||
} | ||
|
||
const oasisAddress = getOasisAddressOrNull(address) | ||
const query = useGetRuntimeTransactions( | ||
network, | ||
layer, // This is OK since consensus has been handled separately | ||
{ | ||
limit, | ||
offset: offset, | ||
rel: oasisAddress!, | ||
}, | ||
{ | ||
query: { | ||
enabled: !!oasisAddress, | ||
}, | ||
Comment on lines
-47
to
-49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oasisAddress used to be async. Since it is sync now and address is always true (loader would fail earlier if not) then I think it is not use to handle empty state |
||
rel: address, | ||
}, | ||
) | ||
const { isFetched, isLoading, data } = query | ||
|
@@ -79,22 +72,12 @@ export const useAccountEvents = (scope: SearchScope, address: string) => { | |
// We should use useGetConsensusEvents() | ||
} | ||
|
||
const oasisAddress = getOasisAddressOrNull(address) | ||
const query = useGetRuntimeEvents( | ||
network, | ||
layer, | ||
{ | ||
limit, | ||
offset: offset, | ||
rel: oasisAddress!, | ||
// TODO: implement filtering for non-transactional events | ||
}, | ||
{ | ||
query: { | ||
enabled: !!oasisAddress, | ||
}, | ||
}, | ||
) | ||
const query = useGetRuntimeEvents(network, layer, { | ||
limit, | ||
offset: offset, | ||
rel: address, | ||
// TODO: implement filtering for non-transactional events | ||
}) | ||
const { isFetched, isLoading, isError, data } = query | ||
const events = data?.data.events | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { getEthAccountAddressFromPreimage } from '../helpers' | ||
import { suggestedEmptyAccount, suggestedParsedAccount } from '../test-fixtures' | ||
|
||
describe('getEthAccountAddressFromPreimage', () => { | ||
it('should convert preimage to evm addresses', () => { | ||
expect(getEthAccountAddressFromPreimage(suggestedParsedAccount.address_preimage)).toEqual( | ||
suggestedParsedAccount.address_eth, | ||
) | ||
}) | ||
|
||
it('should return undefined on empty account', () => { | ||
expect(getEthAccountAddressFromPreimage(suggestedEmptyAccount.address_preimage)).toBeUndefined() | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this means