Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: pass OPENSEA_API_KEY via saveAccountAndLogin #13761

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

jakubgs
Copy link
Member

@jakubgs jakubgs commented Aug 4, 2022

Here the injection of OpenSea API key was done at compile time: aa72ac57

But this makes status-go builds impure, and also prevents them from being extracted from status-mobile into status-go repo.

Instead we pass the OPENSEA_API_KEY env variable to JS bundle at build time, which is then passed to status-go via the Statusgo.saveAccountAndLogin call in saveAccountAndLogin:

public void saveAccountAndLogin(final String multiaccountData, final String password, final String settings, final String config, final String accountsData) {
try {
Log.d(TAG, "saveAccountAndLogin");
String finalConfig = prepareDirAndUpdateConfig(config, this.getKeyUID(multiaccountData));
String result = Statusgo.saveAccountAndLogin(multiaccountData, password, settings, finalConfig, accountsData);

Which sends NodeConfig that also contains WalletConfig which can include OpenseaAPIKey:

type WalletConfig struct {
    Enabled       bool
    OpenseaAPIKey string `json:"OpenseaAPIKey"`
}

https://github.com/status-im/status-go/blob/0135cc15/params/config.go#L510-L514

@jakubgs jakubgs self-assigned this Aug 4, 2022
@status-github-bot status-github-bot bot added this to REVIEW in Pipeline for QA Aug 4, 2022
@status-im-auto
Copy link
Member

status-im-auto commented Aug 4, 2022

Jenkins Builds

Click to see older builds (9)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ a52922e #1 2022-08-04 08:42:48 ~9 min android-e2e 📦apk 📲
✖️ a52922e #1 2022-08-04 08:43:02 ~9 min android 📦apk 📲
✖️ a52922e #1 2022-08-04 08:47:20 ~14 min ios 📦ipa 📲
✔️ 676102b #2 2022-08-04 09:00:51 ~8 min android 📦apk 📲
✔️ 676102b #2 2022-08-04 09:00:55 ~8 min android-e2e 📦apk 📲
✔️ 676102b #2 2022-08-04 09:04:54 ~12 min ios 📦ipa 📲
✔️ ec859f5 #3 2022-08-04 09:54:20 ~7 min android-e2e 📦apk 📲
✔️ ec859f5 #3 2022-08-04 09:54:25 ~7 min android 📦apk 📲
✔️ ec859f5 #3 2022-08-04 09:57:42 ~10 min ios 📦ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d1f79e4 #4 2022-08-04 10:14:04 ~7 min android-e2e 📦apk 📲
✔️ d1f79e4 #4 2022-08-04 10:14:10 ~7 min android 📦apk 📲
✔️ d1f79e4 #4 2022-08-04 10:18:14 ~11 min ios 📦ipa 📲
✔️ 8ec2f23 #5 2022-08-05 12:31:29 ~7 min android-e2e 📦apk 📲
✔️ 8ec2f23 #5 2022-08-05 12:31:50 ~7 min android 📦apk 📲
✔️ 8ec2f23 #5 2022-08-05 12:36:24 ~12 min ios 📦ipa 📲

@jakubgs
Copy link
Member Author

jakubgs commented Aug 4, 2022

It looks like - as @flexsurfer pointed out - it's not enough just to use the Statusgo.saveAccountAndLogin call, since that would leave already created accounts without an OpenSea key.

The correct solution appears to be using the new LoginWithConfig call:

src/status_im/utils/config.cljs Show resolved Hide resolved
src/status_im/node/core.cljs Show resolved Hide resolved
src/status_im/node/core.cljs Outdated Show resolved Hide resolved
@jakubgs jakubgs moved this from REVIEW to E2E Tests in Pipeline for QA Aug 4, 2022
@status-im-auto
Copy link
Member

97% of end-end tests have passed

Total executed tests: 87
Failed tests: 3
Passed tests: 84
IDs of failed tests: 700763,700764,702186 

Failed tests (3)

Click to expand
  • Rerun failed tests

  • Class TestSendTxDeviceMerged:

    1. test_send_tx_eth_check_logcat, id: 700763

    Device 1: ETH value is 7.922505025244562
    Device 1: Waiting 120s for ETH updated balance

    critical/wallet_and_tx/test_send_tx_dapp_keycard.py:40: in test_send_tx_eth_check_logcat self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH']) ../views/wallet_view.py:183: in wait_balance_is_changed self.driver.f

    Class: TestSendTxDeviceMerged

    Device sessions

    2. test_send_tx_token_8_decimals, id: 700764

    Device 1: YEENUS value is 99.9644223
    Device 1: Waiting 120s for YEENUS updated balance

    critical/wallet_and_tx/test_send_tx_dapp_keycard.py:54: in test_send_tx_token_8_decimals self.wallet.wait_balance_is_changed(asset, initial_balance=self.initial_balances[asset]) ../views/wallet_view.py:183: in wait_balance_is_changed self.driver.f

    Class: TestSendTxDeviceMerged

    Device sessions

    Class TestContactBlockMigrateKeycardMultipleSharedDevices:

    1. test_keycard_command_send_tx_eth_1_1_chat, id: 702186

    Device 2: Find `TransactionElement` by `xpath`: `(//android.widget.TextView[contains(@text,'0.0004112027 ETH')])`
    Device 1: Wait for text element `TransactionStatus` to be equal to `Confirmed`

    critical/chats/test_1_1_public_chats.py:704: in test_keycard_command_send_tx_eth_1_1_chat sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120) ../views/base_element.py:152: in wait_for_element_text self.driver.fai

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    Passed tests (84)

    Click to expand

    Class TestPairingSyncMultipleDevicesMerged:

    1. test_pairing_sync_clear_history, id: 702394

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    2. test_pairing_sync_contacts_block_unblock, id: 702196

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    3. test_pairing_sync_initial_profile_picture, id: 702392

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    4. test_pairing_sync_initial_bookmarks, id: 702393

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    5. test_pairing_sync_initial_contacts_blocked_users, id: 702194

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    6. test_pairing_sync_1_1_chat_message, id: 702198

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    7. test_pairing_sync_public_chat_add_remove, id: 702199

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    8. test_pairing_sync_initial_public_chats, id: 702195

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    9. test_pairing_sync_contacts_add_remove_set_nickname_ens, id: 702197

    Class: TestPairingSyncMultipleDevicesMerged

    Device sessions

    Class TestWalletManagementDeviceMerged:

    1. test_wallet_manage_assets, id: 700758

    Class: TestWalletManagementDeviceMerged

    Device sessions

    2. test_wallet_add_account_seed_phrase_validation, id: 700762

    Class: TestWalletManagementDeviceMerged

    Device sessions

    3. test_wallet_add_hide_unhide_account_private_key, id: 700761

    Class: TestWalletManagementDeviceMerged

    Device sessions

    4. test_wallet_add_delete_watch_only_account, id: 700760

    Class: TestWalletManagementDeviceMerged

    Device sessions

    5. test_wallet_fetching_balance_after_offline_insufficient_funds_errors, id: 700766

    Class: TestWalletManagementDeviceMerged

    Device sessions

    6. test_wallet_add_account_generate_new, id: 700759

    Class: TestWalletManagementDeviceMerged

    Device sessions

    7. test_wallet_tx_history_copy_tx_hash_on_cellular, id: 700756

    Class: TestWalletManagementDeviceMerged

    Device sessions

    Class TestCommandsMultipleDevicesMerged:

    1. test_1_1_chat_command_decline_eth_push_changing_state, id: 6265

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    2. test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline, id: 6263

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    3. test_1_1_chat_command_send_tx_eth_outgoing_tx_push, id: 6253

    Class: TestCommandsMultipleDevicesMerged

    Device sessions

    Class TestGroupChatMultipleDeviceMerged:

    1. test_group_chat_push_system_messages_when_invited, id: 3994

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    2. test_group_chat_highligted, id: 5756

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    3. test_group_chat_join_send_text_messages_push, id: 700731

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    4. test_group_chat_offline_pn, id: 3998

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    5. test_group_chat_add_new_member_activity_centre, id: 700732

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    6. test_group_chat_leave_relogin, id: 3997

    Class: TestGroupChatMultipleDeviceMerged

    Device sessions

    Class TestPublicChatBrowserOneDeviceMerged:

    1. test_public_chat_open_using_deep_link, id: 700739

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    2. test_browser_bookmarks_create_edit_remove, id: 702077

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    3. test_browser_blocked_url, id: 702072

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    4. test_browser_delete_close_tabs, id: 702076

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    5. test_browser_connection_is_secure_not_secure_warning, id: 702073

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    6. test_browser_web3_permissions_testdapp, id: 702078

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    7. test_public_chat_tag_message, id: 700738

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    8. test_public_chat_navigate_to_chat_when_relaunch, id: 5396

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    9. test_public_chat_copy_and_paste_message_in_chat_input, id: 5317

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    10. test_public_chat_fetch_more_history, id: 5675

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    11. test_browser_offline, id: 702075

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    12. test_browser_invalid_url, id: 702074

    Class: TestPublicChatBrowserOneDeviceMerged

    Device sessions

    Class TestEnsStickersMultipleDevicesMerged:

    1. test_sticker_1_1_public_chat_mainnet, id: 702157

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    2. test_ens_command_send_tx_eth_1_1_chat, id: 702153

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    3. test_ens_mention_push_highlighted_public_chat, id: 702156

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    4. test_ens_mention_nickname_1_1_chat, id: 702155

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    5. test_ens_purchased_in_profile, id: 702152

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    6. test_start_new_chat_public_key_validation, id: 702158

    Class: TestEnsStickersMultipleDevicesMerged

    Device sessions

    Class TestPublicChatMultipleDeviceMerged:

    1. test_public_chat_message_edit, id: 700734

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    2. test_public_chat_unread_messages_counter, id: 5360

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    3. test_public_chat_emoji_send_copy_paste_reply, id: 700719

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    4. test_public_chat_unread_messages_counter_for_mention_relogin, id: 700718

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    5. test_public_chat_delete_chat_long_press, id: 5319

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    6. test_public_chat_link_send_open, id: 700736

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    7. test_public_chat_mark_all_messages_as_read, id: 6270

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    8. test_public_chat_links_with_previews_github_youtube_twitter_gif_send_enable, id: 700737

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    9. test_public_chat_message_send_check_timestamps_while_on_different_tab, id: 5313

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    10. test_public_chat_message_delete, id: 700735

    Class: TestPublicChatMultipleDeviceMerged

    Device sessions

    Class TestKeycardTxOneDeviceMerged:

    1. test_keycard_relogin_after_restore, id: 700768

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    2. test_keycard_send_tx_sign_message_request_stt_testdapp, id: 700769

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    3. test_keycard_create_account_unlock_same_seed, id: 5689

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    4. test_keycard_send_tx_eth, id: 700767

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    5. test_keycard_wallet_recover_pairing_check_balance_after_offline_tx_history, id: 700770

    Class: TestKeycardTxOneDeviceMerged

    Device sessions

    Class TestRestoreOneDeviceMerged:

    1. test_restore_set_up_wallet_sign_phrase, id: 700749

    Class: TestRestoreOneDeviceMerged

    Device sessions

    2. test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_send_tx, id: 702189

    Class: TestRestoreOneDeviceMerged

    Device sessions

    3. test_restore_seed_phrase_field_validation, id: 700750

    Class: TestRestoreOneDeviceMerged

    Device sessions

    4. test_restore_uppercase_whitespaces_seed_phrase_special_char_passw_logcat, id: 700748

    Class: TestRestoreOneDeviceMerged

    Device sessions

    Class TestSendTxDeviceMerged:

    1. test_send_tx_custom_token_18_decimals_invalid_password, id: 700765

    Class: TestSendTxDeviceMerged

    Device sessions

    2. test_send_tx_set_recipient_options, id: 700757

    Class: TestSendTxDeviceMerged

    Device sessions

    3. test_send_tx_sign_message_2tx_in_batch_tx_filters_request_stt_testdapp, id: 5342

    Class: TestSendTxDeviceMerged

    Device sessions

    Class TestContactBlockMigrateKeycardMultipleSharedDevices:

    1. test_contact_block_unblock_public_chat_offline, id: 702176

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    2. test_contact_add_remove_mention_default_username_nickname_public_chat, id: 702175

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    3. test_restore_account_migrate_multiaccount_to_keycard_db_saved, id: 702177

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    4. test_cellular_settings_on_off_public_chat_fetching_history, id: 702188

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    Class TestOneToOneChatMultipleSharedDevices:

    1. test_1_1_chat_text_message_edit_delete_push_disappear, id: 695843

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    2. test_1_1_chat_message_reaction, id: 6315

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    3. test_1_1_chat_emoji_send_reply_and_open_link, id: 5373

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    4. test_1_1_chat_image_send_save_reply, id: 6305

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    5. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 5310

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    6. test_1_1_chat_text_message_with_push, id: 6316

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    7. test_1_1_chat_non_latin_message_to_newly_added_contact_with_profile_picture_on_different_networks, id: 5315

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    8. test_1_1_chat_delete_via_delete_button_relogin, id: 5387

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    9. test_1_1_chat_push_emoji, id: 6283

    Class: TestOneToOneChatMultipleSharedDevices

    Device sessions

    Class TestOnboardingOneDeviceMerged:

    1. test_onboarding_add_new_multiaccount_username_by_position_pass_validation, id: 700747

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    2. test_onboarding_home_initial_popup, id: 700742

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    3. test_onboarding_share_contact_address, id: 700743

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    4. test_onboarding_backup_seed_phrase_restore_same_login_logcat, id: 700745

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    5. test_onboarding_cant_sign_in_with_invalid_password_logcat, id: 700746

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    6. test_onboarding_share_wallet_address, id: 700744

    Class: TestOnboardingOneDeviceMerged

    Device sessions

    @status-im-auto
    Copy link
    Member

    100% of end-end tests have passed

    Total executed tests: 3
    Failed tests: 0
    Passed tests: 3
    

    Passed tests (3)

    Click to expand

    Class TestSendTxDeviceMerged:

    1. test_send_tx_eth_check_logcat, id: 700763

    Class: TestSendTxDeviceMerged

    Device sessions

    2. test_send_tx_token_8_decimals, id: 700764

    Class: TestSendTxDeviceMerged

    Device sessions

    Class TestContactBlockMigrateKeycardMultipleSharedDevices:

    1. test_keycard_command_send_tx_eth_1_1_chat, id: 702186

    Class: TestContactBlockMigrateKeycardMultipleSharedDevices

    Device sessions

    @jakubgs
    Copy link
    Member Author

    jakubgs commented Aug 4, 2022

    @status-im/mobile-qa The manual testing should focus on features related to OpenSea NFT marketplace.

    Thanks!

    @jakubgs jakubgs marked this pull request as ready for review August 4, 2022 14:04
    @pavloburykh pavloburykh moved this from E2E Tests to IN TESTING in Pipeline for QA Aug 5, 2022
    @pavloburykh pavloburykh self-assigned this Aug 5, 2022
    @pavloburykh
    Copy link
    Contributor

    Tested and ready for merge. Thanx for cooperation @qoqobolo

    @pavloburykh pavloburykh moved this from IN TESTING to MERGE in Pipeline for QA Aug 5, 2022
    Here the injection of OpenSea API key was done at compile time:
    aa72ac57
    
    But this makes `status-go` builds impure, and also prevents them from
    being extracted from `status-mobile` into `status-go` repo.
    
    Instead we pass the `OPENSEA_API_KEY` env variable to JS bundle at build
    time, which is then passed to `status-go` via the
    `Statusgo.saveAccountAndLogin` call in `saveAccountAndLogin`:
    https://github.com/status-im/status-mobile/blob/51174f84/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L323-L327
    
    Which sends `NodeConfig` that also contains `WalletConfig` which can
    include `OpenseaAPIKey`:
    ```go
    type WalletConfig struct {
        Enabled       bool
        OpenseaAPIKey string `json:"OpenseaAPIKey"`
    }
    ```
    https://github.com/status-im/status-go/blob/0135cc15/params/config.go#L510-L514
    
    Signed-off-by: Jakub Sokołowski <jakub@status.im>
    @jakubgs jakubgs merged commit 8ec2f23 into develop Aug 5, 2022
    Pipeline for QA automation moved this from MERGE to DONE Aug 5, 2022
    @jakubgs jakubgs deleted the opeansea-key-runtime branch August 5, 2022 12:36
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    None yet

    5 participants