-
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?
Conversation
Deployed to Cloudflare Pages
|
f89a7a4
to
d856438
Compare
93a9aa5
to
781d415
Compare
781d415
to
95ffd9a
Compare
query: { | ||
enabled: !!oasisAddress, | ||
}, |
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.
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.
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
src/oasis-nexus/api.ts
Outdated
const oasisAddress = | ||
params?.rel && isValidEthAddress(params?.rel) | ||
? getOasisAddressOrNull(params.rel) | ||
: params?.rel | ||
|
||
return { | ||
...tx, | ||
to_eth: !tx.to_eth && tx.to === oasisAddress ? params?.rel : tx.to_eth, |
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 would refactor this as:
const fallbackMaybeEthAddresses = [params?.rel]
const fallbackEthAddressesMap: { [oasis1Address: string]: `0x${string}` } =
Object.fromEntries(
fallbackMaybeEthAddresses.filter(isValidEthAddress).map((eth) => [getOasisAddressOrNull(eth), toChecksumAddress(eth)])
)
return {
...tx,
to_eth: tx.to_eth ?? fallbackEthAddressesMap[tx.to],
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.
if address map is preferable way than we don't need an array, fromEntries, filter, map as we deal with a single address. Added a new commit with helper function.
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.
Hm, looks like we really don't have any EVM queries that support multiple address fields. nevermind
Something broke search: |
ce1a0f6
to
2a8b270
Compare
Ok, search will behave the same way. |
Ooooh, so searching for "0x95D683e4365209E5ce64f2e26e00C23207fe7Ec3" would have still found the 4 results |
Yes, search functionality is not affected by this PR. For now we want to tweak account view with eth address once you navigate from dApp. Will look at search later this week. |
Issue raised by Tadej (while using staker dApp as far as I remember) / for frontend sync meeting.
acc without
address_preimage
(keep eth addr)https://pr-1564.oasis-explorer.pages.dev/mainnet/sapphire/address/0x95D683e4365209E5ce64f2e26e00C23207fe7Ec3
https://explorer.dev.oasis.io/mainnet/sapphire/address/0x95D683e4365209E5ce64f2e26e00C23207fe7Ec3
acc with
address_preimage
(works the same way)https://pr-1564.oasis-explorer.pages.dev/mainnet/sapphire/address/0x8Bba8906467831962Ed5E524F4Bc47733CBF3b27
https://explorer.dev.oasis.io/mainnet/sapphire/address/0x8Bba8906467831962Ed5E524F4Bc47733CBF3b27
Notes: (thx @Andrew7234)