-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: nami mode dapp connector * feat(extension): conditional inject based on wallet mode (#91) Implements LW-11590 and LW-11630 * chore: resolve sonarcloud issues * fixup! feat(extension): conditional inject based on wallet mode (#91) * fixup! feat: nami mode dapp connector * feat(extension): collateral logic * fixup! feat: nami mode dapp connector * fixup! feat: nami mode dapp connector * chore: bump sdk version * fix: hardware wallet integration * fix: banner display condition and popup size * chore: resolve ci issues * chore: fix ui discrepancies * fixup! fix: hardware wallet integration * fixup! fixup! fix: hardware wallet integration * feat(nami): await posthog events that occur before window.close Window.close could occur before the posthog event is sent. Await on sending the event before closing the window. * fixup! chore: resolve ci issues * fixup! fix: banner display condition and popup size * fixup! fix: hardware wallet integration * fixup! fix: banner display condition and popup size * fix(extension): debounce on CIP-30 endpoint calls now starts after first event (#1458) * fix(extension): debounce on CIP-30 endpoint calls now starts after first event * perf: optimize loading states in Dapp connector views * chore: separate dapp view * feat: optimize loading states in Dapp connector views --------- Co-authored-by: Przemysław Włodek <[email protected]> Co-authored-by: Mircea Hasegan <[email protected]> Co-authored-by: vetalcore <[email protected]> * fix: improve error handling for hardware wallet * fixup! fix: hardware wallet integration * chore: extract more tools (#1461) * chore: extract more tools * chore: update assets * fix: preserve location * fix: hide show recovery phrase setting * fix: [LW-11665] dApp connector proportions for hardware wallets (#1467) * fix: change password flow (#1466) * fix: change password flow * chore: fix tests * chore(extension): ensure tabs are closed (#1464) * fix: delete wallet from popup (#1465) * chore: update copy * chore: remove tslint issues * chore: resolve sonarcloud issues * fix: correct copy paste error for extension IDs * fix: scrollbar ref potentially not active * fix: metadata controlled input lag * chore: fix get collateral utxo test * fix: collateral confirmation toast * fix(nami): tx collateral inputs must be part of marked collaterals * fix: handle server urls * fix: fix unresponsive send page on metadata update with multiple assets * chore: update switch to nami mode copies * fix: store recent addresses per env name for send flow * fix: resolve eslint/tslint fixes commit comments * chore: update switch to nami mode copies * chore: add missing dependencies into dapp connector view * feat: show asset info in assets modal * fix: redirect to trezor sign page * fix: allow additional properties while sending events to posthog * chore: fix tslint issues * fix: fix change password flow * chore: fix tslint issues * fix: refresh tx history if new tx appears * fix: cache address and balance per env name * chore(nami): add missing typings * fix: reset states after submitting tx with trezor * fix: close all lace windows before executing migration * fix: show tx history of multi-delegated accounts * feat(nami): implement migration guard on popup - only complete migration via explicit complete in final onboarding step * fix: show all accounts of all hw instead of just a first one * fixup! feat: show asset info in assets modal * fix: use explicit bigint conversion in both sides of abs function * fix: use explicit bigint conversion in both sides of abs function * refactor: address sonarlint issues * fix: update account tests * fixup! fix(nami): tx collateral inputs must be part of marked collaterals * fix: remove second scrollbar in history tab * refactor: remove dead code * feat(nami): send analytic event for trezor dapp tx sign * fix: add analytic event for ledger send tx * fix(nami): asset meatadata with bigint values * fix: add send transaction confirmation click event for trezor * fix: open HWFlow modal if wallet type is hardware * fix(nami): compute datumHash if contract * fix: nami package storybook * fix: confirm modal event capture relative paths need to be used * fix(nami): broken HW connect UI (#1476) --------- Co-authored-by: Mircea Hasegan <[email protected]> Co-authored-by: Angel Castillo <[email protected]> Co-authored-by: Przemysław Włodek <[email protected]> Co-authored-by: John Oshalusi <[email protected]> Co-authored-by: Michael Chappell <[email protected]>
- Loading branch information
1 parent
c636a4b
commit 248659b
Showing
173 changed files
with
5,697 additions
and
7,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/browser-extension-wallet/src/features/nami-migration/NamiMigrationGuard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ami-migration/migration-tool/cross-extension-messaging/lace-migration-client.extension.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable no-console */ | ||
import { runtime, tabs } from 'webextension-polyfill'; | ||
import { State as MigrationData } from '../migrator/migration-data.data'; | ||
import { MigrationState } from '../migrator/migration-state.data'; | ||
import { LaceMessages } from './shared/types'; | ||
import { createLaceMigrationPingListener } from './lace/create-lace-migration-ping-listener'; | ||
import { NAMI_EXTENSION_ID } from './lace/environment'; | ||
import { createLaceMigrationOpenListener } from './lace/create-lace-migration-open-listener'; | ||
import { LACE_EXTENSION_ID } from './nami/environment'; | ||
|
||
type CheckMigrationStatus = () => Promise<MigrationState>; | ||
|
||
export const checkMigrationStatus: CheckMigrationStatus = () => { | ||
const message: LaceMessages = { type: 'status' }; | ||
|
||
return runtime.sendMessage(NAMI_EXTENSION_ID, message); | ||
}; | ||
|
||
type RequestMigrationData = () => Promise<MigrationData>; | ||
|
||
export const requestMigrationData: RequestMigrationData = () => { | ||
const message: LaceMessages = { type: 'data' }; | ||
return runtime.sendMessage(NAMI_EXTENSION_ID, message); | ||
}; | ||
|
||
type AbortMigration = () => Promise<void>; | ||
|
||
export const abortMigration: AbortMigration = () => { | ||
const message: LaceMessages = { type: 'abort' }; | ||
return runtime.sendMessage(NAMI_EXTENSION_ID, message); | ||
}; | ||
|
||
type CompleteMigration = () => Promise<void>; | ||
|
||
export const completeMigration: CompleteMigration = () => { | ||
const message: LaceMessages = { type: 'completed' }; | ||
return runtime.sendMessage(NAMI_EXTENSION_ID, message); | ||
}; | ||
|
||
export const handleNamiRequests = (): void => { | ||
console.log('[NAMI MIGRATION] createLaceMigrationPingListener'); | ||
runtime.onMessageExternal.addListener(createLaceMigrationPingListener(NAMI_EXTENSION_ID)); | ||
console.log('[NAMI MIGRATION] createLaceMigrationOpenListener'); | ||
runtime.onMessageExternal.addListener( | ||
createLaceMigrationOpenListener(NAMI_EXTENSION_ID, LACE_EXTENSION_ID, tabs.create) | ||
); | ||
}; |
14 changes: 14 additions & 0 deletions
14
...tion/migration-tool/cross-extension-messaging/lace/create-lace-migration-open-listener.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable no-console */ | ||
import { closeAllLaceWindows } from '@lib/scripts/background/util'; | ||
import { MessageSender, NamiMessages } from '../shared/types'; | ||
|
||
export const createLaceMigrationOpenListener = | ||
(namiExtensionId: string, laceExtensionId: string, createTab: ({ url }: { url: string }) => void) => | ||
async (message: NamiMessages, sender: MessageSender): Promise<void> => { | ||
console.log('[NAMI MIGRATION] createLaceMigrationOpenListener', message, sender); | ||
if (message === NamiMessages.open && sender.id === namiExtensionId) { | ||
// First close all open lace tabs | ||
await closeAllLaceWindows(); | ||
createTab({ url: `chrome-extension://${laceExtensionId}/app.html` }); | ||
} | ||
}; |
28 changes: 28 additions & 0 deletions
28
...migration-tool/cross-extension-messaging/lace/create-lace-migration-ping-listener.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createLaceMigrationPingListener } from './create-lace-migration-ping-listener'; | ||
import { NamiLacePingProtocol } from '../shared/types'; | ||
|
||
describe('create lace migration ping listener', () => { | ||
const namiId = 'fakeNamiId'; | ||
|
||
it('should answer ping messages from Nami', async () => { | ||
const listener = createLaceMigrationPingListener(namiId); | ||
const response = await listener(NamiLacePingProtocol.ping, { id: namiId }); | ||
expect(response).toBe(NamiLacePingProtocol.pong); | ||
}); | ||
|
||
it('should ignore messages not coming from Nami extension', async () => { | ||
const listener = createLaceMigrationPingListener(namiId); | ||
const response = await listener(NamiLacePingProtocol.ping, { | ||
id: 'otherId' | ||
}); | ||
expect(response).toBeUndefined(); | ||
}); | ||
|
||
it('should ignore other messages coming from Nami', async () => { | ||
const listener = createLaceMigrationPingListener(namiId); | ||
const response = await listener('other' as NamiLacePingProtocol, { | ||
id: namiId | ||
}); | ||
expect(response).toBeUndefined(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
...tion/migration-tool/cross-extension-messaging/lace/create-lace-migration-ping-listener.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-disable consistent-return */ | ||
/* eslint-disable no-console */ | ||
import { MessageSender, NamiLacePingProtocol } from '../shared/types'; | ||
|
||
export const createLaceMigrationPingListener = | ||
(namiExtensionId: string) => | ||
async (message: NamiLacePingProtocol, sender: MessageSender): Promise<void | NamiLacePingProtocol.pong> => { | ||
console.log('[NAMI MIGRATION] createLaceMigrationPingListener', message, sender); | ||
if (message === NamiLacePingProtocol.ping && sender.id === namiExtensionId) { | ||
console.log('[NAMI MIGRATION] Sending pong message to Nami'); | ||
return NamiLacePingProtocol.pong; | ||
} | ||
}; |
4 changes: 4 additions & 0 deletions
4
.../src/features/nami-migration/migration-tool/cross-extension-messaging/lace/environment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if (process.env.NAMI_EXTENSION_ID === undefined) { | ||
throw new Error('process.env.NAMI_EXTENSION_ID must be defined'); | ||
} | ||
export const NAMI_EXTENSION_ID = process.env.NAMI_EXTENSION_ID; |
4 changes: 4 additions & 0 deletions
4
.../src/features/nami-migration/migration-tool/cross-extension-messaging/nami/environment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if (process.env.LACE_EXTENSION_ID === undefined) { | ||
throw new Error('process.env.LACE_EXTENSION_ID must be defined'); | ||
} | ||
export const LACE_EXTENSION_ID = process.env.LACE_EXTENSION_ID; |
4 changes: 4 additions & 0 deletions
4
...src/features/nami-migration/migration-tool/cross-extension-messaging/shared/exceptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum MigrationExceptions { | ||
NotInProgress = 'not-in-progress', | ||
FailedToParse = 'failed-to-parse' | ||
} |
10 changes: 10 additions & 0 deletions
10
...c/features/nami-migration/migration-tool/cross-extension-messaging/shared/test-helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { State } from '../../migrator/nami-storage.data'; | ||
|
||
export const createMockNamiStore = (mockedState: Partial<State> = {}): { set: jest.Mock; get: jest.Mock } => { | ||
const store = { | ||
set: jest.fn(), | ||
get: jest.fn() | ||
}; | ||
store.get.mockResolvedValue(mockedState); | ||
return store; | ||
}; |
Oops, something went wrong.