Skip to content
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: display transaction time #2180

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/frontend/src/icp/components/send/IcSendTokenWizard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
trackTimedEventError
} from '$lib/services/analytics.services';
import { i18n } from '$lib/stores/i18n.store';
import { toastsError } from '$lib/stores/toasts.store';
import { toastsError, toastsShow } from '$lib/stores/toasts.store';
import { token } from '$lib/stores/token.store';
import type { NetworkId } from '$lib/types/network';
import { invalidAmount, isNullishOrEmpty } from '$lib/utils/input.utils';
Expand Down Expand Up @@ -132,6 +132,16 @@
};

const trackAnalyticsOnSendComplete = async () => {
const endTime = performance.now();
const duration = endTime - timedEvent.startTime;

// format duration to seconds and show it in a toast
toastsShow({
text: `Sent ${amount} ICP in less than ${(duration / 1000).toFixed(2)} seconds.`,
level: 'success',
duration: 5000
});

await Promise.allSettled([
trackTimedEventSuccess(timedEvent),
trackEvent({
Expand Down
Loading