-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat(frontend): fallback for non-working index canisters #3761
feat(frontend): fallback for non-working index canisters #3761
Conversation
|
||
// In case of error, we start the listener again, but only with the ledgerCanisterId, | ||
// to make it request only the balance and not the transactions | ||
restartWorkerWithLedgerOnly(); |
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.
@peterpeterparker as discussed; do you think it is too much to have an internal function? I would not externalize it, just because I need to pass all props (worker, ledger, env)
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 think it's good 👍
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.
LGTM, thx
PR discussed and reviewed offline as well, cool stuff!
}) => { | ||
icTransactionsStore.reset(tokenId); | ||
|
||
// We get transactions and balance for the same end point therefore if getting certified transactions fails, it also means the balance is incorrect. | ||
balancesStore.reset(tokenId); | ||
|
||
if (silent) { | ||
// We print the error to console just for debugging purposes | ||
console.error(`${get(i18n).transactions.error.loading_transactions}:`, err); |
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.
console.warn
if it's just for debugging purpose?
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.
done!
|
||
// In case of error, we start the listener again, but only with the ledgerCanisterId, | ||
// to make it request only the balance and not the transactions | ||
restartWorkerWithLedgerOnly(); |
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 think it's good 👍
Motivation
It may happen that an ICRC token has an Index Canister but it is not working. For example, it is out of cycles.
In those cases, we don't want to show an error anymore, but leverage the same wallet service used for tokens without Index Canister.
That means, that in those cases, we will just fetch the balance, and show an explanatory warning for not having the transacitons.
Changes
onLoadTransactionsError
to accept a fallback function.Note
The changes in the UI will be done with:
Tests
I simulated a wrong index canister in the local replica for ckSepoliaUSDC. In the video we can see how I switch between the correct Index canister and the wrong one, back and forth.
Screen.Recording.2024-11-26.at.13.16.36.mov