Compare commits

...
Author SHA1 Message Date
Brian Sztamfater 4d381bd866 add more tests 2024-03-05 11:43:19 -03:00
Brian Sztamfater ba68ccdbac fix address input scan 2024-03-05 11:43:18 -03:00
Brian Sztamfater 178dd93a3b try to fix tests 2024-03-05 11:43:18 -03:00
Brian Sztamfater f7d4645946 fix navigate-back 2024-03-05 11:43:18 -03:00
Brian Sztamfater 1285d3f874 add unit tests 2024-03-05 11:43:17 -03:00
Brian Sztamfater 80fd9e00b0 naming refactor 2024-03-05 11:43:17 -03:00
Brian Sztamfater d667e826b2 fix: add support for multiple modals when tracking modal-view-ids in app-db 2024-03-05 11:43:15 -03:00
Sean Hagstrom f788d7bc85 [#19035] Add status tag for pending contact request to contact profile (#19075)
* chore: add english translation for contact-profile-request-pending

* feature: integrate status-tag for pending contact-request
2024-03-05 14:07:45 +00:00
Lungu Cristian 7415ebdc78 Updated placeholder for no pinned messages in chat (#18923)
* fix: same placeholder for chat & community pins

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: text linebreak

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

---------

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>
2024-03-05 15:47:48 +02:00
Alexander 58e9ae0334 Add peer syncing toggle in "Advanced settings" (#18906)
* Add peer syncing toggle in "Advanced settings"

* status-go-version.json

* Fixes
2024-03-05 12:59:06 +01:00
Sean Hagstrom e783deb5af [#18964] Support custom message when sending contact request (#18998)
* tweak: allow for optional message to be sent when making a contact request

* chore: migrate contact-request event handler from `rf/defn` to `rf/reg-event-fx`

* test: add tests for sending a contact request

* chore: make it easier to test on-success and on-error behaviour after sending a contact request

* tidy: use reframe fx for declaring json-rpc/call

* tidy: remove unused success event handler for send a contact request
2024-03-05 10:45:16 +00:00
Parvesh Monu e771d056a0 fix multiple set view-id events dispatched (#19083) 2024-03-05 11:50:00 +05:30
Omar Basem 62f68ff44b Fix: slide button (#18922)
* fix: slide button
2024-03-05 07:50:03 +04:00
Icaro Motta 5d1e1f8005 Make integration tests more enjoyable to use (#19025)
This commit brings numerous improvements to integration tests. The next step
will be to apply the same improvements to contract tests.

Fixes https://github.com/status-im/status-mobile/issues/18676

Improvements:

- Setting up the application and logged account per test is now done with an
  async test fixture, which is a very idiomatic way to solve this problem. No
  need anymore to write macros to wrap day8.re-frame.test/wait-for. The macros
  in test-helpers.integration will be removed once we apply the same
  improvements to contract tests.
- Integration test timeouts can be controlled per test, with a configurable,
  global default (60s).
- Now the integration test suite will fail-fast by default, i.e. a test failure
  short-circuits the entire suite immediately. This option can be overridden on
  a test-by-test basis. This improvement is very useful when investigating
  failures because the error will be shown on the spot, with no need to search
  backwards across lots of logs.
- Noisy messages from re-frame can be silenced with a test fixture. We can
  silence even more in the future if we remove the hardcoded printf call from
  C++ on every signal and control it with Clojure. We can disable most logs as
  well with the more direct (status-im.common.log/setup "ERROR") at the top of
  tests.integration-test.core. We can make verbosity even more convenient to
  control, but I think this should be designed outside this PR.
- Removed dependency on lib day8.re-frame/test for integration tests (see
  detailed explanation below).
- Each call to (our) wait-for can customize the timeout to process re-frame
  event IDs passed to it.
- Syntax is now flat, instead of being nested on every call to wait-for. You
  can now compose other async operations anywhere in a test.

Notes:

- promesa.core/do is essential in the integration test suite, as it makes sync &
  async operations play nice with each other without the developer having to
  promisify anything manually.
- There are lots of logs related to async storage ("unexpected token u in JSON at
  position..."). This isn't fixed yet.

Are we not going to use day8.re-frame.test?

We don't need this library in integration tests and we won't need it in contract
tests. Whether it will be useful after we remove it from integration and
contract tests is yet to be seen (probably not).

A few reasons:

- The async model of promises is well understood and battle tested. The one
  devised in the lib is poorly understood and rigid.
- There's basically no way to correctly integrate other async operations in the
  test, unless they can be fully controlled via re-frame events. For instance,
  how would you control timeouts? How would you retry in a test? How would
  forcefully delay an operation by a few seconds? These things are useful (to me
  at least) when developing integration/contract tests.
- Every call to day8.re-frame.test/wait-for forces you to nest code one more
  level. Code readability suffers from that choice.
- Have you ever looked up the implementation of wait-for? It's quite convoluted.
  One could say the source code is not that important, but many times I had to
  look it up because I couldn't understand the async model they built with their
  macro approach. The de facto primitive in JS for asynchronicity is promises,
  and we fully leverage it in this PR.
- The lib has an interesting macro run-test-sync, but we have no usage for it. I
  used it in status-mobile for a while. At one point, all event unit tests for
  the Activity Center used it (e.g. commit
  08fb0de7b0), but I replaced them with the
  simpler pure function style.
2024-03-04 22:38:42 -03:00
Jamie Caprani 191c876f47 chore(wallet): some minor cleanups: move sheets to appropriate level, remove unused rf event, improve one rf event api (#18895) 2024-03-04 12:34:21 -08:00
Ibrahem Khalil 0be66e28c1 Fix collectible/token icon and name on addresses for permissions screen (#18897) 2024-03-04 18:34:10 +02:00
Nazarii F fcdd6c5a79 Added destructuring section to new-guidelines.md (#18731)
Adds a section explaining the use cases of destructuring function parameters to
improve code style and reduce the chance of bugs.
2024-03-04 11:38:50 -03:00
Icaro Motta 27e177f18b Account selection: Use bottom sheet component (#18919)
Use bottom sheet component as designed in
Figma https://www.figma.com/file/h9wo4GipgZURbqqr1vShFN/Communities-for-Mobile?type=design&node-id=16409-98076&mode=design&t=jrVNb3JnWNurJwP8-0

- Fixes no animation when closing Addresses For Permissions modal:
  https://github.com/status-im/status-mobile/issues/18617
- Fixes drawer is always expanded:
  https://github.com/status-im/status-mobile/issues/18619

Additionally:

- Fixed incorrect code passing a function instance to a style prop, which leads
  to incorrect appearance for settings.category.reorder.view/view.
- Optimized Reagent a little bit by extracting functions that need to close over
  the community ID to the mount phase. That way, we avoid regenerating function
  instances on every re-render and Reagent can avoid a bit of re-work.

The challenge was to make the scrollable content work inside a
bottom sheet, while supporting the designs for a fixed (always visible) header
and footer.
2024-03-04 09:23:30 -03:00
Lungu Cristian f8cd14296f Add Promesa to simplify working with promises (#18767)
* added promesa (clj)

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* ref(resize): using promesa instead of passing cb

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

---------

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>
2024-03-04 13:59:52 +02:00
Parvesh Monu 851eb6ea8f fix settings navigation (#19080) 2024-03-04 16:06:59 +05:30
Volodymyr Kozieiev 7754460acc Malli schemas added to components (#18949) 2024-03-01 21:03:35 +00:00
Brian Sztamfater 7d55c98e0a feat: update transaction confirmation page to support bridging transactions (#18887) 2024-03-01 16:26:45 -03:00
Mohsen 0e9847f2c3 [#18963] feat: actions UI for stranger contact profile (#19028) 2024-03-01 16:14:05 +03:00
Sean Hagstrom 1aef3106bd Fix chat UI element colors (#18941)
* chore: add community color subscription

* fix: use configured chat color for chat ui and fallback to community color

* test: ensure community-color subscription returns the community color

* tidy: use resolve-color function instead of custom-color function

* revise: rename community-color to customization-color and default non-community channel color to turquoise
2024-03-01 10:46:29 +00:00
Lungu Cristian a4b973970b Fix account edit confirmation button (#18930)
* fix: confirm button not visible

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: edit account btn text

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: removed bottom-action? prop

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: removed unused on-focus and on-blur props

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* ref: using floating-button-page

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: linting error

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: hide btn when disabled and keyboard hidden

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: react warning and header height (again)

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: replace padding prop with style

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* fix: addressed review comments

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

* chore: removed redundant :f> due to new reagent compiler

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>

---------

Signed-off-by: Cristian Lungu <lungucristian95@gmail.com>
2024-03-01 12:00:32 +02:00
Omar Basem abd2b43ce6 Wallet: finalize kp (#18991)
Wallet: finalize kp
2024-03-01 08:09:36 +04:00
BalogunofAfrica ac78dea8ef fix: use blacklist for parallax (#18971) 2024-02-29 17:13:06 +01:00
Mohsen b1f0d1c3d7 [#18865] fix: separate edit bio and set bio, update number of profile name characters (#18892) 2024-02-29 18:28:09 +03:00
flexsurfer da22063308 Error on login with touch ID enabled #19055 (#19057) 2024-02-29 14:56:44 +01:00
flexsurfer c15084fffa fix watch address input field (#19051) 2024-02-29 14:40:01 +01:00
Omar Basem d637f69a45 Revert account origin sheet (#19034)
Revert account origin sheet (#19034)
2024-02-29 10:13:15 +04:00
Yevheniia Berdnyk 05a810b051 e2e: updated method for a profile picture changing 2024-02-29 02:25:59 +02:00
Ibrahem Khalil 7db35a3cc8 Fix statusbar color on dark screens (#18785) 2024-02-28 18:53:13 +02:00
Siddarth Kumar 1301bbc0d9 chore: bump status-go version to v0.176.2 (#19036) 2024-02-28 20:42:10 +05:30
Anton Iakimov 5f4d4bfc11 ci: cleanup more build artifacts
Should be cleaning artifacts for more than 1+1 build for each branch.
2024-02-28 15:50:47 +01:00
flexsurfer 26dd51c5da [#19004] Password input cursor is jumping when typing password fast (#19029) 2024-02-28 15:23:15 +01:00
Parvesh Monu bd7ced5f25 Fix quo preview navigation (#19003) 2024-02-28 18:34:53 +05:30
Icaro Motta 61f8c51d85 Fix: only run unit tests in test-unit target (#18947) 2024-02-28 09:51:53 -03:00
Mohsen 781b83d13d [#18961] feat: add new contact profile skeleton (#19001) 2024-02-28 15:02:24 +03:00
flexsurfer b7bffb3bd3 migrating to react state. step 2 (#18905) 2024-02-28 11:49:49 +01:00
flexsurfer 047e45d2a3 migrating to react state. step 1 (#18901) 2024-02-28 11:48:23 +01:00
Flavio Fraschetti acc6a3c072 Add the Contract Tests to the mobile CI/CD pipeline (#19017)
* Add the Contract Tests to the mobile CI/CD pipeline

* Increase timeout to 20 minutes
2024-02-28 06:47:45 -03:00
Andrea Maria Piana 7171c7085d Bump version to 0.176.1 (#19024) 2024-02-28 08:35:33 +00:00
Lungu Cristian 6d227b61e1 Add react hooks use-state and use-memo (#19016)
* feat: added use-state and use-memo

* feat: add reagent functional compiler

* test: fixed recovery-phrase tests
2024-02-27 15:36:12 +02:00
Siddarth Kumar bf1a734c4e fix: cleanup wallet push notification subscription (#19014)
fixes #19012

### Summary

The legacy wallet code was removed here -> https://github.com/status-im/status-mobile/pull/18749
as part of that purge we also cleaned up re-frame subscriptions for wallet push notifications.

Since the new wallet is under active development we would not need this toggle in settings just yet.

This commit fixes the app crashing on settings UI.

## Platforms
- Android
- iOS
2024-02-27 17:10:37 +05:30
Siddarth Kumar f8eee09d1b chore: update ios/logs to logs dir (#18974)
fixes #18915

In this PR https://github.com/status-im/status-mobile/pull/18900 we added a `logs` folder in the root directory and it was discovered that we also have an `ios/logs` folder which the CI uses to generates logs during build time.
Its more consistent if we move those logs to the log folder in the root of the repo.
This commit fixes that and updates leftover usages.
2024-02-27 14:21:30 +05:30
Jamie Caprani 42d2690c85 chore: remove legacy wallet code (#18749) 2024-02-25 20:00:56 +00:00
flexsurfer b0133e97cf UI components coding guidelines (#18926)
* UI components coding guidelines
2024-02-23 18:30:46 +01:00
flexsurferandYevheniia Berdnyk 3c4f72c061 Enable functional components by default (#18820)
* enable functional components by default

* e2e: updated counter component locator

---------

Co-authored-by: Yevheniia Berdnyk <ie.berdnyk@gmail.com>
2024-02-23 18:29:10 +01:00
Sean Hagstrom 265b712fe3 [#18912] resolve schema issues for context-tag (#18927) (#18927)
chore: create profile-picture schema with profile-picture-fn field

fix: update context-tag schema to allow for profile-picture-fn

tidy: move profile-picture schema into the common schema namespaces

tidy: revise docs for user-avatar-internal component to mainly warn about `profile-picture-fn` usage

tidy: rename `profile-picture` schema to `profile-picture-source`

tidy: use profile-picture-source schema in user-avatar schema
2024-02-23 14:01:14 +00:00
jakub 13f87020eb ci: drop NIX_IGNORE_SYMLINK_STORE from Makefile and CI
This is a fix applied when upgrading to macOS Catalina in 2019:

https://github.com/status-im/status-mobile/pull/9218

I do not believe it is necessary any longer.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-02-23 12:14:08 +01:00
Mohamed Javid 4f5480e36f [Feature] Enable Sepolia as default test network (#18917)
This commit:
- enables Sepolia test network by default
- adds a toggle to switch to the Goerli test network

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-02-23 16:18:35 +05:30
Parvesh Monu 9fab422e0c fix settings navigation (#18854) 2024-02-23 15:09:11 +05:30
frank 6f8aa15b17 fix: sometimes channels do not randomly appear in test community after its creation (#18705) 2024-02-23 12:12:02 +08:00
frank 4469717cc1 fix: sync qr code not visible (#18944) 2024-02-23 10:15:35 +08:00
Yevheniia Berdnyk 5d00c09597 e2e: temp - dict object error info 2024-02-22 22:07:15 +02:00
jakub fee8ef5524 ci: remove starting build of status.im website
This website is now decomissioned and no longer updated.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-02-22 12:46:10 +01:00
yqrashawn 7e228d0e66 chore(schema): for user-avatar component (#18913) 2024-02-22 19:20:13 +08:00
Siddarth Kumar 3c12ac870a chore: fix few outdated things in docs & readme (#18920) 2024-02-22 00:17:09 +05:30
Paul Fitzgerald 321ff9257b feat(communities): add feature to share community channel qr code (#18807) 2024-02-21 05:59:04 -08:00
Omar Basem 28f43acb83 feat: new keypair: mnemonic, address, KP name screen (#18790)
feat: new keypair: mnemonic, address, KP name screen (#18790)
2024-02-21 15:53:14 +04:00
Andrea Maria Piana cfaed80066 dont display previous state when checking 2024-02-21 11:17:45 +00:00
Ulises Manuel fa9b53854b [#18463] Wallet - Page top refactor (#18755)
* Use page-top in bridge screen

* Use page-top in bridge-to screen

* Use page-top in add-address-to-watch screen

* Use page-top in backup-recovery-phrase screen

* Use page-top in check-your-backup screen

* Add support for title right options to page-top

* Use page-top in check-your-backup screen

* Use page-top in send-to screen

* Use page-top in select-asset screen

* Use page-top in :wallet-share-address screen

* Deprecate text-combinations
2024-02-20 23:24:17 -06:00
Ulises Manuel 680bc33971 [#18545] Add missing linear gradient to dark themed cards (#18689)
* Add missing linear gradient to cards dark themed cards
- Fix the `:ellipsis-mode` property
- Simplify code
2024-02-20 17:29:34 -06:00
mmilad75 c7aa10c789 The last collectible is shown for a moment while opening a new collectible #18750 (#18793)
* fix issue

* move navigation to the event

* move clearing to hook

* revert scroll_page

* resolve comment

* fix duplicate navigation
2024-02-20 18:34:33 +03:30
Ajay Sivan ae08cb161f Check eligibility status after enabling the share all addresses toggle 2024-02-20 14:45:46 +00:00
Volodymyr Kozieiev ae75eaeb33 Link to Malli presentation added to docs (#18849) 2024-02-20 12:43:44 +00:00
Parvesh Monu 424bbc39c4 cleanup leftovers (#18907) 2024-02-20 14:32:03 +05:30
Siddarth Kumar 5a7bfc61cc fix: make run-ios-device script (#18845)
fixes #16310

We used to reply on `react-native cli` and would pass a `--device` flag to deploy the debug variant of `iOS` app on connected `iPhone`.
`react-native cli` under the hood uses `ios-deploy` library to achieve this functionality.
This showed many weird issues, specifically in locating connected devices and failures at build step with ambiguous error messages.

This commit fixes it by using our custom script `run-ios-devices.sh` which does not rely on `ios-deploy`.
We use `libimobiledevice` to identify `UDID` of a connected `iPhone`.
We use `xcrun devicectl device install app` and `xcrun devicectl device process launch` to install and launch the app.

This works well with `Xcode 15` and `iOS 17.x`.
We can now remove `ios-deploy` from `iOS` shell and `nix` overlay.
We also set up a logs folder and add a Readme.

## Review notes

- connect your iPhone to your Laptop via a cable
- `make run-clojure`
- `make run-ios-device`
(note: no need to pass device name now)

## Platforms
- iOS
2024-02-20 10:54:09 +05:30
yqrashawn 50f6c1ef1b fix: password input triggers re-render of whole login view (#18728) 2024-02-20 10:11:22 +08:00
Siddarth Kumar 3c6b38aeea fix: improve iOS simulator selection (#18880)
## Summary

Improve iOS Simulator selection via `make run-ios` command.
Currently : `make run-ios SIMULATOR="iPhone SE (3rd generation)"` would fail because of our scripts inability to deal with this kind of a pattern.

This commit fixes that and makes this script more robust by storing output of `xcrun simctl list devices` in a json file `ios_simulators_list.json` and then using `jq` to properly get `UDIDs` of those simulators.

This script will now also prompt you to download a simulator image if you do not already have it.

The file `ios_simulators_list.json` will also help in future debugging when we want to check a quick summary of iOS simulator status of devs in the future.

We also append `-verbose` to `xcodebuild` for debug `iOS` builds, this helps debugging.

## Review notes
try such options -> `make run-ios SIMULATOR="iPhone SE (3rd generation)"`

## Platform 
- iOS
2024-02-20 07:16:54 +05:30
Siddarth Kumar c44ba69676 fix: we need to tunnel 8081 for connected devices (#18862)
`make run-android` would fail for connected Android devices because the android device was not able to talk to metro bundler.
This was discovered by @J-Son89
This was easily fixed by reverse tcping port 8081.

## Review notes
connect Android device by USB or Wifi
- `make run-clojure`
- `make run-android`
status app must run without any errors on the connected Android device.

we also replace during install on emulator.

otherwise on old emulators `make run-android` fails with :

```
adb: failed to install ./result/app-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install im.status.ethereum.debug without first uninstalling.]
```
2024-02-20 00:52:29 +05:30
Parvesh Monu f394fcc3d5 fix android hardware back button is not working for nested sheet-screens (#18886) 2024-02-19 22:42:34 +05:30
Siddarth Kumar 107f263fb1 chore: improve android & iOS build step (#18900)
fixes #18888

## Summary
`make run-android` was sometimes flaky because we used to send metro to background via `nohup` and then bring it back to foreground after we read metro logs.

Now we do not send metro to background. We first wait for a successful build.
we then install the app on the simulator. After this is done we give command to sleep until metro server has started, Once metro server has started we open the installed app.

In this workflow the command to open the installed app goes in background and metro stays in foreground.
The new workflow should now be less flaky.

## Review notes
`make run-clojure`
`make run-android` OR `make run-ios` should just work 

#### Platforms
- Android
- iOS
2024-02-19 21:11:36 +05:30
Ajay Sivan 678bc548ca Use quo/bottom-actions component in addresses for permissions screen (#18863) 2024-02-19 07:06:35 -08:00
mmilad75 d77033e346 Wallet - Add malli spec to Quo Wallet components (batch 3) (#18783)
* draft

* add account_card

* add account-origin

* add account_overview

* add account_permission

* add address_text

* add confirmation_progress

* wrapping up

* resolve comments and fix ci issues

* fix ci issues

* fix transaction_progress tests

* fix all tests

* fix lint issues

* add network-link

* add token-input

* add wallet-overview

* add context-tag

* add wallet-activity

* add transaction-progress

* add transaction-summary

* add default value to render-with-theme-provider

* draft

* add default value to context-tag schema

* fix lint issues

* resolve comments

* add :string type to image type

* update ?image-source schema
2024-02-19 18:01:07 +03:30
Parvesh Monu 8f85e3c726 fix first tap doesn't work when selecting a photo in the gallery (#18885) 2024-02-19 19:05:31 +05:30
Shivek Khurana ed427cf485 🧪 Extract schema to dedicated namespace (#18858)
* 🧪 Extract schema to dedicated namespace

* ✏️ Fix syntax errors and dep issue

* 🦞 Follow guidelines
2024-02-19 13:16:17 +00:00
BalogunofAfricaandLungu Cristian 9362d12bbd fix: communities review (#18634)
* fix: community tag emoji size

* fix: hide channel category sticky header for none

* fix line wrap

* fix formatting

* refactor emoji component for tags

---------

Co-authored-by: Lungu Cristian <lungucristian95@gmail.com>
2024-02-19 08:26:32 +01:00
Flavio Fraschetti bfed36d19f [Communities] Account selection: сan't see the entire text of the community rules (#18761)
Resolved the scrolling issue pertaining to community rules. Additionally, will ensure compatibility with iOS devices lacking safe-area-view in the follow-up.
2024-02-18 08:03:52 -03:00
Yevheniia Berdnyk 456ccb4c69 e2e: temp fix for image selection 2024-02-17 19:03:20 +02:00
Andrea Maria Piana be2c697b7c set light client 2024-02-16 16:30:44 +00:00
Ajay Sivan b27f323dd7 FIX: Addresses for permissions info button bg color (#18855) 2024-02-16 06:08:05 -08:00
Mohsen a33e7f2e90 [#18600] feat: implement set bio screen (#18765) 2024-02-16 16:19:44 +03:00
Ajay Sivan 54d9e5ebeb Share all current and future addresses - UI (#18843)
Fixes
- 'Confirm changes' button unexpected enabled state
- The Confirm button remains enabled even after deselecting all addresses when the user has watch-only wallet accounts.
- Disable the Confirm button when the user deselects the accounts with the token required to join.
- Use community color for address checkbox
2024-02-16 04:11:22 -08:00
Alexander 49567596da General QR code scanner flow (#18677)
* QR scanner

* More options for QR

* Router fixes

* Updates for `on-qr-code-scanned`

* Update for communities

* Updates

* Scan profile path

* More fixes

* Last fixes for scanning

* Fixes

* Fixes

* Fixes

* Test fixes

* Fixes

* Updated Utils.m

* Test fix
2024-02-16 12:06:28 +01:00
Nikolay 2e23dc7ad7 chore(wallet): update default placeholder name for account and watched address when adding it #18416 (#18683) 2024-02-15 20:30:38 +00:00
Mohsen dc53bddb66 [#18754] fix: scrollable addresses permission list in android (#18808) 2024-02-15 18:00:21 +03:00
Mohamed Javid 10f9fe11db [Fix] Broken wallet account emoji when syncing devices (#18828)
This commit fixes the broken wallet account emoji when syncing devices by adding a sanitization method for the wallet account emoji. The desktop can handle both variants (raw emoji and img tag); this PR adds the same for mobile.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-02-15 18:52:59 +05:30
Flavio Fraschetti 2e13cfc47f [Refactor#18748] - Collectible Tag (#18804)
[Refactor Collectible Tag] Improve component schema and add component_spec
2024-02-15 09:52:24 -03:00
Siddarth Kumar e6ea8ae9a9 fix: iOS build stage to install app on simulator (#18839)
fixes #18836

## Summary

While introducing https://github.com/status-im/status-mobile/pull/18784 I missed out on adding an install step to `run-ios.sh` script.

`make run-ios` would work fine for simulators that already have the app installed but would fail for new emulators.
@flexsurfer  discovered this problem.

This commit fixes that by adding an install step to the script.

## Review notes
- `make run-clojure`
- `make run-ios` 
should just work.

## Platforms
- iOS
2024-02-15 17:55:06 +05:30
Alexander 834c0a3800 Design review: create profile password (#18607)
* Design review: create profile password

* Fixes

* Fixes

* Fixes

* Fixes

* Code style fix

* Fixes
2024-02-15 10:42:54 +01:00
Siddarth Kumar 2c96c38339 chore: disable hermes and cleanup gradle vars (#18832)
fixes #18831

We update the nix derivation to build android by passing `hermesEnabled` flag which checks the environment variable and if the environment variable is not set we default `hermesEnabled` to `true`.
This ensures that `hermes` is disabled for debug builds and enabled for release builds.

In this commit we also
- rename `nix/mobile/android/release.nix` → `nix/mobile/android/build.nix` since that nix file no longer generates release only builds.
- cleanup 2 other env vars and use the `gradle` project format
- replace `BUILD_NUMBER` with `verisonCode` for consistency
- replace `androidGradleOpts ` with `buildUrl ` 
- bump `status-jenkins-lib` to v1.8.7
2024-02-15 13:48:11 +05:30
Mohsen 1d2c01c16b [#18752] fix: The W/O address shouldn't be in account selection (#18809) 2024-02-14 20:37:52 +03:00
Andrea Maria Piana 8dc71f6432 Fix translations 2024-02-14 16:12:17 +00:00
Andrea Maria Piana 25f9499454 remove rounding 2024-02-14 16:12:17 +00:00
Siddarth Kumar 42cab08553 chore: Improve DX for building the app locally (#18784)
After upgrading `react-native` to `0.72.5` we frequently started seeing the _red screen of death_ on both `Android` and `iOS` simulators right after the app was built and installed.
This used to happen because our workflow required us to do the following :
- `make run-clojure`
- `make run-metro`
- `make run-ios` OR `make run-android`

The problem with this approach was after `metro` was started the `iOS`, `Android` build step would change the files that `metro` couldn't handle and hence metro would go out of sync.
The quick fix back then was to restart `metro` terminal and to open the app again from the simulator.
This was however not a good DX.

This commit fixes that.
We no longer rely on `react-native` cli to generate and deploy debug builds on simulators. We take control of the process via our own script. The new workflow introduced in this commit will first build the app, then install the app on the simulators and then start metro terminal. When `metro` is successfully running the script will then open the app.

The new workflow now is :
- `make run-clojure`
- `make run-ios` OR `make run-android`
2024-02-14 19:58:45 +05:30
Jamie Caprani 83523b1923 chore: clean up wallet reframe root keys (#18730) 2024-02-14 04:29:35 -08:00
Mohamed Javid f762cdcf9b [Feature] Wallet - Network filter UI in Wallet home and account screens (#18772)
This commit adds network filter UI in the Wallet home and account screens.

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-02-14 15:37:04 +05:30
Ibrahem Khalil 357db52720 Use blurred background for all type shell? bottom sheets (#18400) 2024-02-13 22:54:43 +02:00
Yevheniia Berdnyk 5fdaf0054d e2e: updated join community 2024-02-13 15:26:19 +00:00
Andrea Maria Piana 4e3ce54ac4 Reduce renderings in community overview
https://github.com/status-im/status-go/compare/c15f9e73...1ea2bd99

This PR reduces the amount of rendering in community overview.
It limits the amount of data is passed to components to the necessary,
and it creates functions on component initialization so that they won't
cause a re-render.
Performance of the header are very noticeably better on my local
environment, though on nightly builds is less noticeable.

It also removes data from `communities/communities id` as that cause a
re-render of any component subscribed to it.
2024-02-13 15:26:19 +00:00
Andrea Maria Piana 37be08d2d7 Fix permission screen & trailing zeros
https://github.com/status-im/status-go/compare/c15f9e73...b7b7660a

There were a few issues with the permission screen:
1) Wrong permission was displayed when able to join
2) If not able to join, we were showing both admin/member permissions
3) Trailing zeros in token amount
2024-02-13 15:26:19 +00:00
Paul FitzgeraldandJamie Caprani 3c4d27b6ff chore(wallet): connect UI and data model for input page in bridge flow (#18678)
Co-authored-by: Jamie Caprani <jamiecaprani@gmail.com>
2024-02-13 07:24:02 -08:00
jakub c5df51d944 nix: upgrade from 2.13.4 to 2.19.3
We are moving location of symlinks for build derivations for `gcroots`
from `/nix/var/nix/gcroots/per-user` to `.nix-gcroots` in the repo to
avoid errors like this caused by profile migration in `2.14` release:
```
error: creating directory '/nix/var/nix/gcroots/per-user/joe': Permission denied
```
For more details see: https://github.com/NixOS/nix/issues/8564

To upgrade without using `make nix-purge` use `make nix-upgrade`.

Related infra change:
https://github.com/status-im/infra-ci/commit/37c6ce47

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-02-13 13:32:50 +01:00
NikolayandJamie Caprani b1c467de19 feat(wallet): add ui for account origin info (#18725)
Co-authored-by: Jamie Caprani <jamiecaprani@gmail.com>
2024-02-13 03:27:28 -08:00
Shivek Khurana c766d21296 ⚒️ Fix typo (#18794) 2024-02-12 20:50:07 +00:00
467 changed files with 7079 additions and 12000 deletions
+1
View File
@@ -26,6 +26,7 @@
malli.generator malli.generator
malli.transform malli.transform
malli.util malli.util
promesa.core p
schema.core schema
status-im.feature-flags ff
taoensso.timbre log}}
+9
View File
@@ -0,0 +1,9 @@
{:lint-as {promesa.core/-> clojure.core/->
promesa.core/->> clojure.core/->>
promesa.core/as-> clojure.core/as->
promesa.core/let clojure.core/let
promesa.core/plet clojure.core/let
promesa.core/loop clojure.core/loop
promesa.core/recur clojure.core/recur
promesa.core/with-redefs clojure.core/with-redefs
promesa.core/doseq clojure.core/doseq}}
+1
View File
@@ -34,3 +34,4 @@ STICKERS_TEST_ENABLED=1
LOCAL_PAIRING_ENABLED=1
TEST_STATEOFUS=1
FAST_CREATE_COMMUNITY_ENABLED=1
FLAG_NEW_CONTACT_UI_ENABLED=0
+3
View File
@@ -194,3 +194,6 @@ test/appium/tests/users.py
## git hooks
lefthook.yml
## build time logs
/logs/*.log
+31 -28
View File
@@ -22,34 +22,37 @@
:multi-lhs-hang]
:fn-map
{"reg-sub" :arg1-pair
"h/describe" :arg1-body
"h/describe-skip" :arg1-body
"h/describe-only" :arg1-body
"h/test" :arg1-body
"h/test-skip" :arg1-body
"h/test-only" :arg1-body
"global.describe" :arg1-body
"global.test" :arg1-body
"list-comp" :binding
"defview" :arg1-body
"letsubs" :binding
"with-let" "let"
"reg-event-fx" :arg1-pair
"reg-fx" :arg1-pair
"testing" :arg1-body
"deftest-sub" :arg1-body
"wait-for" :arg1-body
"with-deps-check" :arg1-body
"schema/=>" :arg1-body
"->" [:noarg1-body
{:list {:constant-pair? false :force-nl? false}
:next-inner-restore [[:list :constant-pair?]]}]
"set!" "reset!"
"assoc-when" "assoc"
"assoc-some" "assoc"
"conj-when" "conj"
"conj-some" "conj"}
{"reg-sub" :arg1-pair
"h/describe" :arg1-body
"h/describe-skip" :arg1-body
"h/describe-only" :arg1-body
"h/test" :arg1-body
"h/test-skip" :arg1-body
"h/test-only" :arg1-body
"test/async" :arg1-body
"test/use-fixtures" :arg1-body
"global.describe" :arg1-body
"global.test" :arg1-body
"list-comp" :binding
"defview" :arg1-body
"letsubs" :binding
"with-let" "let"
"reg-event-fx" :arg1-pair
"reg-fx" :arg1-pair
"testing" :arg1-body
"deftest-sub" :arg1-body
"h/integration-test" :arg1-body
"wait-for" :arg1-body
"with-deps-check" :arg1-body
"schema/=>" :arg1-body
"->" [:noarg1-body
{:list {:constant-pair? false :force-nl? false}
:next-inner-restore [[:list :constant-pair?]]}]
"set!" "reset!"
"assoc-when" "assoc"
"assoc-some" "assoc"
"conj-when" "conj"
"conj-some" "conj"}
:style-map
{:no-comma {:map {:comma? false}}
+11 -25
View File
@@ -36,6 +36,8 @@ endif
export TMPDIR = /tmp/tmp-status-mobile-$(BUILD_TAG)
# This has to be specified for both the Node.JS server process and the Qt process.
export REACT_SERVER_PORT ?= 5001
# Default metro port used by scripts/run-android.sh.
export RCT_METRO_PORT ?= 8081
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
export NODE_OPTIONS += --openssl-legacy-provider
# The path can be anything, but home is usually safest.
@@ -44,7 +46,7 @@ export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
# Our custom config is located in nix/nix.conf
export NIX_USER_CONF_FILES = $(PWD)/nix/nix.conf
# Location of symlinks to derivations that should not be garbage collected
export _NIX_GCROOTS = /nix/var/nix/gcroots/per-user/$(USER)/status-mobile
export _NIX_GCROOTS = ./.nix-gcroots
# Defines which variables will be kept for Nix pure shell, use semicolon as divider
export _NIX_KEEP ?= TMPDIR,BUILD_ENV,\
BUILD_TYPE,BUILD_NUMBER,COMMIT_HASH,\
@@ -54,12 +56,6 @@ export _NIX_KEEP ?= TMPDIR,BUILD_ENV,\
# Useful for Android release builds
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
# MacOS root is read-only, read nix/README.md for details
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
export NIX_IGNORE_SYMLINK_STORE=1
endif
#----------------
# Nix targets
#----------------
@@ -214,7 +210,7 @@ build-fdroid: ##@build Build release for F-Droid
build-android: export BUILD_ENV ?= prod
build-android: export BUILD_TYPE ?= nightly
build-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER)
build-android: export ORG_GRADLE_PROJECT_versionCode ?= $(TMP_BUILD_NUMBER)
build-android: export ANDROID_ABI_SPLIT ?= false
build-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
build-android: ##@build Build unsigned Android APK
@@ -267,7 +263,7 @@ run-clojure: ##@run Watch for and build Clojure changes for mobile
run-metro: export TARGET := clojure
run-metro: ##@run Start Metro to build React Native changes
@scripts/start-react-native.sh
@scripts/run-metro.sh
run-re-frisk: export TARGET := clojure
run-re-frisk: ##@run Start re-frisk server
@@ -278,22 +274,15 @@ run-android: export TARGET := android
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
run-android: export ORG_GRADLE_PROJECT_hermesEnabled := false
# INFO: If it's empty (no devices attached, parsing issues, script error) - for Nix it's the same as not set.
run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_abis.sh)
run-android: ##@run Build Android APK and start it on the device
npx react-native run-android --appIdSuffix debug
@scripts/run-android.sh
SIMULATOR=iPhone 13
# TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded
run-ios: export TARGET := ios
run-ios: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64
run-ios: export XCBeautify=$(shell which xcbeautify) # for react-native-cli to pick this up and to auto format output
run-ios: ##@run Build iOS app and start it in a simulator/device
ifneq ("$(SIMULATOR)", "")
npx react-native run-ios --simulator="$(SIMULATOR)"
else
npx react-native run-ios
endif
run-ios: ##@run Build iOS app and start it in on the simulator
@scripts/run-ios.sh "${SIMULATOR}"
show-ios-devices: ##@other shows connected ios device and its name
xcrun xctrace list devices
@@ -301,11 +290,8 @@ show-ios-devices: ##@other shows connected ios device and its name
# TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded
run-ios-device: export TARGET := ios
run-ios-device: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64
run-ios-device: ##@run iOS app and start it on a connected device by its name
ifndef DEVICE_NAME
$(error Usage: make run-ios-device DEVICE_NAME=your-device-name)
endif
react-native run-ios --device "$(DEVICE_NAME)"
run-ios-device: ##@run iOS app and start it on the first connected iPhone
@scripts/run-ios-device.sh
#--------------
# Tests
@@ -373,7 +359,7 @@ test-watch-for-repl: ##@test Watch all Clojure tests and support REPL connection
"until [ -f $$SHADOW_OUTPUT_TO ] ; do sleep 1 ; done ; node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO --repl"
test-unit: export SHADOW_OUTPUT_TO := target/unit_test/test.js
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests-im\.contract-test).*-test$$
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests\.contract-test).*-test$$
test-unit: ##@test Run unit tests
test-unit: _test-clojure
+3 -3
View File
@@ -37,7 +37,7 @@ project dependencies, coding guidelines and testing procedures.
Check out our [coding guidelines](doc/new-guidelines.md).
- **Community Management**
Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and the long-lasting relationships you form will be well worth it, check out our [Mission and Community Principles](https://status.im/about)
Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and the long-lasting relationships you form will be well worth it, check out our [Mission and Community Principles](https://status.app/manifesto)
- **Specification / Documentation**
John Dewey once said, "Education is not preparation for life; education is life *itself* ". Developers and Designers need guidance and it all starts from documentation and specifications. Our software is only as good as its documentation, check out our [docs](doc/) and see how you can improve what we have.
@@ -53,10 +53,10 @@ Status is a visual interface to make permanent changes on the Blockchain, it han
- **Evangelism**
Help us spread the word! Tell a friend *right now*, in fact, tell **everyone** - yell from a mountain if you have to, every person counts! If you've got a great story to tell or have some interesting way you've spread the word about Status let us know about it in our [chat](https://join.status.im/chat/public/status)
## Give me Binaries!
You can get our Beta builds for both Android and iOS on our [website](https://status.im), through our [nightly builds](https://status.im/nightly/), or by [building it yourself](https://status.im/technical/build_status/).
You can get our Beta builds for both Android and iOS on our [website](https://status.app), through our [nightly builds](https://status.im/nightly/), or by [building it yourself](doc/starting-guide.md).
## Core Contributors
+3 -3
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
pipeline {
agent { label 'linux && x86_64 && nix-2.14' }
agent { label 'linux && x86_64 && nix-2.19' }
options {
timestamps()
@@ -15,7 +15,7 @@ pipeline {
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '20',
artifactNumToKeepStr: '10',
artifactNumToKeepStr: '1',
))
/* Allows combined build to copy */
copyArtifactPermission('/status-mobile/*')
+3 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent { label 'linux' }
@@ -13,7 +13,7 @@ pipeline {
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '10',
artifactNumToKeepStr: '1',
))
}
@@ -35,8 +35,6 @@ pipeline {
stage('Prep') {
steps { script {
println("Current JOB: ${env.JOB_NAME}")
/* just for a shorter access */
btype = utils.getBuildType()
} }
}
stage('Build') {
@@ -84,10 +82,8 @@ pipeline {
when { expression { params.PUBLISH } }
steps { script {
switch (btype) {
case 'nightly':
/* Create JSON file with newest build URLs */
case 'nightly': /* Create JSON file with newest build URLs */
s3.updateBucketJSON(urls, 'latest.json');
build(job: 'website/status.im', wait: false);
break;
case 'release':
github.publishReleaseFiles(repo: 'status-mobile');
+2 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent { label 'linux' }
@@ -23,6 +23,7 @@ pipeline {
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
+4 -6
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
pipeline {
agent { label 'macos && arm64 && nix-2.14 && xcode-15.1' }
agent { label 'macos && arm64 && nix-2.19 && xcode-15.1' }
parameters {
string(
@@ -23,7 +23,7 @@ pipeline {
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '20',
artifactNumToKeepStr: '10',
artifactNumToKeepStr: '1',
))
/* Allows combined build to copy */
copyArtifactPermission('/status-mobile/*')
@@ -39,8 +39,6 @@ pipeline {
LANGUAGE = "en_US.UTF-8"
TARGET = 'ios'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
/* See nix/README.md */
NIX_IGNORE_SYMLINK_STORE = 1
FASTLANE_DISABLE_COLORS = 1
BUNDLE_PATH = "${HOME}/.bundle"
}
@@ -65,7 +63,7 @@ pipeline {
}
post {
failure {
archiveArtifacts 'ios/logs/*'
archiveArtifacts 'logs/*'
}
}
}
+12 -4
View File
@@ -1,21 +1,21 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
pipeline {
agent { label 'linux && x86_64 && nix-2.14' }
agent { label 'linux && x86_64 && nix-2.19' }
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 15, unit: 'MINUTES')
timeout(time: 20, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '20',
artifactNumToKeepStr: '10',
artifactNumToKeepStr: '1',
))
/* Abort old PR builds. */
disableConcurrentBuilds(
@@ -62,6 +62,14 @@ pipeline {
}
}
}
stage('Contract Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make test-contract 2>&1 | tee -a ${LOG_FILE}
"""
}
}
stage('Integration Tests') {
steps {
sh """#!/bin/bash
+6 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
@@ -29,6 +29,11 @@ pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
stages {
+6 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
@@ -47,6 +47,11 @@ pipeline {
options {
disableConcurrentBuilds()
timeout(time: 90, unit: 'MINUTES')
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
stages {
+6 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
@@ -28,6 +28,11 @@ pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
+1 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent { label 'macos' }
@@ -10,8 +10,6 @@ pipeline {
LC_ALL = 'en_US.UTF-8'
TARGET = 'ios'
FASTLANE_DISABLE_COLORS = 1
/* See nix/README.md */
NIX_IGNORE_SYMLINK_STORE = 1
/* avoid writing to r/o /nix */
GEM_HOME = '~/.rubygems'
}
+3 -4
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent { label params.AGENT_LABEL }
@@ -18,8 +18,6 @@ pipeline {
}
environment {
/* See nix/README.md */
NIX_IGNORE_SYMLINK_STORE = 1
/* we source .bash_profile to be able to use nix-store */
NIX_SSHOPTS = "-oStrictHostKeyChecking=no"
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
@@ -36,6 +34,7 @@ pipeline {
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
@@ -82,7 +81,7 @@ pipeline {
env.NIXPKGS_SYSTEM_OVERRIDE = nixSysOverride(os, arch, 'android')
/* Build/fetch deps required to build android release. */
nix.build(
attr: 'targets.mobile.android.release.buildInputs',
attr: 'targets.mobile.android.build.buildInputs',
sandbox: false,
pure: false,
link: false
+1 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent { label 'linux' }
@@ -10,8 +10,6 @@ pipeline {
LC_ALL = 'en_US.UTF-8'
TARGET = 'ios'
FASTLANE_DISABLE_COLORS = 1
/* See nix/README.md */
NIX_IGNORE_SYMLINK_STORE = 1
/* avoid writing to r/o /nix */
GEM_HOME = '~/.rubygems'
}
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.5'
library 'status-jenkins-lib@v1.8.7'
pipeline {
agent {
+4
View File
@@ -10,6 +10,8 @@
[Coding guidelines](new-guidelines.md)
[UI components coding guidelines](ui-guidelines.md)
[Release Checklist](release-checklist.md)
[Release Guide](release-guide.md)
@@ -28,6 +30,8 @@
[Contributing to status-go](status-go-changes.md)
[Malli schemas (recorded demo)](https://www.youtube.com/watch?v=SlRio70aYVI) ([slides](files/forging-code-with-schemas-sep-2023-slides.pdf))
## Testing
[How to run local tests](testing.md)
+1 -2
View File
@@ -122,10 +122,9 @@ See below:
Do the following:
Ensure you have 3 terminals running the following
Ensure you have 2 terminals running the following
- `make run-clojure`
- `make run-metro`
- `make run-ios` / `make run-android`
[See the STARTING GUIDE for details](STARTING_GUIDE.md#development)
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

+37 -23
View File
@@ -4,22 +4,41 @@ This document provides information on how to start developing Status App.
# Getting Started
To start developing start a shell for the platform you are interested in.
To start developing clone the status-mobile repo in the directory of your choice.
```
make shell TARGET=android
git clone https://github.com/status-im/status-mobile.git
```
This step will take a while the first time as it will download all dependencies.
# Development
Then open a terminal and cd into this directory.
There are three steps necessary to start development, in this case for Android:
```
cd status-mobile
```
1. `make run-clojure` - Compiles Clojure into JavaScript, watches for changes on cljs files, and hot-reloads code in the app.
2. `make run-metro` - Starts metro bundler and watches JavaScript code.
3. `make run-android` or `make run-ios` - Builds the Android/iOS app and starts it on the device.
Then build the clojure terminal
The first two will continue watching for changes and keep re-building the app. They need to be ready first.
The last one will exit once the app is up and ready.
```
make run-clojure
```
note: ⚠️ This might take a while if this is your first time.
This command installs `nix` and pulls in all the dependencies.
Do answer with "Y" to all the prompts and press "Enter" when `nix` setup asks you to Acknowledge.
This command builds the `jsbundle` and then compiles `Clojure` into `JavaScript`, watches for changes on `cljs` files, and hot-reloads code in the app.
wait till you see the following message :
```
[:mobile] Build completed. (1801 files, 52 compiled, 0 warnings, 9.52s)
```
Once the clojure terminal is running you need to run the appropriate command next for your platform in a separate terminal :
`make run-android` or `make run-ios`
These commands will build the app, start a metro bundler and deploy the app on your simulator OR connected device (android only). For building and deploying to connected iPhones use `make run-ios-device` instead of `make run-ios`
Also check [developing on a physical iOS Device](#Additional-requirements-for-developing-on-physical-ios-device).
## Simulators and Devices
### Android
@@ -46,13 +65,9 @@ Running `make run-ios` will target `iPhone 13` by default.
If you need to run on any other simulator, you can specify the simulator type by adding the `SIMULATOR` flag:
```sh
make run-ios SIMULATOR="iPhone 13"
make run-ios SIMULATOR="iPhone 15"
```
#### Running on a physical device
Some manual steps are necessary for [developing on a physical iOS Device](#physical-ios-device).
# Build release
To build the app, you can simply run on of the following:
@@ -102,16 +117,15 @@ Steps:
3. [Setup Git to sign commits](https://help.github.com/en/github/authenticating-to-github/signing-commits)
4. [Setup GitHub to validate commits](https://help.github.com/en/github/authenticating-to-github/adding-a-new-gpg-key-to-your-github-account)
## Physical iOS Device
## Additional requirements for developing on Physical iOS Device
To use a physical iPhone your device UDID must be added to provisioning profiles and your Apple account invited as Developer to Status team.
1. [Get your UDID of your iPhone.](https://www.extentia.com/post/finding-the-udid-of-an-ios-device)
2. Request from someone with access like @cammellos or @jakubgs to
- Add the UDID to development devices on Apple Developer Portal.
- Invite your Apple account to be Developer in Status team.
3. Run a build in XCode using the project from `status-mobile/ios` directory.
- You might see error: `Select a development team in the Signing & Capabilities editor`
- Select `Status Research & Development GmbH` as the development team and rebuild again.
Once build finishes Status should start on your iPhone with its logs in terminal running `make run-metro`.
- Add the UDID to development devices on Apple Developer Portal.
- Invite your Apple account to be Developer in Status team.
3. Open XCode using the project from `status-mobile/ios` directory.
- You might see error: `Select a development team in the Signing & Capabilities editor`
- Select `Status Research & Development GmbH` as the development team.
4. In a new terminal execute `make clean` and then `make xcode-clean`
+32 -6
View File
@@ -2,14 +2,12 @@
## Unit & integration tests
To run tests:
To run all tests:
```
make test
```
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
```
@@ -51,18 +49,46 @@ Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right p
[2022-12-19 13-17.webm](https://user-images.githubusercontent.com/46027/208471199-1909c446-c82d-42a0-9350-0c15ca562713.webm)
## Component tests
## Component tests only
To run tests:
```
make component-test
make component-test
```
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
```
make component-test-watch
make component-test-watch
```
Check [component tests doc](./component-tests-overview.md) for more.
## Unit tests only
To run unit tests:
```
make test-unit
```
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
```
make test-unit WATCH=true
```
## Integration tests only
To run integration tests:
```
make test-integration
```
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
```
make test-integration WATCH=true
```
+1 -20
View File
@@ -88,6 +88,7 @@ info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this
Update yarn.lock file. In order to do this, perform the following steps on a clean `status-mobile` repo:
```
cd status-mobile
make shell
yarn install
```
and don't forget to commit updated `yarn.lock` together with `package.json`.
@@ -127,23 +128,3 @@ Status-mobile uses `shadow-cljs` for hot reloading changes and uses its own [rel
### Solution
Open react native's [In-App Developer Menu](https://reactnative.dev/docs/debugging#accessing-the-in-app-developer-menu) and press "Disable Fast Refresh" or "Disable Hot Reloading"
## App Crashes after few reloads
### Cause
For x86 CPU architecture Android Devices, Hermes is creating the issue and the app crashes after a few reloads.
([Original Issue](https://github.com/status-im/status-mobile/issues/14031))
<details>
<summary>How to Find CPU architecture</summary>
CPU architecture of android device can be found using
- `adb shell uname -m` or
- `adb shell getprop ro.product.cpu.abilist`
</details>
### Solution
Disable Hermes while building the app
`make run-android DISABLE_HERMES=true`
+254
View File
@@ -0,0 +1,254 @@
# UI components coding guidelines
> [!IMPORTANT]
> React apps are made out of components. A component is a piece of the UI (user interface) that has its own logic and appearance. A component can be as small as a button, or as large as an entire screen.
> React components are JavaScript functions that return markup
> This document will provide best practices on how to write efficient React components in ClojureScript
At the time of creating the Status app, the Reagent library was a solid choice. Back then, hooks didn't exist, and there weren't any libraries providing effective global state management. After Reagent's emergence, another library called Re-frame built upon Reagent. Together, they offered powerful tools for developing React applications with ClojureScript. However, as React evolved, significant changes occurred. Class components, utilized in Reagent, became deprecated. Instead, functional components and hooks emerged for state management. In Status 2.0, we began incorporating more functional components and hooks, resulting in a blend of both approaches. To simplify matters and reduce confusion, we opted to transition to functional components and hooks for local state management.
BEFORE:
```clojure
(defn- view-internal
[_ _]
(let [pressed? (reagent/atom false)]
(fn
[{:keys [theme on-press on-long-press icon]}]
[rn/pressable
{:style (style/main @pressed? theme)
:on-press on-press
:on-press-in #(reset! pressed? true)
:on-press-out #(reset! pressed? nil)
:on-long-press on-long-press}
[quo.icons/icon icon]])))
(def view (theme/with-theme view-internal))
```
NOW:
```clojure
(defn view
[{:keys [on-press on-long-press icon]}]
(let [[pressed? set-pressed] (rn/use-state false)
theme (theme/use-theme-value)
on-press-in (rn/use-callback #(set-pressed true))
on-press-out (rn/use-callback #(set-pressed nil))]
[rn/pressable
{:style (style/main pressed? theme)
:on-press on-press
:on-press-in on-press-in
:on-press-out on-press-out
:on-long-press on-long-press}
[quo.icons/icon icon]]))
```
- We no longer need to create an anonymous function for rendering. This removes unnecessary confusion and the need for specific knowledge on how it works and why it was needed.
- `rn/use-state` is used instead of `reagent/atom`
- State values no longer need to be dereferenced; they are accessible as regular symbols. This eliminates a common bug where the "@" symbol was inadvertently omitted.
- `theme/with-theme` wrapper is not needed anymore, `(theme/use-theme-value)` hook can be used directly in the components
- `:f>` not needed anymore, all components are functional by default
- `rn/use-callback` hook should be used for anon callback functions
> [!IMPORTANT]
> DO NOT USE anon functions directly in the props
BAD
```clojure
(defn view
[]
(let [[pressed? set-pressed] (rn/use-state false)]
[rn/pressable
{:style (style/main pressed?)
:on-press-in #(set-pressed true)
:on-press-out #(set-pressed nil)}]))
```
GOOD:
```clojure
(defn view
[]
(let [[pressed? set-pressed] (rn/use-state false)
on-press-in (rn/use-callback #(set-pressed true))
on-press-out (rn/use-callback #(set-pressed nil))]
[rn/pressable
{:style (style/main pressed?)
:on-press-in on-press-in
:on-press-out on-press-out}]))
```
## Global state and subscriptions
For global state management, we utilize Re-frame subscriptions. They can be likened to React state. To obtain the state, `(rf/sub [])` is employed, and to modify it, `(rf/dispatch [])` is utilized. However, they update components in a similar manner to React states.
```clojure
(defn view
[{:keys [selected-tab]}]
(let [collectible-list (rf/sub [:wallet/all-collectibles])
on-collectible-press (rn/use-callback
(fn [{:keys [id]}]
(rf/dispatch [:wallet/get-collectible-details id])))]
[rn/view {:style style/container}
(case selected-tab
:assets [assets/view]
:collectibles [collectibles/view {:collectibles collectible-list
:on-collectible-press on-collectible-press}])
[activity/view]]))
```
## Regular atoms
In certain instances, components utilized regular atoms; however, they should now be used with `rn/use-ref-atom`
BEFORE:
```clojure
(defn view
[]
(let [focused? (atom false)]
(fn []
(let [on-clear #(reset! status (if @focused? :active :default))
on-focus #(reset! focused? true)
on-blur #(reset! focused? false)]))))
```
NOW:
```clojure
(defn view
[]
(let [focused? (rn/use-ref-atom false)
on-clear (rn/use-callback #(set-status (if @focused? :active :default)))
on-focus (rn/use-callback #(reset! focused? true))
on-blur (rn/use-callback #(reset! focused? false))]))
```
## Effects
LIFECYCLE:
```clojure
(defn view
[{:keys []}]
(let [opacity (reanimated/use-shared-value 0)]
(rn/use-mount #(reanimated/animate opacity 1))
[rn/view
{:style (style/opacity opacity)}]))
```
```clojure
(defn view
[{:keys []}]
(let []
(rn/use-unmount #(rn/dispatch [:unmounted]))
[rn/view]))
```
> [!IMPORTANT]
> Effects should NOT be utilized as a response to state changes for modifying logic. If you're unsure how to achieve this without using effects, please consult the team in the general chat. There may be instances where using effects is appropriate, so we can explore a solution together and enhance our guidelines.
BAD:
```clojure
(defn f-zoom-button
[{:keys [selected? current-zoom]}]
(let [size (reanimated/use-shared-value (if selected? 37 25))]
(rn/use-effect #(reanimated/animate size (if selected? 37 25)) [current-zoom])
[rn/touchable-opacity
{:style (style/zoom-button-container size)}]))
```
BAD:
```clojure
(defn view
[collectible-list (rf/sub [:wallet/all-collectibles])]
(let []
(rn/use-effect #(rn/dispatch [:all-collectibles-changed]) [collectible-list])
[rn/view]))
```
Instead `:all-collectibles-changed` should be used in the handler which changes `collectible-list` state
## Performance tips
To begin with, we need to understand that there are two distinct stages for a component: creation and update. React creates a render tree, a UI tree, composed of the rendered components.
![react_tree.png](react_tree.png)
### Component creation
For component creation, the most critical factor is the number of elements involved, so we should strive to minimize them. For instance, it's advisable to avoid using unnecessary wrappers or containers.
BAD:
```clojure
(defn view
[]
(let []
[rn/view {:style {:padding-top 20}}
[quo/button]]))
```
GOOD:
```clojure
(defn view
[]
(let []
[quo/button {:container-style {:padding-top 20}}]))
```
### Component updates
For component updates, it's crucial to recognize that React will invoke the function where state is utilized. Therefore, if you utilize state in the root component, React will execute the root function and re-render the entire root component along with all its children (unless optimizations like memoization are implemented).
BAD:
```clojure
(defn component
[{:keys [label]}]
(let []
[rn/text label]))
(defn component2
[{:keys [label2]}]
(let []
[rn/text label2]))
(defn screen
[]
(let [screen-params (rf/sub [:screen-params])]
[component screen-params]
[component1]
[component2 screen-params]
[component3]
[rn/view {:padding-top 20}
[quo/button]]))
```
Here, we have lost control over the `screen-params` map. It can contain any data, and if any field within this map changes, the entire screen function will be executed, resulting in the re-rendering of both `component` and `component2`.
GOOD:
```clojure
(defn component
[]
(let [label (rf/sub [:screen-params-label])]
[rn/text label]))
(defn component2
[]
(let [label2 (rf/sub [:screen-params-label2])]
[rn/text label2]))
(defn screen
[]
(let []
[component]
[component1]
[component2]
[component3]
[rn/view {:padding-top 20}
[quo/button]]))
```
So, now the screen component function will never be invoked, and `component` and `component2` will be re-rendered only when `label` or `label2` have changed.
+3 -2
View File
@@ -1,4 +1,5 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
@@ -96,7 +97,7 @@ end
# if false - read list of devices from AppStoreConnect, and upgrade the provisioning profiles from it
# `pr_build`:
# if true - uses StatusImPR scheme and postfixed app id with `.pr` to build an app, which can be used in parallel with release
# if false - uses StatusIm scheme to build the release app
# if false - uses StatusIm scheme to build the release app
def build_ios_adhoc(readonly: false, pr_build: false)
# PR builds should appear as a separate App on iOS
@@ -123,7 +124,7 @@ def build_ios_adhoc(readonly: false, pr_build: false)
export_method: 'ad-hoc',
output_name: 'StatusIm',
output_directory: 'status-ios',
buildlog_path: 'ios/logs',
buildlog_path: 'logs',
export_options: {
signingStyle: 'manual',
provisioningProfiles: {
+1 -1
View File
@@ -793,7 +793,7 @@ CHECKOUT OPTIONS:
:submodules: true
SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: 64032b9e9b938fda23325e68a3771f0fabf414dc
BVLinearGradient: 612a04ff38e8480291f3379ee5b5a2c571f03fe0
CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
+5 -5
View File
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -542,7 +542,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/env sh";
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ./logs/react-native-xcode.log 2>&1";
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ../logs/react-native-xcode.log 2>&1";
};
28606042DA81A750949525E4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
@@ -578,7 +578,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/env sh";
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ./logs/react-native-xcode.log 2>&1";
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ../logs/react-native-xcode.log 2>&1";
};
3AAD2AD724A3A60E0075D594 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
@@ -592,7 +592,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = "/usr/bin/env sh";
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./logs/set_xcode_version.log 2>&1";
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ../logs/set_xcode_version.log 2>&1";
};
523CD6BCB20FD78FBF3564AD /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
@@ -716,7 +716,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = "/usr/bin/env sh";
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./logs/set_xcode_version.log 2>&1";
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ../logs/set_xcode_version.log 2>&1";
};
/* End PBXShellScriptBuildPhase section */
+1 -1
View File
@@ -133,7 +133,7 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<false/>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A00000080400010101</string>
-14
View File
@@ -1,14 +0,0 @@
# Description
This directory is the destination of logs created by Fastlane and React Native Xcode script.
# Logs
* `react-native-xcode.log` - Output from `node_modules/react-native/scripts/react-native-xcode.sh`.
- Created by redirecting output of `shellScript` in `ios/StatusIm.xcodeproj/project.pbxproj`.
* `Status PR-StatusImPR.log - Created by [Fastlane Gym](https://docs.fastlane.tools/actions/gym/).
- Configred via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
# CI
These log files are uploaded to Jenkins as CI job artifacts on failure using `archiveArtifacts`.
+27
View File
@@ -0,0 +1,27 @@
# Description
This directory is the destination of logs created during build time of debug builds and logs created by Fastlane on CI.
# Logs
* `xcrun_device_install.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
- Created by redirecting output of `xcrun simctl install "$UDID" "$APP_PATH"`.
* `xcrun_device_process_launch.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
- Created by specifying `--json-output` flag for `xcrun devicectl device process launch --no-activate --verbose --device "${DEVICE_UUID}" "${INSTALLATION_URL}"`.
* `xcrun_device_process_resume.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
- Created by redirecting output of `xcrun devicectl device process resume --device "${DEVICE_UUID}" --pid "${STATUS_PID}"`.
* `adb_install.log` - Output from `scripts/run-android.sh`.
- Created by redirecting output of `adb install -r ./result/app-debug.apk`.
* `adb_shell_monkey.log` - Output from `status-mobile/scripts/run-android.sh`.
- Created by redirecting output of `adb shell monkey -p im.status.ethereum.debug 1 >`.
* `ios_simulators_list.log` - Output from `status-mobile/scripts/run-ios.sh`.
- Created by redirecting output of `xcrun simctl list devices -j`.
# CI
These log files are uploaded to Jenkins as CI job artifacts on failure using `archiveArtifacts`.
* `react-native-xcode.log` - Output from `node_modules/react-native/scripts/react-native-xcode.sh`.
- Created by redirecting output of `shellScript` in `ios/StatusIm.xcodeproj/project.pbxproj`.
* `Status PR-StatusImPR.log - Created by [Fastlane Gym](https://docs.fastlane.tools/actions/gym/).
- Configred via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
@@ -342,4 +342,14 @@ public class AccountManager extends ReactContextBaseJavaModule {
final String keyStoreDir = this.utils.getKeyStorePath(keyUID);
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.deleteMultiaccount(keyUID, keyStoreDir), callback);
}
@ReactMethod
public void getRandomMnemonic(final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.getRandomMnemonic(), callback);
}
@ReactMethod
public void createAccountFromMnemonicAndDeriveAccountsForPaths(final String mnemonic, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.createAccountFromMnemonicAndDeriveAccountsForPaths(mnemonic), callback);
}
}
@@ -214,4 +214,20 @@ RCT_EXPORT_METHOD(logout) {
NSLog(@"%@", result);
}
RCT_EXPORT_METHOD(getRandomMnemonic:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"GetRandomMnemonic() method called");
#endif
NSString *result = StatusgoGetRandomMnemonic();
callback(@[result]);
}
RCT_EXPORT_METHOD(createAccountFromMnemonicAndDeriveAccountsForPaths:(NSString *)mnemonic callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"createAccountFromMnemonicAndDeriveAccountsForPaths() method called");
#endif
NSString *result = StatusgoCreateAccountFromMnemonicAndDeriveAccountsForPaths(mnemonic);
callback(@[result]);
}
@end
@@ -120,9 +120,12 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(checkAddressChecksum:(NSString *)address)
return StatusgoCheckAddressChecksum(address);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isAddress:(NSString *)address) {
return StatusgoIsAddress(address);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(toChecksumAddress:(NSString *)address) {
return StatusgoToChecksumAddress(address);
}
@end
+7 -5
View File
@@ -61,7 +61,7 @@ We will use the `make jsbundle` target as an example of a derivation you can bui
3. [`build.sh`](/nix/scripts/build.sh) calls `nix-build --attr targets.mobile.jsbundle` with extra arguments
4. `nix-build` builds the derivation from [`nix/mobile/jsbundle/default.nix`](/nix/mobile/jsbundle/default.nix)
The same can be done for other targets like `targets.mobile.android.release`.
The same can be done for other targets like `targets.mobile.android.build`.
Except in that case extra arguments are required which is why the [`scripts/release-android.sh`](/scripts/release-android.sh) is used in the `make release-android` target.
If you run `make release-android` you'll see the `nix-build` command used:
@@ -71,21 +71,23 @@ nix-build \
--fallback \
--no-out-link \
--show-trace \
--attr targets.mobile.android.release \
--attr targets.mobile.android.build \
--argstr secrets-file '/tmp/tmp-status-mobile-559a3a441/tmp.xAnrPuNtAP' \
--option extra-sandbox-paths '/home/joe/.gradle/status-im.keystore /tmp/tmp-status-mobile-559a3a441/tmp.xAnrPuNtAP' \
default.nix
```
Some of those are required which is why just calling:
```
nix-build --attr targets.mobile.android.release
nix-build --attr targets.mobile.android.build
```
Would fail.
# Garbage Collection
The `make nix-gc` target calls `nix-store --gc` and normally would remove almost everything, but to prevent that we place symlinks to protected derivations in `/nix/var/nix/gcroots` subfolder. Specifically:
The `make nix-gc` target calls `nix-store --gc` and normally would remove almost everything, but to prevent that we place symlinks to protected derivations in `.nix-gcroots` folder. Specifically:
```sh
_NIX_GCROOTS="${_NIX_GCROOTS:-/nix/var/nix/gcroots/per-user/${USER}/status-mobile}"
_NIX_GCROOTS="${_NIX_GCROOTS:-${GIT_ROOT}/.nix-gcroots}
```
These symlinks in turn will be symlinked from `/nix/var/nix/gcroots/auto` through use of `nix-store --add-gcroots`.
Whenever `nix/scripts/build.sh` or `nix/scripts/shell.sh` are called they update symlinks named after given targets in that folder. This in combination with `keep-outputs = true` set in `nix/nix.conf` prevents garbage collection from removing too much.
+1 -1
View File
@@ -28,7 +28,7 @@ export STATUS_GO_IPFS_GATEWAY_URL="https://ipfs.status.im/"
```
You can see the defaults in code:
- [`nix/status-go/default.nix`](./status-go/default.nix)
- [`nix/mobile/android/release.nix`](./mobile/android/release.nix)
- [`nix/mobile/android/release.nix`](./mobile/android/build.nix)
## Shell
+148 -130
View File
@@ -90,20 +90,20 @@
},
{
"path": "cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3",
"path": "cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "5ae0efd9377a5e60c084bdaf4a2ce094f759ce23",
"sha256": "0drxf9nm23i1pcgrkwbcr09msq37csilzww38709add0hz8spjhq"
"sha1": "1f28a4a834a7a46cf24def971b1a705a6795c73a",
"sha256": "0h4pyzy8rzzh567khvimw2cs8jr640kqxgaxvbfx1s5yfp56fka2"
}
},
{
"path": "cider/piggieback/0.4.1/piggieback-0.4.1",
"path": "cider/piggieback/0.5.2/piggieback-0.5.2",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0a02a3e2ecd7a126ab60d8a44793342f20ced79b",
"sha256": "142vl5np33akcrnn6pksi0rjfsmmi528villxsj6cwcndvybiw4m"
"sha1": "ecfd5c286a85db3f059e75c37fca5722d9e26f79",
"sha256": "1ps9yf3cxmlm447hqkidjb5xry90n0wl3jk0jn28fagq31lzylkl"
}
},
@@ -251,15 +251,6 @@
}
},
{
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
{
"path": "com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0",
"host": "https://repo1.maven.org/maven2",
@@ -306,11 +297,11 @@
},
{
"path": "com/google/javascript/closure-compiler-unshaded/v20230411/closure-compiler-unshaded-v20230411",
"path": "com/google/javascript/closure-compiler-unshaded/v20230802/closure-compiler-unshaded-v20230802",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "2f5d7ab921f9cc07ffeb4e1c0f156f164c650eeb",
"sha256": "0gphdrrhr88bcqa1scndachvhbayh7m11zm9hcsmvzn9bw72pabw"
"sha1": "0a2498a4d45bf5896042f31da0cd30c5e7b415af",
"sha256": "0jvgqq0gnvm4jw2zac4677ds05klvsjalszdzcq3nw8g7fjyjv2x"
}
},
@@ -333,38 +324,11 @@
},
{
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
"path": "com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d",
"sha256": "0qzd8v96j4x7jjcfpvvdh9ar1xhwxpxi2rh51nzhj0br7bbgdsdk"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.11.0/commons-io-2.11.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "a2503f302b11ebde7ebc3df41daebe0e4eea3689",
"sha256": "020946yakki3qzc652arfndzi594drxanidz9bawbb6vhxnjy6wn"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
"sha1": "c9ad4a0850ab676c5c64461a05ca524cdfff59f1",
"sha256": "170rflxnqnah0265ik2aylmxkshyqbf2zas9bp2l32xqj9l6jsaf"
}
},
@@ -404,6 +368,42 @@
}
},
{
"path": "commons-codec/commons-codec/1.15/commons-codec-1.15",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d",
"sha256": "0qzd8v96j4x7jjcfpvvdh9ar1xhwxpxi2rh51nzhj0br7bbgdsdk"
}
},
{
"path": "commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "f95188e3d372e20e7328706c37ef366e5d7859b0",
"sha256": "1xyyl54sfxsdcwxdyq6b0azmr31b4dwqns850jjkw9a9dwrh5v54"
}
},
{
"path": "commons-io/commons-io/2.11.0/commons-io-2.11.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "a2503f302b11ebde7ebc3df41daebe0e4eea3689",
"sha256": "020946yakki3qzc652arfndzi594drxanidz9bawbb6vhxnjy6wn"
}
},
{
"path": "compojure/compojure/1.5.2/compojure-1.5.2",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0b5258d0616ffc5f64c2b6d95f09de56d24df439",
"sha256": "1s2k05lwnlm9a66mxnsss437i9gp70dny8y2rlfkl090s6mdqsaf"
}
},
{
"path": "crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1",
"host": "https://repo.clojars.org",
@@ -449,6 +449,15 @@
}
},
{
"path": "funcool/promesa/11.0.678/promesa-11.0.678",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "0ee1690ba74b2609c2d85b51edacad13046a18e2",
"sha256": "1wif8nwdbpchwg56fz47ymjnflmva0fzy0bw1s6bacnac472pmza"
}
},
{
"path": "hiccup/hiccup/1.0.5/hiccup-1.0.5",
"host": "https://repo.clojars.org",
@@ -504,11 +513,11 @@
},
{
"path": "io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final",
"path": "io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "78650b4029dd9280c4769d9425b5559f12cb83bf",
"sha256": "1brpkd2l98byf76jga6hj5drv5sj2d93lxlq2xz0rxpqyqas1xm4"
"sha1": "96d1d5ca6406a75a285b95ea8f4b39e0fb2d707e",
"sha256": "1s1m5hfhmfr7jsp4bn4c6fhdbgiz72mz0a96494nyhfa0b4lql8l"
}
},
@@ -594,11 +603,11 @@
},
{
"path": "nrepl/nrepl/1.0.0/nrepl-1.0.0",
"path": "nrepl/nrepl/0.9.0/nrepl-0.9.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "f47774c43493efdc879d36b95ebd67ea0d9c890a",
"sha256": "1fx5ssmixgqmklliw0ng8fjz41kkhys56x8dbwv9yqrfzws9f2x3"
"sha1": "49beada131959f08f9a20899affbd1b10c03a668",
"sha256": "1phak0479s27ffw9wzz7pi8cqqs6ipsm15dhgw9szxxcfhx529qa"
}
},
@@ -611,15 +620,6 @@
}
},
{
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "b875cd48a0bc955ae9c5c477ad991e1f26fb24d2",
"sha256": "0m07pifkdpwghpp8wvqh14sbxazmjbkkpsfakw6ixq5apfdvih48"
}
},
{
"path": "org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11",
"host": "https://repo1.maven.org/maven2",
@@ -630,11 +630,11 @@
},
{
"path": "org/babashka/sci/0.7.38/sci-0.7.38",
"host": "https://repo.clojars.org",
"path": "org/apache/ant/ant/1.10.11/ant-1.10.11",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "ef2d8c74065b9a7d685a11bff017676db308a923",
"sha256": "04pkxwcgkd1p4f4rszsr6pp18fl0vni1az47a390llrhyyrjcckn"
"sha1": "b875cd48a0bc955ae9c5c477ad991e1f26fb24d2",
"sha256": "0m07pifkdpwghpp8wvqh14sbxazmjbkkpsfakw6ixq5apfdvih48"
}
},
@@ -647,6 +647,15 @@
}
},
{
"path": "org/babashka/sci/0.7.38/sci-0.7.38",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "ef2d8c74065b9a7d685a11bff017676db308a923",
"sha256": "04pkxwcgkd1p4f4rszsr6pp18fl0vni1az47a390llrhyyrjcckn"
}
},
{
"path": "org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0",
"host": "https://repo1.maven.org/maven2",
@@ -737,15 +746,6 @@
}
},
{
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "533ce2bdbb7925db781449abb6527af1e6c5e782",
"sha256": "0js19lw8bp9gym3pn47h867vhf65j18qc6x1pfn883vkwyasm18l"
}
},
{
"path": "org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
@@ -755,6 +755,15 @@
}
},
{
"path": "org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "533ce2bdbb7925db781449abb6527af1e6c5e782",
"sha256": "0js19lw8bp9gym3pn47h867vhf65j18qc6x1pfn883vkwyasm18l"
}
},
{
"path": "org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0",
"host": "https://repo1.maven.org/maven2",
@@ -782,15 +791,6 @@
}
},
{
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "692882a35d7b50947d6e4852fba8a51d8d5e3646",
"sha256": "08fzw3srrppgq1d11sh1ghnyvi24ixa10kbqsncc7xyx7fybcs0k"
}
},
{
"path": "org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2",
"host": "https://repo1.maven.org/maven2",
@@ -800,6 +800,15 @@
}
},
{
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "692882a35d7b50947d6e4852fba8a51d8d5e3646",
"sha256": "08fzw3srrppgq1d11sh1ghnyvi24ixa10kbqsncc7xyx7fybcs0k"
}
},
{
"path": "org/clojure/tools.cli/1.0.206/tools.cli-1.0.206",
"host": "https://repo1.maven.org/maven2",
@@ -828,11 +837,11 @@
},
{
"path": "org/clojure/tools.reader/1.3.6/tools.reader-1.3.6",
"path": "org/clojure/tools.reader/1.3.7/tools.reader-1.3.7",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "927809dcb44fa726e4969d993e3e733636d95ebb",
"sha256": "1q5q7fmshybvp55f6qys8i5sbzfaix5v9f9b55dkbhv55hgv7l8i"
"sha1": "c60dfd3d79cbc5ec6264ba45c14b8d4c9b6708b2",
"sha256": "1mr0qx3gw1myfls07vrx3arwsi5n95b2lwk74ijpj0z3lzpzlj7m"
}
},
@@ -846,38 +855,38 @@
},
{
"path": "org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final",
"path": "org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "40fd4d696c55793e996d1ff3c475833f836c2498",
"sha256": "1f7f4kjn3v6vibhgsr3k8hl0r2xq0c2rbcl82dx0bqg5jdyqgzlf"
"sha1": "c4bd7e12a745c0e7f6cf98c45cdcdf482fd827ea",
"sha256": "0jdcziqbdzmah981zv3q88k2zrnclr2h1k3h3vjn002m9p54qchb"
}
},
{
"path": "org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final",
"path": "org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "9b260c0302f637a84a52d3d118214a3c59217615",
"sha256": "0yc0p71y7yjhqjhkvqqi9xqgljavp3aslnik2k7dppbxnkrnlff9"
"sha1": "dd23d4788b3eafe9597ef3fe028e46ceb293ba8d",
"sha256": "1cchp54dw1578my27siim3h5jbf240aq8q6xd3z2b1ajgxxbcl71"
}
},
{
"path": "org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final",
"path": "org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "e2c29acf42ac6f42c34f0b74ba089e3f3d1b2394",
"sha256": "041qnvb74bkgmfxyd23vdl26il55cmfbhi6a4bm3fcmyrpapjfjl"
"sha1": "1ba9c8b9a8dea1c6cd656155943e6d4c2c631fa7",
"sha256": "0wvqdcbardi55l77aw5404qgw70384hw155xvc66shn7l6z8h6bh"
}
},
{
"path": "org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final",
"path": "org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "90c57dcf7f8c846b4da331d0e6e048c39842c92a",
"sha256": "1zndnb5648wqw23gj80zjqk3yd8gq6grqhz9n4zrcqixx1z586jf"
"sha1": "a5d2faf8d02e0a0bb9e9eabca8e38173cb640331",
"sha256": "0pxw2iv1q1yzk39knc650rg4vflsyjzhf07mwm2s5aqn5h82sk3i"
}
},
@@ -909,11 +918,20 @@
},
{
"path": "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36",
"path": "org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "6c62681a2f655b49963a5983b8b0950a6120ae14",
"sha256": "1h512ry8g0nriazg3dqzs6s96502a77drw8vq26nfya97rg5gvyk"
"sha1": "7cf2726fdcfbc8610f9a71fb3ed639871f315340",
"sha256": "0v1b7iydpnh2rvyzqvqbqm19vr2qva8icq84690bppnpr06r6608"
}
},
{
"path": "org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "fa0627049304bf501bf6a0e4d1416bcaec9a72a9",
"sha256": "10vdg9qkailjbzmf5mfnv328675swmnf1x3g9v7ymhxs29xkc4jn"
}
},
@@ -927,11 +945,11 @@
},
{
"path": "org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final",
"path": "org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "8eba40cfe86bcfcc223551e75201e6e7574c7c36",
"sha256": "17rkkm9dqbxdzpamwl9jr8z285awsj6hzpavzmc87wcz9469hp5b"
"sha1": "735ceee5616d5143bac1bc740e444697073c002f",
"sha256": "0sp48y3q7bmp3bjb7a6fpz8gb7ssizvxlw5wdv2xwa6mifpkrnlz"
}
},
@@ -944,15 +962,6 @@
}
},
{
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
}
},
{
"path": "re-com/re-com/2.8.0/re-com-2.8.0",
"host": "https://repo.clojars.org",
@@ -962,15 +971,6 @@
}
},
{
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
}
},
{
"path": "re-frame/re-frame/1.3.0/re-frame-1.3.0",
"host": "https://repo.clojars.org",
@@ -998,6 +998,24 @@
}
},
{
"path": "reagent/reagent/1.2.0/reagent-1.2.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "1b9a181b5c7ed3557768d2ea0c66f5616aef5e97",
"sha256": "0scvkzfqjs613z10rngh7427v3pxdqablf0fcl65pbpkzz16wgav"
}
},
{
"path": "refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "f949af92dd1d6fef59d7447bd0cb62118e34eca1",
"sha256": "0dml9yvjmji6xk2sk3cdmkvvnh13rw29szxxl363hap8yg28xcs1"
}
},
{
"path": "ring-cors/ring-cors/0.1.8/ring-cors-0.1.8",
"host": "https://repo.clojars.org",
@@ -1035,11 +1053,11 @@
},
{
"path": "thheller/shadow-cljs/2.25.0/shadow-cljs-2.25.0-aot",
"path": "thheller/shadow-cljs/2.26.2/shadow-cljs-2.26.2-aot",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "013921db91ce4a3616aec9c72c1832a014a0fece",
"sha256": "0ks380z7h8i2ylirvjgmlicq9jjpz9w71gjv521h4xs5fb273cl0"
"sha1": "ab6b31649cb03e352369698781207db4f6da6d5f",
"sha256": "0mh28nykpillkym7hvplrr7vy5hn6a2ymafyf4yfl5y2kfx4yq42"
}
},
@@ -1053,11 +1071,11 @@
},
{
"path": "thheller/shadow-undertow/0.3.1/shadow-undertow-0.3.1",
"path": "thheller/shadow-undertow/0.3.3/shadow-undertow-0.3.3",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "9be444bea4037bb80b451cc52a8e80359c4c45be",
"sha256": "174s2rdxvp7d4jg9kvzjadps42bdsbi05rs2pjy5i0ssq9n23zwa"
"sha1": "ba377c3b70fd942b3ca7e38f055412a441626711",
"sha256": "10w2slj4znm93j0qq3ldj9hj0i7a50vbnmn6kv8i77fakikdjc48"
}
},
+27 -25
View File
@@ -8,8 +8,8 @@ borkdude/edamame/1.3.23/edamame-1.3.23.jar
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar
cheshire/cheshire/5.11.0/cheshire-5.11.0.jar
cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
cider/piggieback/0.4.1/piggieback-0.4.1.jar
cider/cider-nrepl/0.31.0/cider-nrepl-0.31.0.jar
cider/piggieback/0.5.2/piggieback-0.5.2.jar
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
cljs-bean/cljs-bean/1.9.0/cljs-bean-1.9.0.jar
clout/clout/2.1.2/clout-2.1.2.jar
@@ -26,35 +26,36 @@ com/github/javaparser/javaparser-core/3.25.3/javaparser-core-3.25.3.jar
com/google/auto/value/auto-value-annotations/1.6/auto-value-annotations-1.6.jar
com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
com/google/code/gson/gson/2.9.1/gson-2.9.1.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0.jar
com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar
com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
com/google/javascript/closure-compiler-unshaded/v20230411/closure-compiler-unshaded-v20230411.jar
com/google/javascript/closure-compiler-unshaded/v20230802/closure-compiler-unshaded-v20230802.jar
com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar
com/google/re2j/re2j/1.3/re2j-1.3.jar
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/taoensso/encore/3.68.0/encore-3.68.0.jar
com/taoensso/timbre/6.3.1/timbre-6.3.1.jar
com/taoensso/truss/1.11.0/truss-1.11.0.jar
com/taoensso/tufte/2.6.3/tufte-2.6.3.jar
commons-codec/commons-codec/1.15/commons-codec-1.15.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
compojure/compojure/1.5.2/compojure-1.5.2.jar
crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar
crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.jar
day8/re-frame/test/0.1.5/test-0.1.5.jar
expound/expound/0.9.0/expound-0.9.0.jar
fipp/fipp/0.6.26/fipp-0.6.26.jar
funcool/promesa/11.0.678/promesa-11.0.678.jar
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
instaparse/instaparse/1.4.0/instaparse-1.4.0.jar
io/aviso/pretty/1.4.4/pretty-1.4.4.jar
io/methvin/directory-watcher/0.17.1/directory-watcher-0.17.1.jar
io/replikativ/datalog-parser/0.2.25/datalog-parser-0.2.25.jar
io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar
io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final.jar
javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
@@ -64,12 +65,12 @@ mvxcvi/arrangement/2.1.0/arrangement-2.1.0.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
nrepl/bencode/1.1.0/bencode-1.1.0.jar
nrepl/nrepl/1.0.0/nrepl-1.0.0.jar
nrepl/nrepl/0.9.0/nrepl-0.9.0.jar
nubank/matcher-combinators/3.8.8/matcher-combinators-3.8.8.jar
org/apache/ant/ant/1.10.11/ant-1.10.11.jar
org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
org/babashka/sci/0.7.38/sci-0.7.38.jar
org/apache/ant/ant/1.10.11/ant-1.10.11.jar
org/babashka/sci.impl.types/0.0.2/sci.impl.types-0.0.2.jar
org/babashka/sci/0.7.38/sci-0.7.38.jar
org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar
org/clojure/clojure/1.11.1/clojure-1.11.1.jar
org/clojure/clojurescript/1.11.60/clojurescript-1.11.60.jar
@@ -80,41 +81,42 @@ org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar
org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar
org/clojure/data.json/2.4.0/data.json-2.4.0.jar
org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/math.combinatorics/0.2.0/math.combinatorics-0.2.0.jar
org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar
org/clojure/test.check/1.1.1/test.check-1.1.1.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar
org/clojure/tools.logging/1.1.0/tools.logging-1.1.0.jar
org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar
org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.jar
org/clojure/tools.reader/1.3.7/tools.reader-1.3.7.jar
org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar
org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar
org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar
org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar
org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar
org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final.jar
org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final.jar
org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final.jar
org/jspecify/jspecify/0.2.0/jspecify-0.2.0.jar
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
org/ow2/asm/asm/9.4/asm-9.4.jar
org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar
org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9.jar
org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.jar
prismatic/schema/1.1.7/schema-1.1.7.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar
re-com/re-com/2.8.0/re-com-2.8.0.jar
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
re-frisk/sente/1.15.0/sente-1.15.0.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar
refactor-nrepl/refactor-nrepl/3.9.1/refactor-nrepl-3.9.1.jar
ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
ring/ring-codec/1.2.0/ring-codec-1.2.0.jar
ring/ring-core/1.9.6/ring-core-1.9.6.jar
thheller/shadow-client/1.3.3/shadow-client-1.3.3.jar
thheller/shadow-cljs/2.25.0/shadow-cljs-2.25.0-aot.jar
thheller/shadow-cljs/2.26.2/shadow-cljs-2.26.2-aot.jar
thheller/shadow-cljsjs/0.0.22/shadow-cljsjs-0.0.22.jar
thheller/shadow-undertow/0.3.1/shadow-undertow-0.3.1.jar
thheller/shadow-undertow/0.3.3/shadow-undertow-0.3.3.jar
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
tigris/tigris/0.1.2/tigris-0.1.2.jar
+1 -1
View File
@@ -6,7 +6,7 @@ This directory contains the tools and the data that allows Nix to manage Gradle
Simply calling `generate.sh` should result in a `deps.json` file which is used in the derivation that provides Gradle dependencies when building the Android app.
You can see in [`nix/mobile/android/release.nix`](../../mobile/android/release.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag.
You can see in [`nix/mobile/android/release.nix`](../../mobile/android/build.nix) that it's used via the `-Dmaven.repo.local='${deps.gradle}'` Gradle flag.
# Files
@@ -7,15 +7,15 @@
# Path to the file containing secret environment variables
secretsFile ? "",
# Build type (influences which .env file gets used for feature flags)
# TODO: pr or relase for default?
buildType ? lib.getEnvWithDefault "BUILD_TYPE" "release",
# Used for versionCode
buildNumber ? lib.getEnvWithDefault "BUILD_NUMBER" 9999,
versionCode ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_versionCode" 9999,
# Included in APK Manifest for easier identification.
# TODO: or GIT_COMMIT from Jenkins?
commitHash ? lib.getEnvWithDefault "COMMIT_HASH" "unknown",
# Gradle options passed for Android builds
androidGradleOpts ? lib.getEnvWithDefault "ANDROID_GRADLE_OPTS" null,
commitHash ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_commitHash" "unknown",
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
hermesEnabled ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_hermesEnabled" "true",
buildUrl ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_buildUrl" null,
statusGoSrcOverride ? lib.getEnvWithDefault "STATUS_GO_SRC_OVERRIDE" null,
# If APKs should be split based on architectures
androidAbiSplit ? lib.getEnvWithDefault "ANDROID_ABI_SPLIT" "false",
@@ -40,8 +40,10 @@ let
else if (elem buildType ["pr" "manual"]) then ".env.jenkins"
else ".env";
# There are only two types of Gradle build targets: pr and release
gradleBuildType = if buildType == "pr" then "Pr" else "Release";
gradleBuildType =
if buildType == "pr" then "Pr"
else if buildType == "debug" then "Debug"
else "Release";
apksPath = "./android/app/build/outputs/apk/${toLower gradleBuildType}";
@@ -81,7 +83,10 @@ in stdenv.mkDerivation rec {
ANDROID_ABI_INCLUDE = androidAbiInclude;
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
# https://github.com/status-im/status-mobile/issues/18493
ORG_GRADLE_PROJECT_hermesEnabled = true;
ORG_GRADLE_PROJECT_versionCode = versionCode;
ORG_GRADLE_PROJECT_commitHash = commitHash;
ORG_GRADLE_PROJECT_buildUrl = buildUrl;
ORG_GRADLE_PROJECT_hermesEnabled = hermesEnabled;
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
NODE_OPTIONS = "--openssl-legacy-provider";
@@ -116,8 +121,6 @@ in stdenv.mkDerivation rec {
# Symlink React Native entrypoint.
cp -Lr ${builtJsBundle} ./result
pwd
find -L result
# Copy android/ directory
mkdir -p ./android/build
@@ -144,7 +147,6 @@ in stdenv.mkDerivation rec {
"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${makeLibraryPath [ pkgs.zlib ]}";
gradleCommand = ''
${pkgs.gradle}/bin/gradle \
${toString androidGradleOpts} \
--console=plain \
--offline \
--no-daemon \
@@ -152,8 +154,6 @@ in stdenv.mkDerivation rec {
--no-watch-fs \
--no-build-cache \
-Dmaven.repo.local='${deps.gradle}' \
-PversionCode=${toString buildNumber} \
-PcommitHash=${commitHash} \
assemble${gradleBuildType}
'';
in
@@ -171,12 +171,14 @@ in stdenv.mkDerivation rec {
${adhocEnvVars} ${gradleCommand}
popd > /dev/null
'';
doCheck = true;
checkPhase = ''
doCheck = buildType != "debug";
checkPhase = ''
ls ${apksPath}/*.apk \
| xargs -n1 ${pkgs.unzip}/bin/unzip -qql \
| grep 'index.android.bundle'
'';
installPhase = ''
mkdir -p $out
cp ${apksPath}/*.apk $out/
+2 -2
View File
@@ -2,7 +2,7 @@
, jsbundle, status-go, androidPkgs, androidShell }:
rec {
release = callPackage ./release.nix {
build = callPackage ./build.nix {
inherit jsbundle status-go;
};
@@ -15,7 +15,7 @@ rec {
];
inputsFrom = [
(release {})
(build {})
androidShell
];
+1 -1
View File
@@ -20,8 +20,8 @@ in {
buildInputs = with pkgs; [
xcodeWrapper watchman procps
flock # used in nix/scripts/node_modules.sh
ios-deploy # used in 'make run-ios-device'
xcbeautify # used in 'make run-ios'
libimobiledevice # used in `make run-ios-device`
];
# WARNING: Executes shellHook in reverse order.
-12
View File
@@ -26,18 +26,6 @@ in {
react-native = callPackage ./deps/react-native { };
};
# Fix for missing libarclite_macosx.a in Xcode 14.3.
# https://github.com/ios-control/ios-deploy/issues/580
ios-deploy = super.darwin.ios-deploy.overrideAttrs (old: rec {
version = "1.12.2";
src = super.fetchFromGitHub {
owner = "ios-control";
repo = "ios-deploy";
rev = version;
sha256 = "sha256-TVGC+f+1ow3b93CK3PhIL70le5SZxxb2ug5OkIg8XCA";
};
});
# Clojure's linter receives frequent upgrades, and we want to take advantage
# of the latest available rules.
clj-kondo = super.clj-kondo.override rec {
+1 -1
View File
@@ -45,7 +45,7 @@ if [[ -z "${TARGET}" ]]; then
fi
# Hack fix for missing Android SDK for aarch64 on Darwin. See systemOverride in `nix/pkgs.nix`.
if [[ "${TARGET}" =~ ^(targets.status-go.mobile.android|targets.mobile.android.release)$ ]]; then
if [[ "${TARGET}" =~ ^(targets.status-go.mobile.android|targets.mobile.android.build)$ ]]; then
os=$(uname -s | tr '[:upper:]' '[:lower:]')
export NIXPKGS_SYSTEM_OVERRIDE="x86_64-${os}"
fi
+2 -2
View File
@@ -2,12 +2,12 @@
set -Ee
_NIX_GCROOTS="${_NIX_GCROOTS:-/nix/var/nix/gcroots/per-user/${USER}/status-mobile}"
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
source "${GIT_ROOT}/nix/scripts/source.sh"
source "${GIT_ROOT}/scripts/colors.sh"
_NIX_GCROOTS="${_NIX_GCROOTS:-${GIT_ROOT}/.nix-gcroots}"
TARGET="${1}"
shift
if [[ -z "${TARGET}" ]]; then
+3 -5
View File
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
# WARNING: Versions 2.14, 2.15, 2.16 have an issue creating gcroots:
# https://github.com/NixOS/nix/issues/8564
export NIX_VERSION="2.13.4"
export NIX_PACKAGE="nixVersions.nix_2_13"
export NIX_VERSION="2.19.3"
export NIX_PACKAGE="nixVersions.nix_2_19"
export NIX_INSTALL_URL="https://nixos.org/releases/nix/nix-${NIX_VERSION}/install"
export NIX_INSTALL_SHA256="a9908cc48f5886b4f22172bdd2f9657873276fd295e78c6ed97fb308c6d284d0"
export NIX_INSTALL_SHA256="73d47b0ab783fddca1b2d44a03d52a74c97c28a1fc8ff5a29419079302ef9c3d"
export NIX_INSTALL_PATH="/tmp/nix-install-${NIX_VERSION}"
+1 -3
View File
@@ -21,8 +21,6 @@ function append_env_export() {
VAR_VALUE=$(must_get_env "${VAR_NAME}")
echo "export ${VAR_NAME}=\"${VAR_VALUE}\";" >> "${SECRETS_FILE_PATH}"
}
export COMMIT_HASH="$(git rev-parse --verify HEAD)"
nixOpts=()
# We create if now so the trap knows its location
@@ -73,4 +71,4 @@ else
fi
"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.release "${nixOpts[@]}"
"${GIT_ROOT}/nix/scripts/build.sh" targets.mobile.android.build "${nixOpts[@]}"
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
ADB_INSTALL_LOG_FILE="${GIT_ROOT}/logs/adb_install.log"
ADB_SHELL_MONKEY_LOG_FILE="${GIT_ROOT}/logs/adb_shell_monkey.log"
# Generate android debug build.
export ANDROID_ABI_INCLUDE=$("${GIT_ROOT}/scripts/adb_devices_abis.sh")
export BUILD_ENV=debug
export BUILD_TYPE=debug
"${GIT_ROOT}/scripts/build-android.sh"
# Install the APK on running emulator or android device.
installAndLaunchApp() {
adb install -r ./result/app-debug.apk > "${ADB_INSTALL_LOG_FILE}" 2>&1
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
# connected android devices need this port to be exposed for metro
adb reverse "tcp:${RCT_METRO_PORT}" "tcp:${RCT_METRO_PORT}"
adb shell monkey -p im.status.ethereum.debug 1 > "${ADB_SHELL_MONKEY_LOG_FILE}" 2>&1
}
showAdbLogs() {
cat "${ADB_INSTALL_LOG_FILE}" >&2;
cat "${ADB_SHELL_MONKEY_LOG_FILE}" >&2;
}
trap showAdbLogs EXIT ERR INT QUIT
installAndLaunchApp &
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
set -m # needed to access jobs
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
XCRUN_DEVICE_INSTALL_LOG_DIR="${GIT_ROOT}/logs/xcrun_device_install.log"
XCRUN_DEVICE_PROCESS_LAUNCH_LOG_DIR="${GIT_ROOT}/logs/xcrun_device_process_launch.log"
XCRUN_DEVICE_PROCESS_RESUME_LOG_DIR="${GIT_ROOT}/logs/xcrun_device_process_resume.log"
# Install on the connected device
installAndLaunchApp() {
xcrun devicectl device install app --device "${DEVICE_UUID}" "${APP_PATH}" --json-output "${XCRUN_DEVICE_INSTALL_LOG_DIR}" 2>&1
# Extract installationURL
INSTALLATION_URL=$(jq -r '.result.installedApplications[0].installationURL' "${XCRUN_DEVICE_INSTALL_LOG_DIR}")
# launch the app and put it in background
xcrun devicectl device process launch --no-activate --verbose --device "${DEVICE_UUID}" "${INSTALLATION_URL}" --json-output "${XCRUN_DEVICE_PROCESS_LAUNCH_LOG_DIR}"
# Extract background PID of status app
STATUS_PID=$(jq -r '.result.process.processIdentifier' "${XCRUN_DEVICE_PROCESS_LAUNCH_LOG_DIR}")
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
# now that metro is ready, resume the app from background
xcrun devicectl device process resume --device "${DEVICE_UUID}" --pid "${STATUS_PID}" > "${XCRUN_DEVICE_PROCESS_RESUME_LOG_DIR}" 2>&1
}
showXcrunLogs() {
cat "${XCRUN_DEVICE_INSTALL_LOG_DIR}" >&2;
cat "${XCRUN_DEVICE_PROCESS_LAUNCH_LOG_DIR}" >&2;
cat "${XCRUN_DEVICE_PROCESS_RESUME_LOG_DIR}" >&2;
}
# find the first connected iPhone's UUID
DEVICE_UUID=$(idevice_id -l)
# Check if any device is connected
if [ -z "${DEVICE_UUID}" ]; then
echo "No connected iPhone device detected."
exit 1
else
echo "Connected iPhone UDID: ${DEVICE_UUID}"
fi
BUILD_DIR="${GIT_ROOT}/build"
#iOS build of debug scheme
xcodebuild -workspace "ios/StatusIm.xcworkspace" -configuration Debug -scheme StatusIm -destination id="${DEVICE_UUID}" -derivedDataPath "${BUILD_DIR}" -verbose | xcbeautify
APP_PATH="${BUILD_DIR}/Build/Products/Debug-iphoneos/StatusIm.app"
trap showXcrunLogs EXIT ERR INT QUIT
installAndLaunchApp &
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1
+69
View File
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -euo pipefail
set -m # needed to access jobs
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
XCRUN_INSTALL_LOG_FILE="${GIT_ROOT}/logs/xcrun_install.log"
XCRUN_LAUNCH_LOG_FILE="${GIT_ROOT}/logs/xcrun_launch.log"
XCRUN_SIMULATOR_JSON_FILE="${GIT_ROOT}/logs/ios_simulators_list.log"
# Install on the simulator
installAndLaunchApp() {
xcrun simctl install "$UDID" "$APP_PATH" > "${XCRUN_INSTALL_LOG_FILE}" 2>&1
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
xcrun simctl launch "$UDID" im.status.ethereum.debug > "${XCRUN_LAUNCH_LOG_FILE}" 2>&1
}
showXcrunLogs() {
cat "${XCRUN_INSTALL_LOG_FILE}" >&2;
cat "${XCRUN_LAUNCH_LOG_FILE}" >&2;
}
# Check if the first argument is provided
if [ -z "${1-}" ]; then
echo "Error: No simulator name provided." >&2
exit 1
fi
# fetch available iOS Simulators
xcrun simctl list devices -j > "${XCRUN_SIMULATOR_JSON_FILE}"
SIMULATOR=${1}
# get the first available UDID for Simulators that match the name
read -r UDID SIMULATOR_STATE IS_AVAILABLE < <(jq --raw-output --arg simulator "${SIMULATOR}" '
[ .devices[] | .[] | select(.name == $simulator) ] |
map(select(.isAvailable)) + map(select(.isAvailable | not)) |
first |
"\(.udid) \(.state) \(.isAvailable)"
' "${XCRUN_SIMULATOR_JSON_FILE}")
if [ "${IS_AVAILABLE}" == false ] || [ "${UDID}" == null ]; then
echo "Error: Simulator ${SIMULATOR} is not available, Please find and install them."
echo "For help please refer"
echo "https://developer.apple.com/documentation/safari-developer-tools/adding-additional-simulators#Add-and-remove-Simulators " >&2
exit 1
fi
# sometimes a simulator is already running, shut it down to avoid errors
if [ "${SIMULATOR_STATE}" != "Shutdown" ]; then
xcrun simctl shutdown "${UDID}"
fi
# boot up iOS for simulator
xcrun simctl boot "${UDID}"
# start the simulator
open -a Simulator --args -CurrentDeviceUDID "${UDID}"
BUILD_DIR="${GIT_ROOT}/build"
#iOS build of debug scheme
xcodebuild -workspace "ios/StatusIm.xcworkspace" -configuration Debug -scheme StatusIm -destination id="${UDID}" -derivedDataPath "${BUILD_DIR}" -verbose | xcbeautify
APP_PATH="${BUILD_DIR}/Build/Products/Debug-iphonesimulator/StatusIm.app"
trap showXcrunLogs EXIT ERR INT QUIT
installAndLaunchApp &
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
pkill -f 'react-native start'
react-native start --reset-cache
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
source "${GIT_ROOT}/scripts/colors.sh"
METRO_PORT=8081
METRO_PID="$(lsof -i :${METRO_PORT} | awk 'NR!=1 {print $2}' | sort -u | tr '\r\n' ' ')"
if [ ! -z "$METRO_PID" ]; then
echo -e "${YLW}TCP port ${METRO_PORT} is required by the Metro packager.\nThe following processes currently have the port open, preventing Metro from starting:${RST}"
ps -fp $METRO_PID
echo -e "${YLW}Do you want to terminate them (y/n)?${RST}"
read -n 1 term
[[ $term == 'y' ]] && kill $METRO_PID
fi
react-native start --reset-cache
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
TIMEOUT=10 # Metro should not take this long to start.
while [ "${TIMEOUT}" -gt 0 ]; do
if ! lsof -i:8081 &> /dev/null; then
echo "."
sleep 1
((TIMEOUT--))
else
break
fi
done
+1
View File
@@ -10,6 +10,7 @@
[com.cognitect/transit-cljs "0.8.280"]
[camel-snake-kebab "0.4.3"]
[metosin/malli "0.13.0"]
[funcool/promesa "11.0.678"]
;; Dev dependencies
[refactor-nrepl "3.9.1"]
@@ -28,10 +28,10 @@
[:f>
(fn []
(rn/use-effect (fn []
(rn/hw-back-add-listener dismiss-bottom-sheet-callback)
(fn []
(rn/hw-back-remove-listener dismiss-bottom-sheet-callback))))
(rn/use-mount (fn []
(rn/hw-back-add-listener dismiss-bottom-sheet-callback)
(fn []
(rn/hw-back-remove-listener dismiss-bottom-sheet-callback))))
[theme/provider {:theme (or page-theme (theme/get-theme))}
[bottom-sheet/bottom-sheet opts
(when content
@@ -16,12 +16,14 @@
:align-self :center})
(def backdrop
{:position :absolute
:left 0
:right 0
:bottom 0
:top 0
:background-color colors/neutral-100})
{:position :absolute
:left 0
:right 0
:bottom 0
:top 0})
(def backdrop-color
{:background-color colors/neutral-100})
(def container
{:position :absolute
+4 -2
View File
@@ -207,11 +207,13 @@
[@show-bottom-sheet? @expanded? @gesture-running?])
[:<>
[rn/touchable-without-feedback {:on-press (when backdrop-dismiss? close-bottom-sheet)}
[rn/pressable
{:on-press (when backdrop-dismiss? close-bottom-sheet)
:style styles/backdrop}
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity bg-opacity}
styles/backdrop)}]]
styles/backdrop-color)}]]
(cond->> [reanimated/view
{:style (reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]}
+1 -3
View File
@@ -1,7 +1,6 @@
(ns legacy.status-im.currency.core
(:require
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.wallet.prices :as prices]
[utils.re-frame :as rf]))
(defn get-currency
@@ -16,5 +15,4 @@
:currency
currency
;; on changing currency, we should fetch tokens prices again
{:on-success #(rf/dispatch [:wallet/get-wallet-token])})
(prices/update-prices)))
{:on-success #(rf/dispatch [:wallet/get-wallet-token])})))
+1 -2
View File
@@ -7,7 +7,6 @@
[legacy.status-im.ethereum.ens :as ens]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.utils.random :as random]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.navigation.events :as navigation]
@@ -126,7 +125,7 @@
{:events [::set-pub-key]}
[{:keys [db]}]
(let [{:keys [username address custom-domain?]} (:ens/registration db)
address (or address (wallet.utils/default-address db))
address address
{:keys [public-key]} (:profile/profile db)
chain-id (chain/chain-id db)
username (fullname custom-domain? username)]
@@ -4,7 +4,6 @@
[legacy.status-im.ethereum.decode :as decode]
[legacy.status-im.ethereum.encode :as encode]
[legacy.status-im.utils.mobile-sync :as utils.mobile-sync]
[legacy.status-im.wallet.core :as wallet]
[re-frame.core :as re-frame]
[status-im.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]
@@ -256,24 +255,13 @@
(let [checksum (eip55/address->checksum address)
max-known-block (get-max-block-with-transfers db address)
effects (cond-> [(when (seq transfers)
(set-lowest-fetched-block checksum transfers))
(wallet/set-max-block-with-transfers checksum transfers)]
(set-lowest-fetched-block checksum transfers))]
(seq transfers)
(concat
[]
(mapv add-transfer transfers))
(and max-known-block
(some #(> (:block %) max-known-block) transfers))
(conj (wallet/update-balances
[address]
(zero? max-known-block)))
(and (zero? max-known-block)
(empty? transfers))
(conj (wallet/set-zero-balances {:address address}))
(< (count transfers) limit)
(conj (tx-history-end-reached checksum)))]
(apply rf/merge cofx (tx-fetching-ended [checksum]) effects)))
@@ -282,8 +270,7 @@
{:events [::new-transfers]}
[cofx transfers params]
(rf/merge cofx
(handle-new-transfer transfers params)
(wallet/stop-fetching-on-empty-tx-history transfers)))
(handle-new-transfer transfers params)))
(rf/defn tx-fetching-failed
{:events [::tx-fetching-failed]}
-7
View File
@@ -32,10 +32,6 @@
legacy.status-im.visibility-status-popover.core
legacy.status-im.visibility-status-updates.core
legacy.status-im.waku.core
legacy.status-im.wallet.accounts.core
legacy.status-im.wallet.choose-recipient.core
[legacy.status-im.wallet.core :as wallet]
legacy.status-im.wallet.custom-tokens.core
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[react-native.core :as rn]
@@ -141,7 +137,6 @@
(rf/merge cofx
{:db (dissoc db :app-in-background-since)}
(mailserver/process-next-messages-request)
(wallet/restart-wallet-service-after-background app-in-background-since)
(when-not new-account?
(universal-links/process-stored-event))
#(when-let [chat-id (:current-chat-id db)]
@@ -198,10 +193,8 @@
:reset-card (keycard/reset-card-screen-did-load %)
:enter-pin-settings (keycard/enter-pin-screen-did-load %)
:keycard-login-pin (keycard/login-pin-screen-did-load %)
:add-new-account-pin (keycard/enter-pin-screen-did-load %)
:keycard-authentication-method (keycard/authentication-method-screen-did-load %)
:multiaccounts (keycard/multiaccounts-screen-did-load %)
:wallet-legacy (wallet/wallet-will-focus %)
nil)))
;;TODO :replace by named events
+4 -7
View File
@@ -401,15 +401,12 @@
(merge
args
{:on-success
(fn [response]
(fn [_response]
(log/debug "[keycard response succ] export-key")
(re-frame/dispatch [:keycard.callback/on-export-key-success
response]))
(js/alert "feature no longer supported"))
:on-failure
(fn [response]
(log/debug "[keycard response fail] export-key")
(re-frame/dispatch [:keycard.callback/on-export-key-error
(error-object->map response)]))})))
(fn [_response]
(log/debug "[keycard response fail] export-key"))})))
(defn unpair-and-delete
[args]
-5
View File
@@ -12,7 +12,6 @@
[legacy.status-im.keycard.recovery :as recovery]
[legacy.status-im.keycard.sign :as sign]
legacy.status-im.keycard.unpair
[legacy.status-im.keycard.wallet :as wallet]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[re-frame.db]
[status-im.navigation.events :as navigation]
@@ -401,10 +400,6 @@
(= pin-code-length numbers-entered))
(common/verify-pin {:pin-step :current})
(and (= enter-step :export-key)
(= pin-code-length numbers-entered))
(wallet/verify-pin-with-delay)
(and (= enter-step :sign)
(= pin-code-length numbers-entered))
(sign/prepare-to-sign)
@@ -1,51 +1,13 @@
(ns legacy.status-im.keycard.export-key
(:require
[legacy.status-im.keycard.common :as common]
[legacy.status-im.keycard.wallet :as wallet]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/defn on-export-key-error
{:events [:keycard.callback/on-export-key-error]}
[{:keys [db] :as cofx} error]
(log/debug "[keycard] export key error" error)
(let [tag-was-lost? (common/tag-lost? (:error error))
pin-retries (common/pin-retries (:error error))]
(cond
tag-was-lost?
(rf/merge cofx
{:db (assoc-in db [:keycard :pin :status] nil)}
(common/set-on-card-connected :wallet-legacy.accounts/generate-new-keycard-account))
(not (nil? pin-retries))
(rf/merge cofx
{:db (-> db
(assoc-in [:keycard :application-info :pin-retry-counter] pin-retries)
(update-in [:keycard :pin]
assoc
:status :error
:enter-step :export-key
:puk []
:current []
:original []
:confirmation []
:sign []
:export-key []
:error-label :t/pin-mismatch))}
(common/hide-connection-sheet)
(when (zero? pin-retries) (common/frozen-keycard-popup)))
:else
(rf/merge cofx
(common/show-wrong-keycard-alert)
(common/clear-pin)
(common/hide-connection-sheet)))))
(rf/defn on-export-key-success
{:events [:keycard.callback/on-export-key-success]}
[{:keys [db] :as cofx} pubkey]
(let [callback-fn (get-in db [:keycard :on-export-success])]
(rf/merge cofx
{:dispatch (callback-fn pubkey)}
(wallet/hide-pin-sheet)
(common/clear-pin)
(common/hide-connection-sheet))))
+1 -3
View File
@@ -3,7 +3,6 @@
[clojure.string :as string]
[legacy.status-im.keycard.common :as common]
[legacy.status-im.utils.deprecated-types :as types]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
[utils.address :as address]
@@ -24,8 +23,7 @@
typed? (get-in db [:keycard :typed?])
pin (common/vector->string (get-in db [:keycard :pin :sign]))
from (or (get-in db [:signing/tx :from :address])
(get-in db [:signing/tx :message :from])
(wallet.utils/default-address db))
(get-in db [:signing/tx :message :from]))
path (reduce
(fn [_ {:keys [address path]}]
(when (address/address= from address)
-76
View File
@@ -1,76 +0,0 @@
(ns legacy.status-im.keycard.wallet
(:require
[legacy.status-im.bottom-sheet.events :as bottom-sheet]
[legacy.status-im.keycard.common :as common]
[legacy.status-im.ui.screens.wallet.add-new.views :as add-new.views]
[legacy.status-im.utils.hex :as utils.hex]
[native-module.core :as native-module]
[status-im.constants :as constants]
[utils.ethereum.eip.eip55 :as eip55]
[utils.re-frame :as rf]))
(rf/defn show-pin-sheet
{:events [:keycard/new-account-pin-sheet]}
[{:keys [db] :as cofx}]
(rf/merge
cofx
{:db (-> db
(assoc-in [:keycard :pin :enter-step] :export-key)
(update-in [:keycard :pin] dissoc :export-key))
:dismiss-keyboard nil}
(bottom-sheet/show-bottom-sheet-old {:view {:content add-new.views/pin}})))
(rf/defn verify-pin-with-delay
[cofx]
{:utils/dispatch-later
;; We need to give previous sheet some time to be fully hidden
[{:ms 200
:dispatch [:wallet-legacy.accounts/verify-pin]}]})
(rf/defn hide-pin-sheet
{:events [:keycard/new-account-pin-sheet-hide]}
[cofx]
(bottom-sheet/hide-bottom-sheet-old cofx))
(defn public-key->address
[public-key]
(let [length (count public-key)
normalized-key (case length
132 (str "0x" (subs public-key 4))
130 public-key
128 (str "0x" public-key)
nil)]
(when normalized-key
(subs (native-module/sha3 normalized-key) 26))))
(rf/defn generate-new-keycard-account
{:events [:wallet-legacy.accounts/generate-new-keycard-account]}
[{:keys [db]}]
(let [path-num (inc (get-in db [:profile/profile :latest-derived-path]))
path (str constants/path-wallet-root "/" path-num)
pin (common/vector->string (get-in db [:keycard :pin :export-key]))]
{:db
(assoc-in
db
[:keycard :on-export-success]
#(vector :wallet-legacy.accounts/account-stored
(let [public-key (utils.hex/normalize-hex %)]
{;; Strip leading 04 prefix denoting uncompressed key format
:address (eip55/address->checksum
(str "0x"
(public-key->address
(subs public-key 2))))
:public-key (str "0x" public-key)
:path path})))
:keycard/export-key {:pin pin :path path}}))
(rf/defn verify-pin
{:events [:wallet-legacy.accounts/verify-pin]}
[cofx]
(common/verify-pin
cofx
{:pin-step :export-key
:on-card-connected :wallet-legacy.accounts/verify-pin
:on-success :wallet-legacy.accounts/generate-new-keycard-account
:on-failure :keycard/new-account-pin-sheet}))
@@ -5,7 +5,6 @@
[legacy.status-im.multiaccounts.model :as multiaccounts.model]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.utils.mobile-sync :as utils]
[legacy.status-im.wallet.core :as wallet]
[status-im.contexts.chat.home.add-new-contact.events :as add-new-contact]
[status-im.navigation.events :as navigation]
[taoensso.timbre :as log]
@@ -35,8 +34,7 @@
(and logged-in? initialized?)
[(mailserver/process-next-messages-request)
(bottom-sheet/hide-bottom-sheet-old)
(wallet/restart-wallet-service nil)
(add-new-contact/set-new-identity-reconnected)]
#(add-new-contact/set-new-identity-reconnected %)]
logged-in?
[(mailserver/process-next-messages-request)
@@ -67,8 +65,7 @@
(boolean remember-choice?)
{})
(when (and cellular? sync?)
(mailserver/process-next-messages-request))
(wallet/restart-wallet-service nil))))))
(mailserver/process-next-messages-request)))))))
(rf/defn mobile-network-continue-syncing
{:events [:mobile-network/continue-syncing]}
@@ -1,6 +1,5 @@
(ns legacy.status-im.multiaccounts.logout.core
(:require
[legacy.status-im.wallet.core :as wallet]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[status-im.common.keychain.events :as keychain]
@@ -31,7 +30,6 @@
(let [key-uid (get-in db [:profile/profile :key-uid])]
(rf/merge cofx
{:set-root :progress
:chat.ui/clear-inputs nil
:effects.shell/reset-state nil
:hide-popover nil
::logout nil
@@ -40,7 +38,6 @@
:profile/get-profiles-overview #(rf/dispatch
[:profile/get-profiles-overview-success %])}
(keychain/save-auth-method key-uid auth-method)
(wallet/clear-timeouts)
(initialize-app-db))))
(rf/defn logout
+1 -7
View File
@@ -2,7 +2,6 @@
(:require
["@react-native-community/netinfo" :default net-info]
[legacy.status-im.mobile-sync-settings.core :as mobile-network]
[legacy.status-im.wallet.core :as wallet]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
@@ -11,12 +10,7 @@
(rf/defn change-network-status
[{:keys [db] :as cofx} is-connected?]
(rf/merge cofx
{:db (assoc db :network-status (if is-connected? :online :offline))}
(when (and is-connected?
(or (not= (count (get-in db [:wallet-legacy :accounts]))
(count (get db :profile/wallet-accounts)))
(wallet/has-empty-balances? db)))
(wallet/update-balances nil nil))))
{:db (assoc db :network-status (if is-connected? :online :offline))}))
(rf/defn change-network-type
[{:keys [db] :as cofx} old-network-type network-type expensive?]
+1 -1
View File
@@ -72,7 +72,7 @@
:PeerExchange true
:Port 0
:UDPPort 0
:LightClient true})
:LightClient false})
(def login-node-config
{:WalletConfig (cond-> {:Enabled true}
-11
View File
@@ -72,14 +72,3 @@
{:events [:show-tooltip]}
[_ tooltip-id]
{:show-tooltip tooltip-id})
(rf/defn show-profile
{:events [:chat.ui/show-profile]}
[{:keys [db]} identity ens-name]
(let [my-public-key (get-in db [:profile/profile :public-key])]
(if (not= my-public-key identity)
{:db (-> db
(assoc :contacts/identity identity)
(assoc :contacts/ens-name ens-name))
:dispatch [:contacts/build-contact identity ens-name true]}
{:dispatch [:navigate-to :my-profile]})))
@@ -1,59 +0,0 @@
(ns legacy.status-im.search.core-test
(:require
[cljs.test :refer-macros [deftest testing is]]
[legacy.status-im.subs.wallet.search :as search.subs]))
(defn extract-chat-attributes
[chat]
(let [{:keys [name alias tags]} (val chat)]
(into [name alias] tags)))
(deftest filter-chats
(let [chats {:chat-1 {:name "name1"
:alias "alias1"
:tags #{"tag1"}}
:chat-2 {:name "name2"
:alias "alias2"
:tags #{"tag2" "tag3"}}
:chat-3 {:name "name3"
:alias "alias3"
:tags #{}}
:chat-4 {:name "name4"
:alias "alias4"
:tags #{"tag4"}}}]
(testing "no search filter"
(is (= (count chats)
(count (search.subs/apply-filter ""
chats
extract-chat-attributes
false)))))
(testing "searching for a specific tag"
(is (= 1
(count (search.subs/apply-filter "tag2"
chats
extract-chat-attributes
false)))))
(testing "searching for a partial tag"
(is (= 3
(count (search.subs/apply-filter "tag"
chats
extract-chat-attributes
false)))))
(testing "searching for a specific alias"
(is (= 1
(count (search.subs/apply-filter "alias4"
chats
extract-chat-attributes
false)))))
(testing "searching for a partial alias"
(is (= 4
(count (search.subs/apply-filter "alias"
chats
extract-chat-attributes
false)))))
(testing "searching for a specific chat name"
(is (= 1
(count (search.subs/apply-filter "name4"
chats
extract-chat-attributes
false)))))))
+4 -9
View File
@@ -10,9 +10,6 @@
[legacy.status-im.utils.deprecated-types :as types]
[legacy.status-im.utils.hex :as utils.hex]
[legacy.status-im.utils.utils :as utils]
[legacy.status-im.wallet.core :as wallet]
[legacy.status-im.wallet.prices :as prices]
[legacy.status-im.wallet.utils :as wallet.utils]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[status-im.common.json-rpc.events :as json-rpc]
@@ -83,7 +80,7 @@
[{{:signing/keys [sign tx] :as db} :db}]
(let [{{:keys [data typed? from v4]} :message} tx
{:keys [in-progress? password]} sign
from (or from (wallet.utils/default-address db))
from from
hashed-password (native-module/sha3 (security/safe-unmask-data
password))]
(when-not in-progress?
@@ -335,7 +332,7 @@
:dismiss-keyboard nil}
#(when-not wallet-set-up-passed?
{:dispatch-later [{:dispatch [:show-popover {:view :signing-phrase}] :ms 200}]})
(prices/update-prices)
#(when-not gas
{:db (assoc-in (:db %) [:signing/edit-fee :gas-loading?] true)
:signing/update-estimated-gas {:obj (-> tx-obj
@@ -395,7 +392,6 @@
:signing/show-transaction-result nil}
(prepare-unconfirmed-transaction result tx-obj symbol amount)
(check-queue)
(wallet/watch-tx (get from :address) result)
#(when on-result
{:dispatch (conj on-result result)}))))
@@ -408,7 +404,6 @@
(rf/merge
cofx
{:db (dissoc db :signing/tx :signing/sign)}
(wallet/watch-tx (get from :address) transaction-hash)
(if (keycard.common/keycard-multiaccount? db)
(signing.keycard/hash-message
{:data data
@@ -511,8 +506,8 @@
{:dispatch (conj on-error "transaction was cancelled by user")}))))
(defn normalize-tx-obj
[db tx]
(update-in tx [:tx-obj :from] #(eip55/address->checksum (or % (wallet.utils/default-address db)))))
[_db tx]
(update-in tx [:tx-obj :from] #(eip55/address->checksum %)))
(rf/defn sign
"Signing transaction or message, shows signing sheet
-10
View File
@@ -1,7 +1,6 @@
(ns legacy.status-im.stickers.core
(:require
[legacy.status-im.utils.utils :as utils]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
[utils.ethereum.chain :as chain]
@@ -39,15 +38,6 @@
:params []
:on-success #(re-frame/dispatch [:stickers/stickers-recent-success %])}]})
(rf/defn buy-pack
{:events [:stickers/buy-pack]}
[{db :db} pack-id]
{:json-rpc/call [{:method "stickers_buyPrepareTx"
:params [(chain/chain-id db) (wallet.utils/default-address db) (int pack-id)]
:on-success #(re-frame/dispatch [:signing.ui/sign
{:tx-obj %
:on-result [:stickers/pending-pack pack-id]}])}]})
(rf/defn pending-pack
{:events [:stickers/pending-pack]}
[{db :db} id]
-4
View File
@@ -7,10 +7,6 @@
legacy.status-im.subs.mailservers
legacy.status-im.subs.networks
legacy.status-im.subs.stickers
legacy.status-im.subs.wallet.search
legacy.status-im.subs.wallet.signing
legacy.status-im.subs.wallet.transactions
legacy.status-im.subs.wallet.wallet
[re-frame.core :as re-frame]))
(defn reg-root-key-sub
@@ -1,73 +0,0 @@
(ns legacy.status-im.subs.wallet.search
(:require
[clojure.string :as string]
[legacy.status-im.utils.currency :as currency]
[re-frame.core :as re-frame]))
(defn sort-by-timestamp
[coll]
(when (not-empty coll)
(sort-by #(-> % second :timestamp)
>
(into {} coll))))
(defn apply-filter
"extract-attributes-fn is a function that take an element from the collection
and returns a vector of attributes which are strings
apply-filter returns the elements for which at least one attribute includes
the search-filter
apply-filter returns nil if there is no element that match the filter
apply-filter returns full collection if the search-filter is empty"
[search-filter coll extract-attributes-fn sort?]
(let [results (if (not-empty search-filter)
(let [search-filter (string/lower-case search-filter)]
(filter (fn [element]
(some (fn [v]
(let [s (cond (string? v) v
(keyword? v) (name v))]
(when (string? s)
(string/includes? (string/lower-case s)
search-filter))))
(extract-attributes-fn element)))
coll))
coll)]
(if sort?
(sort-by-timestamp results)
results)))
(defn extract-currency-attributes
[currency]
(let [{:keys [code display-name]} (val currency)]
[code display-name]))
(re-frame/reg-sub
:wallet-legacy/search-filtered-currencies
:<- [:search/currency-filter]
(fn [search-currency-filter]
{:search-filter search-currency-filter
:currencies (apply-filter search-currency-filter
currency/currencies
extract-currency-attributes
false)}))
(defn extract-token-attributes
[token]
[(:symbol token) (:name token)])
(re-frame/reg-sub
:wallet-legacy/search-token-filter
:<- [:ui/search]
(fn [search]
(get search :token-filter)))
(re-frame/reg-sub
:wallet-legacy/filtered-grouped-chain-tokens
:<- [:wallet-legacy/grouped-chain-tokens]
:<- [:wallet-legacy/search-token-filter]
(fn [[{custom-tokens true default-tokens nil} search-token-filter]]
{:search-filter search-token-filter
:tokens {true (apply-filter search-token-filter custom-tokens extract-token-attributes false)
nil (apply-filter search-token-filter
default-tokens
extract-token-attributes
false)}}))
@@ -1,235 +0,0 @@
(ns legacy.status-im.subs.wallet.signing
(:require
[clojure.string :as string]
[legacy.status-im.ethereum.tokens :as tokens]
[legacy.status-im.signing.gas :as signing.gas]
[legacy.status-im.wallet.db :as wallet.db]
[re-frame.core :as re-frame]
[utils.ethereum.chain :as chain]
[utils.i18n :as i18n]
[utils.money :as money]))
(re-frame/reg-sub
::send-transaction
:<- [:wallet-legacy]
(fn [wallet]
(:send-transaction wallet)))
(re-frame/reg-sub
:wallet-legacy.send/symbol
:<- [::send-transaction]
(fn [send-transaction]
(:symbol send-transaction)))
(re-frame/reg-sub
:wallet-legacy.send/camera-flashlight
:<- [::send-transaction]
(fn [send-transaction]
(:camera-flashlight send-transaction)))
(re-frame/reg-sub
:wallet-legacy/settings
:<- [:wallet-legacy]
(fn [{:keys [settings]}]
(reduce-kv #(conj %1 %3) [] settings)))
(re-frame/reg-sub
:wallet-legacy.request/transaction
:<- [:wallet-legacy]
:request-transaction)
(re-frame/reg-sub
:wallet-legacy/binance-chain?
:<- [:current-network]
(fn [network]
(chain/binance-chain-id? (get-in network [:config :NetworkId]))))
(re-frame/reg-sub
:signing/fee
:<- [:signing/tx]
(fn [{:keys [gas gasPrice maxFeePerGas]}]
(signing.gas/calculate-max-fee gas (or maxFeePerGas gasPrice))))
(re-frame/reg-sub
:signing/currencies
:<- [:prices]
:<- [:wallet-legacy/currency]
:<- [:ethereum/native-currency]
(fn [[prices {:keys [code]} {sym :symbol}]]
[(name sym)
code
(get-in prices [sym (keyword code)])]))
(re-frame/reg-sub
:signing/priority-fee-suggestions-range
:<- [:wallet-legacy/current-priority-fee]
:<- [:wallet-legacy/slow-base-fee]
:<- [:wallet-legacy/normal-base-fee]
:<- [:wallet-legacy/fast-base-fee]
(fn [[latest-tip slow normal fast]]
(reduce
(fn [acc [k fees]]
(assoc acc
k
(reduce
(fn [acc [k fee]]
(assoc acc
k
(-> fee
money/wei->gwei
(money/to-fixed 2))))
{}
fees)))
{}
(signing.gas/get-fee-options latest-tip slow normal fast))))
(re-frame/reg-sub
:signing/phrase
:<- [:profile/profile]
(fn [{:keys [signing-phrase]}]
signing-phrase))
(re-frame/reg-sub
:signing/sign-message
:<- [:signing/sign]
:<- [:profile/wallet-accounts]
:<- [:prices]
(fn [[sign wallet-accounts prices]]
(if (= :pinless (:type sign))
(let [message (get-in sign [:formatted-data :message])
wallet-acc (some #(when (= (:address %) (:receiver message)) %) wallet-accounts)]
(cond-> sign
(and (:amount message) (:currency message))
(assoc :fiat-amount
(money/fiat-amount-value (:amount message)
(:currency message)
:USD
prices)
:fiat-currency "USD")
(and (:receiver message) wallet-acc)
(assoc :account wallet-acc)))
sign)))
(defn- too-precise-amount?
"Checks if number has any extra digit beyond the allowed number of decimals.
It does so by checking the number against its rounded value."
[amount decimals]
(let [^js bn (money/bignumber amount)]
(not (.eq bn (.round bn decimals)))))
(defn get-amount-error
[amount decimals]
(when (and (seq amount) decimals)
(let [normalized-amount (money/normalize amount)
value (money/bignumber normalized-amount)]
(cond
(not (money/valid? value))
{:amount-error (i18n/label :t/validation-amount-invalid-number)}
(too-precise-amount? normalized-amount decimals)
{:amount-error (i18n/label :t/validation-amount-is-too-precise {:decimals decimals})}
:else nil))))
(defn get-sufficient-funds-error
[balance sym amount]
(when-not (money/sufficient-funds? amount (get balance sym))
{:amount-error (i18n/label :t/wallet-insufficient-funds)}))
(defn gas-required-exceeds-allowance?
[gas-error-message]
(and gas-error-message
(string/starts-with?
gas-error-message
"gas required exceeds allowance")))
(defn get-sufficient-gas-error
[gas-error-message balance sym amount ^js gas ^js gasPrice]
(if (and gas gasPrice)
(let [^js fee (.times gas gasPrice)
^js available-ether (money/bignumber (get balance :ETH 0))
^js available-for-gas (if (= :ETH sym)
(.minus available-ether (money/bignumber amount))
available-ether)]
(merge {:gas-error-state (when gas-error-message :gas-is-set)}
(when-not (money/sufficient-funds? fee (money/bignumber available-for-gas))
{:gas-error (i18n/label :t/wallet-insufficient-gas)})))
(let [insufficient-balance? (gas-required-exceeds-allowance? gas-error-message)]
{:gas-error-state (when gas-error-message :gas-isnt-set)
:insufficient-balalce? insufficient-balance?
:gas-error (if insufficient-balance?
(i18n/label :t/insufficient-balance-to-cover-fee)
(or gas-error-message
(i18n/label :t/invalid-number)))})))
(re-frame/reg-sub
:signing/amount-errors
(fn [[_ address] _]
[(re-frame/subscribe [:signing/tx])
(re-frame/subscribe [:balance address])])
(fn [[{:keys [amount token gas gasPrice maxFeePerGas approve? gas-error-message]} balance]]
(let [gas-price (or maxFeePerGas gasPrice)]
(if (and amount token (not approve?))
(let [amount-bn (money/formatted->internal (money/bignumber amount)
(:symbol token)
(:decimals token))
amount-error (or (get-amount-error amount (:decimals token))
(get-sufficient-funds-error balance (:symbol token) amount-bn))]
(merge
amount-error
(get-sufficient-gas-error gas-error-message balance (:symbol token) amount-bn gas gas-price)))
(get-sufficient-gas-error gas-error-message balance nil nil gas gas-price)))))
(re-frame/reg-sub
:wallet-legacy.send/prepare-transaction-with-balance
:<- [:wallet-legacy/prepare-transaction]
:<- [:wallet-legacy]
:<- [:offline?]
:<- [:wallet-legacy/all-tokens]
:<- [:current-network]
(fn [[{:keys [from to amount-text] :as transaction}
wallet offline? all-tokens current-network]]
(let [sym (:symbol transaction)
balance (get-in wallet [:accounts (:address from) :balance])
{:keys [decimals] :as token} (tokens/asset-for all-tokens current-network sym)
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
amount (money/formatted->internal value sym decimals)
{:keys [amount-error] :as transaction-new}
(merge transaction
{:amount-error error}
(when amount
(get-sufficient-funds-error balance sym amount)))]
(assoc transaction-new
:amount amount
:balance balance
:token (assoc token :amount (get balance (:symbol token)))
:sign-enabled? (and to
(nil? amount-error)
(not (nil? amount))
(not offline?))))))
(re-frame/reg-sub
:wallet-legacy.request/prepare-transaction-with-balance
:<- [:wallet-legacy/prepare-transaction]
:<- [:wallet-legacy]
:<- [:offline?]
:<- [:wallet-legacy/all-tokens]
:<- [:current-network]
(fn [[{:keys [from to amount-text] :as transaction}
wallet offline? all-tokens current-network]]
(let [sym (:symbol transaction)
balance (get-in wallet [:accounts (:address from) :balance])
{:keys [decimals] :as token} (tokens/asset-for all-tokens current-network sym)
{:keys [value error]} (wallet.db/parse-amount amount-text decimals)
amount (money/formatted->internal value sym decimals)
{:keys [amount-error] :as transaction-new}
(assoc transaction :amount-error error)]
(assoc transaction-new
:amount amount
:balance balance
:token (assoc token :amount (get balance (:symbol token)))
:sign-enabled? (and to
from
(nil? amount-error)
(not (nil? amount))
(not offline?))))))
@@ -1,247 +0,0 @@
(ns legacy.status-im.subs.wallet.transactions
(:require
[legacy.status-im.ethereum.transactions.core :as transactions]
[legacy.status-im.notifications.wallet :as notifications.wallet]
[legacy.status-im.wallet.db :as wallet.db]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[utils.datetime :as datetime]
[utils.i18n :as i18n]
[utils.money :as money]))
(re-frame/reg-sub
:wallet-legacy/accounts
:<- [:wallet-legacy]
(fn [wallet]
(get wallet :accounts)))
(re-frame/reg-sub
:wallet-legacy/account-by-transaction-hash
:<- [:wallet-legacy/accounts]
(fn [accounts [_ tx-hash]]
(some (fn [[address account]]
(when-let [transaction (get-in account [:transactions tx-hash])]
(assoc transaction :address address)))
accounts)))
(re-frame/reg-sub
:wallet-legacy/transactions
:<- [:wallet-legacy]
(fn [wallet [_ address]]
(get-in wallet [:accounts address :transactions])))
(re-frame/reg-sub
:wallet-legacy/filters
:<- [:wallet-legacy]
(fn [wallet]
(get wallet :filters)))
(defn enrich-transaction
[{:keys [type to from value token] :as transaction}
contacts native-currency]
(let [[contact-address key-contact key-wallet]
(if (= type :inbound)
[from :from-contact :to-wallet]
[to :to-contact :from-wallet])
wallet (i18n/label :t/main-wallet)
contact (get contacts contact-address)
{:keys [symbol-display decimals] :as asset}
(or token native-currency)
amount-text (if value
(wallet.utils/format-amount value decimals)
"...")
currency-text (when asset
(clojure.core/name (or symbol-display
(:symbol asset))))]
(cond-> transaction
contact (assoc key-contact (:name contact))
:always (assoc key-wallet
wallet
:amount-text amount-text
:currency-text currency-text))))
(re-frame/reg-sub
:wallet-legacy.transactions/transactions
(fn [[_ address] _]
[(re-frame/subscribe [:wallet-legacy/transactions address])
(re-frame/subscribe [:contacts/contacts-by-address])
(re-frame/subscribe [:ethereum/native-currency])])
(fn [[transactions contacts native-currency]]
(reduce (fn [acc [tx-hash transaction]]
(assoc acc
tx-hash
(enrich-transaction transaction contacts native-currency))) ;;TODO this doesn't
;;look good for performance, we need to calculate this only once for each transaction
{}
transactions)))
(re-frame/reg-sub
:wallet-legacy.transactions/all-filters?
:<- [:wallet-legacy/filters]
(fn [filters]
(= wallet.db/default-wallet-filters
filters)))
(def filters-labels
{:inbound (i18n/label :t/incoming)
:outbound (i18n/label :t/outgoing)
:pending (i18n/label :t/pending)
:failed (i18n/label :t/failed)})
(re-frame/reg-sub
:wallet-legacy.transactions/filters
:<- [:wallet-legacy/filters]
(fn [filters]
(map (fn [id]
(let [checked? (filters id)]
{:id id
:label (filters-labels id)
:checked? checked?
:on-touch #(if checked?
(re-frame/dispatch [:wallet-legacy.transactions/remove-filter id])
(re-frame/dispatch [:wallet-legacy.transactions/add-filter id]))}))
wallet.db/default-wallet-filters)))
(re-frame/reg-sub
:wallet-legacy.transactions.filters/screen
:<- [:wallet-legacy.transactions/filters]
:<- [:wallet-legacy.transactions/all-filters?]
(fn [[filters all-filters?]]
{:all-filters? all-filters?
:filters filters
:on-touch-select-all (when-not all-filters?
#(re-frame/dispatch
[:wallet-legacy.transactions/add-all-filters]))}))
(defn- enrich-transaction-for-list
[filters
{:keys [type from-contact from to-contact to timestamp] :as transaction}
address]
(when (filters type)
(assoc
(case type
:inbound
(assoc transaction
:label (i18n/label :t/from-capitalized)
:contact-accessibility-label :sender-text
:address-accessibility-label :sender-address-text
:contact from-contact
:address from)
(assoc transaction
:label (i18n/label :t/to-capitalized)
:contact-accessibility-label :recipient-name-text
:address-accessibility-label :recipient-address-text
:contact to-contact
:address to))
:time-formatted (datetime/timestamp->time timestamp)
:on-touch-fn #(re-frame/dispatch [:wallet-legacy.ui/show-transaction-details
(:hash transaction)
address]))))
(defn group-transactions-by-date
[transactions]
(->> transactions
(group-by #(datetime/timestamp->date-key (:timestamp %)))
(sort-by key >)
(map (fn [[date-key transactions]]
{:title (datetime/timestamp->mini-date (:timestamp (first transactions)))
:key date-key
:data (sort-by :timestamp > transactions)}))))
(re-frame/reg-sub
:wallet-legacy.transactions.history/screen
(fn [[_ address] _]
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])
(re-frame/subscribe [:wallet-legacy/filters])
(re-frame/subscribe [:wallet-legacy.transactions/all-filters?])])
(fn [[transactions filters all-filters?] [_ address]]
{:all-filters? all-filters?
:total (count transactions)
:transaction-history-sections
(->> transactions
vals
(keep #(enrich-transaction-for-list filters % address))
(group-transactions-by-date))}))
(re-frame/reg-sub
:wallet-legacy/recipient-recent-txs
(fn [[_ address] _]
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])])
(fn [[transactions] _]
(->> transactions
vals
(sort-by :timestamp >)
(remove #(= (:type %) :pending))
(take 3))))
(re-frame/reg-sub
:wallet-legacy.transactions.details/current-transaction
(fn [[_ _ address] _]
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])
(re-frame/subscribe [:ethereum/native-currency])
(re-frame/subscribe [:chain-id])])
(fn [[transactions native-currency chain-id] [_ tx-hash _]]
(let [{:keys [gas-used gas-price fee-cap tip-cap timestamp type]
:as transaction}
(get transactions tx-hash)
native-currency-text (name (or (:symbol-display native-currency)
(:symbol native-currency)))]
(when transaction
(merge transaction
{:gas-price-eth (if gas-price
(money/wei->str :eth
gas-price
native-currency-text)
"-")
:gas-price-gwei (if gas-price
(money/wei->str :gwei
gas-price)
"-")
:fee-cap-gwei (if fee-cap
(money/wei->str :gwei
fee-cap)
"-")
:tip-cap-gwei (if tip-cap
(money/wei->str :gwei
tip-cap)
"-")
:date (datetime/timestamp->long-date timestamp)}
(if (= type :unsigned)
{:block (i18n/label :t/not-applicable)
:cost (i18n/label :t/not-applicable)
:gas-limit (i18n/label :t/not-applicable)
:gas-used (i18n/label :t/not-applicable)
:nonce (i18n/label :t/not-applicable)
:hash (i18n/label :t/not-applicable)}
{:cost (when gas-used
(money/wei->str :eth
(money/fee-value gas-used gas-price)
native-currency-text))
:url (transactions/get-transaction-details-url
chain-id
(:hash transaction))}))))))
(re-frame/reg-sub
:wallet-legacy.transactions.details/screen
(fn [[_ tx-hash address] _]
[(re-frame/subscribe [:wallet-legacy.transactions.details/current-transaction tx-hash address])
(re-frame/subscribe [:ethereum/current-block])])
(fn [[transaction current-block]]
(let [confirmations (wallet.db/get-confirmations transaction
current-block)]
(assoc transaction
:confirmations confirmations
:confirmations-progress
(if (>= confirmations transactions/confirmations-count-threshold)
100
(* 100 (/ confirmations transactions/confirmations-count-threshold)))))))
(re-frame/reg-sub
:push-notifications/wallet-transactions
:<- [:push-notifications/preferences]
(fn [pref]
(first (filter #(notifications.wallet/preference= %
{:service "wallet"
:event "transaction"
:identifier "all"})
pref))))
@@ -1,295 +0,0 @@
(ns legacy.status-im.subs.wallet.wallet
(:require
[clojure.string :as string]
[legacy.status-im.ethereum.tokens :as tokens]
[legacy.status-im.utils.currency :as currency]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[status-im.config :as config]
[utils.i18n :as i18n]
[utils.money :as money]))
(re-frame/reg-sub
:balance
:<- [:wallet-legacy]
(fn [wallet [_ address]]
(get-in wallet [:accounts address :balance])))
(re-frame/reg-sub
:balance-default
:<- [:wallet-legacy]
:<- [:profile/wallet-accounts]
(fn [[wallet accounts]]
(get-in wallet [:accounts (:address (wallet.utils/get-default-account accounts)) :balance])))
(re-frame/reg-sub
:balances
:<- [:wallet-legacy]
:<- [:multiaccount/visible-accounts]
(fn [[wallet accounts]]
(let [accounts (map :address accounts)]
(map :balance (vals (select-keys (:accounts wallet) accounts))))))
(re-frame/reg-sub
:empty-balances?
:<- [:balances]
(fn [balances]
(every?
(fn [balance]
(every?
(fn [^js asset]
(or (nil? asset) (.isZero asset)))
(vals balance)))
balances)))
(re-frame/reg-sub
:price
:<- [:prices]
(fn [prices [_ fsym tsym]]
(get-in prices [fsym tsym])))
(re-frame/reg-sub
:last-day
:<- [:prices]
(fn [prices [_ fsym tsym]]
(get-in prices [fsym tsym :last-day])))
(re-frame/reg-sub
:wallet-legacy/settings-currency
:<- [:profile/profile]
(fn [settings]
(or (get settings :currency) :usd)))
(defn get-balance-total-value
[balance prices currency token->decimals]
(reduce-kv (fn [acc sym value]
(if-let [price (get-in prices [sym currency])]
(+ acc
(or (some-> (money/internal->formatted value sym (token->decimals sym))
^js (money/crypto->fiat price)
.toNumber)
0))
acc))
0
balance))
(re-frame/reg-sub
:wallet-legacy/token->decimals
:<- [:wallet-legacy/all-tokens]
(fn [all-tokens]
(into {} (map #(vector (:symbol %) (:decimals %)) (vals all-tokens)))))
(re-frame/reg-sub
:portfolio-value
:<- [:balances]
:<- [:prices]
:<- [:wallet-legacy/currency]
:<- [:wallet-legacy/token->decimals]
(fn [[balances prices currency token->decimals]]
(if (and balances prices)
(let [currency-key (-> currency :code keyword)
balance-total-value (apply
+
(map #(get-balance-total-value % prices currency-key token->decimals)
balances))]
(if (pos? balance-total-value)
(-> balance-total-value
(money/with-precision 2)
str
(i18n/format-currency (:code currency)))
"0"))
"...")))
(re-frame/reg-sub
:account-portfolio-value
(fn [[_ address] _]
[(re-frame/subscribe [:balance address])
(re-frame/subscribe [:prices])
(re-frame/subscribe [:wallet-legacy/currency])
(re-frame/subscribe [:wallet-legacy/token->decimals])])
(fn [[balance prices currency token->decimals]]
(if (and balance prices)
(let [currency-key (-> currency :code keyword)
balance-total-value (get-balance-total-value balance prices currency-key token->decimals)]
(if (pos? balance-total-value)
(-> balance-total-value
(money/with-precision 2)
str
(i18n/format-currency (:code currency)))
"0"))
"...")))
(re-frame/reg-sub
:wallet-legacy/sorted-tokens
:<- [:wallet-legacy/all-tokens]
(fn [all-tokens]
(tokens/sorted-tokens-for all-tokens)))
(re-frame/reg-sub
:wallet-legacy/grouped-chain-tokens
:<- [:wallet-legacy/sorted-tokens]
:<- [:wallet-legacy/visible-tokens-symbols]
(fn [[all-tokens visible-tokens]]
(let [vt-set (set visible-tokens)]
(group-by :custom?
(map #(assoc % :checked? (boolean (get vt-set (keyword (:symbol %))))) all-tokens)))))
(re-frame/reg-sub
:wallet-legacy/fetching-tx-history?
:<- [:wallet-legacy]
(fn [wallet [_ address]]
(get-in wallet [:fetching address :history?])))
(re-frame/reg-sub
:wallet-legacy/fetching-recent-tx-history?
:<- [:wallet-legacy]
(fn [wallet [_ address]]
(get-in wallet [:fetching address :recent?])))
(re-frame/reg-sub
:wallet-legacy/tx-history-fetched?
:<- [:wallet-legacy]
(fn [wallet [_ address]]
(get-in wallet [:fetching address :all-fetched?])))
(re-frame/reg-sub
:wallet-legacy/chain-explorer-link
(fn [db [_ address]]
(let [network (:networks/current-network db)
link (get-in config/default-networks-by-id
[network :chain-explorer-link])]
(when link
(str link address)))))
(re-frame/reg-sub
:wallet-legacy/error-message
:<- [:wallet-legacy]
(fn [wallet]
(or (get-in wallet [:errors :balance-update])
(get-in wallet [:errors :prices-update]))))
(re-frame/reg-sub
:wallet-legacy/visible-tokens-symbols
:<- [:ethereum/chain-keyword]
:<- [:profile/profile]
(fn [[chain current-multiaccount]]
(get-in current-multiaccount [:wallet-legacy/visible-tokens chain])))
(re-frame/reg-sub
:wallet-legacy/visible-assets
:<- [:current-network]
:<- [:wallet-legacy/visible-tokens-symbols]
:<- [:wallet-legacy/sorted-tokens]
(fn [[network visible-tokens-symbols all-tokens-sorted]]
(conj (filter #(contains? visible-tokens-symbols (:symbol %)) all-tokens-sorted)
(tokens/native-currency network))))
(re-frame/reg-sub
:wallet-legacy/visible-assets-with-amount
(fn [[_ address] _]
[(re-frame/subscribe [:balance address])
(re-frame/subscribe [:wallet-legacy/visible-assets])])
(fn [[balance visible-assets]]
(map #(assoc % :amount (get balance (:symbol %))) visible-assets)))
(defn update-value
[prices currency]
(fn [{:keys [decimals amount] :as token}]
(let [sym (:symbol token)
currency-kw (-> currency :code keyword)
price (get-in prices [sym currency-kw])]
(assoc token
:price price
:value (when (and amount price)
(-> (money/internal->formatted amount sym decimals)
(money/crypto->fiat price)
(money/with-precision 2)
str
(i18n/format-currency (:code currency))))))))
(re-frame/reg-sub
:wallet-legacy/visible-assets-with-values
(fn [[_ address] _]
[(re-frame/subscribe [:wallet-legacy/visible-assets-with-amount address])
(re-frame/subscribe [:prices])
(re-frame/subscribe [:wallet-legacy/currency])])
(fn [[assets prices currency]]
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
tokens-with-values (map (update-value prices currency) tokens)]
{:tokens tokens-with-values
:nfts nfts})))
(defn get-asset-amount
[balances sym]
(reduce #(if-let [^js bl (get %2 sym)]
(.plus ^js (or ^js %1 ^js (money/bignumber 0)) bl)
%1)
nil
balances))
(re-frame/reg-sub
:wallet-legacy/all-visible-assets-with-amount
:<- [:balances]
:<- [:wallet-legacy/visible-assets]
(fn [[balances visible-assets]]
(map #(assoc % :amount (get-asset-amount balances (:symbol %))) visible-assets)))
(re-frame/reg-sub
:wallet-legacy/all-visible-assets-with-values
:<- [:wallet-legacy/all-visible-assets-with-amount]
:<- [:prices]
:<- [:wallet-legacy/currency]
(fn [[assets prices currency]]
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
tokens-with-values (map (update-value prices currency) tokens)]
{:tokens tokens-with-values
:nfts nfts})))
(re-frame/reg-sub
:wallet-legacy/transferrable-assets-with-amount
(fn [[_ address]]
(re-frame/subscribe [:wallet-legacy/visible-assets-with-amount address]))
(fn [all-assets]
(filter #(not (:nft? %)) all-assets)))
(re-frame/reg-sub
:wallet-legacy/currency
:<- [:wallet-legacy/settings-currency]
(fn [currency-id]
(get currency/currencies currency-id (get currency/currencies :usd))))
(defn filter-recipient-favs
[search-filter {:keys [name]}]
(string/includes? (string/lower-case (str name)) search-filter))
(re-frame/reg-sub
:wallet-legacy/favourites-filtered
:<- [:wallet-legacy/favourites]
:<- [:wallet-legacy/search-recipient-filter]
(fn [[favs search-filter]]
(let [favs (vals favs)]
(if (string/blank? search-filter)
favs
(filter (partial filter-recipient-favs
(string/lower-case search-filter))
favs)))))
(re-frame/reg-sub
:wallet-legacy/collectible-collection
:<- [:wallet-legacy/collectible-collections]
(fn [all-collections [_ address]]
(when address
(let [all-collections (get all-collections (string/lower-case address) [])]
(sort-by :name all-collections)))))
(re-frame/reg-sub
:wallet-legacy/collectible-assets-by-collection-and-address
:<- [:wallet-legacy/collectible-assets]
(fn [all-assets [_ address collectible-slug]]
(get-in all-assets [address collectible-slug] [])))
(re-frame/reg-sub
:wallet-legacy/fetching-assets-by-collectible-slug
:<- [:wallet-legacy/fetching-collection-assets]
(fn [fetching-collection-assets [_ collectible-slug]]
(get fetching-collection-assets collectible-slug false)))
@@ -1,152 +0,0 @@
(ns legacy.status-im.subs.wallet.wallet-test
(:require
[cljs.test :refer [deftest is testing]]
[legacy.status-im.subs.wallet.transactions :as wallet.transactions]
[legacy.status-im.subs.wallet.wallet :as wallet]
[re-frame.db :as rf-db]
[test-helpers.unit :as h]
[utils.money :as money]
[utils.re-frame :as rf]))
(def money-zero (money/bignumber 0))
(def money-eth (money/bignumber 8000000000000000000))
(def money-snt (money/bignumber 756000000000000000000))
(def main-account-id "0x0Fbd")
(def accounts
[{:address "0x0Fbd"
:name "Main account"
:hidden false
:removed false}
{:address "0x5B03"
:name "Secondary account"
:hidden false
:removed false}])
(def wallet
{:accounts {main-account-id
{:balance {:ETH money-eth :SNT money-snt}
:transactions {}
:max-block 0}
"0x5B03"
{:balance {:ETH money-eth :SNT money-snt}
:transactions {}
:max-block 10}}})
(def prices
{:ETH {:USD 1282.23}
:SNT {:USD 0.0232}})
(def tokens
{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
{:address "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
:name "Ether"
:symbol :ETH
:decimals 18
:chainId 1}
"0x744d70fdbe2ba4cf95131626614a1763df805b9e"
{:address "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
:name "Status Network Token"
:symbol :SNT
:decimals 18
:chainId 1}})
(h/deftest-sub :balances
[sub-name]
(swap! rf-db/app-db assoc
:profile/wallet-accounts accounts
:wallet-legacy wallet)
(is (= [{:ETH money-eth
:SNT money-snt}
{:ETH money-eth
:SNT money-snt}]
(rf/sub [sub-name]))))
(h/deftest-sub :wallet-legacy/token->decimals
[sub-name]
(swap! rf-db/app-db assoc :wallet-legacy/all-tokens tokens)
(is (= {:SNT 18 :ETH 18}
(rf/sub [sub-name]))))
(deftest get-balance-total-value-test
(is (= 697.53
(wallet/get-balance-total-value
{:ETH (money/bignumber 1000000000000000000)
:SNT (money/bignumber 100000000000000000000)
:AST (money/bignumber 10000)}
{:ETH {:USD 677.91}
:SNT {:USD 0.1562}
:AST {:USD 4}}
:USD
{:ETH 18
:SNT 18
:AST 4}))))
(h/deftest-sub :portfolio-value
[sub-name]
(testing "returns fallback value when balances and prices are not available"
(is (= "..." (rf/sub [sub-name]))))
(testing "returns zero when balance is not positive"
(let [empty-wallet {:accounts {main-account-id
{:balance {:ETH money-zero
:SNT money-zero}}}}]
(swap! rf-db/app-db assoc
:profile/wallet-accounts accounts
:prices prices
:wallet-legacy empty-wallet
:wallet-legacy/all-tokens tokens)
(is (= "0" (rf/sub [sub-name])))))
(testing "returns formatted value in the default USD currency"
(swap! rf-db/app-db assoc
:profile/wallet-accounts accounts
:prices prices
:wallet-legacy wallet
:wallet-legacy/all-tokens tokens)
(is (= "20,550.76" (rf/sub [sub-name])))))
(h/deftest-sub :account-portfolio-value
[sub-name]
(testing "returns fallback value when balances and prices are not available"
(is (= "..." (rf/sub [sub-name]))))
(testing "returns zero when balance is not positive"
(let [empty-wallet {:accounts {main-account-id
{:balance {:ETH money-zero
:SNT money-zero}}}}]
(swap! rf-db/app-db assoc
:profile/wallet-accounts accounts
:prices prices
:wallet-legacy empty-wallet
:wallet-legacy/all-tokens tokens)
(is (= "0" (rf/sub [sub-name main-account-id])))))
(testing "returns formatted value in the default USD currency"
(swap! rf-db/app-db assoc
:profile/wallet-accounts accounts
:prices prices
:wallet-legacy wallet
:wallet-legacy/all-tokens tokens)
(is (= "10,275.38" (rf/sub [sub-name main-account-id])))))
(def transactions
[{:timestamp "1505912551000"}
{:timestamp "1505764322000"}
{:timestamp "1505750000000"}])
(def grouped-transactions
'({:title "20 Sep"
:key :20170920
:data
({:timestamp "1505912551000"})}
{:title "18 Sep"
:key :20170918
:data
({:timestamp "1505764322000"}
{:timestamp "1505750000000"})}))
(deftest group-transactions-by-date
(testing "Check if transactions are sorted by date"
(is (= (wallet.transactions/group-transactions-by-date transactions)
grouped-transactions))))
@@ -1,13 +1,12 @@
(ns legacy.status-im.ui.components.keyboard-avoid-presentation
(:require
[legacy.status-im.ui.components.react :as react]
[react-native.utils :as rn.utils]
[reagent.core :as reagent]))
(defn keyboard-avoiding-view
[]
(let [this (reagent/current-component)
props (reagent/props this)
children (reagent/children this)]
[& argv]
(let [[props children] (rn.utils/get-props-and-children argv)]
(reagent/as-element
(into [react/keyboard-avoiding-view
(update props
@@ -3,16 +3,16 @@
[legacy.status-im.ui.components.spacing :as spacing]
[legacy.status-im.ui.components.text :as text]
[react-native.core :as rn]
[reagent.core :as reagent]))
[react-native.utils :as rn.utils]))
(defn footer
[]
(let [this (reagent/current-component)
[& argv]
(let [[props children] (rn.utils/get-props-and-children argv)
{:keys [color]
:or {color :secondary}}
(reagent/props this)]
props]
[rn/view
{:style (merge (:base spacing/padding-horizontal)
(:small spacing/padding-vertical))}
(into [text/text {:color color}]
(reagent/children this))]))
children)]))
@@ -3,18 +3,18 @@
[legacy.status-im.ui.components.spacing :as spacing]
[legacy.status-im.ui.components.text :as text]
[react-native.core :as rn]
[reagent.core :as reagent]))
[react-native.utils :as rn.utils]))
(defn header
[]
(let [this (reagent/current-component)
[& argv]
(let [[props children] (rn.utils/get-props-and-children argv)
{:keys [color]
:or {color :secondary}}
(reagent/props this)]
props]
[rn/view
{:style (merge (:base spacing/padding-horizontal)
(:x-tiny spacing/padding-vertical))}
(into [text/text
{:color color
:style {:margin-top 10}}]
(reagent/children this))]))
children)]))
+5 -7
View File
@@ -3,7 +3,7 @@
[legacy.status-im.ui.components.colors :as colors]
[legacy.status-im.ui.components.typography :as typography]
[react-native.core :as rn]
[reagent.core :as reagent]))
[react-native.utils :as rn.utils]))
(defn text-style
[{:keys [size align weight monospace color style]}]
@@ -40,11 +40,9 @@
style))
(defn text
[]
(let [this (reagent/current-component)
props (reagent/props this)
component rn/text]
(into [component
[& argv]
(let [[props children] (rn.utils/get-props-and-children argv)]
(into [rn/text
(merge {:style (text-style props)}
(dissoc props
:style
@@ -53,4 +51,4 @@
:color
:align
:animated?))]
(reagent/children this))))
children)))
@@ -20,7 +20,8 @@
current-fleet
webview-debug
test-networks-enabled?
is-sepolia-enabled?]}]
is-goerli-enabled?
peer-syncing-enabled?]}]
(keep
identity
[{:size :small
@@ -28,7 +29,7 @@
:accessibility-label :network-button
:container-margin-top 8
:on-press
#(re-frame/dispatch [:navigate-to :network-settings])
#(re-frame/dispatch [:open-modal :network-settings])
:accessory :text
:accessory-text network-name
:chevron true}
@@ -37,13 +38,13 @@
:accessibility-label :network-button
:container-margin-top 8
:on-press
#(re-frame/dispatch [:navigate-to :network-info])
#(re-frame/dispatch [:open-modal :network-info])
:chevron true}
{:size :small
:title (i18n/label :t/log-level)
:accessibility-label :log-level-settings-button
:on-press
#(re-frame/dispatch [:navigate-to :log-level-settings])
#(re-frame/dispatch [:open-modal :log-level-settings])
:accessory :text
:accessory-text current-log-level
:chevron true}
@@ -51,7 +52,7 @@
:title (i18n/label :t/fleet)
:accessibility-label :fleet-settings-button
:on-press
#(re-frame/dispatch [:navigate-to :fleet-settings])
#(re-frame/dispatch [:open-modal :fleet-settings])
:accessory :text
:accessory-text current-fleet
:chevron true}
@@ -66,14 +67,14 @@
:accessibility-label :rpc-usage-info
:container-margin-top 8
:on-press
#(re-frame/dispatch [:navigate-to :rpc-usage-info])
#(re-frame/dispatch [:open-modal :rpc-usage-info])
:chevron true}
{:size :small
:title (i18n/label :t/peers-stats)
:accessibility-label :peers-stats
:container-margin-top 8
:on-press
#(re-frame/dispatch [:navigate-to :peers-stats])
#(re-frame/dispatch [:open-modal :peers-stats])
:chevron true}
{:size :small
:title (i18n/label :t/light-client-enabled)
@@ -112,18 +113,26 @@
:accessory :switch
:active test-networks-enabled?}
{:size :small
:title "Enable Sepolia as test network"
:title "Enable Goerli as test network"
:accessibility-label :enable-sepolia-as-test-network
:container-margin-bottom 8
:on-press
#(re-frame/dispatch [:profile.settings/toggle-sepolia-test-network])
#(re-frame/dispatch [:profile.settings/toggle-goerli-test-network])
:accessory :switch
:active is-sepolia-enabled?}
:active is-goerli-enabled?}
{:size :small
:title "Peer syncing"
:accessibility-label :peer-syncing
:container-margin-bottom 8
:on-press
#(re-frame/dispatch [:profile.settings/toggle-peer-syncing])
:accessory :switch
:active peer-syncing-enabled?}
{:size :small
:title (i18n/label :t/set-currency)
:accessibility-label :wallet-change-currency
:on-press #(hide-sheet-and-dispatch
[:navigate-to :currency-settings])
[:open-modal :currency-settings])
:chevron true}]))
(defn- flat-list-data
@@ -139,13 +148,14 @@
(views/defview advanced-settings
[]
(views/letsubs [test-networks-enabled? [:profile/test-networks-enabled?]
is-sepolia-enabled? [:profile/is-sepolia-enabled?]
is-goerli-enabled? [:profile/is-goerli-enabled?]
light-client-enabled? [:profile/light-client-enabled?]
webview-debug [:profile/webview-debug]
network-name [:network-name]
transactions-management-enabled? [:wallet-legacy/transactions-management-enabled?]
current-log-level [:log-level/current-log-level]
current-fleet [:fleets/current-fleet]]
current-fleet [:fleets/current-fleet]
peer-syncing-enabled? [:profile/peer-syncing-enabled?]]
[list/flat-list
{:data (flat-list-data
{:network-name network-name
@@ -156,6 +166,7 @@
:dev-mode? false
:webview-debug webview-debug
:test-networks-enabled? test-networks-enabled?
:is-sepolia-enabled? is-sepolia-enabled?})
:is-goerli-enabled? is-goerli-enabled?
:peer-syncing-enabled? peer-syncing-enabled?})
:key-fn (fn [_ i] (str i))
:render-fn render-item}]))
@@ -11,7 +11,6 @@
[legacy.status-im.ui.screens.browser.accounts :as accounts]
[legacy.status-im.ui.screens.browser.empty-tab.styles :as styles]
[legacy.status-im.ui.screens.browser.views :as browser]
[legacy.status-im.ui.screens.wallet.components.views :as components]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[utils.i18n :as i18n]
@@ -144,7 +143,7 @@
:container-style styles/input-container-style
:accessibility-label :dapp-url-input
:return-key-type :go}]
[components/separator-dark]
[react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]
[list/flat-list
{:header [list-header (empty? bookmarks)]
:data bookmarks
@@ -8,7 +8,6 @@
[legacy.status-im.ui.components.icons.icons :as icons]
[legacy.status-im.ui.components.list.item :as list.item]
[legacy.status-im.ui.components.react :as react]
[legacy.status-im.ui.screens.wallet.components.views :as components]
[legacy.status-im.utils.utils :as utils]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
@@ -32,7 +31,7 @@
:subtitle (utils/get-shortened-checksum-address (:address account))
:accessory [icons/icon :main-icons/check {:color colors/gray}]}]
[react/view {:padding-vertical 8}
[components/separator]]
[react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]]
[list.item/list-item
{:theme :negative
:title (i18n/label :t/revoke-access)
@@ -86,7 +85,7 @@
(js/setTimeout
#(browser/share-link url)
200))}]
[components/separator]])
[react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]])
(if connected?
[list.item/list-item
{:icon [chat-icon/custom-icon-view-list (:name account) (:color account)]
@@ -8,7 +8,6 @@
[legacy.status-im.ui.components.plus-button :as components.plus-button]
[legacy.status-im.ui.components.react :as react]
[legacy.status-im.ui.components.topbar :as topbar]
[legacy.status-im.ui.screens.wallet.components.views :as components]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[utils.i18n :as i18n]
@@ -67,7 +66,7 @@
:on-press #(do (re-frame/dispatch [:browser.ui/clear-all-browsers-pressed])
(re-frame/dispatch [:browser.ui/open-empty-tab]))}]
:title (i18n/label :t/tabs)}]
[components/separator-dark]
[react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]
[list/flat-list
{:data (conj browsers
{:empty-tab true
@@ -16,7 +16,6 @@
[legacy.status-im.ui.screens.browser.permissions.views :as permissions.views]
[legacy.status-im.ui.screens.browser.site-blocked.views :as site-blocked.views]
[legacy.status-im.ui.screens.browser.styles :as styles]
[legacy.status-im.ui.screens.wallet.components.views :as components]
[legacy.status-im.utils.js-resources :as js-res]
[re-frame.core :as re-frame]
[react-native.permissions :as components.permissions]
@@ -258,7 +257,7 @@
url-original (browser/get-current-url current-browser)]
[react/view {:style styles/browser}
[toolbar-content url url-original secure? url-editing? unsafe?]
[components/separator-dark]
[react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]
[react/view
(when loading?
[connectivity/loading-indicator-anim window-width])]
@@ -16,7 +16,6 @@
[legacy.status-im.ui.components.topbar :as topbar]
[legacy.status-im.ui.screens.chat.utils :as chat.utils]
[legacy.status-im.ui.screens.profile.components.views :as profile.components]
[legacy.status-im.ui.screens.wallet.send.sheets :as sheets]
[legacy.status-im.utils.utils :as utils]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
@@ -292,9 +291,7 @@
:title (:name account)
:subtitle (utils/get-shortened-checksum-address (:address account))
:chevron true
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
{:content (fn [] [sheets/accounts-list :from
::ens/change-address])}])}]))
:on-press #(js/alert "funcitonality no longer supported")}]))
(defn- registration
[checked contract address public-key]
@@ -8,24 +8,6 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn local-notifications
[]
(let [{:keys [enabled?]} (rf/sub [:push-notifications/wallet-transactions])
{:keys [notifications-enabled?]} (rf/sub [:profile/profile])]
[:<>
[quo/separator
{:color (:ui-02 @colors/theme)
:style {:margin-vertical 8}}]
[quo/list-header (i18n/label :t/local-notifications)]
[list.item/list-item
{:size :small
:title (i18n/label :t/notifications-transactions)
:accessibility-label :notifications-button
:active (and notifications-enabled? enabled?)
:on-press #(rf/dispatch [:push-notifications.wallet/switch-transactions
(not enabled?)])
:accessory :switch}]]))
(defn notifications-settings-ios
[]
(let [{:keys [notifications-enabled?
@@ -63,8 +45,7 @@
:on-press #(rf/dispatch
[:push-notifications/switch-block-mentions
(not push-notifications-block-mentions?)])
:accessory :switch}]
[local-notifications]]))
:accessory :switch}]]))
(defn notifications-settings-android
[]
@@ -76,8 +57,7 @@
:subtitle (i18n/label :t/local-notifications-subtitle)
:active notifications-enabled?
:on-press #(rf/dispatch [:push-notifications/switch (not notifications-enabled?)])
:accessory :switch}]
[local-notifications]]))
:accessory :switch}]]))
(defn notifications-settings
[]
@@ -9,8 +9,6 @@
[legacy.status-im.ui.screens.reset-password.views :as reset-password.views]
[legacy.status-im.ui.screens.signing.sheets :as signing-sheets]
[legacy.status-im.ui.screens.signing.views :as signing]
[legacy.status-im.ui.screens.wallet.request.views :as request]
[legacy.status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[re-frame.core :as re-frame]
[react-native.platform :as platform]
[reagent.core :as reagent]))
@@ -131,12 +129,6 @@
(vector? view)
view
(= :signing-phrase view)
[signing-phrase/signing-phrase]
(= :share-account view)
[request/share-address]
(= :share-chat-key view)
[profile.user/share-chat-key]
@@ -102,7 +102,7 @@
:chevron true
:icon :main-icons/username}
registrar
(assoc :on-press #(re-frame/dispatch [:navigate-to :ens-main registrar])))]
(assoc :on-press #(re-frame/dispatch [:open-modal :ens-main registrar])))]
[list.item/list-item
{:title (i18n/label :t/contacts)
:icon :main-icons/in-contacts
@@ -112,7 +112,7 @@
(str active-contacts-count)
(i18n/label :t/none))
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :contacts-list])}]
:on-press #(re-frame/dispatch [:open-modal :contacts-list])}]
[react/view {:padding-top 16}
[quo/list-header (i18n/label :t/settings)]]
[list.item/list-item
@@ -122,71 +122,71 @@
:chevron true
:accessory (when mnemonic
[components.common/counter {:size 22} 1])
:on-press #(re-frame/dispatch [:navigate-to :privacy-and-security])}]
:on-press #(re-frame/dispatch [:open-modal :privacy-and-security])}]
(when config/quo-preview-enabled?
[list.item/list-item
{:icon :main-icons/appearance
:title "Quo Preview"
:accessibility-label :appearance-settings-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :quo-preview])}])
:on-press #(re-frame/dispatch [:open-modal :quo-preview])}])
(when config/quo-preview-enabled?
[list.item/list-item
{:icon :main-icons/appearance
:title "Status IM Components"
:accessibility-label :status-im-common-components
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :status-im-preview])}])
:on-press #(re-frame/dispatch [:open-modal :status-im-preview])}])
[list.item/list-item
{:icon :main-icons/appearance
:title (i18n/label :t/appearance)
:accessibility-label :appearance-settings-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :appearance])}]
:on-press #(re-frame/dispatch [:open-modal :appearance])}]
[list.item/list-item
{:icon :main-icons/notification
:title (i18n/label :t/notifications)
:accessibility-label :notifications-settings-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :notifications])}]
:on-press #(re-frame/dispatch [:open-modal :notifications])}]
[list.item/list-item
{:icon :main-icons/mobile
:title (i18n/label :t/sync-settings)
:accessibility-label :sync-settings-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :sync-settings])}]
:on-press #(re-frame/dispatch [:open-modal :sync-settings])}]
(when keycard-pairing
[list.item/list-item
{:icon :main-icons/keycard
:title (i18n/label :t/keycard)
:accessibility-label :keycard-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :keycard-settings])}])
:on-press #(re-frame/dispatch [:open-modal :keycard-settings])}])
[list.item/list-item
{:icon :main-icons/settings-advanced
:title (i18n/label :t/advanced)
:accessibility-label :advanced-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :advanced-settings])}]
:on-press #(re-frame/dispatch [:open-modal :advanced-settings])}]
[list.item/list-item
{:icon :main-icons/help
:title (i18n/label :t/need-help)
:accessibility-label :help-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :help-center])}]
:on-press #(re-frame/dispatch [:open-modal :help-center])}]
[list.item/list-item
{:icon :main-icons/info
:title (i18n/label :t/about-app)
:accessibility-label :about-button
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :about-app])}]
:on-press #(re-frame/dispatch [:open-modal :about-app])}]
(when local-pairing-mode-enabled?
[list.item/list-item
{:icon :i/mobile
:title (i18n/label :t/syncing)
:accessibility-label :syncing
:chevron true
:on-press #(re-frame/dispatch [:navigate-to :settings-syncing])}])
:on-press #(re-frame/dispatch [:open-modal :settings-syncing])}])
[react/view {:padding-vertical 24}
[list.item/list-item
{:icon :main-icons/log-out
@@ -49,19 +49,6 @@
[legacy.status-im.ui.screens.sync-settings.views :as sync-settings]
[legacy.status-im.ui.screens.wakuv2-settings.edit-node.views :as edit-wakuv2-node]
[legacy.status-im.ui.screens.wakuv2-settings.views :as wakuv2-settings]
[legacy.status-im.ui.screens.wallet.account-settings.views :as account-settings]
[legacy.status-im.ui.screens.wallet.account.views :as wallet.account]
[legacy.status-im.ui.screens.wallet.accounts-manage.views :as accounts-manage]
[legacy.status-im.ui.screens.wallet.accounts.views :as wallet.accounts]
[legacy.status-im.ui.screens.wallet.add-new.views :as add-account]
[legacy.status-im.ui.screens.wallet.buy-crypto.views :as wallet.buy-crypto]
[legacy.status-im.ui.screens.wallet.collectibles.views :as wallet.collectibles]
[legacy.status-im.ui.screens.wallet.custom-tokens.views :as custom-tokens]
[legacy.status-im.ui.screens.wallet.recipient.views :as recipient]
[legacy.status-im.ui.screens.wallet.send.views :as wallet.send]
[legacy.status-im.ui.screens.wallet.settings.views :as wallet-settings]
[legacy.status-im.ui.screens.wallet.swap.views :as wallet.swap]
[legacy.status-im.ui.screens.wallet.transactions.views :as wallet-transactions]
[status-im.contexts.chat.group-details.view :as group-details]
[utils.i18n :as i18n]))
@@ -106,86 +93,11 @@
;;TODO custom subtitle
:component group-chat/new-group}
;;WALLET
{:name :wallet-legacy
:on-focus [:wallet-legacy/tab-opened]
;;TODO wallet redesign
;;:options {:statusBar {:backgroundColor quo.colors/neutral-5}}
:component wallet.accounts/accounts-overview-old}
{:name :wallet-account
;;TODO dynamic titleaccounts-overview
:options {:insets {:top? true}}
:component wallet.account/account}
{:name :add-new-account
;;TODO dynamic title
:options {:insets {:top? true :bottom? true}}
:component add-account/add-account-view}
{:name :add-new-account-pin
;;TODO dynamic title
:options {:insets {:top? true}}
:component add-account/pin}
{:name :account-settings
;;TODO dynamic title
:options {:insets {:top? true}}
:component account-settings/account-settings}
{:name :wallet-transaction-details
;;TODO dynamic title
:options {:insets {:top? true}}
:component wallet-transactions/transaction-details}
{:name :wallet-settings-assets
;;TODO dynamic title
:options {:insets {:top? true}}
:component wallet-settings/manage-assets}
{:name :wallet-add-custom-token
:on-focus [:wallet-legacy/wallet-add-custom-token]
:options {:topBar {:title {:text (i18n/label :t/add-custom-token)}}
:insets {:top? true}}
:component custom-tokens/add-custom-token}
{:name :wallet-custom-token-details
;;TODO dynamic title
:options {:insets {:top? true}}
:component custom-tokens/custom-token-details}
{:name :currency-settings
:options {:topBar {:title {:text (i18n/label :t/main-currency)}}
:insets {:top? true}}
:component currency-settings/currency-settings}
{:name :manage-accounts
:options {:topBar {:title {:text (i18n/label :t/wallet-manage-accounts)}}
:insets {:top? true}}
:component accounts-manage/manage}
{:name :token-swap
;;TODO dynamic title
:options {:insets {:top? true}}
:component wallet.swap/swap}
{:name :token-swap-advanced-nonce
:options {:topBar {:title {:text (i18n/label :t/nonce)}}
:insets {:top? true}}
:component wallet.swap/nonce-modal}
{:name :token-swap-advanced-approve-token
:options {:topBar {:title {:text (i18n/label :t/approve-token)}}
:insets {:top? true}}
:component wallet.swap/approve-token-modal}
{:name :token-swap-advanced-transaction-fee
:options {:topBar {:title {:text (i18n/label :t/transaction-fee)}}
:insets {:top? true}}
:component wallet.swap/transaction-fee-modal}
{:name :token-swap-advanced-swap-details
:options {:topBar {:title {:text (i18n/label :t/swap-details)}}
:insets {:top? true}}
:component wallet.swap/swap-details-modal}
{:name :swap-asset-selector
;;TODO dynamic title
:options {:insets {:top? true}}
:component wallet.swap/asset-selector}
;;PROFILE
{:name :my-profile
@@ -404,20 +316,6 @@
:top? true}}
:component communities.invite/legacy-invite}
;[Wallet] Recipient
{:name :recipient
;;TODO accessories
:options {:insets {:bottom? true
:top? true}}
:component recipient/recipient}
;[Wallet] New favourite
{:name :new-favourite
:options {:topBar {:title {:text (i18n/label :t/new-favourite)}}
:insets {:bottom? true
:top? true}}
:component recipient/new-favourite}
;QR Scanner
{:name :qr-scanner
;;TODO custom topbar
@@ -438,44 +336,6 @@
:top? true}}
:component notifications-settings/notifications-settings}
;[Wallet] Prepare Transaction
{:name :prepare-send-transaction
:on-dissmiss [:wallet-legacy/cancel-transaction-command]
:options {:topBar {:title {:text (i18n/label :t/send-transaction)}}
:swipeToDismiss false
:hardwareBackButton {:dismissModalOnPress false}
:insets {:bottom? true
:top? true}}
:component wallet.send/prepare-send-transaction}
;[Wallet] Request Transaction
{:name :request-transaction
:on-dissmiss [:wallet-legacy/cancel-transaction-command]
:options {:topBar {:title {:text (i18n/label :t/request-transaction)}}
:swipeToDismiss false
:hardwareBackButton {:dismissModalOnPress false}
:insets {:bottom? true
:top? true}}
:component wallet.send/request-transaction}
;[Wallet] Buy crypto
{:name :buy-crypto
:insets {:bottom? true}
:component wallet.buy-crypto/container}
;[Wallet] Buy crypto website
{:name :buy-crypto-website
;;TODO subtitle
:options {:insets {:bottom? true
:top? true}}
:component wallet.buy-crypto/website}
{:name :nft-details
;;TODO dynamic title
:options {:insets {:bottom? true
:top? true}}
:component wallet.collectibles/nft-details-modal}
;[Browser] New bookmark
{:name :new-bookmark
;;TODO dynamic title
@@ -2,7 +2,6 @@
(:require-macros [legacy.status-im.utils.views :as views])
(:require
[clojure.string :as string]
[legacy.status-im.ethereum.tokens :as tokens]
[legacy.status-im.react-native.resources :as resources]
[legacy.status-im.signing.eip1559 :as eip1559]
[legacy.status-im.ui.components.bottom-panel.views :as bottom-panel]
@@ -15,10 +14,8 @@
[legacy.status-im.ui.components.react :as react]
[legacy.status-im.ui.screens.signing.sheets :as sheets]
[legacy.status-im.ui.screens.signing.styles :as styles]
[legacy.status-im.ui.screens.wallet.components.views :as wallet.components]
[legacy.status-im.utils.deprecated-types :as types]
[legacy.status-im.utils.utils :as utils]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.contexts.profile.utils :as profile.utils]
@@ -57,11 +54,7 @@
:style {:margin-right 8}}
display-symbol]
(if icon
[wallet.components/token-icon
(assoc icon
:style {:background-color colors/gray-lighter
:border-radius 16}
:image-style {:width 24 :height 24})]
[react/view]
[chat-icon/custom-icon-view-list (:name token) color 32])]}]
[separator]]))
@@ -328,7 +321,6 @@
[{:keys [from contact amount token cancel?] :as tx}]
(views/letsubs [fee [:signing/fee]
sign [:signing/sign]
chain [:current-network]
{:keys [amount-error gas-error gas-error-state insufficient-balalce?]}
[:signing/amount-errors (:address from)]
keycard-multiaccount? [:keycard-multiaccount?]
@@ -337,8 +329,8 @@
mainnet? [:mainnet?]
prices-loading? [:prices-loading?]
management-enabled? [:wallet-legacy/transactions-management-enabled?]]
(let [display-symbol (wallet.utils/display-symbol token)
fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))]
(let [display-symbol nil
fee-display-symbol nil]
[react/view (styles/sheet)
[header sign tx display-symbol fee fee-display-symbol]
[separator]
@@ -38,7 +38,7 @@
(or owned free)
(re-frame/dispatch [:stickers/install-pack id])
not-enough-snt? nil
:else (re-frame/dispatch [:stickers/buy-pack id]))}
:else (fn [] (js/alert "feature no longer supported")))}
[react/view (styles/price-badge (and (not (or owned free)) not-enough-snt?))
(when (and (not free) (not owned))
[icons/tiny-icon :tiny-icons/tiny-snt
@@ -1,68 +0,0 @@
(ns legacy.status-im.ui.screens.wallet.account.styles
(:require
[clojure.string :as string]
[legacy.status-im.ui.components.animation :as animation]
[legacy.status-im.ui.components.colors :as colors]))
(defn card
[window-width color]
{:width (- window-width 30)
:height 161
:background-color (if (string/blank? color)
colors/blue
color)
:shadow-offset {:width 0 :height 2}
:shadow-radius 8
:shadow-opacity 1
:shadow-color (if (colors/dark?)
"rgba(0, 0, 0, 0.75)"
"rgba(0, 9, 26, 0.12)")
:elevation 2
:border-radius 8
:justify-content :space-between})
(defn divider
[]
{:height 52
:width 1
:background-color colors/black-transparent-20
:shadow-offset {:width 0 :height 2}
:shadow-radius 8
:shadow-opacity 1
:shadow-color (if (colors/dark?)
"rgba(0, 0, 0, 0.75)"
"rgba(0, 9, 26, 0.12)")})
(defn bottom-send-recv-buttons-raise
[anim-y]
(animation/timing
anim-y
{:toValue 0
:duration 200
:easing (.-ease ^js animation/easing)
:useNativeDriver true}))
(defn bottom-send-recv-buttons-lower
[anim-y y]
(animation/timing
anim-y
{:toValue y
:duration 200
:easing (.-ease ^js animation/easing)
:useNativeDriver true}))
(def round-action-button
{:background-color colors/blue
:height 44
:flex 1
:justify-content :center
:align-items :center
:width 44
:border-radius 44})
(def top-actions
{:flex 1
:flex-direction :row
:justify-content :space-between
:width "60%"
:align-self :center})
@@ -1,363 +0,0 @@
(ns legacy.status-im.ui.screens.wallet.account.views
(:require
[legacy.status-im.ui.components.animation :as animation]
[legacy.status-im.ui.components.colors :as colors]
[legacy.status-im.ui.components.core :as components.core]
[legacy.status-im.ui.components.icons.icons :as icons]
[legacy.status-im.ui.components.react :as react]
[legacy.status-im.ui.components.spacing :as spacing]
[legacy.status-im.ui.components.tabs :as tabs]
[legacy.status-im.ui.components.topbar :as topbar]
[legacy.status-im.ui.screens.wallet.account.styles :as styles]
[legacy.status-im.ui.screens.wallet.accounts.common :as common]
[legacy.status-im.ui.screens.wallet.accounts.sheets :as sheets]
[legacy.status-im.ui.screens.wallet.buy-crypto.views :as buy-crypto]
[legacy.status-im.ui.screens.wallet.collectibles.views :as collectibles.views]
[legacy.status-im.ui.screens.wallet.transactions.views :as history]
[quo.core :as quo]
[quo.foundations.colors :as quo.colors]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.config :as config]
[utils.address :as address]
[utils.i18n :as i18n]
[utils.re-frame :as rf])
(:require-macros [legacy.status-im.utils.views :as views]))
(def state (reagent/atom {:tab :assets}))
(def selected-tab (reagent/atom :tokens))
(defn button
[label icon color handler]
[react/touchable-highlight {:on-press handler :style {:flex 1}}
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/view {:flex-direction :row :align-items :center}
[icons/icon icon {:color color}]
[react/text {:style {:margin-left 8 :color color}} label]]]])
(def button-group-height 52)
(views/defview account-card
[{:keys [address color type] :as account}]
(views/letsubs [currency [:wallet-legacy/currency]
portfolio-value [:account-portfolio-value address]
window-width [:dimensions/window-width]
prices-loading? [:prices-loading?]]
[react/view {:style (styles/card window-width color)}
[react/view {:padding 16 :padding-bottom 12 :flex 1 :justify-content :space-between}
[react/view {:style {:flex-direction :row}}
(if prices-loading?
[react/small-loading-indicator :colors/white-persist]
[react/text {:style {:font-size 32 :color colors/white-persist :font-weight "600"}}
portfolio-value])
[react/text {:style {:font-size 32 :color colors/white-transparent-persist :font-weight "600"}}
(str " " (:code currency))]]
[components.core/text
{:number-of-lines 1
:ellipsize-mode :middle
:monospace true
:size :small
:style {:width (/ window-width 3)
:line-height 22
:color colors/white-transparent-70-persist}}
(address/normalized-hex address)]]
[react/view {:position :absolute :top 12 :right 12}
[react/touchable-highlight {:on-press #(re-frame/dispatch [:wallet-legacy/share-popover address])}
[icons/icon :main-icons/share
{:color colors/white-persist
:accessibility-label :share-wallet-address-icon}]]]
[react/view
{:height button-group-height
:background-color colors/black-transparent-20
:border-bottom-right-radius 8
:border-bottom-left-radius 8
:flex-direction :row}
(if (= type :watch)
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/text {:style {:margin-left 8 :color colors/white-persist}}
(i18n/label :t/watch-only)]]
[button
(i18n/label :t/wallet-send)
:main-icons/send
colors/white-persist
#(re-frame/dispatch [:wallet-legacy/prepare-transaction-from-wallet account])])
[react/view {:style (styles/divider)}]
[button
(i18n/label :t/receive)
:main-icons/receive
colors/white-persist
#(re-frame/dispatch [:wallet-legacy/share-popover address])]]]))
(views/defview transactions
[address]
(views/letsubs [data [:wallet-legacy.transactions.history/screen address]]
[history/history-list data address]))
(defn opensea-link
[address]
[react/touchable-highlight
{:on-press #(re-frame/dispatch [:browser.ui/open-url (str "https://opensea.io/" address)])}
[react/view
{:style {:flex 1
:padding-horizontal 14
:flex-direction :row
:align-items :center
:background-color colors/blue-light
:height 52}}
[icons/tiny-icon
:tiny-icons/tiny-external
{:color colors/blue
:container-style {:margin-right 5}}]
[react/text
{:style {:color colors/blue}}
(i18n/label :t/check-on-opensea)]]])
(views/defview assets-and-collections-new
[address]
(views/letsubs [{:keys [tokens]} [:wallet-legacy/visible-assets-with-values address]
currency [:wallet-legacy/currency]
opensea-enabled? [:opensea-enabled?]
collectible-collection [:wallet-legacy/collectible-collection address]]
;ethereum-network? [:ethereum-network?]]
(let [tab @selected-tab]
[react/view {:flex 1}
[react/view {:padding-horizontal 20 :padding-bottom 20}
[quo/tabs
{:size 24
:on-change #(reset! selected-tab %)
:default-active :tokens
:data [{:id :tokens :label "Tokens"}
{:id :nft :label "NFTs"}
{:id :activity :label "Activity"}]}]]
(cond
(= tab :tokens)
[react/scroll-view
(for [item tokens]
^{:key (:name item)}
[common/render-asset-new item nil nil (:code currency)])]
(= tab :nft)
[:<>
[opensea-link address]
;; Hide collectibles behind a feature flag
(when config/collectibles-enabled?
(cond
(not opensea-enabled?)
[collectibles.views/enable-opensea-view]
(and opensea-enabled? (seq collectible-collection))
[collectibles.views/nft-collections address]
:else
[react/view {:align-items :center :margin-top 32}
[react/text {:style {:color colors/gray}}
(i18n/label :t/no-collectibles)]]))]
(= tab :activity)
[transactions address])])))
(views/defview bottom-send-recv-buttons
[{:keys [address type] :as account} anim-y]
[react/animated-view
{:style {:background-color colors/white
:bottom 0
:flex-direction :row
:height button-group-height
:position :absolute
:shadow-offset {:width 0 :height 1}
:shadow-opacity 0.75
:shadow-radius 1
:transform [{:translateY anim-y}]
:width "100%"}}
(if (= type :watch)
[react/view {:flex 1 :align-items :center :justify-content :center}
[react/text {:style {:margin-left 8 :color colors/blue-persist}}
(i18n/label :t/watch-only)]]
[button
(i18n/label :t/wallet-send)
:main-icons/send
colors/blue-persist
#(re-frame/dispatch [:wallet-legacy/prepare-transaction-from-wallet account])])
[button
(i18n/label :t/receive)
:main-icons/receive
colors/blue-persist
#(re-frame/dispatch [:wallet-legacy/share-popover address])]])
(defn anim-listener
[anim-y scroll-y]
(let [to-show (atom false)]
(animation/add-listener
scroll-y
(fn [anim]
(let [y-trigger 149]
(cond
(and (>= (.-value anim) y-trigger) (not @to-show))
(animation/start
(styles/bottom-send-recv-buttons-raise anim-y)
#(reset! to-show true))
(and (< (.-value anim) y-trigger) @to-show)
(animation/start
(styles/bottom-send-recv-buttons-lower anim-y button-group-height)
#(reset! to-show false))))))))
(defn round-action-button
[{:keys [icon title on-press]}]
[react/view
{:style {:flex 1
:align-items :center
:margin-vertical (:large spacing/spacing)}}
[react/touchable-opacity
{:style styles/round-action-button
:on-press on-press}
(icons/icon icon {:color colors/white})]
[components.core/text
{:color :secondary
:size :small
:style {:margin-top (:tiny spacing/spacing)}}
title]])
(defn top-actions
[]
[react/view {:style styles/top-actions}
[round-action-button
{:icon :main-icons/add
:title (i18n/label :t/buy-crypto)
:on-press #(re-frame/dispatch [:buy-crypto.ui/open-screen])}]
[round-action-button
{:icon :main-icons/change
:title (i18n/label :t/swap)
:on-press #(re-frame/dispatch [:open-modal :token-swap])}]])
(views/defview assets-and-collections
[address]
(views/letsubs [{:keys [tokens]} [:wallet-legacy/visible-assets-with-values address]
currency [:wallet-legacy/currency]
opensea-enabled? [:opensea-enabled?]
collectible-collection [:wallet-legacy/collectible-collection address]
ethereum-network? [:ethereum-network?]]
(let [{:keys [tab]} @state]
[react/view {:flex 1}
[react/view {:flex-direction :row :margin-bottom 8 :padding-horizontal 4}
[tabs/tab-title state :assets (i18n/label :t/wallet-assets) (= tab :assets)]
(when ethereum-network?
[tabs/tab-title state :nft (i18n/label :t/wallet-collectibles) (= tab :nft)])
[tabs/tab-title state :history (i18n/label :t/history) (= tab :history)]]
[quo/separator {:style {:margin-top -8}}]
(cond
(= tab :assets)
[:<>
(for [item tokens]
^{:key (:name item)}
[common/render-asset item nil nil (:code currency)])]
(= tab :nft)
[:<>
[opensea-link address]
;; Hide collectibles behind a feature flag
(when config/collectibles-enabled?
(cond
(not opensea-enabled?)
[collectibles.views/enable-opensea-view]
(and opensea-enabled? (seq collectible-collection))
[collectibles.views/nft-collections address]
:else
[react/view {:align-items :center :margin-top 32}
[react/text {:style {:color colors/gray}}
(i18n/label :t/no-collectibles)]]))]
(= tab :history)
[transactions address])])))
(defn account-new
[selected-account]
(let [;{:keys [name address] :as account} (rf/sub [:account-by-address selected-account])
currency (rf/sub [:wallet-legacy/currency])
portfolio-value (rf/sub [:account-portfolio-value selected-account])
width (rf/sub [:dimensions/window-width])
button-width (/ (- width 40 (* 2 12)) 3)]
;fetching-error (rf/sub [:wallet-legacy/fetching-error])]
[react/view
{:flex 1
:background-color (quo.colors/theme-colors quo.colors/white quo.colors/neutral-90)
:border-top-left-radius 20
:border-top-right-radius 20
:elevation 4
:shadow-opacity 1
:shadow-radius 20
:shadow-color (:shadow-01 @colors/theme)
:shadow-offset {:width 0 :height 4}}
[react/view {:padding 20}
[quo/text {:size :heading-2 :weight :semi-bold} (str portfolio-value " " (:code currency))]]
[react/view
[react/scroll-view {:horizontal true :margin-bottom 32 :showsHorizontalScrollIndicator false}
[react/view {:width 20}]
[quo/button {:size 56 :width button-width :above :i/placeholder} "Buy"]
[react/view {:width 12}]
[quo/button {:size 56 :width button-width :type :secondary :above :i/placeholder} "Send"]
[react/view {:width 12}]
[quo/button {:size 56 :width button-width :type :secondary :above :i/placeholder}
"Receive"]
[react/view {:width 12}]
[quo/button {:size 56 :width button-width :type :secondary :above :i/placeholder} "Swap"]
[react/view {:width 20}]]]
[assets-and-collections-new selected-account]]))
(views/defview account
[]
(views/letsubs [{:keys [name address] :as current-account} [:multiaccount/current-account]
fetching-error [:wallet-legacy/fetching-error]]
(let [anim-y (animation/create-value button-group-height)
scroll-y (animation/create-value 0)]
(anim-listener anim-y scroll-y)
[:<>
[topbar/topbar
{:title name
:right-accessories
[{:icon :main-icons/more
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
{:content sheets/account-settings
:content-height 60}])}]}]
[react/animated-scroll-view
{:contentContainerStyle {:padding-bottom button-group-height}
:on-scroll (animation/event
[{:nativeEvent {:contentOffset {:y scroll-y}}}]
{:useNativeDriver true})
:scrollEventThrottle 1
:refreshControl (common/refresh-control
(and
@common/updates-counter
@(re-frame/subscribe [:wallet-legacy/refreshing-history?])))}
(when fetching-error
[react/view
{:style {:flex 1
:align-items :center
:margin 8}}
[icons/icon
:main-icons/warning
{:color :red
:container-style {:background-color (colors/get-color :negative-02)
:height 40
:width 40
:border-radius 20
:align-items :center
:justify-content :center}}]
[react/view
{:style {:justify-content :center
:align-items :center
:margin-top 8
:margin-horizontal 67.5
:text-align :center}}
[components.core/text
{:color :secondary
:size :small
:style {:text-align :center}}
(i18n/label :t/transfers-fetching-failure)]]])
[react/view {:padding-left 16}
[react/scroll-view {:horizontal true}
[react/view {:flex-direction :row :padding-top 8 :padding-bottom 12}
[account-card current-account]]]]
(if config/swap-enabled?
[top-actions]
[buy-crypto/banner])
[assets-and-collections address]]
[bottom-send-recv-buttons current-account anim-y]])))

Some files were not shown because too many files have changed in this diff Show More