-
Notifications
You must be signed in to change notification settings - Fork 395
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/add gridplus lattice1 #3744
Open
mrcnk
wants to merge
11
commits into
tahowallet:main
Choose a base branch
from
GridPlus:feat/add-gridplus-lattice1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8d12a47
feat(gridplus): add onboarding views
mrcnk 1517f55
feat(gridplus): wrap up accounts import with GridPlus
mrcnk 0fd291f
feat(gridplus): discover active gridplus addresses
mrcnk 1b66d25
feat(gridplus): add gridplus signer frame
mrcnk 6c73b19
chore(conflicts): resolve
mrcnk 67ad0b6
Merge branch 'main' into feat/add-gridplus-lattice1
mrcnk f8c57bc
feat(gridplus): add mocked onboarding test
mrcnk 9497135
fix(gridplus): fix build and linter issues
mrcnk f238add
fix(gridplus): adjust pledge-signer-sync version lock
mrcnk fb65792
chore(gridplus): add i18n entries for the onboarding
mrcnk d768e83
chore(gridplus): implement pr improvements and remove eth-sig-util
mrcnk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v16.20.0 | ||
v18.20.3 |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ ui/_locales/**/*.json | |
!.github | ||
ci/cache | ||
.vscode | ||
size-plugin.json | ||
size-plugin.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { createSlice } from "@reduxjs/toolkit" | ||
import { createBackgroundAsyncThunk } from "./utils" | ||
import { type GridPlusAddress } from "../services/gridplus" | ||
|
||
const MOCKED_ONBOARDING = process.env.MOCKED_GRIDPLUS_ONBOARDING === "true" | ||
|
||
export type GridPlusState = { | ||
importableAddresses: string[] | ||
activeAddresses: GridPlusAddress[] | ||
} | ||
|
||
export const initialState: GridPlusState = { | ||
importableAddresses: [], | ||
activeAddresses: [], | ||
} | ||
|
||
const gridplusSlice = createSlice({ | ||
name: "gridplus", | ||
initialState, | ||
reducers: { | ||
resetGridPlusState: (immerState) => { | ||
immerState.importableAddresses = [] | ||
immerState.activeAddresses = [] | ||
}, | ||
setImportableAddresses: ( | ||
immerState, | ||
{ payload: importableAddresses }: { payload: string[] }, | ||
) => { | ||
immerState.importableAddresses = importableAddresses | ||
}, | ||
setActiveAddresses: ( | ||
immerState, | ||
{ payload: activeAddresses }: { payload: GridPlusAddress[] }, | ||
) => { | ||
immerState.activeAddresses = activeAddresses | ||
}, | ||
}, | ||
}) | ||
|
||
export const { | ||
resetGridPlusState, | ||
setImportableAddresses, | ||
setActiveAddresses, | ||
} = gridplusSlice.actions | ||
|
||
export default gridplusSlice.reducer | ||
|
||
export const connectGridplus = createBackgroundAsyncThunk( | ||
"gridplus/connect", | ||
async ( | ||
{ deviceId, password }: { deviceId?: string; password?: string }, | ||
{ extra: { main } }, | ||
) => main.connectGridplus({ deviceId, password }), | ||
) | ||
|
||
export const pairGridplusDevice = createBackgroundAsyncThunk( | ||
"gridplus/pairDevice", | ||
async ({ pairingCode }: { pairingCode: string }, { extra: { main } }) => | ||
main.pairGridplusDevice({ pairingCode }), | ||
) | ||
|
||
export const fetchGridPlusAddresses = createBackgroundAsyncThunk( | ||
"gridplus/fetchAddresses", | ||
async ( | ||
{ | ||
n = 10, | ||
startPath = [0x80000000 + 44, 0x80000000 + 60, 0x80000000, 0, 0], | ||
}: { n?: number; startPath?: number[] }, | ||
{ dispatch, extra: { main } }, | ||
) => { | ||
if (MOCKED_ONBOARDING) { | ||
return dispatch( | ||
setImportableAddresses(["0xdfb2682febe6ea96682b1018702958980449b7db"]), | ||
) | ||
} | ||
return dispatch( | ||
setImportableAddresses( | ||
await main.fetchGridPlusAddresses({ n, startPath }), | ||
), | ||
) | ||
}, | ||
) | ||
|
||
export const importGridPlusAddresses = createBackgroundAsyncThunk( | ||
"gridplus/importAddresses", | ||
async ( | ||
{ addresses }: { addresses: GridPlusAddress[] }, | ||
{ extra: { main } }, | ||
) => main.importGridPlusAddresses({ addresses }), | ||
) | ||
|
||
export const initializeActiveAddresses = createBackgroundAsyncThunk( | ||
"gridplus/initializeActiveAddresses", | ||
async (_, { extra: { main }, dispatch }) => { | ||
const activeAddresses = await main.readActiveGridPlusAddresses() | ||
return dispatch(setActiveAddresses(activeAddresses)) | ||
}, | ||
) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Everywhere we refer to
gridplus
should begrid-plus
, including filenames, as capital letters/separate words translate to-
when we move outside of camel-casing. Anywhere we then importgridplus
should begridPlus
, etc, for consistency.