├── .babelrc
├── .eslintrc
├── .gitignore
├── .nvmrc
├── .travis.yml
├── LICENSE
├── README.md
├── package-lock.json
├── package.json
├── spectrum.config.js
├── spectrum.dapplet.js
├── src
├── actions
│ ├── address.js
│ ├── keystore.js
│ ├── keystoreType.js
│ ├── network.js
│ ├── session.js
│ └── token.js
├── assets
│ ├── digix_logo_minimal_blue_mini.png
│ ├── icon.png
│ └── qr-overlay.png
├── components
│ ├── __tests__
│ │ ├── __snapshots__
│ │ │ └── app.test.jsx.snap
│ │ └── app.test.jsx
│ ├── app.jsx
│ ├── common
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── active_link.test.jsx.snap
│ │ │ │ ├── address.test.jsx.snap
│ │ │ │ ├── address_dropdown.test.jsx.snap
│ │ │ │ ├── address_input.test.jsx.snap
│ │ │ │ ├── address_selector.test.jsx.snap
│ │ │ │ ├── advanced.test.jsx.snap
│ │ │ │ ├── balance_label.test.jsx.snap
│ │ │ │ ├── button_selector.test.jsx.snap
│ │ │ │ ├── color_picker.test.jsx.snap
│ │ │ │ ├── connection_status.test.jsx.snap
│ │ │ │ ├── crypto_price.test.jsx.snap
│ │ │ │ ├── default_address_selector.test.jsx.snap
│ │ │ │ ├── download_json_button.test.jsx.snap
│ │ │ │ ├── dropdown_selector.test.jsx.snap
│ │ │ │ ├── entropy_field.test.jsx.snap
│ │ │ │ ├── entropy_generator.test.jsx.snap
│ │ │ │ ├── error_message.test.jsx.snap
│ │ │ │ ├── footer.test.jsx.snap
│ │ │ │ ├── form_field.test.jsx.snap
│ │ │ │ ├── ipfs_image.test.jsx.snap
│ │ │ │ ├── ipfs_uploader.test.jsx.snap
│ │ │ │ ├── menu_system.test.jsx.snap
│ │ │ │ ├── network_selector.test.jsx.snap
│ │ │ │ ├── network_status.test.jsx.snap
│ │ │ │ ├── network_tokens_selector.test.jsx.snap
│ │ │ │ ├── pagination_menu.test.jsx.snap
│ │ │ │ ├── qr_button.test.jsx.snap
│ │ │ │ ├── qr_code.test.jsx.snap
│ │ │ │ ├── qr_multi_button.test.jsx.snap
│ │ │ │ ├── qr_reader.test.jsx.snap
│ │ │ │ ├── series_paginator.test.jsx.snap
│ │ │ │ ├── startup_overlay.test.jsx.snap
│ │ │ │ ├── tx_visualisation.test.jsx.snap
│ │ │ │ └── value_input.test.jsx.snap
│ │ │ ├── active_link.test.jsx
│ │ │ ├── address.test.jsx
│ │ │ ├── address_dropdown.test.jsx
│ │ │ ├── address_input.test.jsx
│ │ │ ├── address_selector.test.jsx
│ │ │ ├── advanced.test.jsx
│ │ │ ├── balance_label.test.jsx
│ │ │ ├── button_selector.test.jsx
│ │ │ ├── color_picker.test.jsx
│ │ │ ├── connection_status.test.jsx
│ │ │ ├── crypto_price.test.jsx
│ │ │ ├── default_address_selector.test.jsx
│ │ │ ├── download_json_button.test.jsx
│ │ │ ├── dropdown_selector.test.jsx
│ │ │ ├── entropy_field.test.jsx
│ │ │ ├── entropy_generator.test.jsx
│ │ │ ├── error_message.test.jsx
│ │ │ ├── footer.test.jsx
│ │ │ ├── form_field.test.jsx
│ │ │ ├── ipfs_image.test.jsx
│ │ │ ├── ipfs_uploader.test.jsx
│ │ │ ├── menu_system.test.jsx
│ │ │ ├── network_selector.test.jsx
│ │ │ ├── network_status.test.jsx
│ │ │ ├── network_tokens_selector.test.jsx
│ │ │ ├── pagination_menu.test.jsx
│ │ │ ├── qr_button.test.jsx
│ │ │ ├── qr_code.test.jsx
│ │ │ ├── qr_multi_button.test.jsx
│ │ │ ├── qr_reader.test.jsx
│ │ │ ├── series_paginator.test.jsx
│ │ │ ├── startup_overlay.test.jsx
│ │ │ ├── tx_visualisation.test.jsx
│ │ │ └── value_input.test.jsx
│ │ ├── active_link.jsx
│ │ ├── address.jsx
│ │ ├── address_dropdown.jsx
│ │ ├── address_input.jsx
│ │ ├── address_selector.jsx
│ │ ├── advanced.jsx
│ │ ├── balance_label.jsx
│ │ ├── button_selector.jsx
│ │ ├── color_picker.jsx
│ │ ├── connection_status.jsx
│ │ ├── crypto_price.jsx
│ │ ├── default_address_selector.jsx
│ │ ├── dll_paginator.jsx
│ │ ├── download_json_button.jsx
│ │ ├── dropdown_selector.jsx
│ │ ├── entropy_field.jsx
│ │ ├── entropy_generator.jsx
│ │ ├── error_message.jsx
│ │ ├── footer.jsx
│ │ ├── form_field.jsx
│ │ ├── form_image_field.jsx
│ │ ├── form_image_preview.jsx
│ │ ├── ipfs_image.jsx
│ │ ├── ipfs_uploader.jsx
│ │ ├── lazyload.jsx
│ │ ├── menu_system.jsx
│ │ ├── menu_system_dropdown.jsx
│ │ ├── network_selector.jsx
│ │ ├── network_status.jsx
│ │ ├── network_tokens_selector.jsx
│ │ ├── pagination_menu.jsx
│ │ ├── qr_button.jsx
│ │ ├── qr_code.jsx
│ │ ├── qr_multi_button.jsx
│ │ ├── qr_reader.jsx
│ │ ├── redux_paginator.jsx
│ │ ├── series_paginator.jsx
│ │ ├── spectrum_watermark.jsx
│ │ ├── startup_overlay.jsx
│ │ ├── success_header.jsx
│ │ ├── tx_visualisation.jsx
│ │ └── value_input.jsx
│ ├── config
│ │ ├── index.jsx
│ │ ├── networks
│ │ │ ├── __tests__
│ │ │ │ ├── __snapshots__
│ │ │ │ │ ├── index.test.jsx.snap
│ │ │ │ │ ├── network.test.jsx.snap
│ │ │ │ │ └── network_form.test.jsx.snap
│ │ │ │ ├── index.test.jsx
│ │ │ │ ├── network.test.jsx
│ │ │ │ └── network_form.test.jsx
│ │ │ ├── index.jsx
│ │ │ ├── network.jsx
│ │ │ └── network_form.jsx
│ │ └── tokens
│ │ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── index.test.jsx.snap
│ │ │ │ ├── token.test.jsx.snap
│ │ │ │ └── token_form.test.jsx.snap
│ │ │ ├── index.test.jsx
│ │ │ ├── token.test.jsx
│ │ │ └── token_form.test.jsx
│ │ │ ├── index.jsx
│ │ │ ├── token.jsx
│ │ │ └── token_form.jsx
│ ├── dapplets
│ │ ├── index.jsx
│ │ └── placeholder.jsx
│ ├── keystores
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── address.test.jsx.snap
│ │ │ │ ├── address_balances.test.jsx.snap
│ │ │ │ ├── import_keystore_form.test.jsx.snap
│ │ │ │ ├── import_keystore_modal.test.jsx.snap
│ │ │ │ ├── index.test.jsx.snap
│ │ │ │ ├── keystore_buttons.test.jsx.snap
│ │ │ │ ├── keystore_creation_form.test.jsx.snap
│ │ │ │ ├── keystore_edit_form.test.jsx.snap
│ │ │ │ ├── keystore_menu.test.jsx.snap
│ │ │ │ ├── keystore_modal.test.jsx.snap
│ │ │ │ ├── keystore_selector.test.jsx.snap
│ │ │ │ └── keystore_type_message.test.jsx.snap
│ │ │ ├── address.test.jsx
│ │ │ ├── address_balances.test.jsx
│ │ │ ├── import_keystore_form.test.jsx
│ │ │ ├── import_keystore_modal.test.jsx
│ │ │ ├── index.test.jsx
│ │ │ ├── keystore_buttons.test.jsx
│ │ │ ├── keystore_creation_form.test.jsx
│ │ │ ├── keystore_edit_form.test.jsx
│ │ │ ├── keystore_menu.test.jsx
│ │ │ ├── keystore_modal.test.jsx
│ │ │ ├── keystore_selector.test.jsx
│ │ │ └── keystore_type_message.test.jsx
│ │ ├── address.jsx
│ │ ├── address_balances.jsx
│ │ ├── base_token
│ │ │ ├── __tests__
│ │ │ │ ├── __snapshots__
│ │ │ │ │ ├── base_token_balance.test.jsx.snap
│ │ │ │ │ ├── base_token_transfer.test.jsx.snap
│ │ │ │ │ ├── base_token_transfer_form.test.jsx.snap
│ │ │ │ │ ├── base_token_tx_ui.test.jsx.snap
│ │ │ │ │ └── index.test.jsx.snap
│ │ │ │ ├── base_token_balance.test.jsx
│ │ │ │ ├── base_token_transfer.test.jsx
│ │ │ │ ├── base_token_transfer_form.test.jsx
│ │ │ │ ├── base_token_tx_ui.test.jsx
│ │ │ │ └── index.test.jsx
│ │ │ ├── base_token_balance.jsx
│ │ │ ├── base_token_transfer.jsx
│ │ │ ├── base_token_transfer_form.jsx
│ │ │ ├── base_token_tx_ui.jsx
│ │ │ └── index.jsx
│ │ ├── generic_transaction
│ │ │ ├── __tests__
│ │ │ │ ├── __snapshots__
│ │ │ │ │ ├── generic_transaction_form.test.jsx.snap
│ │ │ │ │ └── index.test.jsx.snap
│ │ │ │ ├── generic_transaction_form.test.jsx
│ │ │ │ └── index.test.jsx
│ │ │ ├── generic_transaction_form.jsx
│ │ │ └── index.jsx
│ │ ├── import_keystore_form.jsx
│ │ ├── import_keystore_modal.jsx
│ │ ├── index.jsx
│ │ ├── keystore_buttons.jsx
│ │ ├── keystore_creation_form.jsx
│ │ ├── keystore_edit_form.jsx
│ │ ├── keystore_menu.jsx
│ │ ├── keystore_modal.jsx
│ │ ├── keystore_selector.jsx
│ │ ├── keystore_type_message.jsx
│ │ └── token
│ │ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── index.test.jsx.snap
│ │ │ │ ├── token_balance.test.jsx.snap
│ │ │ │ ├── token_transfer.test.jsx.snap
│ │ │ │ ├── token_transfer_form.test.jsx.snap
│ │ │ │ └── token_tx_ui.test.jsx.snap
│ │ │ ├── index.test.jsx
│ │ │ ├── token_balance.test.jsx
│ │ │ ├── token_transfer.test.jsx
│ │ │ ├── token_transfer_form.test.jsx
│ │ │ └── token_tx_ui.test.jsx
│ │ │ ├── index.jsx
│ │ │ ├── token_balance.jsx
│ │ │ ├── token_transfer.jsx
│ │ │ ├── token_transfer_form.jsx
│ │ │ └── token_tx_ui.jsx
│ └── transactions
│ │ ├── __tests__
│ │ ├── __snapshots__
│ │ │ ├── transaction_info.test.jsx.snap
│ │ │ ├── transaction_info_table.test.jsx.snap
│ │ │ ├── transaction_modal.test.jsx.snap
│ │ │ ├── transaction_modal_container.test.jsx.snap
│ │ │ ├── transaction_modal_form.test.jsx.snap
│ │ │ ├── transaction_signing_overlay.test.jsx.snap
│ │ │ └── transaction_tracker.test.jsx.snap
│ │ ├── transaction_info.test.jsx
│ │ ├── transaction_info_table.test.jsx
│ │ ├── transaction_modal.test.jsx
│ │ ├── transaction_modal_container.test.jsx
│ │ ├── transaction_modal_form.test.jsx
│ │ ├── transaction_signing_overlay.test.jsx
│ │ └── transaction_tracker.test.jsx
│ │ ├── transaction_info.jsx
│ │ ├── transaction_info_table.jsx
│ │ ├── transaction_modal.jsx
│ │ ├── transaction_modal_container.jsx
│ │ ├── transaction_modal_form.jsx
│ │ ├── transaction_signing_overlay.jsx
│ │ └── transaction_tracker.jsx
├── helpers
│ ├── blockie.js
│ ├── constants.js
│ ├── fileUtils.js
│ ├── offlinePlugin.js
│ ├── registerReducers.js
│ ├── seedStore.js
│ ├── stringUtils.js
│ ├── uiRegistry.js
│ ├── validation.js
│ └── web3
│ │ ├── connect.js
│ │ ├── index.js
│ │ ├── redux_subprovider.js
│ │ └── rpc_subprovider.js
├── index.html
├── index.jsx
├── keystoreTypes
│ ├── cold
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── cold_keystore_address.test.jsx.snap
│ │ │ │ ├── cold_keystore_creation_form.test.jsx.snap
│ │ │ │ ├── cold_keystore_edit_form.test.jsx.snap
│ │ │ │ └── cold_keystore_transaction_signer.test.jsx.snap
│ │ │ ├── cold_keystore_address.test.jsx
│ │ │ ├── cold_keystore_creation_form.test.jsx
│ │ │ ├── cold_keystore_edit_form.test.jsx
│ │ │ └── cold_keystore_transaction_signer.test.jsx
│ │ ├── cold_keystore_actions.js
│ │ ├── cold_keystore_address.jsx
│ │ ├── cold_keystore_creation_form.jsx
│ │ ├── cold_keystore_edit_form.jsx
│ │ ├── cold_keystore_transaction_signer.jsx
│ │ └── index.js
│ ├── index.js
│ ├── ledger
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── ledger_keystore_address_item.test.jsx.snap
│ │ │ │ ├── ledger_keystore_address_list.test.jsx.snap
│ │ │ │ ├── ledger_keystore_creation_form.test.jsx.snap
│ │ │ │ ├── ledger_keystore_edit_form.test.jsx.snap
│ │ │ │ └── ledger_keystore_transaction_signer.test.jsx.snap
│ │ │ ├── ledger_keystore_address_item.test.jsx
│ │ │ ├── ledger_keystore_address_list.test.jsx
│ │ │ ├── ledger_keystore_creation_form.test.jsx
│ │ │ ├── ledger_keystore_edit_form.test.jsx
│ │ │ └── ledger_keystore_transaction_signer.test.jsx
│ │ ├── index.js
│ │ ├── ledger_keystore_actions.js
│ │ ├── ledger_keystore_address_item.jsx
│ │ ├── ledger_keystore_address_list.jsx
│ │ ├── ledger_keystore_creation_form.jsx
│ │ ├── ledger_keystore_edit_form.jsx
│ │ └── ledger_keystore_transaction_signer.jsx
│ ├── multisig
│ │ ├── __tests__
│ │ │ ├── __snapshots__
│ │ │ │ ├── multisig_keystore_creation_form.test.jsx.snap
│ │ │ │ ├── multisig_keystore_deploy_form.test.jsx.snap
│ │ │ │ ├── multisig_keystore_deploy_tx_ui.test.jsx.snap
│ │ │ │ ├── multisig_keystore_edit_form.test.jsx.snap
│ │ │ │ ├── multisig_keystore_info.test.jsx.snap
│ │ │ │ ├── multisig_keystore_transaction_proxy.test.jsx.snap
│ │ │ │ └── multisig_keystore_transaction_signer.test.jsx.snap
│ │ │ ├── multisig_keystore_creation_form.test.jsx
│ │ │ ├── multisig_keystore_deploy_form.test.jsx
│ │ │ ├── multisig_keystore_deploy_tx_ui.test.jsx
│ │ │ ├── multisig_keystore_edit_form.test.jsx
│ │ │ ├── multisig_keystore_info.test.jsx
│ │ │ ├── multisig_keystore_transaction_proxy.test.jsx
│ │ │ └── multisig_keystore_transaction_signer.test.jsx
│ │ ├── index.js
│ │ ├── multisig_keystore_actions.js
│ │ ├── multisig_keystore_creation_form.jsx
│ │ ├── multisig_keystore_deploy_form.jsx
│ │ ├── multisig_keystore_deploy_tx_ui.jsx
│ │ ├── multisig_keystore_edit_form.jsx
│ │ ├── multisig_keystore_info.jsx
│ │ ├── multisig_keystore_transaction_proxy.jsx
│ │ └── multisig_keystore_transaction_signer.jsx
│ └── v3
│ │ ├── __tests__
│ │ ├── __snapshots__
│ │ │ ├── v3_keystore_creation_form.test.jsx.snap
│ │ │ ├── v3_keystore_download_button.test.jsx.snap
│ │ │ ├── v3_keystore_edit_form.test.jsx.snap
│ │ │ └── v3_keystore_transaction_signer.test.jsx.snap
│ │ ├── v3_keystore_creation_form.test.jsx
│ │ ├── v3_keystore_download_button.test.jsx
│ │ ├── v3_keystore_edit_form.test.jsx
│ │ └── v3_keystore_transaction_signer.test.jsx
│ │ ├── index.js
│ │ ├── v3_keystore_actions.js
│ │ ├── v3_keystore_creation_form.jsx
│ │ ├── v3_keystore_download_button.jsx
│ │ ├── v3_keystore_edit_form.jsx
│ │ ├── v3_keystore_transaction_signer.jsx
│ │ └── v3_sign_tx.js
├── models
│ ├── address.js
│ ├── index.js
│ ├── keystore.js
│ ├── keystoreType.js
│ ├── network.js
│ ├── session.js
│ └── token.js
├── selectors.js
├── semantic-ui
│ ├── spectrum.less
│ └── theme.config
└── store.js
├── test
├── __mocks__
│ ├── connectMock.js
│ ├── fileMock.js
│ └── styleMock.js
└── cucumber
│ ├── features
│ ├── Example.feature
│ └── V3Keystore.feature
│ ├── steps
│ ├── given.js
│ ├── then.js
│ └── when.js
│ └── support
│ ├── action
│ ├── clearInputField.js
│ ├── clickElement.js
│ ├── closeAllButFirstTab.js
│ ├── closeLastOpenedWindow.js
│ ├── deleteCookie.js
│ ├── dragElement.js
│ ├── focusLastOpenedWindow.js
│ ├── handleModal.js
│ ├── moveToElement.js
│ ├── openSpectrumAndAcceptTerms.js
│ ├── openWebsite.js
│ ├── pause.js
│ ├── pressButton.js
│ ├── resizeScreenSize.js
│ ├── scroll.js
│ ├── selectOption.js
│ ├── selectOptionByIndex.js
│ ├── setCookie.js
│ ├── setInputField.js
│ ├── setPromptText.js
│ ├── submitForm.js
│ ├── waitFor.js
│ └── waitForVisible.js
│ ├── check
│ ├── checkClass.js
│ ├── checkContainsAnyText.js
│ ├── checkContainsText.js
│ ├── checkCookieContent.js
│ ├── checkCookieExists.js
│ ├── checkDimension.js
│ ├── checkElementExists.js
│ ├── checkEqualsText.js
│ ├── checkFocus.js
│ ├── checkInURLPath.js
│ ├── checkIsEmpty.js
│ ├── checkIsOpenedInNewWindow.js
│ ├── checkModal.js
│ ├── checkModalText.js
│ ├── checkNewWindow.js
│ ├── checkOffset.js
│ ├── checkProperty.js
│ ├── checkSelected.js
│ ├── checkTitle.js
│ ├── checkURL.js
│ ├── checkURLPath.js
│ ├── checkWithinViewport.js
│ ├── compareText.js
│ ├── isEnabled.js
│ ├── isExisting.js
│ └── isVisible.js
│ └── lib
│ └── checkIfElementExists.js
├── wdio.ci.config.js
├── wdio.development.config.js
├── webpack.config.js
├── webpack.development.config.js
└── webpack.production.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "react",
5 | "stage-2",
6 | "stage-0"
7 | ],
8 | "compact" : false,
9 | "plugins": [
10 | "transform-class-properties",
11 | ["babel-root-import", { "rootPathSuffix": "src" }],
12 | "react-hot-loader/babel",
13 | "transform-object-rest-spread"
14 | ],
15 | "env": {
16 | "production": {
17 | "plugins": "transform-class-properties",
18 | "presets": [
19 | "react-optimize",
20 | ["env", {
21 | "targets": {
22 | "uglify": false,
23 | "browsers": [
24 | "last 2 versions",
25 | "safari >= 8",
26 | "ie >= 10",
27 | "ios >= 8"
28 | ]
29 | },
30 | "loose": true,
31 | "useBuiltIns": true
32 | }]
33 | ]
34 | },
35 | "test": {
36 | "presets": ["env"],
37 | "plugins": [
38 | "transform-class-properties",
39 | ["babel-root-import", { "rootPathSuffix": "src" }],
40 | "transform-object-rest-spread"
41 | ]
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | ---
2 | extends: airbnb
3 | parser: babel-eslint
4 | plugins:
5 | - react
6 | - jest
7 | env:
8 | browser: true
9 | jest/globals: true
10 | rules:
11 | react/prefer-stateless-function:
12 | - 0
13 | react/forbid-prop-types:
14 | - 0
15 | import/no-unresolved:
16 | - 2
17 | - ignore:
18 | - "^[~]"
19 | max-len:
20 | - error
21 | - 128
22 | import/extensions:
23 | - off
24 | - never
25 | class-methods-use-this:
26 | - 0
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.diff
2 | *.done.txt
3 | *.err
4 | *.esproj
5 | *.komodoproject
6 | *.log
7 | *.orig
8 | *.pyc
9 | *.rej
10 | *.sass-cache
11 | *.sublime-project
12 | *.sublime-workspace
13 | *.swo
14 | *.swp
15 | *.todo
16 | *.todo.txt
17 | *.vi
18 | *.zip
19 | *~
20 | .CVS
21 | .DS_Store
22 | ._*
23 | .cache
24 | .grunt
25 | .hg
26 | .idea
27 | .komodotools
28 | .npmrc
29 | .project
30 | .settings
31 | .static
32 | .svn
33 | .tern-port
34 | .tmp
35 | .tmproj
36 | Thumbs.db
37 | _SpecRunner.html
38 | _site
39 | _tmp
40 | bower_components
41 | coverage
42 | docs
43 | done.txt
44 | nbproject
45 | node_modules
46 | npm-debug.log
47 | reports
48 | selenium-debug.log
49 | todo.txt
50 | stats.json
51 | errorShots
52 | .cache-loader
53 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | 8
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | node_js:
4 | - '8'
5 |
6 | addons:
7 | apt:
8 | sources:
9 | - ubuntu-toolchain-r-test
10 | packages:
11 | - g++-4.8
12 | - libusb-1.0-0-dev
13 | env:
14 | - CXX=g++-4.8
15 | cache:
16 | directories:
17 | - node_modules
18 |
19 | before_script:
20 | - npm run serve &
21 |
22 | script:
23 | - npm run build:ci
24 | - npm run test:ci
25 |
--------------------------------------------------------------------------------
/spectrum.config.js:
--------------------------------------------------------------------------------
1 | module.exports = { };
2 |
--------------------------------------------------------------------------------
/spectrum.dapplet.js:
--------------------------------------------------------------------------------
1 | // this file imports the dapplet and is seperate from config.js to enable HMR
2 | export default null;
3 |
--------------------------------------------------------------------------------
/src/actions/address.js:
--------------------------------------------------------------------------------
1 | import { REDUX_PREFIX } from '~/helpers/constants';
2 |
3 | export const actions = {
4 | CREATE_ADDRESS: `${REDUX_PREFIX} create address`,
5 | UPDATE_ADDRESS: `${REDUX_PREFIX} update address`,
6 | DELETE_ADDRESS: `${REDUX_PREFIX} delete address`,
7 | };
8 |
9 | export const createAddress = props => ({
10 | type: actions.CREATE_ADDRESS,
11 | payload: props,
12 | });
13 |
14 | export const updateAddress = props => ({
15 | type: actions.UPDATE_ADDRESS,
16 | payload: props,
17 | });
18 |
19 | export const deleteAddress = id => ({
20 | type: actions.DELETE_ADDRESS,
21 | payload: id,
22 | });
23 |
--------------------------------------------------------------------------------
/src/actions/keystore.js:
--------------------------------------------------------------------------------
1 | import { REDUX_PREFIX } from '~/helpers/constants';
2 | import { getKeystoreAction } from '~/keystoreTypes';
3 |
4 | export const actions = {
5 | CREATE_KEYSTORE: `${REDUX_PREFIX} create keystore`,
6 | UPDATE_KEYSTORE: `${REDUX_PREFIX} update keystore`,
7 | DELETE_KEYSTORE: `${REDUX_PREFIX} delete keystore`,
8 | ADD_ACCOUNT_TO_KEYSTORE: `${REDUX_PREFIX} add account to keystore`,
9 | REMOVE_ACCOUNT_FROM_KEYSTORE: `${REDUX_PREFIX} remove account from keystore`,
10 | };
11 |
12 | export const createKeystore = props =>
13 | getKeystoreAction({ id: props.type, type: 'create' })(props);
14 |
15 | export const updateKeystore = (props, data) =>
16 | getKeystoreAction({ id: data.type.id, type: 'update' })(props, data);
17 |
18 | export const deleteKeystore = payload => ({
19 | type: actions.DELETE_KEYSTORE, payload,
20 | });
21 |
--------------------------------------------------------------------------------
/src/actions/keystoreType.js:
--------------------------------------------------------------------------------
1 | import { REDUX_PREFIX } from '~/helpers/constants';
2 |
3 | export const actions = {
4 | CREATE_KEYSTORE_TYPE: `${REDUX_PREFIX} create keystore type`,
5 | DELETE_KEYSTORE_TYPE: `${REDUX_PREFIX} delete keystore type`,
6 | };
7 |
8 | export const createKeystoreType = props => ({
9 | type: actions.CREATE_KEYSTORE_TYPE,
10 | payload: props,
11 | });
12 |
13 | export const deleteKeystoreType = id => ({
14 | type: actions.DELETE_KEYSTORE_TYPE,
15 | payload: id,
16 | });
17 |
--------------------------------------------------------------------------------
/src/actions/token.js:
--------------------------------------------------------------------------------
1 | import { REDUX_PREFIX } from '~/helpers/constants';
2 | import { validateProps } from '~/helpers/validation';
3 |
4 | export const actions = {
5 | CREATE_TOKEN: `${REDUX_PREFIX} create token`,
6 | UPDATE_TOKEN: `${REDUX_PREFIX} update token`,
7 | DELETE_TOKEN: `${REDUX_PREFIX} delete token`,
8 | };
9 |
10 | const requiredProps = {
11 | address: 'address',
12 | color: true,
13 | decimals: 'number',
14 | name: true,
15 | network: true,
16 | symbol: true,
17 | };
18 |
19 | export const createToken = (payload) => {
20 | validateProps(requiredProps, payload);
21 | return {
22 | type: actions.CREATE_TOKEN,
23 | payload,
24 | };
25 | };
26 |
27 | export const updateToken = (payload) => {
28 | validateProps(requiredProps, payload);
29 | return {
30 | type: actions.UPDATE_TOKEN,
31 | payload,
32 | };
33 | };
34 |
35 | export const deleteToken = payload => ({
36 | type: actions.DELETE_TOKEN,
37 | payload,
38 | });
39 |
--------------------------------------------------------------------------------
/src/assets/digix_logo_minimal_blue_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IstoraMandiri/spectrum/4329330a6df5991af3d67c3edde5b69ac01621d9/src/assets/digix_logo_minimal_blue_mini.png
--------------------------------------------------------------------------------
/src/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IstoraMandiri/spectrum/4329330a6df5991af3d67c3edde5b69ac01621d9/src/assets/icon.png
--------------------------------------------------------------------------------
/src/assets/qr-overlay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IstoraMandiri/spectrum/4329330a6df5991af3d67c3edde5b69ac01621d9/src/assets/qr-overlay.png
--------------------------------------------------------------------------------
/src/components/__tests__/__snapshots__/app.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
8 |
9 |
40 |
41 |
42 |
43 | `;
44 |
--------------------------------------------------------------------------------
/src/components/__tests__/app.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import App from '../app';
6 |
7 | jest.mock('react-redux', () => ({
8 | connect: () => component => component,
9 | }));
10 |
11 | describe('', () => {
12 | test('renders correctly', () => {
13 | const component = shallow(
14 | ,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/active_link.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
10 | `;
11 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/address.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
12 |
20 | test address
21 |
22 |
23 | `;
24 |
25 | exports[` renders correctly with short width 1`] = `
26 |
29 |
34 |
42 | test address 2
43 |
44 |
45 | `;
46 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/address_input.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
15 |
16 |
20 |
21 |
22 | `;
23 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/address_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
46 | `;
47 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/advanced.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
15 | Advanced
16 |
17 |
21 |
22 |
23 | `;
24 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/balance_label.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
12 | `;
13 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/button_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
14 |
23 |
32 |
33 | `;
34 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/connection_status.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
16 |
19 |
20 | `;
21 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/crypto_price.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
37 | `;
38 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/default_address_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 | No keystores:
6 |
7 |
8 |
9 |
14 |
15 | `;
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/download_json_button.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
8 | `;
9 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/dropdown_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
23 |
24 |
27 |
28 |
29 | `;
30 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/entropy_field.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
11 | }
12 | fluid={true}
13 | name="test"
14 | onChange={[Function]}
15 | placeholder="randomBytes(32)"
16 | type="password"
17 | value="Test name"
18 | />
19 |
20 | `;
21 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/entropy_generator.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
24 | }
25 | />
26 | `;
27 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/error_message.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
10 | `;
11 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/form_field.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
11 |
12 | `;
13 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/ipfs_image.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 | Loading...
6 |
7 | ipfs:
8 | QmXRPqMrSaekAdAPu7NEewQVBYLACmk42f84EKa2a3pRx5
9 |
10 | `;
11 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/ipfs_uploader.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
10 |
13 |
14 |
23 |
33 |
34 |
35 |
36 | `;
37 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/menu_system.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
25 |
32 |
33 | `;
34 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/network_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
16 | `;
17 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/network_status.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
13 | `;
14 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/network_tokens_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
13 |
14 | `;
15 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/pagination_menu.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
52 | `;
53 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/qr_button.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
16 | }
17 | />
18 | `;
19 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/qr_code.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
8 |
9 | "qr code test"
10 |
11 |
12 |
13 | }
14 | header="QR Code Data"
15 | trigger={
16 |
24 |
31 |
32 | }
33 | />
34 | `;
35 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/qr_multi_button.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
15 |
19 |
20 | }
21 | size="small"
22 | trigger={
23 |
30 | }
31 | />
32 | `;
33 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/qr_reader.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 |
14 |
15 | `;
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/series_paginator.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
18 | `;
19 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/startup_overlay.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
20 |
34 |
35 | TODO: Default TOS
36 |
37 |
38 | }
39 | header="Spectrum"
40 | initiallyOpen={true}
41 | onClose={[Function]}
42 | />
43 |
44 | `;
45 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/__snapshots__/value_input.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
16 |
20 |
21 |
28 |
29 |
33 |
34 | `;
35 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/active_link.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ActiveLink from '../active_link';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/address.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Address from '../address';
5 |
6 | jest.mock('../../../helpers/blockie');
7 |
8 | describe('', () => {
9 | test('renders correctly', () => {
10 | const component = shallow(
11 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 |
19 | test('renders correctly with short width', () => {
20 | const component = shallow(
21 | ,
25 | );
26 |
27 | expect(toJson(component)).toMatchSnapshot();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/address_dropdown.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import AddressDropdown from '../address_dropdown';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const addresses = [{
11 | name: 'address 1',
12 | address: 'address test 1',
13 | }, {
14 | name: 'address 2',
15 | address: 'address test 2',
16 | }, {
17 | name: 'address 3',
18 | address: 'address test 4',
19 | }];
20 |
21 | describe('', () => {
22 | test('renders correctly', () => {
23 | const component = shallow(
24 | ,
28 | );
29 |
30 | expect(toJson(component)).toMatchSnapshot();
31 | });
32 |
33 | test('renders correctly with matching value', () => {
34 | const component = shallow(
35 | ,
39 | );
40 |
41 | expect(toJson(component)).toMatchSnapshot();
42 | });
43 | });
44 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/address_input.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import AddressInput from '../address_input';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/address_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import AddressSelector from '../address_selector';
6 |
7 | const addresses = [{
8 | name: 'address 1',
9 | address: 'address test 1',
10 | keystore: {
11 | type: { color: 'white' },
12 | },
13 | }, {
14 | name: 'address 2',
15 | address: 'address test 2',
16 | keystore: {
17 | type: { color: 'black' },
18 | },
19 | }, {
20 | name: 'address 3',
21 | address: 'address test 4',
22 | keystore: {
23 | type: { color: 'orange' },
24 | },
25 | }];
26 |
27 | describe('', () => {
28 | test('renders correctly', () => {
29 | const component = shallow(
30 | ,
33 | );
34 |
35 | expect(toJson(component)).toMatchSnapshot();
36 | });
37 | });
38 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/advanced.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import Advanced from '../advanced';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | Test
,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/balance_label.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import BalanceLabel from '../balance_label';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/button_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ButtonSelector from '../button_selector';
6 |
7 | const items = [{
8 | id: 1,
9 | text: 'testing 1',
10 | name: 'test1',
11 | color: 'blue',
12 | }, {
13 | id: 2,
14 | text: 'testing 2',
15 | name: 'test2',
16 | color: 'black',
17 | }, {
18 | id: 3,
19 | text: 'testing 3',
20 | name: 'test3',
21 | color: 'red',
22 | }];
23 |
24 | describe('', () => {
25 | test('renders correctly', () => {
26 | const component = shallow(
27 | ,
33 | );
34 |
35 | expect(toJson(component)).toMatchSnapshot();
36 | });
37 | });
38 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/color_picker.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ColorPicker from '../color_picker';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/connection_status.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import ConnectionStatus from '../connection_status';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const web3Redux = {
11 | web3: jest.fn(),
12 | pendingRequests: () => true,
13 | };
14 |
15 | const networks = [{
16 | id: 1,
17 | enabled: true,
18 | }, {
19 | id: 2,
20 | enabled: false,
21 | }];
22 |
23 | describe('', () => {
24 | test('renders correctly', () => {
25 | const component = shallow(
26 | ,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/crypto_price.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import CryptoPrice from '../crypto_price';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const cryptoPrices = {
11 | available: ['Test'],
12 | prices: {
13 | GBP: 10,
14 | selected: 'GBP',
15 | },
16 | selected: 'GBP',
17 | };
18 |
19 | describe('', () => {
20 | test('renders correctly', () => {
21 | const component = shallow(
22 | ,
29 | );
30 |
31 | expect(toJson(component)).toMatchSnapshot();
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/default_address_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import DefaultAddressSelector from '../default_address_selector';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 | jest.mock('../../../components/keystores/keystore_buttons');
10 |
11 | describe('', () => {
12 | test('renders correctly', () => {
13 | const component = shallow(
14 | ,
18 | );
19 |
20 | expect(toJson(component)).toMatchSnapshot();
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/download_json_button.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import DownloadJsonButton from '../download_json_button';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/dropdown_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import DropdownSelector from '../dropdown_selector';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/entropy_field.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import EntropyField from '../entropy_field';
6 |
7 | const formData = {
8 | test: 'Test name',
9 | };
10 |
11 | describe('', () => {
12 | test('renders correctly', () => {
13 | const component = shallow(
14 | ,
19 | );
20 |
21 | expect(toJson(component)).toMatchSnapshot();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/entropy_generator.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import EntropyGenerator from '../entropy_generator';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/error_message.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ErrorMessage from '../error_message';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/footer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import Footer from '../footer';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/form_field.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import FormField from '../form_field';
6 |
7 | const formData = {
8 | TestField: 'test value',
9 | };
10 |
11 | describe('', () => {
12 | test('renders correctly', () => {
13 | const component = shallow(
14 | ,
19 | );
20 |
21 | expect(toJson(component)).toMatchSnapshot();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/ipfs_image.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import IpfsImage from '../ipfs_image';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/ipfs_uploader.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import IpfsUploader from '../ipfs_uploader';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/menu_system.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MenuSystem from '../menu_system';
6 |
7 | const tabs = [{
8 | icon: 'tabIcon1',
9 | name: 'Tab 1',
10 | path: '/tab-1',
11 | exact: true,
12 | }, {
13 | icon: 'tabIcon2',
14 | name: 'Tab 2',
15 | path: '/tab-2',
16 | exact: true,
17 | }];
18 |
19 | describe('', () => {
20 | test('renders correctly', () => {
21 | const component = shallow(
22 | ,
25 | );
26 |
27 | expect(toJson(component)).toMatchSnapshot();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/network_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import NetworkSelector from '../network_selector';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const networks = [{
11 | enabled: true,
12 | }, {
13 | enabled: false,
14 | }];
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
22 | );
23 |
24 | expect(toJson(component)).toMatchSnapshot();
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/network_status.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import NetworkStatus from '../network_status';
5 |
6 | describe('', () => {
7 | test('renders correctly', () => {
8 | const component = shallow(
9 | ,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/network_tokens_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import NetworkTokensSelector from '../network_tokens_selector';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | describe('', () => {
11 | test('renders correctly', () => {
12 | const component = shallow(
13 | ,
19 | );
20 |
21 | expect(toJson(component)).toMatchSnapshot();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/pagination_menu.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import PaginationMenu from '../pagination_menu';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
16 | );
17 |
18 | expect(toJson(component)).toMatchSnapshot();
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/qr_button.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import QrButton from '../qr_button';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/qr_code.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import QrCode from '../qr_code';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/qr_multi_button.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import QrMultiButton from '../qr_multi_button';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/qr_reader.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import QrReader from '../qr_reader';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
13 | );
14 |
15 | expect(toJson(component)).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/series_paginator.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import SeriesPaginator from '../series_paginator';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/startup_overlay.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import StartupOverlay from '../startup_overlay';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/tx_visualisation.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TxVisualisation from '../tx_visualisation';
5 |
6 | jest.mock('semantic-ui-react');
7 |
8 | const items = [{
9 | header: 'test header 1',
10 | icon: 'testIcon1',
11 | subheader: 'test subheader 1',
12 | data: 'test data 1',
13 | color: 'blue',
14 | dataLink: '/test-link-1',
15 | }, {
16 | header: 'test header 2',
17 | icon: 'testIcon2',
18 | subheader: 'test subheader 2',
19 | data: 'test data 2',
20 | color: 'white',
21 | dataLink: '/test-link-2',
22 | }];
23 |
24 | describe('', () => {
25 | test('renders correctly', () => {
26 | const component = shallow(
27 | ,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/common/__tests__/value_input.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import ValueInput from '../value_input';
5 |
6 | jest.mock('../../../helpers/stringUtils');
7 |
8 | const formData = {
9 | testForm: 'test',
10 | };
11 |
12 | const sendAll = {
13 | toNumber: () => 1,
14 | };
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
27 | );
28 |
29 | expect(toJson(component)).toMatchSnapshot();
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/src/components/common/active_link.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { NavLink } from 'react-router-dom';
3 |
4 | export default class ActiveLink extends Component {
5 | render() {
6 | return (
7 |
8 | );
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/components/common/address.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Image } from 'semantic-ui-react';
4 |
5 | import getBlockie from '~/helpers/blockie';
6 |
7 | export default class Address extends Component {
8 | static propTypes = {
9 | address: PropTypes.string.isRequired,
10 | short: PropTypes.bool,
11 | };
12 | static defaultProps = {
13 | short: false,
14 | }
15 | render() {
16 | const { address, short } = this.props;
17 | return (
18 |
19 |
20 | {address}
21 |
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/common/address_dropdown.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { connect } from 'react-redux';
4 | import { Dropdown } from 'semantic-ui-react';
5 |
6 | import { getAddresses } from '~/selectors';
7 |
8 | class AddressDropdown extends Component {
9 | static propTypes = {
10 | addresses: PropTypes.array.isRequired,
11 | value: PropTypes.string.isRequired,
12 | onChange: PropTypes.func,
13 | };
14 | static defaultProps = {
15 | onChange: null,
16 | }
17 | render() {
18 | let match;
19 | const { addresses, value, onChange } = this.props;
20 | const options = addresses.map(({ name, address }) => {
21 | if (address === value) { match = value; }
22 | return {
23 | key: address,
24 | value: address,
25 | text: name,
26 | content: {name}
,
27 | };
28 | });
29 | return (
30 |
39 | );
40 | }
41 | }
42 |
43 | export default connect(state => ({
44 | addresses: getAddresses(state),
45 | }))(AddressDropdown);
46 |
--------------------------------------------------------------------------------
/src/components/common/advanced.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Form, Icon } from 'semantic-ui-react';
4 |
5 | export default class Advanced extends Component {
6 | static propTypes = {
7 | children: PropTypes.node.isRequired,
8 | title: PropTypes.string,
9 | };
10 | static defaultProps = {
11 | title: 'Advanced',
12 | }
13 |
14 | constructor(props) {
15 | super(props);
16 | this.state = { showing: false };
17 | this.handleToggle = this.handleToggle.bind(this);
18 | }
19 | handleToggle() {
20 | this.setState({ showing: !this.state.showing });
21 | }
22 | render() {
23 | const { showing } = this.state;
24 | const { children, title } = this.props;
25 | return (
26 |
27 |
28 | {title}
29 |
30 | {showing && children}
31 |
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/components/common/balance_label.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Label } from 'semantic-ui-react';
4 |
5 | export default class BalanceLabel extends Component {
6 | static propTypes = {
7 | item: PropTypes.object.isRequired,
8 | value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
9 | };
10 | static defaultProps = {
11 | value: '?',
12 | }
13 | render() {
14 | const { item, value } = this.props;
15 | const color = value && item.color ? item.color : undefined;
16 | return (
17 |
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/common/download_json_button.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Button } from 'semantic-ui-react';
4 |
5 | import { downloadJSON } from '~/helpers/fileUtils';
6 |
7 | export default class DownloadJSONButton extends Component {
8 | static propTypes = {
9 | getFileInfo: PropTypes.func.isRequired,
10 | props: PropTypes.object,
11 | }
12 | static defaultProps = {
13 | props: {},
14 | }
15 | constructor(props) {
16 | super(props);
17 | this.handleClick = this.handleClick.bind(this);
18 | }
19 | handleClick(e) {
20 | e.preventDefault();
21 | this.props.getFileInfo().then(({ name, content }) => {
22 | downloadJSON(content, name);
23 | });
24 | }
25 | render() {
26 | return (
27 |
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/components/common/error_message.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Message } from 'semantic-ui-react';
4 |
5 | function parseContent(content) {
6 | if (!content) { return null; }
7 | if (typeof content === 'string') {
8 | return content;
9 | }
10 | return {JSON.stringify(content, null, 2)}
;
11 | }
12 | export default class ErrorMessage extends Component {
13 | static propTypes = {
14 | content: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
15 | children: PropTypes.func,
16 | };
17 | static defaultProps = {
18 | children: undefined,
19 | }
20 | render() {
21 | const { content, children } = this.props;
22 | return (
23 |
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/common/form_image_preview.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Segment, Image, Form } from 'semantic-ui-react';
4 | import FormImageField from './form_image_field';
5 |
6 | export default class FormImagePreview extends Component {
7 | static propTypes = {
8 | preview: PropTypes.string,
9 | }
10 | static defaultProps = {
11 | preview: undefined,
12 | }
13 | render() {
14 | const { preview, ...rest } = this.props;
15 | return (
16 |
17 |
18 | {preview &&
19 |
20 |
21 |
22 | }
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/common/lazyload.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Loader } from 'semantic-ui-react';
3 |
4 | function asyncComp(getComp) {
5 | return class AsyncComp extends Component {
6 | static Comp = null;
7 | state = { Comp: AsyncComp.Comp };
8 |
9 | componentWillMount() {
10 | if (!this.state.Comp) {
11 | getComp().then((Comp) => {
12 | AsyncComp.Comp = Comp;
13 | this.setState({ Comp });
14 | });
15 | }
16 | }
17 | render() {
18 | const { Comp } = this.state;
19 | if (Comp) {
20 | return ;
21 | }
22 | return ;
23 | }
24 | };
25 | }
26 |
27 | export default promise => asyncComp(() => promise().then(module => module.default));
28 |
--------------------------------------------------------------------------------
/src/components/common/menu_system_dropdown.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Dropdown, Container } from 'semantic-ui-react';
4 |
5 | export default class MenuSystemDropdown extends Component {
6 | static propTypes = {
7 | children: PropTypes.node.isRequired,
8 | }
9 | render() {
10 | const { children, ...rest } = this.props;
11 | return (
12 |
13 |
14 |
15 | {children}
16 |
17 |
18 |
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/common/network_status.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Label } from 'semantic-ui-react';
4 |
5 | export default class NetworkStatus extends Component {
6 | static propTypes = {
7 | name: PropTypes.bool,
8 | network: PropTypes.object.isRequired,
9 | web3: PropTypes.object,
10 | }
11 | static defaultProps = {
12 | web3: undefined,
13 | name: false,
14 | }
15 | render() {
16 | const { web3, network, name } = this.props;
17 | const status = {
18 | connected: { content: 'Connected', color: 'green', icon: 'checkmark' },
19 | disconnected: { content: 'No Connection', color: 'red', icon: 'unlinkify' },
20 | disabled: { content: 'Disabled', icon: 'remove' },
21 | connecting: { content: 'Connecting...', color: 'orange', icon: 'wait' },
22 | }[web3 ? web3.connectionStatus() : 'disabled'];
23 | return (
24 |
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/common/qr_code.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import QRCode from 'qrcode.react';
4 | import EZModal from 'sui-react-ezmodal';
5 |
6 | export default class QrCode extends Component {
7 | static propTypes = {
8 | data: PropTypes.string.isRequired,
9 | }
10 | render() {
11 | return (
12 | {JSON.stringify(this.props.data, null, 2)}
}
15 | trigger={(
16 |
17 |
18 |
19 | )}
20 | />
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/common/qr_reader.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import QRReader from 'react-qr-reader';
5 |
6 | export default class QrReader extends Component {
7 | static propTypes = {
8 | onScan: PropTypes.func.isRequired,
9 | onError: PropTypes.func,
10 | };
11 | static defaultProps = {
12 | onError: () => ({}),
13 | }
14 | render() {
15 | return (
16 |
17 |
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/common/spectrum_watermark.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | const buildTime = window.spectrumBuildTime && new Date(window.spectrumBuildTime).toLocaleString();
5 |
6 | export default class SpectrumWatermark extends Component {
7 | static propTypes = {
8 |
9 | }
10 | render() {
11 | return (
12 |
13 | Powered by Spectrum
14 |
15 | Built {buildTime}
16 |
17 | );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/common/success_header.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Header, Icon } from 'semantic-ui-react';
4 |
5 | export default class extends Component {
6 | static propTypes = {
7 | title: PropTypes.string.isRequired,
8 | children: PropTypes.node.isRequired,
9 | failure: PropTypes.bool,
10 | }
11 | static defaultProps = {
12 | failure: false,
13 | }
14 | render() {
15 | const { title, children, failure } = this.props;
16 | return (
17 |
18 |
19 | {title}
20 |
21 | {children}
22 |
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/components/config/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Grid } from 'semantic-ui-react';
3 |
4 | import Networks from './networks';
5 | import Tokens from './tokens';
6 |
7 | export default class Config extends Component {
8 | render() {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/config/networks/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Networks from '../index';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const networks = [{
11 | id: 1,
12 | }, {
13 | id: 2,
14 | }];
15 |
16 | const web3Redux = {
17 | web3: () => {},
18 | };
19 |
20 | describe('', () => {
21 | test('renders correctly', () => {
22 | const component = shallow(
23 | ,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/config/networks/__tests__/network.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import Network from '../network';
6 |
7 | const network = {
8 | name: 'testNetwork',
9 | color: 'blue',
10 | image: 'test.png',
11 | description: 'test description',
12 | };
13 |
14 | describe('', () => {
15 | test('renders correctly', () => {
16 | const component = shallow(
17 | ,
23 | );
24 |
25 | expect(toJson(component)).toMatchSnapshot();
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/src/components/config/networks/__tests__/network_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import NetworkForm from '../network_form';
5 |
6 | describe('', () => {
7 | test('renders correctly', () => {
8 | const component = shallow(
9 | ,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/config/tokens/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Tokens from '../index';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const tokens = [{
11 | id: 1,
12 | }, {
13 | id: 2,
14 | }];
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
25 | );
26 |
27 | expect(toJson(component)).toMatchSnapshot();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/src/components/config/tokens/__tests__/token.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Token from '../token';
5 |
6 | jest.mock('../../../../helpers/blockie');
7 |
8 | const token = {
9 | id: 1,
10 | name: 'Test token',
11 | address: '0x123f43ddd',
12 | network: {
13 | id: 1,
14 | name: 'Test network',
15 | color: 'blue',
16 | },
17 | symbol: 'GBP',
18 | };
19 |
20 | describe('', () => {
21 | test('renders correctly', () => {
22 | const component = shallow(
23 | ,
28 | );
29 |
30 | expect(toJson(component)).toMatchSnapshot();
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/src/components/config/tokens/__tests__/token_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import TokenForm from '../token_form';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/dapplets/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Grid, Header } from 'semantic-ui-react';
3 |
4 | // import Lazyload from '~/components/common/lazyload';
5 |
6 | // import MenuSystem from '~/components/common/menu_system';
7 | // import Placeholder from './placeholder';
8 |
9 | // const EtcRedemption = Lazyload(() => System.import('@digix/etc-redemption/spectrum'));
10 | // const DigixKyc = Lazyload(() => System.import('@digix/etc-redemption/spectrum'));
11 |
12 |
13 | export default class Dapplets extends Component {
14 | static propTypes = {
15 |
16 | }
17 | render() {
18 | return (
19 |
20 |
21 |
22 | Dapplets
23 |
24 | Sample of some Dapplets built in spectrum. This section will soon be replaced with an on-chain registry.
25 |
26 |
27 |
28 |
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/dapplets/placeholder.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class Placeholder extends Component {
4 | static propTypes = {
5 |
6 | }
7 | render() {
8 | return (
9 | COMING SOON
10 | );
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/import_keystore_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
16 |
19 |
22 |
25 |
26 | Click or drag and drop keystore here to upload.
27 |
28 |
29 |
30 |
31 | `;
32 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/import_keystore_modal.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 | }
11 | />
12 | `;
13 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_buttons.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
23 | }
24 | />
25 |
41 | }
42 | />
43 |
44 | `;
45 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_creation_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = ``;
4 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_edit_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
12 | <[object Object]
13 | data={
14 | Object {
15 | "type": Object {
16 | "id": "testId",
17 | },
18 | }
19 | }
20 | />
21 |
22 | `;
23 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_modal.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 | }
20 | />
21 | `;
22 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_selector.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
27 | `;
28 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/__snapshots__/keystore_type_message.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
8 |
12 |
13 |
14 | keystore test 1
15 |
16 | test description
17 |
18 |
19 | `;
20 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/address.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Address from '../address';
5 |
6 | jest.mock('../../../helpers/blockie');
7 |
8 | const address = {
9 | address: '0x12345',
10 | name: 'test address',
11 | };
12 |
13 | describe('', () => {
14 | test('renders correctly', () => {
15 | const component = shallow(
16 | ,
17 | );
18 |
19 | expect(toJson(component)).toMatchSnapshot();
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/address_balances.test.jsx:
--------------------------------------------------------------------------------
1 | /* eslint global-require:0 */
2 | import React from 'react';
3 | import { shallow } from 'enzyme';
4 | import toJson from 'enzyme-to-json';
5 | import AddressBalances from '../address_balances';
6 |
7 | jest.mock('../../../helpers/web3/connect', () => require('../../../../test/__mocks__/connectMock'));
8 |
9 | const address = {
10 | networks: [{
11 | id: 1,
12 | }, {
13 | id: 2,
14 | }],
15 | tokens: [{
16 | id: 1,
17 | }, {
18 | id: 2,
19 | }],
20 | };
21 |
22 | describe('', () => {
23 | test('renders correctly', () => {
24 | const component = shallow(
25 | ,
29 | );
30 |
31 | expect(toJson(component)).toMatchSnapshot();
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/import_keystore_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ImportKeystoreForm from '../import_keystore_form';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/import_keystore_modal.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ImportKeystoreModal from '../import_keystore_modal';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | }
12 | createKeystore={jest.fn}
13 | />,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import Keystores from '../index';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 | jest.mock('semantic-ui-react');
10 |
11 | const keystores = [{
12 | id: 1,
13 | type: {
14 | name: 'test keystore',
15 | color: 'red',
16 | icon: 'testIcon',
17 | subtitle: 'test subtitle',
18 | },
19 | addresses: [{
20 | address: '0x12345',
21 | }, {
22 | address: '0x1234567',
23 | }],
24 | }, {
25 | id: 2,
26 | type: {
27 | name: 'test keystore 2',
28 | color: 'blue',
29 | icon: 'testIcon2',
30 | subtitle: 'test subtitle 2',
31 | },
32 | addresses: [{
33 | address: '0x54321',
34 | }, {
35 | address: '0x543210123',
36 | }],
37 | }];
38 |
39 | describe('', () => {
40 | test('renders correctly', () => {
41 | const component = shallow(
42 | ,
49 | );
50 |
51 | expect(toJson(component)).toMatchSnapshot();
52 | });
53 | });
54 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_buttons.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreButtons from '../keystore_buttons';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | describe('', () => {
11 | test('renders correctly', () => {
12 | const component = shallow(
13 | ,
17 | );
18 |
19 | expect(toJson(component)).toMatchSnapshot();
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_creation_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreCreationForm from '../keystore_creation_form';
5 |
6 | jest.mock('../../../keystoreTypes');
7 |
8 | const formData = {};
9 |
10 | const keystoreTypes = [{
11 | id: 'testType',
12 | }, {
13 | id: 'testType2',
14 | }];
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
26 | );
27 |
28 | expect(toJson(component)).toMatchSnapshot();
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_edit_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreEditForm from '../keystore_edit_form';
5 |
6 | jest.mock('../../../keystoreTypes', () => ({
7 | getKeystoreComponent: () => jest.fn,
8 | }));
9 |
10 | const data = {
11 | type: {
12 | id: 'testId',
13 | },
14 | };
15 |
16 | describe('', () => {
17 | test.skip('renders correctly', () => {
18 | const component = shallow(
19 | ,
20 | );
21 |
22 | expect(toJson(component)).toMatchSnapshot();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_menu.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreMenu from '../keystore_menu';
5 |
6 | jest.mock('semantic-ui-react');
7 |
8 | const keystoreTypes = [{
9 | id: 1,
10 | name: 'keystore test 1',
11 | icon: 'testIcon',
12 | color: 'blue',
13 | subtitle: 'test subtitle',
14 | }, {
15 | id: 2,
16 | name: 'keystore test 2',
17 | icon: 'testIcon2',
18 | color: 'black',
19 | subtitle: 'test subtitle 2',
20 | }];
21 |
22 | describe('', () => {
23 | test('renders correctly', () => {
24 | const component = shallow(
25 | ,
29 | );
30 |
31 | expect(toJson(component)).toMatchSnapshot();
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_modal.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreModal from '../keystore_modal';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const keystoreTypes = [{
11 | id: 1,
12 | name: 'keystore test 1',
13 | icon: 'testIcon',
14 | color: 'blue',
15 | subtitle: 'test subtitle',
16 | }, {
17 | id: 2,
18 | name: 'keystore test 2',
19 | icon: 'testIcon2',
20 | color: 'black',
21 | subtitle: 'test subtitle 2',
22 | }];
23 |
24 | describe('', () => {
25 | test('renders correctly', () => {
26 | const component = shallow(
27 | }
31 | trigger={}
32 | />,
33 | );
34 |
35 | expect(toJson(component)).toMatchSnapshot();
36 | });
37 | });
38 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_selector.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import KeystoreSelector from '../keystore_selector';
6 |
7 | const keystoreTypes = [{
8 | id: 1,
9 | name: 'keystore test 1',
10 | icon: 'testIcon',
11 | color: 'blue',
12 | subtitle: 'test subtitle',
13 | }, {
14 | id: 2,
15 | name: 'keystore test 2',
16 | icon: 'testIcon2',
17 | color: 'black',
18 | subtitle: 'test subtitle 2',
19 | }];
20 |
21 | describe('', () => {
22 | test('renders correctly', () => {
23 | const component = shallow(
24 | ,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/keystores/__tests__/keystore_type_message.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import KeystoreTypeMessage from '../keystore_type_message';
5 |
6 | jest.mock('semantic-ui-react');
7 |
8 | const keystoreType = {
9 | id: 1,
10 | name: 'keystore test 1',
11 | icon: 'testIcon',
12 | color: 'blue',
13 | description: 'test description',
14 | };
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
20 | );
21 |
22 | expect(toJson(component)).toMatchSnapshot();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/components/keystores/address_balances.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Table } from 'semantic-ui-react';
4 |
5 | import web3Connect from '~/helpers/web3/connect';
6 |
7 | import BaseTokenButton from './base_token';
8 | import TokenButton from './token';
9 |
10 | class AddressBalances extends Component {
11 | static propTypes = {
12 | address: PropTypes.object.isRequired,
13 | web3Redux: PropTypes.object.isRequired,
14 | }
15 | renderNetworkBalances() {
16 | const { address, web3Redux } = this.props;
17 | return address.networks.map(network => (
18 |
19 | ));
20 | }
21 | renderTokens() {
22 | const { address, web3Redux } = this.props;
23 | return address.tokens.map(token => (
24 |
25 | ));
26 | }
27 | render() {
28 | return (
29 |
30 | {this.renderNetworkBalances()}
31 | {this.renderTokens()}
32 |
33 | );
34 | }
35 | }
36 |
37 | export default web3Connect(AddressBalances);
38 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/__snapshots__/base_token_balance.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
8 | `;
9 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/__snapshots__/base_token_transfer.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 | }
16 | />
17 | `;
18 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/__snapshots__/base_token_transfer_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
20 |
35 |
50 |
51 | `;
52 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/__snapshots__/base_token_tx_ui.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
33 | `;
34 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/__snapshots__/index.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `null`;
4 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/base_token_balance.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import BaseTokenBalance from '../base_token_balance';
5 |
6 | jest.mock('../../../../helpers/stringUtils', () => ({
7 | parseBigNumber: () => 20,
8 | }));
9 |
10 | const web3 = {
11 | eth: {
12 | getBalance: jest.fn,
13 | balance: () => 10,
14 | },
15 | };
16 |
17 | describe('', () => {
18 | test('renders correctly', () => {
19 | const component = shallow(
20 | ,
27 | );
28 |
29 | expect(toJson(component)).toMatchSnapshot();
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/base_token_transfer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import BaseTokenTransfer from '../base_token_transfer';
5 |
6 | describe('', () => {
7 | test('renders correctly', () => {
8 | const component = shallow(
9 | }
11 | network={{
12 | name: 'test network',
13 | }}
14 | />,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/base_token_transfer_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import BaseTokenTransferForm from '../base_token_transfer_form';
6 |
7 | const web3 = {
8 | eth: {
9 | getBalance: jest.fn,
10 | balance: () => ({
11 | minus: () => ({
12 | shift: () => ({}),
13 | }),
14 | }),
15 | },
16 | };
17 |
18 | const network = {
19 | symbol: 'GBP',
20 | color: 'blue',
21 | };
22 |
23 | const formData = {
24 | from: '0x1234',
25 | gas: 1000,
26 | gasPrice: 10,
27 | };
28 |
29 | describe('', () => {
30 | test('renders correctly', () => {
31 | const component = shallow(
32 | ,
38 | );
39 |
40 | expect(toJson(component)).toMatchSnapshot();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/base_token_tx_ui.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import BaseTokenTxUi from '../base_token_tx_ui';
5 |
6 | jest.mock('../../../../helpers/stringUtils', () => ({
7 | parseBigNumber: () => 20,
8 | }));
9 |
10 | const address = {
11 | keystore: {
12 | type: {
13 | color: 'black',
14 | icon: 'testIcon',
15 | },
16 | },
17 | name: 'test network',
18 | address: '0x213452',
19 | color: 'blue',
20 | };
21 |
22 | const network = {
23 | explorerAddressPrefix: 'testPrefix',
24 | name: 'test network',
25 | color: 'red',
26 | symbol: 'GBP',
27 | description: 'test description',
28 | };
29 |
30 | const txData = {
31 | to: '0x123456ff',
32 | value: 10,
33 | };
34 |
35 | describe('', () => {
36 | test('renders correctly', () => {
37 | const component = shallow(
38 | ,
43 | );
44 |
45 | expect(toJson(component)).toMatchSnapshot();
46 | });
47 | });
48 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import BaseTokenButton from '../index';
6 |
7 | const web3Redux = {
8 | web3: () => {},
9 | };
10 |
11 | const address = {
12 | address: '0x12345',
13 | };
14 |
15 | const network = {
16 | enabled: true,
17 | };
18 |
19 | describe('', () => {
20 | test('renders correctly', () => {
21 | const component = shallow(
22 | ,
27 | );
28 |
29 | expect(toJson(component)).toMatchSnapshot();
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/base_token_balance.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import BalanceLabel from '~/components/common/balance_label';
5 |
6 | import { parseBigNumber } from '~/helpers/stringUtils';
7 |
8 | export default class BaseTokenBalance extends Component {
9 | static propTypes = {
10 | web3: PropTypes.object.isRequired,
11 | network: PropTypes.object.isRequired,
12 | address: PropTypes.object.isRequired,
13 | };
14 | componentDidMount() {
15 | const { address, web3 } = this.props;
16 | web3.eth.getBalance(address.address);
17 | }
18 | render() {
19 | const { web3, network, address } = this.props;
20 | const balance = web3.eth.balance(address.address);
21 | const parsedBalance = parseBigNumber(balance, 18);
22 | return ;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/keystores/base_token/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { registerUIs } from '~/helpers/uiRegistry';
5 |
6 | import BaseTokenBalance from './base_token_balance';
7 | import BaseTokenTransfer from './base_token_transfer';
8 | import BaseTokenTxUi from './base_token_tx_ui';
9 |
10 | // register the tx ui
11 | registerUIs({ baseTokenTx: { component: BaseTokenTxUi } });
12 |
13 | export default class BaseTokenButton extends Component {
14 | static propTypes = {
15 | web3Redux: PropTypes.object.isRequired,
16 | network: PropTypes.object.isRequired,
17 | address: PropTypes.object.isRequired,
18 | };
19 | render() {
20 | const { network, web3Redux, address } = this.props;
21 | if (!network || !network.enabled) { return null; }
22 | if (!address || !address.address) { return null; }
23 | const web3 = web3Redux.web3(network.id);
24 | if (!web3) { return null; }
25 | const gas = 21000;
26 | return (
27 | }
29 | data={{ from: address.address, gas }}
30 | {...{ network, web3 }}
31 | />
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/components/keystores/generic_transaction/__tests__/__snapshots__/index.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
18 | }
19 | />
20 | `;
21 |
--------------------------------------------------------------------------------
/src/components/keystores/generic_transaction/__tests__/generic_transaction_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import GenericTransactionForm from '../generic_transaction_form';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
15 | );
16 |
17 | expect(toJson(component)).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/keystores/generic_transaction/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import GenericTransactionForm from '../index';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | describe('', () => {
11 | test('renders correctly', () => {
12 | const component = shallow(
13 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/keystores/keystore_creation_form.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Form } from 'semantic-ui-react';
4 |
5 | import { getKeystoreComponent } from '~/keystoreTypes';
6 |
7 | import KeystoreSelector from './keystore_selector';
8 |
9 | export default class KeystoreCreationForm extends Component {
10 | static propTypes = {
11 | hideMenu: PropTypes.bool,
12 | formData: PropTypes.object.isRequired,
13 | keystoreTypes: PropTypes.array.isRequired,
14 | }
15 | static defaultProps = {
16 | hideMenu: false,
17 | }
18 | render() {
19 | const { hideMenu, formData, keystoreTypes } = this.props;
20 | const KeystoreTypeCreationForm = getKeystoreComponent({ type: 'creationForm', id: formData.type });
21 | const keystoreType = formData.type && keystoreTypes.find(ks => ks.id === formData.type);
22 | return (
23 |
24 | {!hideMenu && }
25 | {keystoreType &&
26 |
27 |
28 |
29 | }
30 |
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/components/keystores/keystore_edit_form.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Form } from 'semantic-ui-react';
4 |
5 | import { getKeystoreComponent } from '~/keystoreTypes';
6 |
7 | import KeystoreTypeMessage from './keystore_type_message';
8 |
9 | export default class KeystoreEditForm extends Component {
10 | static propTypes = {
11 | data: PropTypes.object.isRequired,
12 | }
13 | render() {
14 | const keystore = this.props.data;
15 | const KeystoreTypeEditForm = getKeystoreComponent({ type: 'editForm', id: keystore.type.id });
16 | return (
17 |
18 |
19 |
20 |
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/keystores/keystore_menu.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Header, Menu, Icon } from 'semantic-ui-react';
4 |
5 | export default class KeystoreMenu extends Component {
6 | static propTypes = {
7 | keystoreTypes: PropTypes.array.isRequired,
8 | formChange: PropTypes.func.isRequired,
9 | }
10 | constructor(props) {
11 | super(props);
12 | this.renderItem = this.renderItem.bind(this);
13 | }
14 | handleClick(value) {
15 | this.props.formChange({ name: 'type', value });
16 | }
17 | renderItem({ id, name, icon, color, subtitle }) {
18 | return (
19 | this.handleClick(id)}>
20 |
21 |
22 | {name}
23 | {subtitle}
24 |
25 |
26 | );
27 | }
28 | render() {
29 | const { keystoreTypes } = this.props;
30 | return (
31 |
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/components/keystores/keystore_type_message.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import { Icon, Message } from 'semantic-ui-react';
4 |
5 | export default class KeystoreTypeMessage extends Component {
6 | static propTypes = {
7 | keystoreType: PropTypes.object.isRequired,
8 | }
9 | render() {
10 | const { keystoreType } = this.props;
11 | return (
12 |
13 |
14 |
15 | {keystoreType.name}
16 | {keystoreType.description}
17 |
18 |
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/__snapshots__/index.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
26 |
51 |
52 | }
53 | />
54 | `;
55 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/__snapshots__/token_balance.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
12 | `;
13 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/__snapshots__/token_transfer.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 | }
25 | />
26 | `;
27 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/__snapshots__/token_transfer_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
18 |
31 |
44 |
45 | `;
46 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/__snapshots__/token_tx_ui.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
34 | `;
35 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/index.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import BaseTokenButton from '../index';
6 |
7 | const web3Redux = {
8 | web3: () => ({
9 | eth: {
10 | contract: () => ({
11 | at: () => ({}),
12 | }),
13 | },
14 | }),
15 | };
16 |
17 | const token = {
18 | address: '0x123456',
19 | networkEnabled: true,
20 | network: {
21 | id: 1,
22 | enabled: true,
23 | },
24 | };
25 |
26 | const address = {
27 | address: '0x5434132',
28 | };
29 |
30 | describe('', () => {
31 | test('renders correctly', () => {
32 | const component = shallow(
33 | ,
38 | );
39 |
40 | expect(toJson(component)).toMatchSnapshot();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/token_balance.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TokenBalance from '../token_balance';
5 |
6 | jest.mock('../../../../helpers/stringUtils', () => ({
7 | parseBigNumber: () => 20,
8 | }));
9 |
10 | const token = {
11 | decimals: 2,
12 | };
13 |
14 | const address = {
15 | address: '0x5434132',
16 | };
17 |
18 | const contract = {
19 | balanceOf: () => 10,
20 | };
21 |
22 | describe('', () => {
23 | test('renders correctly', () => {
24 | const component = shallow(
25 | ,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/token_transfer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TokenTransfer from '../token_transfer';
5 |
6 | jest.mock('../../../../helpers/stringUtils', () => ({
7 | toBigNumber: () => 20,
8 | }));
9 |
10 | const contract = {
11 | transfer: {
12 | sendTransaction: jest.fn,
13 | },
14 | balanceOf: jest.fn,
15 | };
16 |
17 | const token = {
18 | decimals: 2,
19 | name: 'test token',
20 | };
21 |
22 | describe('', () => {
23 | test('renders correctly', () => {
24 | const component = shallow(
25 | }
27 | contract={contract}
28 | token={token}
29 | />,
30 | );
31 |
32 | expect(toJson(component)).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/token_transfer_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import TokenTransferForm from '../token_transfer_form';
6 |
7 | const formData = {
8 | from: '0x12345',
9 | };
10 |
11 | const contract = {
12 | balanceOf: () => ({
13 | shift: () => ({}),
14 | }),
15 | };
16 |
17 | const token = {
18 | color: 'blue',
19 | symbol: 'GBP',
20 | decimals: 2,
21 | };
22 |
23 | describe('', () => {
24 | test('renders correctly', () => {
25 | const component = shallow(
26 | ,
32 | );
33 |
34 | expect(toJson(component)).toMatchSnapshot();
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/src/components/keystores/token/__tests__/token_tx_ui.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import TokenTxUi from '../token_tx_ui';
6 |
7 | const address = {
8 | color: 'red',
9 | address: '0x12345',
10 | name: 'test address',
11 | keystore: {
12 | type: {
13 | color: 'black',
14 | icon: 'testIcon',
15 | },
16 | },
17 | };
18 |
19 | const network = {
20 | explorerAddressPrefix: 'testPrefix',
21 | };
22 |
23 | const ui = {
24 | token: {
25 | decimals: 2,
26 | symbol: 'GBP',
27 | color: 'orange',
28 | name: 'test token',
29 | },
30 | value: 10,
31 | to: '0x432145',
32 | };
33 |
34 | describe('', () => {
35 | test('renders correctly', () => {
36 | const component = shallow(
37 | ,
42 | );
43 |
44 | expect(toJson(component)).toMatchSnapshot();
45 | });
46 | });
47 |
--------------------------------------------------------------------------------
/src/components/keystores/token/token_balance.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import BalanceLabel from '~/components/common/balance_label';
5 |
6 | import { parseBigNumber } from '~/helpers/stringUtils';
7 |
8 | export default class TokenBalance extends Component {
9 | static propTypes = {
10 | contract: PropTypes.object.isRequired,
11 | token: PropTypes.object.isRequired,
12 | address: PropTypes.object.isRequired,
13 | }
14 | componentDidMount() {
15 | const { contract, address } = this.props;
16 | contract.balanceOf.call(address.address);
17 | }
18 | render() {
19 | const { contract, token, address } = this.props;
20 | const balance = contract.balanceOf(address.address);
21 | const parsedBalance = parseBigNumber(balance, token.decimals);
22 | return ;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_info.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
8 | `;
9 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_info_table.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
22 | `;
23 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_modal.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
9 |
10 |
11 | `;
12 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_modal_container.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 | }
16 | />
17 | `;
18 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_modal_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
8 |
11 |
19 |
27 |
35 |
36 |
37 |
38 | `;
39 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/__snapshots__/transaction_signing_overlay.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `null`;
4 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_info.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import TransactionInfo from '../transaction_info';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
11 | );
12 |
13 | expect(toJson(component)).toMatchSnapshot();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_info_table.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TransactionInfoTable from '../transaction_info_table';
5 |
6 | jest.mock('../../../helpers/stringUtils', () => ({
7 | parseBigNumber: () => 20,
8 | }));
9 |
10 | const txData = {
11 | tx1: 10,
12 | tx2: 20,
13 | tx3: 30,
14 | };
15 |
16 | describe('', () => {
17 | test('renders correctly', () => {
18 | const component = shallow(
19 | ,
20 | );
21 |
22 | expect(toJson(component)).toMatchSnapshot();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_modal.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import TransactionModal from '../transaction_modal';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | }
13 | />,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_modal_container.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TransactionModalContainer from '../transaction_modal_container';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const web3Redux = {
11 | web3: () => ({
12 | eth: {
13 | contract: () => ({
14 | at: () => ({}),
15 | }),
16 | },
17 | }),
18 | };
19 |
20 | describe('', () => {
21 | test('renders correctly', () => {
22 | const component = shallow(
23 | }
31 | data={{}}
32 | closeButtonText="test close button text"
33 | noSubmitButton={false}
34 | />,
35 | );
36 |
37 | expect(toJson(component)).toMatchSnapshot();
38 | });
39 | });
40 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_modal_form.test.jsx:
--------------------------------------------------------------------------------
1 | /* eslint global-require:0 */
2 |
3 | import React from 'react';
4 | import { shallow } from 'enzyme';
5 | import toJson from 'enzyme-to-json';
6 | import TransactionModalForm from '../transaction_modal_form';
7 |
8 | jest.mock('../../../helpers/web3/connect', () => require('../../../../test/__mocks__/connectMock'));
9 |
10 | describe('', () => {
11 | test('renders correctly', () => {
12 | const component = shallow(
13 | ,
17 | );
18 |
19 | expect(toJson(component)).toMatchSnapshot();
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_signing_overlay.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TransactionSigningOverlay from '../transaction_signing_overlay';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | describe('', () => {
11 | test('renders correctly', () => {
12 | const component = shallow(
13 | ,
16 | );
17 |
18 | expect(toJson(component)).toMatchSnapshot();
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/src/components/transactions/__tests__/transaction_tracker.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import TransactionTracker from '../transaction_tracker';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const networks = [{
11 | id: 1,
12 | explorerTransactionPrefix: 'testPrefix',
13 | explorerBlockPrefix: 'blockTestPrefix',
14 | }, {
15 | id: 2,
16 | }];
17 |
18 | const web3Redux = {
19 | web3: () => ({
20 | eth: {
21 | transaction: () => jest.fn,
22 | },
23 | networkId: 1,
24 | }),
25 | };
26 |
27 | describe('', () => {
28 | test('renders correctly', () => {
29 | const component = shallow(
30 | ,
37 | );
38 |
39 | expect(toJson(component)).toMatchSnapshot();
40 | });
41 | });
42 |
--------------------------------------------------------------------------------
/src/components/transactions/transaction_info.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import { getUI } from '~/helpers/uiRegistry';
5 | import TransactionInfoTable from './transaction_info_table';
6 |
7 | export default class TransactionInfo extends Component {
8 | static propTypes = {
9 | ui: PropTypes.object,
10 | txData: PropTypes.object.isRequired,
11 | }
12 | static defaultProps = {
13 | ui: undefined,
14 | }
15 | render() {
16 | const { ui, txData } = this.props;
17 | const defaultRender = ;
18 | if (!ui) { return defaultRender; }
19 | const uiEntry = getUI(ui.type);
20 | if (!uiEntry || !uiEntry.component) { return defaultRender; }
21 | const TransactionUI = uiEntry.component;
22 | return (
23 |
24 |
25 |
26 |
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/helpers/blockie.js:
--------------------------------------------------------------------------------
1 | import blockies from 'blockies';
2 |
3 | const cache = {};
4 |
5 | export default function (_seed) {
6 | const seed = _seed.toLowerCase();
7 | if (cache[seed]) { return cache[seed]; }
8 | cache[seed] = blockies({ seed, size: 8, scale: 16 }).toDataURL();
9 | return cache[seed];
10 | }
11 |
--------------------------------------------------------------------------------
/src/helpers/offlinePlugin.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-alert, global-require */
2 |
3 | const enabled = process.env.NODE_ENV === 'production';
4 |
5 | // TODO start a timer and auto-refresh if we're not
6 | if (enabled) {
7 | let autoReload = true;
8 | setTimeout(() => { autoReload = false; }, 10 * 1000); // 10 secs
9 | const OfflinePluginRuntime = require('offline-plugin/runtime');
10 | OfflinePluginRuntime.install({
11 | onUpdateReady: () => {
12 | OfflinePluginRuntime.applyUpdate();
13 | },
14 | onUpdated: () => {
15 | if (autoReload) {
16 | return window.location.reload();
17 | }
18 | if (window.confirm('A new version of the app has been pushed. Would you like to reload?')) {
19 | return window.location.reload();
20 | }
21 | return null;
22 | },
23 | });
24 | }
25 |
--------------------------------------------------------------------------------
/src/helpers/registerReducers.js:
--------------------------------------------------------------------------------
1 | let reducerRegistry = {};
2 |
3 | export default function registerReducers(obj) {
4 | console.log('reg reducer', obj);
5 | reducerRegistry = { ...reducerRegistry, ...obj };
6 | }
7 |
8 | export function registeredReducers() {
9 | return reducerRegistry;
10 | }
11 |
--------------------------------------------------------------------------------
/src/helpers/uiRegistry.js:
--------------------------------------------------------------------------------
1 | // a registry for UI components (current only for transactions)
2 | const transactionUIRegistry = {};
3 |
4 | export function registerUIs(obj) {
5 | Object.keys(obj).forEach((key) => {
6 | transactionUIRegistry[key] = { ...obj[key] };
7 | });
8 | }
9 |
10 | export function getUI(key) {
11 | return transactionUIRegistry[key];
12 | }
13 |
--------------------------------------------------------------------------------
/src/helpers/validation.js:
--------------------------------------------------------------------------------
1 | import { lowercaseUnprefixedHex, capitalize, isAddress } from '~/helpers/stringUtils';
2 | import { getAddresses } from '~/selectors';
3 |
4 | export function validateProps(requiredProps, props) {
5 | Object.keys(requiredProps).forEach((requiredKey) => {
6 | const requiredProp = requiredProps[requiredKey];
7 | if (!requiredProp) { return null; }
8 | if (requiredProp === 'number' && isNaN(props[requiredKey])) {
9 | throw Error(`"${capitalize(requiredKey)}" must be a Number`);
10 | }
11 | if (requiredProp === 'address' && !isAddress(props[requiredKey])) {
12 | throw Error(`"${capitalize(requiredKey)}" must be a valid address`);
13 | }
14 | if (props[requiredKey] === undefined) {
15 | throw Error(`"${capitalize(requiredKey)}" is not set`);
16 | }
17 | return null;
18 | });
19 | }
20 |
21 | export function throwIfExistingAddress(addresses, getState) {
22 | const sanitizedAdddresses = addresses.map(lowercaseUnprefixedHex);
23 | const existingAddresses = getAddresses(getState()).map(({ address }) => lowercaseUnprefixedHex(address));
24 | const existing = existingAddresses.find(address => sanitizedAdddresses.indexOf(address) > -1);
25 | if (existing) {
26 | throw new Error(`Address ${existing} already exists`);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/helpers/web3/connect.js:
--------------------------------------------------------------------------------
1 | import { connect } from 'react-redux';
2 | import { web3Connect } from 'web3-redux';
3 |
4 | export default function (WrappedComponent) {
5 | return web3Connect(connect, WrappedComponent);
6 | }
7 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | <%= htmlWebpackPlugin.options.title || 'Webpack App'%>
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 | import { AppContainer } from 'react-hot-loader';
4 | import { Provider } from 'react-redux';
5 |
6 | import 'semantic-ui-less/semantic.less';
7 |
8 | import './helpers/offlinePlugin';
9 |
10 | const renderApp = () => {
11 | /* eslint-disable global-require */
12 | const NewApp = require('./components/app').default;
13 | const store = require('./store').default;
14 | /* eslint-enable global-require */
15 | render(
16 |
17 |
18 |
19 |
20 |
21 | , document.getElementById('app'));
22 | };
23 |
24 | renderApp();
25 |
26 | if (module.hot) {
27 | module.hot.accept('./components/app', () => { renderApp(); });
28 | }
29 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/__snapshots__/cold_keystore_creation_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
39 | `;
40 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/__snapshots__/cold_keystore_edit_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
37 | `;
38 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/__snapshots__/cold_keystore_transaction_signer.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
22 |
25 |
26 | `;
27 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/cold_keystore_address.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ColdKeystoreAddress from '../cold_keystore_address';
6 |
7 | const data = {
8 | address: '0x12345',
9 | enabled: true,
10 | exists: true,
11 | name: 'test name',
12 | };
13 |
14 | describe('', () => {
15 | test('renders correctly', () => {
16 | const component = shallow(
17 | ,
22 | );
23 |
24 | expect(toJson(component)).toMatchSnapshot();
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/cold_keystore_creation_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ColdKeystoreCreationForm from '../cold_keystore_creation_form';
6 |
7 | const formData = {
8 | addresses: {},
9 | };
10 |
11 | describe('', () => {
12 | test('renders correctly', () => {
13 | const component = shallow(
14 | ,
18 | );
19 |
20 | expect(toJson(component)).toMatchSnapshot();
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/cold_keystore_edit_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ColdKeystoreEditForm from '../cold_keystore_edit_form';
6 |
7 | const data = {
8 | type: 'testType',
9 | addresses: [{
10 | name: 'test address 1',
11 | address: '0x12345',
12 | tokens: [{
13 | id: 1,
14 | }, {
15 | id: 2,
16 | }],
17 | networks: [{
18 | id: 1,
19 | }, {
20 | id: 2,
21 | }],
22 | }],
23 | };
24 |
25 | describe('', () => {
26 | test('renders correctly', () => {
27 | const component = shallow(
28 | ,
34 | );
35 |
36 | expect(toJson(component)).toMatchSnapshot();
37 | });
38 | });
39 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/__tests__/cold_keystore_transaction_signer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import ColdKeystoreTransactionSigner from '../cold_keystore_transaction_signer';
6 |
7 | const txData = {
8 | to: '0x54341',
9 | from: '0x543535',
10 | data: {},
11 | value: 10,
12 | nonce: 10,
13 | gas: 100000,
14 | gasPrice: 2,
15 | chainId: 1,
16 | };
17 |
18 | describe('', () => {
19 | test('renders correctly', () => {
20 | const component = shallow(
21 | ,
25 | );
26 |
27 | expect(toJson(component)).toMatchSnapshot();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/cold_keystore_edit_form.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import ColdKeystoreCreationForm from './cold_keystore_creation_form';
5 |
6 | export default class ColdKeystoreEditForm extends Component {
7 | static propTypes = {
8 | setFormData: PropTypes.func.isRequired,
9 | data: PropTypes.object.isRequired,
10 | };
11 | componentDidMount() {
12 | this.props.setFormData({
13 | type: this.props.data.type,
14 | addresses: this.props.data.addresses.reduce((o, a, i) => ({
15 | ...o,
16 | [`${i}`]: {
17 | name: a.name,
18 | enabled: true,
19 | exists: true,
20 | address: a.address,
21 | tokens: a.tokens.map(({ id }) => id),
22 | networks: a.networks.map(({ id }) => id),
23 | },
24 | }), {}),
25 | });
26 | }
27 | render() {
28 | return ;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/keystoreTypes/cold/index.js:
--------------------------------------------------------------------------------
1 | import creationForm from './cold_keystore_creation_form';
2 | import editForm from './cold_keystore_edit_form';
3 | import transactionSigner from './cold_keystore_transaction_signer';
4 |
5 | import * as actions from './cold_keystore_actions';
6 |
7 | const components = {
8 | creationForm,
9 | editForm,
10 | transactionSigner,
11 | };
12 |
13 | export default {
14 | components,
15 | actions,
16 | };
17 |
--------------------------------------------------------------------------------
/src/keystoreTypes/index.js:
--------------------------------------------------------------------------------
1 | import v3 from './v3';
2 | import ledger from './ledger';
3 | import cold from './cold';
4 | import multisig from './multisig';
5 |
6 | const keystores = { v3, cold, ledger, multisig };
7 |
8 | export function getKeystoreComponent({ type, id }) {
9 | return ((keystores[id] || {}).components || {})[type] || null;
10 | }
11 |
12 | export function getKeystoreAction({ type, id }) {
13 | return ((keystores[id] || {}).actions || {})[type] || null;
14 | }
15 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/__snapshots__/ledger_keystore_address_list.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
12 | Ledger
13 | 1
14 |
15 |
21 |
22 | `;
23 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/__snapshots__/ledger_keystore_creation_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
7 | `;
8 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/__snapshots__/ledger_keystore_edit_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
12 | `;
13 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/__snapshots__/ledger_keystore_transaction_signer.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
14 | `;
15 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/ledger_keystore_address_item.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import LedgerKeystoreAddressItem from '../ledger_keystore_address_item';
6 |
7 | jest.mock('../../../helpers/blockie');
8 |
9 | const data = {
10 | name: 'test name',
11 | enabled: true,
12 | };
13 |
14 | describe('', () => {
15 | test('renders correctly', () => {
16 | const component = shallow(
17 | ,
23 | );
24 |
25 | expect(toJson(component)).toMatchSnapshot();
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/ledger_keystore_address_list.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import LedgerKeystoreAddressList from '../ledger_keystore_address_list';
6 |
7 | const config = {
8 | version: 1,
9 | };
10 |
11 | const ethLedger = {
12 | getAddress_async: () => jest.fn,
13 | };
14 |
15 | describe('', () => {
16 | test('renders correctly', () => {
17 | const component = shallow(
18 | ,
23 | );
24 |
25 | expect(toJson(component)).toMatchSnapshot();
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/ledger_keystore_creation_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import LedgerKeystoreCreationForm from '../ledger_keystore_creation_form';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/ledger_keystore_edit_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import LedgerKeystoreEditForm from '../ledger_keystore_edit_form';
6 |
7 | const data = {
8 | type: 'testType',
9 | addresses: [{
10 | name: 'test address 1',
11 | address: '0x12345',
12 | kdPath: 'kdpath test',
13 | tokens: [{
14 | id: 1,
15 | }, {
16 | id: 2,
17 | }],
18 | networks: [{
19 | id: 1,
20 | }, {
21 | id: 2,
22 | }],
23 | }],
24 | };
25 |
26 | const formData = {
27 | addresses: [],
28 | };
29 |
30 | describe('', () => {
31 | test('renders correctly', () => {
32 | const component = shallow(
33 | ,
39 | );
40 |
41 | expect(toJson(component)).toMatchSnapshot();
42 | });
43 | });
44 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/__tests__/ledger_keystore_transaction_signer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import LedgerKeystoreTransactionSigner from '../ledger_keystore_transaction_signer';
6 |
7 | const address = {
8 | kdPath: 'kdPath test',
9 | address: '0x123435',
10 | };
11 |
12 | describe('', () => {
13 | test('renders correctly', () => {
14 | const component = shallow(
15 | ,
20 | );
21 |
22 | expect(toJson(component)).toMatchSnapshot();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/index.js:
--------------------------------------------------------------------------------
1 | import creationForm from './ledger_keystore_creation_form';
2 | import editForm from './ledger_keystore_edit_form';
3 | import transactionSigner from './ledger_keystore_transaction_signer';
4 | import * as actions from './ledger_keystore_actions';
5 |
6 | const components = {
7 | creationForm,
8 | editForm,
9 | transactionSigner,
10 | };
11 |
12 | export default {
13 | components,
14 | actions,
15 | };
16 |
--------------------------------------------------------------------------------
/src/keystoreTypes/ledger/ledger_keystore_edit_form.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import LedgerKeystoreCreationForm from './ledger_keystore_creation_form';
5 |
6 | export default class LedgerKeystoreEditForm extends Component {
7 | static propTypes = {
8 | setFormData: PropTypes.func.isRequired,
9 | data: PropTypes.object.isRequired,
10 | formChange: PropTypes.func.isRequired,
11 | formData: PropTypes.object.isRequired,
12 | }
13 | componentDidMount() {
14 | this.props.setFormData({
15 | type: this.props.data.type,
16 | addresses: this.props.data.addresses.reduce((o, a) => ({
17 | ...o,
18 | [a.kdPath]: {
19 | name: a.name,
20 | kdPath: a.kdPath,
21 | enabled: true,
22 | address: a.address, // TODO ensure we don't override other addresses
23 | tokens: a.tokens.map(({ id }) => id),
24 | networks: a.networks.map(({ id }) => id),
25 | },
26 | }), {}),
27 | });
28 | }
29 | render() {
30 | const { formChange, formData } = this.props;
31 | if (!formData.addresses) { return null; }
32 | return (
33 |
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_deploy_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 |
6 |
11 |
12 |
13 |
16 |
26 |
36 |
37 |
38 |
43 |
44 |
45 | `;
46 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_deploy_tx_ui.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
32 | `;
33 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_edit_form.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
35 | `;
36 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_info.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `null`;
4 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_transaction_proxy.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
5 | Loading...
6 |
7 | `;
8 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/__snapshots__/multisig_keystore_transaction_signer.test.jsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[` renders correctly 1`] = `
4 |
31 | `;
32 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_creation_form.test.jsx:
--------------------------------------------------------------------------------
1 | /* eslint global-require:0 */
2 | import React from 'react';
3 | import { shallow } from 'enzyme';
4 | import toJson from 'enzyme-to-json';
5 | import MultisigKeystoreCreationForm from '../multisig_keystore_creation_form';
6 |
7 | jest.mock('../../../helpers/web3/connect', () => require('../../../../test/__mocks__/connectMock'));
8 |
9 | describe('', () => {
10 | test('renders correctly', () => {
11 | const component = shallow(
12 | ,
16 | );
17 |
18 | expect(toJson(component)).toMatchSnapshot();
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_deploy_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MultisigKeystoreDeployForm from '../multisig_keystore_deploy_form';
6 |
7 | describe('', () => {
8 | test('renders correctly', () => {
9 | const component = shallow(
10 | ,
14 | );
15 |
16 | expect(toJson(component)).toMatchSnapshot();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_deploy_tx_ui.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MultisigKeystoreDeployTxUi from '../multisig_keystore_deploy_tx_ui';
6 |
7 | const address = {
8 | keystore: {
9 | type: {
10 | color: 'black',
11 | icon: 'testIcon',
12 | },
13 | },
14 | name: 'test network',
15 | address: '0x213452',
16 | color: 'blue',
17 | };
18 |
19 | const network = {
20 | explorerAddressPrefix: 'testPrefix',
21 | name: 'test network',
22 | };
23 |
24 | const ui = {
25 | required: 2,
26 | count: 5,
27 | };
28 |
29 | describe('', () => {
30 | test('renders correctly', () => {
31 | const component = shallow(
32 | ,
37 | );
38 |
39 | expect(toJson(component)).toMatchSnapshot();
40 | });
41 | });
42 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_edit_form.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MultisigKeystoreEditForm from '../multisig_keystore_edit_form';
6 |
7 | const data = {
8 | type: 'testType',
9 | addresses: [{
10 | name: 'test address 1',
11 | address: '0x12345',
12 | tokens: [{
13 | id: 1,
14 | }, {
15 | id: 2,
16 | }],
17 | networks: [{
18 | id: 1,
19 | }, {
20 | id: 2,
21 | }],
22 | }],
23 | };
24 |
25 | describe('', () => {
26 | test('renders correctly', () => {
27 | const component = shallow(
28 | ,
32 | );
33 |
34 | expect(toJson(component)).toMatchSnapshot();
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_info.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MultisigKeystoreInfo from '../multisig_keystore_info';
6 |
7 | const formData = {
8 | type: 'testType',
9 | addresses: [{
10 | name: 'test address 1',
11 | address: '0x12345',
12 | tokens: [{
13 | id: 1,
14 | }, {
15 | id: 2,
16 | }],
17 | networks: [{
18 | id: 1,
19 | }, {
20 | id: 2,
21 | }],
22 | }],
23 | };
24 |
25 | describe('', () => {
26 | test('renders correctly', () => {
27 | const component = shallow(
28 | ,
31 | );
32 |
33 | expect(toJson(component)).toMatchSnapshot();
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_transaction_proxy.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 |
5 | import MultisigKeystoreTransactionProxy from '../multisig_keystore_transaction_proxy';
6 |
7 | const contract = {
8 | address: '0x12345',
9 | submitTransaction: {
10 | getData: () => ({}),
11 | },
12 | };
13 |
14 | const addresses = [{
15 | address: '0x54325',
16 | }, {
17 | address: '0x6423466',
18 | }];
19 |
20 | describe('', () => {
21 | test('renders correctly', () => {
22 | const component = shallow(
23 | ,
29 | );
30 |
31 | expect(toJson(component)).toMatchSnapshot();
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/__tests__/multisig_keystore_transaction_signer.test.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { shallow } from 'enzyme';
3 | import toJson from 'enzyme-to-json';
4 | import MultisigKeystoreTransactionSigner from '../multisig_keystore_transaction_signer';
5 |
6 | jest.mock('react-redux', () => ({
7 | connect: () => component => component,
8 | }));
9 |
10 | const web3Redux = {
11 | web3: () => ({
12 | isConnected: () => true,
13 | eth: {
14 | contract: () => ({
15 | at: () => ({}),
16 | }),
17 | },
18 | }),
19 | };
20 |
21 | const network = {
22 | id: 1,
23 | };
24 |
25 | describe('', () => {
26 | test('renders correctly', () => {
27 | const component = shallow(
28 | ,
34 | );
35 |
36 | expect(toJson(component)).toMatchSnapshot();
37 | });
38 | });
39 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/index.js:
--------------------------------------------------------------------------------
1 | import { registerUIs } from '~/helpers/uiRegistry';
2 |
3 | import creationForm from './multisig_keystore_creation_form';
4 | import editForm from './multisig_keystore_edit_form';
5 | import transactionSigner from './multisig_keystore_transaction_signer';
6 | import MultisigKeystoreDeployTxUi from './multisig_keystore_deploy_tx_ui';
7 | import * as actions from './multisig_keystore_actions';
8 |
9 | registerUIs({ multisigKeystoreDeployTxUi: { component: MultisigKeystoreDeployTxUi } });
10 |
11 | const components = {
12 | creationForm,
13 | editForm,
14 | transactionSigner,
15 | };
16 |
17 | export default {
18 | components,
19 | actions,
20 | };
21 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/multisig_keystore_edit_form.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | import MultSigKeystoreCreationForm from './multisig_keystore_creation_form';
5 |
6 | export default class MultSigKeystoreEditForm extends Component {
7 | componentDidMount() {
8 | const formData = this.props.data.addresses[0];
9 | this.props.setFormData({
10 | type: this.props.data.type,
11 | address: formData.address,
12 | name: formData.name,
13 | tokens: formData.tokens.map(({ id }) => id),
14 | networks: formData.networks.map(({ id }) => id),
15 | });
16 | }
17 | render() {
18 | return (
19 |
20 | );
21 | }
22 | }
23 |
24 | MultSigKeystoreEditForm.propTypes = {
25 | setFormData: PropTypes.func.isRequired,
26 | data: PropTypes.object.isRequired,
27 | };
28 |
--------------------------------------------------------------------------------
/src/keystoreTypes/multisig/multisig_keystore_info.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import PropTypes from 'prop-types';
3 | import EZModal from 'sui-react-ezmodal';
4 | import { Button } from 'semantic-ui-react';
5 |
6 | import MultiSig from '@digix/truffle-gnosis-multisig/spectrum/index.jsx';
7 |
8 | export default class MultisigKeystoreInfo extends Component {
9 | render() {
10 | const { formData } = this.props;
11 | const { networks, address } = formData;
12 | const networkId = (networks || [])[0];
13 | if (!networkId || !address) { return null; }
14 | return (
15 | }
19 | trigger={