Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion chrome-extension/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const manifest = deepmerge(
version: packageJson.version,
description: '__MSG_extensionDescription__',
host_permissions: ['<all_urls>'],
permissions: ['storage', 'tabs', 'commands', 'alarms'],
permissions: ['storage', 'tabs', 'commands'],
options_page: 'options/index.html',
background: {
service_worker: 'background.iife.js',
Expand Down
2 changes: 1 addition & 1 deletion chrome-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chrome-extension",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - core settings",
"type": "module",
"scripts": {
Expand Down
48 changes: 10 additions & 38 deletions chrome-extension/src/background/chains/ethereumHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1376,15 +1376,16 @@ const signTypedData = async (params: any, KEEPKEY_WALLET: any, ADDRESS: string,
* a clear warning and emits a runtime message so the side-panel (or any
* listener) can surface it. See RETRO_uniswap_swap_dropped_tx.md.
*
* Two delivery mechanisms:
* - Short delays (< 30s): setTimeout. Best-effort; only fires if the
* MV3 service worker is still alive. The 8s check usually hits while
* the SW is still warm from the broadcast.
* - Long delays (>= 30s): chrome.alarms. Survives SW suspension —
* the alarm wakes the SW, registering the listener at module load.
* Production minimum delay is 30s; we use 45s for the eviction probe.
* Best-effort via setTimeout. Both 8s and 45s checks fire only if the
* MV3 service worker is still alive at delay time. The 8s check almost
* always hits because the broadcast just happened. The 45s check fires
* during active dApp interaction (block polling / eth_chainId pings
* keep the SW warm) but may miss if the SW idles immediately after
* broadcast — acceptable trade for not requiring the chrome.alarms
* permission, which would gate Chrome Web Store updates on user
* re-consent. The drop warning is diagnostic UX; the tx outcome is
* unchanged when the warning is missed.
*/
const DROP_CHECK_ALARM_PREFIX = 'eth-drop-check-';

// Map hash → URL that successfully accepted the broadcast. Drop-check
// then queries that exact RPC instead of running getProvider() again,
Expand Down Expand Up @@ -1431,38 +1432,9 @@ const performDropCheck = async (hash: string, scheduledDelayMs: number) => {

const scheduleDropCheck = (hash: string, delayMs: number, successUrl?: string) => {
if (successUrl) dropCheckUrlByHash.set(hash, successUrl);
if (delayMs < 30_000) {
setTimeout(() => performDropCheck(hash, delayMs), delayMs);
return;
}
// Encode delay in alarm name so the listener can recover it without
// a separate storage round-trip. Alarms are unique by name; suffixing
// with delayMs lets us schedule multiple checks for the same hash.
const alarmName = `${DROP_CHECK_ALARM_PREFIX}${hash}-${delayMs}`;
try {
chrome.alarms.create(alarmName, { when: Date.now() + delayMs });
} catch (e) {
console.warn('[DROP-CHECK] alarm scheduling failed, falling back to setTimeout:', e);
setTimeout(() => performDropCheck(hash, delayMs), delayMs);
}
setTimeout(() => performDropCheck(hash, delayMs), delayMs);
};

// Registered at module load — re-runs on every service-worker startup,
// which is exactly when the alarm fires and wakes the SW. (URL hint
// is not recovered across SW restart; drop-check falls back to
// getProvider in that case.)
if (typeof chrome !== 'undefined' && chrome.alarms?.onAlarm) {
chrome.alarms.onAlarm.addListener(alarm => {
if (!alarm.name.startsWith(DROP_CHECK_ALARM_PREFIX)) return;
const rest = alarm.name.slice(DROP_CHECK_ALARM_PREFIX.length);
const lastDash = rest.lastIndexOf('-');
if (lastDash <= 0) return;
const hash = rest.slice(0, lastDash);
const delayMs = Number(rest.slice(lastDash + 1));
void performDropCheck(hash, Number.isFinite(delayMs) ? delayMs : 0);
});
}

/**
* Classify a broadcast error so the failover loop knows whether to try
* the next RPC or stop and surface it.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "keepkey-client",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension for KeepKey",
"license": "GNU General Public License v3.0",
"repository": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/chrome": "^0.0.290",
"@types/chrome": "^0.0.300",
"@types/node": "^20.16.11",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/dev-utils",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - dev utils",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/hmr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/hmr",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - hot module reload/refresh",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/i18n",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - internationalization",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/shared",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - shared code",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/storage",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - storage",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwind-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/tailwindcss-config",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - tailwindcss configuration",
"main": "tailwind.config.ts",
"private": true
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/tsconfig",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - tsconfig",
"private": true
}
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/ui",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - ui components",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/vite-config",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - vite base configuration",
"main": "index.mjs",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/zipper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/zipper",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - zipper",
"private": true,
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion pages/content-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/content-runtime-script",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - content runtime script",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/content-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/content-ui",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - content ui",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/content-script",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - content script",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/devtools-panel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/devtools-panel",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - devtools panel",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/devtools",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - devtools",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/options/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/options",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - options",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion pages/side-panel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/sidepanel",
"version": "0.0.29",
"version": "0.0.30",
"description": "chrome extension - side panel",
"private": true,
"sideEffects": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@extension/e2e",
"version": "0.0.29",
"version": "0.0.30",
"description": "E2e tests configuration boilerplate",
"private": true,
"type": "module",
Expand Down
Loading