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: wallet api - part 1/2 #333

Merged

Conversation

jopedroliveira
Copy link
Contributor

@jopedroliveira jopedroliveira commented Dec 12, 2022

Part 1 of 2 - APIs and Structure

This PR briefly implements the required RPC calls and handlers for the Station Wallet Module.
The changes on this PR may lead to application malfunction since this is part 1 of the feature, separated here for readability purposes.

🚨 Backend: FilAddress configuration keys need refactoring. Left some // todo comments

⚠️ Should be merged after #332

@jopedroliveira jopedroliveira changed the title Feat/wallet api feat: wallet api - part 1/2 Dec 12, 2022
@bajtos bajtos requested a review from juliangruber December 12, 2022 15:45
@jopedroliveira jopedroliveira marked this pull request as ready for review December 12, 2022 16:52
@jopedroliveira
Copy link
Contributor Author

@juliangruber I'd like to review this with you since it is mainly focused on backend/API

main/ipc.js Outdated Show resolved Hide resolved
main/ipc.js Outdated Show resolved Hide resolved
main/preload.js Show resolved Hide resolved
main/preload.js Outdated Show resolved Hide resolved
main/station-config.js Outdated Show resolved Hide resolved
main/station-config.js Outdated Show resolved Hide resolved
renderer/src/components/Saturn.tsx Outdated Show resolved Hide resolved
renderer/src/hooks/StationWallet.tsx Show resolved Hide resolved
renderer/src/lib/station-config.tsx Show resolved Hide resolved
renderer/src/pages/Onboarding.tsx Outdated Show resolved Hide resolved
jopedroliveira and others added 20 commits December 16, 2022 13:37
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
Co-authored-by: Julian Gruber <julian@juliangruber.com>
@@ -24,9 +24,6 @@ const OnboardingPage = (): JSX.Element => {
useEffect(() => {
(async () => {
await sleep(2000)
if (await getFilAddress()) {
return navigate('/dashboard', { replace: true })
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this redirect missing now? I don't see any other code redirecting to that url

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is addressed on #334

const [totalJobs, setTotalJobs] = useState<number>(0)
const [totalEarnings, setTotalEarnigs] = useState<number>(0)
const [activities, setActivities] = useState<ActivityEventMessage[]>([])
const { totalJobs, totalEarnings, activities } = useStationActivity()
const shortAddress = (str: string) => str
? str.substring(0, 4) + '...' + str.substring(str.length - 4, str.length)
: ''
const disconnect = async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a disconnect any more, and the saturn node shouldn't be stopped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is addressed on #334


export async function setDestinationWalletAddress (address: string | undefined): Promise<void> {
return await window.electron.saturnNode.setFilAddress(address)
// return await window.electron.stationConfig.setDestinationWalletAddress(address)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a todo comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed here

@jopedroliveira
Copy link
Contributor Author

@juliangruber just to reinforce that most of front-end related comments are addressed on #334

@juliangruber juliangruber merged commit 22114c5 into CheckerNetwork:feat/wallet Jan 4, 2023
juliangruber added a commit that referenced this pull request Feb 7, 2023
* feat: move station rpc into hook

* feat: backend interface and wire up for wallet

* wip: ensure compatibility

* eslint

* feat: wallet ui

* feat: status indicator animations

* wip: animations and transitions

* wip: address input animations and transitions

* wip: address input animations and transitions

* feat: address input animations and transitions

* fixup: eslint cleanup

* feat: input focus on edit

* wip: wallet onboarding slide

* feat: move station rpc into hook (#332)

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/station-config.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update renderer/src/lib/station-config.tsx

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* feat: backend interface and wire up for wallet

* wip: ensure compatibility

* eslint

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/station-config.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update renderer/src/lib/station-config.tsx

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* fixup: remove address check on onboarding page

* refactor: staturn fe component startup

* fixup: lint

* Update renderer/src/typings.d.ts

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* feat: wallet ui

* feat: status indicator animations

* wip: animations and transitions

* wip: address input animations and transitions

* wip: address input animations and transitions

* feat: address input animations and transitions

* fixup: eslint cleanup

* feat: input focus on edit

* fixup: form input ref

* fixup: typo and eslint

* feat: wallet api - part 1/2 (#333)

* feat: move station rpc into hook

* feat: backend interface and wire up for wallet

* wip: ensure compatibility

* eslint

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/station-config.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update renderer/src/lib/station-config.tsx

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* feat: backend interface and wire up for wallet

* wip: ensure compatibility

* eslint

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/ipc.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/preload.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update main/station-config.js

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* Update renderer/src/lib/station-config.tsx

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* fixup: remove address check on onboarding page

* refactor: staturn fe component startup

* fixup: lint

* Update renderer/src/typings.d.ts

Co-authored-by: Julian Gruber <julian@juliangruber.com>

Co-authored-by: Julian Gruber <julian@juliangruber.com>

* fix: send fil button scale with text (#409)

* Hide parts of destination address (#407)

* feat: hide parts of destination address

* feat: hide internal station address and add copy button

* Fix transaction history scroll and add loading (#408)

* wip: loading transaction history

* refactor: revert loading

* update copy

* fix: history scroll when status drawer is open (#441)

* Feat: wallet frontend tests and e2e (#344)

* Add Wallet Backend. #388 (#373)

* wallet: add getAddress()

* try to fix `buffer` dependency

* this seems to work

* ignore typescript error

* disable transfer FIL with balance 0

* improve readability

* truncate FIL destination address when not editing

* fix buffer problem by downgrading address module (#379)

* fix buffer problem by downgrading address module

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>

* fixup! remove rollup-inject

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>

* add show real balance

* add list transactions (wip: types)

* abbreviate station address

* fix types

* add show transaction history

* let frontend handle FIL rendering

* remove render function (antipattern)

* let frontend handle more FIL rendering

* fix button text overflow

* add transfer out all funds

* add show in progress transaction

* abbreviate address

* add wait for transaction completion

* move clear processing transaction to backend

* refactor

* fix types (wip)

* first transaction worked

* add update balance and transactions periodically

* add loading state to transaction list

* throw error, should never happen

* use ellipsis character

* "fix" type

* debounce expensive listTransactions()

* move debouncing to frontend

* simplify frontend again

* add store (wip)

* load transactions from disk

* loading transactions works again, next: send funds

* progress on sending fil

* only transfer a tiny amount for now

* never show incoming processing transactions

* wip

* refactor type

* docs

* refactor type

* refactor types

* port type to renderer

* refactor type

* fix success/failure not being shown

* clean up

* refactor

* fix button not changing

* fix balance loading

* disable transfer fil while sending

* fix types / lint / typo

* unify processing transaction naming

* simplify

* refactor

* fix missing await

* fix braces

* fix test

* update typing style

* refactor `Array#filter` -> `Array#find`

* use type guards

* rename `sent` to `succeeded`

* refactor

* refactor

* test `getSeedPhrase`

* test and refactor more

* refactor `getStateReplay`

* refactor `getTipset`

* cleanup

* move .transactions to backend

* refactor `fetchAllTransactions`

* clean up

* wip

* Revert "use type guards"

This reverts commit d85f943.

* fix type fallback

* refactor

* adjust elements to new text sizes

* refactor `#fetchAllTransactions`

* use `p-map` for configuring concurrency

* downgrade to `p-map@4`

* fix p-map usage

* simplify transaction errors into strings

* debug

* disable keyring in tests

* refactor

* disable keytar completely

* disable keytar more

* disable keytar during e2e tests

* enable saturn again

* add very simple test for `fetchAllTransactions`

* increase test timeout

* prevent `updateBalance` race conditions

* increase test timeout again

* log

* refactor types

* Revert "refactor types"

This reverts commit c9f81c9.

* docs

* refactor

* refactor `transferFunds`

* add tests for `getTransactionsForUI`

* convert renderer typings from `.d.ts` to `.ts`

* add missing `onTransactionUpdate` call

* add back type guards

* fix transactions not updating

* debug

* try downgrading `keytar`

* try downgrading `keytar` more

* try downgrading `keytar` even more

* switch back to latest `keytar`

* more debug

* use fork of electron-builder

* bump action-electron-builder

* clean up

* try fixing afterSign hook

* FIXME: disable build task

* enable debug again

* try fixing beforePack hook

* switch to `npm exec` to fix builder issue

* clean up

* debug

* unlock full transfer

* enable build again

---------

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
Co-authored-by: Miroslav Bajtoš <saturn@bajtos.net>

---------

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
Co-authored-by: Pedro Oliveira <poliveira@subvisual.co>
Co-authored-by: Pedro Oliveira <jopedroliveira@users.noreply.github.com>
Co-authored-by: Miroslav Bajtoš <saturn@bajtos.net>
juliangruber added a commit that referenced this pull request Feb 20, 2024
juliangruber added a commit that referenced this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants