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: Transaction service refactoring #1053

Merged
merged 21 commits into from
Sep 21, 2023
Merged

Conversation

egor0798
Copy link
Contributor

@egor0798 egor0798 commented Sep 7, 2023

Resources:

Changes:

  • Created ExtrinsicService and moved extrinsic creation logic from transaction service
  • Made transaction service statefull so UI would not be responsible for creating transaction
  • Removed multisig transaction creation logic from UI
  • Integrated new transaction service to transfer flow

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

Current coverage report

Summary

Lines Statements Branches Functions
Covered: 59%
58.37% (1168/2001) 31.14% (237/761) 40.13% (183/456)

Tests which was executed

Tests Skipped Failures Errors Time
213 0 💤 0 ❌ 0 🔥 3m 10s ⏱️
Coverage by files (59%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files58.3731.1440.1359.98 
domain100100100100 
   connection.ts100100100100 
entities/asset100100100100 
   index.ts100100100100 
entities/multisig/lib/multisigTx/common16.360020.93 
   utils.ts16.360020.9326–36, 41–47, 56–72, 80–94, 110–125, 135–139, 160–188
entities/transaction100100100100 
   index.ts100100100100 
entities/transaction/lib28.39010.7628.02 
   extrinsicService.ts25.71010.862523, 40–52, 58–298, 313–354, 363–366, 369, 373, 384–396
   transactionService.ts30.43010.5230.3330, 39–41, 54–62, 73–75, 79–81, 89–91, 95–97, 101–104, 108–111, 120–186, 191–193, 197–203, 212
features/operation/init/ui10071.42100100 
   OperationFooter.tsx10071.4210010085
pages/Staking/Operations/Bond83.554.546085.05 
   Bond.tsx83.554.546085.0576–79, 84–85, 133–134, 147, 162–172, 246
pages/Staking/Operations/Bond/InitOperation71.8139.0255.1779.12 
   InitOperation.tsx71.8139.0255.1779.1293–95, 108–114, 120, 158–161, 173, 177–183, 187–190, 204
pages/Staking/Operations/ChangeValidators83.955.266085.71 
   ChangeValidators.tsx83.955.266085.7172–75, 80–81, 125–126, 137, 152–154, 220
pages/Staking/Operations/ChangeValidators/InitOperation79.7745.8373.9184.93 
   InitOperation.tsx79.7745.8373.9184.9379, 107–109, 113–116, 130–132, 137–139, 145
pages/Staking/Operations/Destination81.9251.355083.78 
   Destination.tsx81.9251.355083.7856–57, 70–73, 78–79, 129–136, 149, 199
pages/Staking/Operations/Destination/InitOperation78.5739.2873.9183.58 
   InitOperation.tsx78.5739.2873.9183.5877, 99–101, 105–108, 127–129, 134–136, 142
pages/Staking/Operations/Redeem23.756.457.1419.17 
   Redeem.tsx23.756.457.1419.1725–196
pages/Staking/Operations/Redeem/InitOperation74.2840.7460.7178.65 
   InitOperation.tsx74.2840.7460.7178.65106–112, 136–138, 146–159, 169–175, 179–182, 188
pages/Staking/Operations/Restake84.1455.8857.1486.3 
   Restake.tsx84.1455.8857.1486.369–72, 77–78, 124–131, 142, 198
pages/Staking/Operations/Restake/InitOperation69.9134.2859.3775.26 
   InitOperation.tsx69.9134.2859.3775.2699–111, 136–138, 142–145, 156–159, 164–170, 174–177, 189
pages/Staking/Operations/StakeMore84.1455.8857.1486.3 
   StakeMore.tsx84.1455.8857.1486.369–72, 77–78, 122, 132–139, 199
pages/Staking/Operations/StakeMore/InitOperation69.638.4653.5778.04 
   InitOperation.tsx69.638.4653.5778.0490–96, 122–124, 128–131, 143, 147–153, 157–160, 172
pages/Staking/Operations/Unstake79.5454.2857.1482.05 
   Unstake.tsx79.5454.2857.1482.0570–73, 78–79, 125–132, 143–151, 212
pages/Staking/Operations/Unstake/InitOperation66.9430.7655.8871.28 
   InitOperation.tsx66.9430.7655.8871.28105–117, 122, 142–144, 148–159, 171–174, 179–185, 189–192, 204
pages/Staking/Operations/components/Confirmation85.29754087.09 
   Confirmation.tsx85.29754087.0977–87
shared/api/storage100100100100 
   index.ts100100100100 
shared/lib/utils100100100100 
   index.ts100100100100 
widgets/SendAssetModal/ui27.53107.1423.43 
   SendAssetModal.tsx27.53107.1423.4332–192
widgets/SendAssetModal/ui/components12.80014.15 
   TransferForm.tsx12.80014.1580–439
widgets/SendAssetModal/ui/components/ActionSteps16.840018.28 
   Confirmation.tsx45.450052.6339–87
   InitOperation.tsx11.530012.6346–266
   Submit.tsx15.620016.3935–142

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

Jest Unit tests results

Generic badge

Duration: 228.155 seconds
Start: 2023-09-21 12:20:16.356 UTC
Finish: 2023-09-21 12:24:04.511 UTC
Duration: 228.155 seconds
Outcome: Passed | Total Tests: 339 | Passed: 339 | Failed: 0
Total Test Suites: 141
Total Tests: 339
Failed Test Suites: 0
Failed Tests: 0
Passed Test Suites: 141
Passed Tests: 339

@egor0798 egor0798 marked this pull request as ready for review September 11, 2023 10:35
@egor0798 egor0798 marked this pull request as draft September 11, 2023 10:47
@egor0798 egor0798 marked this pull request as ready for review September 11, 2023 15:29
Copy link
Contributor

@tuul-wq tuul-wq left a comment

Choose a reason for hiding this comment

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

Code has become much cleaner, nice!

Copy link
Member

@valentunn valentunn left a comment

Choose a reason for hiding this comment

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

PR doesnt follow discussed architecture and doesnt solve problems that we stated as a DOD for this task

@valentunn
Copy link
Member

Please consider the following DOD for this PR:

No single screen should have if(multisig) logic. Otherwise whole refactoring becomes uselles

@egor0798 egor0798 merged commit e30b527 into dev Sep 21, 2023
4 checks passed
stepanLav added a commit that referenced this pull request Sep 29, 2023
* Feat: Transaction service refactoring (#1053)

* feat: added new transaction service, extrinsic builder and changed transfer florw

* feat: removed extra components, changed get fee func

* fix: wrap tx for submit step only if account is multisig

* feat: implemented new service usage for staking transactions

* fix: fix build tx error

* chore: fixed tests, removed extrinsic service from public api

* fix: signatory error fix

* chore: renamed wrappers

* chore: renamed operation footer prop and make it optional

* Update src/renderer/entities/transaction/lib/extrinsicService.ts

Co-authored-by: Yaroslav Grachev <[email protected]>

* Update src/renderer/entities/multisig/lib/multisigTx/common/utils.ts

Co-authored-by: Yaroslav Grachev <[email protected]>

* chore: fixed pr comments

* chore: fixed linter error

* chore: removed extra props from transfer form

* chore: fix lockfile

* chore: fixed confirmation test

* fix: fixed xcm transfer fee error

* fix: fixed amount error

* chore: fixed invalid character error

---------

Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>

* feat: add stage build

* fix: remove config separation

* fix: change triggers

* fix: github triggers

* fix: change approach to url management

* fix: change trigger and github command

* fix: add separate webpack for internal build

* fix: eslinter

* fix: typo in yamls

* Update src/main/factories/create.ts

Co-authored-by: Aleksandr Makhnev <[email protected]>

---------

Co-authored-by: egor0798 <[email protected]>
Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: Aleksandr Makhnev <[email protected]>
stepanLav added a commit that referenced this pull request Oct 3, 2023
* Feat: Price provider model (#1084)

* Feat: Currency settings (#1076)

* Feat: fiat balance assets and staking (#1087)

* Feat: amount input currency (#1083)

* feat: currency select modal

* chore: added icon for currency

* feat: added currency mode to amount input

* feat: price provider model

* feat: load assets prices

* chore: code style, export events

* feat: integrated currency modal to currenc settings

* chore: updated crouped select semantics

* chore: fixed General Action test

* chore: fixed grouped select active state

* feat: tests for models, review fixes

* chore: fixed pr comments

* chore: added currency form model

* fix: fixed modal reload after submit

* feat: [wip] amount input currency integration

* chore: removed button disabled condition

* feat: amount input with currency integration

* fix: tests

* feat: form model, test

* chore: removed GroupedSelect

* fix: ui
fix: correct input for priceless asset

* fix: revert commented code

---------

Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: asmadek <[email protected]>

* Feat: wallet fiat balance balance (#1099)

* Feat: Operations parameters fiat amount (#1098)

* Feat: Price provider model (#1084)

* Feat: Currency settings (#1076)

* Feat: fiat balance assets and staking (#1087)

* Feat: amount input currency (#1083)

* feat: currency select modal

* chore: added icon for currency

* feat: added currency mode to amount input

* feat: price provider model

* feat: load assets prices

* chore: code style, export events

* feat: integrated currency modal to currenc settings

* chore: updated crouped select semantics

* chore: fixed General Action test

* chore: fixed grouped select active state

* feat: tests for models, review fixes

* chore: fixed pr comments

* chore: added currency form model

* fix: fixed modal reload after submit

* feat: [wip] amount input currency integration

* chore: removed button disabled condition

* feat: amount input with currency integration

* fix: tests

* feat: form model, test

* chore: removed GroupedSelect

* fix: ui
fix: correct input for priceless asset

* fix: revert commented code

---------

Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: asmadek <[email protected]>

* feat: added fiat amount for transfer and multisig operations

* feat: added fiat values to staking operations

---------

Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: Aleksandr Makhnev <[email protected]>
Co-authored-by: Egor B <[email protected]>

* Feat: Fiat update rules (#1096)

* feat: fiat update rules

* chore: added test

* Update src/renderer/entities/price/model/__tests__/price-provider-model.test.ts

Co-authored-by: Yaroslav Grachev <[email protected]>

* chore: updated price proveder test

* chore: improved priceProvider test

---------

Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>

* Feat/adding dev build (#1103)

* Feat: Transaction service refactoring (#1053)

* feat: added new transaction service, extrinsic builder and changed transfer florw

* feat: removed extra components, changed get fee func

* fix: wrap tx for submit step only if account is multisig

* feat: implemented new service usage for staking transactions

* fix: fix build tx error

* chore: fixed tests, removed extrinsic service from public api

* fix: signatory error fix

* chore: renamed wrappers

* chore: renamed operation footer prop and make it optional

* Update src/renderer/entities/transaction/lib/extrinsicService.ts

Co-authored-by: Yaroslav Grachev <[email protected]>

* Update src/renderer/entities/multisig/lib/multisigTx/common/utils.ts

Co-authored-by: Yaroslav Grachev <[email protected]>

* chore: fixed pr comments

* chore: fixed linter error

* chore: removed extra props from transfer form

* chore: fix lockfile

* chore: fixed confirmation test

* fix: fixed xcm transfer fee error

* fix: fixed amount error

* chore: fixed invalid character error

---------

Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>

* feat: add stage build

* fix: remove config separation

* fix: change triggers

* fix: github triggers

* fix: change approach to url management

* fix: change trigger and github command

* fix: add separate webpack for internal build

* fix: eslinter

* fix: typo in yamls

* Update src/main/factories/create.ts

Co-authored-by: Aleksandr Makhnev <[email protected]>

---------

Co-authored-by: egor0798 <[email protected]>
Co-authored-by: Egor B <[email protected]>
Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: Aleksandr Makhnev <[email protected]>

* Fix: Currency form value reset on close (#1107)

* fix: added form reset on close

* feat: added disabled condition for save button

* chore: fixed pr comments

---------

Co-authored-by: Egor B <[email protected]>

* fix: changed default fiat flag value to true (#1106)

Co-authored-by: Egor B <[email protected]>

* fix: wallet balance assets undefined fix (#1108)

Co-authored-by: Egor B <[email protected]>

* Fix: zero balance errors fix (#1109)

* fix: network zero balances possible fix

* fix: wallet 0 balance fix, asset display 0 fix

* fix: wallet zero balance fix

* fix: network zero balance fix

---------

Co-authored-by: Egor B <[email protected]>

* fix: removed second shimmer from assets if fiat flag is false (#1110)

Co-authored-by: Egor B <[email protected]>

---------

Co-authored-by: Yaroslav Grachev <[email protected]>
Co-authored-by: egor0798 <[email protected]>
Co-authored-by: Aleksandr Makhnev <[email protected]>
Co-authored-by: Egor B <[email protected]>
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.

5 participants