Compare commits

...
Author SHA1 Message Date
Andrea Maria Piana 5edbd0f31c Update snx/synth contract 2020-10-06 12:13:23 +02:00
andrey 9f0ba0f67e fixed custom tokens 2020-10-06 11:38:54 +02:00
andrey 4a0ad12f3a fixed keycard tokens 2020-10-06 10:44:21 +02:00
andrey e52706a48e fix lint 2020-10-06 09:25:39 +02:00
andrey 5d4f48662a do not request tokens for new account 2020-10-06 08:20:48 +02:00
andrey 619c589bc8 update token balances and prices when selecting token 2020-10-06 07:42:26 +02:00
andrey 31e18663bd fix token balances for account creation 2020-10-05 20:12:08 +02:00
jakub 2a21b6c142 fix availability of INFURA_TOKEN for Android build
The env variable `INFURA_TOKEN` is used at build time of JS bundle, not
the final APK file. We never passed the `secretsFile` to the
derivation for JS bundle so it never saw the `INFURA_TOKEN`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-10-05 16:41:09 +02:00
andrey e1cbd3936f fix init wallet 2020-10-05 16:19:06 +02:00
andrey 99c6aa8512 fix js object 2020-10-05 14:48:50 +02:00
Andrea Maria Piana 2ad863a854 Bump version to 1.7.2 2020-10-05 13:11:42 +02:00
andrey c7ba1dea21 do not show zeros for token balances, and fetch all tokens only when creating new account 2020-10-05 13:10:08 +02:00
Andrea Maria Piana e4a65b3a23 Fix infura token
Setting a top-level closure-defines does not have any effect,
it needs to be for some reason inside each environment.
2020-10-05 13:08:50 +02:00
Andrea Maria Piana 385bf0d023 Add hotfix for wallet balance 2020-10-05 13:02:14 +02:00
Andrea Maria Piana 2d4638ab7f Fix migration when interrupted 2020-10-01 14:40:43 +02:00
andrey e40664533d override custom tokens
Signed-off-by: andrey <motor4ik@gmail.com>
2020-09-25 14:05:54 +02:00
Churikova Tetiana f152f8156f disable collectible e2e
Signed-off-by: andrey <motor4ik@gmail.com>
2020-09-25 14:05:53 +02:00
andrey b206a4e955 [#11218] Hard code fix for SUPR NFT support
Drop collectibles details support
2020-09-25 14:05:51 +02:00
andrey a18c429fee add images
Signed-off-by: andrey <motor4ik@gmail.com>
2020-09-25 14:05:51 +02:00
andrey 420e3f3586 [#11222] Add aUSDC token and optimize search for Aave (LEND) (aka Ethlend) 2020-09-25 14:05:50 +02:00
41 changed files with 128 additions and 480 deletions
+1 -1
View File
@@ -1 +1 @@
1.7.0
1.7.2
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'macos-xcode-11.5' }
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label params.AGENT_LABEL }
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'macos' }
+1 -1
View File
@@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.3'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }
+14 -1
View File
@@ -4,6 +4,9 @@
{ stdenv, lib, deps, pkgs }:
# Path to the file containing secret environment variables
{ secretsFile ? "" }:
stdenv.mkDerivation {
name = "status-react-build-jsbundle-android";
src =
@@ -36,8 +39,18 @@ stdenv.mkDerivation {
};
};
buildInputs = with pkgs; [ clojure nodejs bash git openjdk];
phases = [
"unpackPhase" "secretsPhase" "patchPhase"
"configurePhase" "buildPhase" "installPhase"
];
# For optional INFURA_TOKEN variable
secretsPhase = if (secretsFile != "") then ''
source "${secretsFile}"
'' else ''
echo "No secrets provided!"
'';
phases = [ "unpackPhase" "patchPhase" "configurePhase" "buildPhase" "installPhase" ];
# Patching shadow-cljs.edn so it uses the local maven repo of dependencies provided by Nix
patchPhase =
let anchor = ''{:source-paths ["src" "test/cljs"]'';
+4 -1
View File
@@ -19,6 +19,9 @@ let
toLower optionalString stringLength assertMsg
getConfig makeLibraryPath assertEnvVarSet elem;
# Pass secretsFile for INFURA_TOKEN to jsbundle build
builtJsBundle = jsbundle { inherit secretsFile; };
buildType = getConfig "build-type" "release";
buildNumber = getConfig "build-number" 9999;
gradleOpts = getConfig "android.gradle-opts" null;
@@ -98,7 +101,7 @@ in stdenv.mkDerivation rec {
cp -bf ./${envFileName} ./.env
# Copy index.js and app/ input files
cp -ra --no-preserve=ownership ${jsbundle}/* ./
cp -ra --no-preserve=ownership ${builtJsBundle}/* ./
# Copy android/ directory
mkdir -p ./android/build
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

+3 -3
View File
@@ -38,7 +38,6 @@
{:target :react-native
:output-dir "app"
:init-fn status-im.core/init
:closure-defines {"status-im.utils.config/INFURA_TOKEN" #shadow/env "INFURA_TOKEN"}
:dev {:devtools {:after-load status-im.reloader/reload
:preloads [re-frisk-remote.preload]}
:compiler-options {:closure-defines
@@ -50,7 +49,8 @@
:local-ip #shadow/env "SHADOW_HOST"}
:chunks {:fleets status-im.default-fleet/default-fleets
:chats status-im.chat.default-chats/default-chats}
:release {:compiler-options {:output-feature-set :es6
:release {:closure-defines {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"}
:compiler-options {:output-feature-set :es6
;;disable for android build as there
;;is an intermittent warning with deftype
:warnings-as-errors false
@@ -67,8 +67,8 @@
{:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :simple
:closure-defines {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"}
:target :node-test
:closure-defines {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"}
:compiler-options {;; needed because we override require and it
;; messes with source-map which reports callstack
;; exceeded exceptions instead of real issues
+11 -3
View File
@@ -485,6 +485,10 @@
:nft? true
:name "SupeRare"
:address "0x41a322b28d0ff354040e2cbc676f0320d8c8850d"}
{:symbol :SUPRR
:nft? true
:name "SuperRare"
:address "0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0"}
{:symbol :KDO
:nft? true
:name "KudosToken"
@@ -641,7 +645,7 @@
:decimals 9
:symbol :XRL
:name "RIALTO"}
{:address "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F"
{:address "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F"
:decimals 18
:symbol :SNX
:name "Synthetix Network Token"}
@@ -705,7 +709,7 @@
:symbol :DTA
:name "Data Token"
:decimals 18}
{:address "0x57ab1e02fee23774580c119740129eac7081e9d3"
{:address "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51"
:symbol :sUSD
:name "Synth sUSD"
:decimals 18}
@@ -736,7 +740,11 @@
{:address "0x8ab7404063ec4dbcfd4598215992dc3f8ec853d7"
:symbol :AKRO
:name "Akropolis"
:decimals 18}])
:decimals 18}
{:address "0x9ba00d6856a4edf4665bca2c2309936572473b7e"
:symbol :aUSDC
:name "Aave Interest bearing USDC"
:decimals 6}])
:testnet
(resolve-icons :testnet
[{:name "Status Test Token"
@@ -228,7 +228,8 @@
(conj acc address)
acc))
#{}
transfers))))
transfers))
nil))
(< (count transfers) limit)
(conj (tx-history-end-reached checksum)))]
+3 -2
View File
@@ -48,7 +48,6 @@
[taoensso.timbre :as log]
status-im.waku.core
status-im.wallet.choose-recipient.core
status-im.wallet.collectibles.core
status-im.wallet.accounts.core
status-im.popover.core
[status-im.keycard.core :as keycard]
@@ -68,7 +67,8 @@
status-im.ui.screens.profile.events
status-im.chat.models.images
status-im.ui.screens.privacy-and-security-settings.events
[status-im.data-store.invitations :as data-store.invitations]))
[status-im.data-store.invitations :as data-store.invitations]
[status-im.ui.screens.wallet.events :as wallet.events]))
;; init module
(handlers/register-handler-fx
@@ -1257,4 +1257,5 @@
;; messages
:chat (chat.loading/load-messages %)
:multiaccounts (keycard/multiaccounts-screen-did-load %)
(:wallet-stack :wallet) (wallet.events/wallet-will-focus %)
nil))))
+2 -1
View File
@@ -167,7 +167,8 @@
(assoc-in [:keycard :setup-step] nil)
(dissoc :intro-wizard))}
(multiaccounts.create/on-multiaccount-created
{:derived {constants/path-wallet-root-keyword
{:recovered (get-in db [:intro-wizard :recovering?])
:derived {constants/path-wallet-root-keyword
{:public-key wallet-root-public-key
:address (eip55/address->checksum wallet-root-address)}
constants/path-whisper-keyword
+3 -2
View File
@@ -218,7 +218,7 @@
(fx/defn on-multiaccount-created
[{:keys [signing-phrase random-guid-generator db] :as cofx}
{:keys [address chat-key keycard-instance-uid key-uid
keycard-pairing keycard-paired-on mnemonic public-key]
keycard-pairing keycard-paired-on mnemonic recovered]
:as multiaccount}
password
{:keys [save-mnemonic? login?] :or {login? true save-mnemonic? false}}]
@@ -252,7 +252,8 @@
:latest-derived-path 0
:signing-phrase signing-phrase
:send-push-notifications? true
:installation-id (random-guid-generator)}
:installation-id (random-guid-generator)
:recovered (or recovered (get-in db [:intro-wizard :recovering?]))}
constants/default-multiaccount)
;; The address from which we derive any chat
;; account/encryption keys
+4 -4
View File
@@ -55,14 +55,14 @@
(fx/defn initialize-wallet
{:events [::initialize-wallet]}
[{:keys [db] :as cofx} accounts custom-tokens favourites]
[{:keys [db] :as cofx} accounts custom-tokens favourites new-account?]
(fx/merge
cofx
{:db (assoc db :multiaccount/accounts
(rpc->accounts accounts))}
(wallet/initialize-tokens custom-tokens)
(wallet/initialize-favourites favourites)
(wallet/update-balances nil)
(wallet/update-balances nil new-account?)
(prices/update-prices)))
(fx/defn login
@@ -266,6 +266,7 @@
;;so here we set it at 1 already so that it passes the check once it has
;;been initialized
:filters/initialized 1))
:dispatch-later [{:ms 2000 :dispatch [::initialize-wallet accounts nil nil (:recovered multiaccount)]}]
:filters/load-filters [[]]}
(finish-keycard-setup)
(when first-account?
@@ -275,8 +276,7 @@
:mailserver-topics {}
:default-mailserver true})
(multiaccounts/switch-preview-privacy-mode-flag)
(logging/set-log-level (:log-level multiaccount))
(initialize-wallet accounts nil nil))))
(logging/set-log-level (:log-level multiaccount)))))
(defn- keycard-setup? [cofx]
(boolean (get-in cofx [:db :keycard :flow])))
+1 -1
View File
@@ -13,7 +13,7 @@
{:db (assoc db :network-status (if is-connected? :online :offline))}
(when is-connected?
(if-not (= (count (get-in db [:wallet :accounts])) (count (get db :multiaccount/accounts)))
(wallet/update-balances nil)))))
(wallet/update-balances nil nil)))))
(fx/defn change-network-type
[{:keys [db] :as cofx} old-network-type network-type expensive?]
+2 -2
View File
@@ -1274,9 +1274,9 @@
(defn get-asset-amount [balances sym]
(reduce #(if-let [^js bl (get %2 sym)]
(.plus ^js %1 bl)
(.plus ^js (or ^js %1 ^js (money/bignumber 0)) bl)
%1)
^js (money/bignumber 0)
nil
balances))
(re-frame/reg-sub
@@ -11,7 +11,6 @@
[status-im.ui.screens.routing.intro-login-stack :as intro-login-stack]
[status-im.ui.screens.routing.chat-stack :as chat-stack]
[status-im.ui.screens.routing.wallet-stack :as wallet-stack]
[status-im.ui.screens.wallet.events :as wallet.events]
[status-im.ui.screens.group.views :as group-chat]
[status-im.ui.screens.group.events :as group.events]
[status-im.ui.screens.routing.profile-stack :as profile-stack]
@@ -43,7 +42,6 @@
:insets {:top false}
:component browser-stack/browser-stack}
{:name :wallet-stack
:on-focus [::wallet.events/wallet-stack]
:insets {:top false}
:component wallet-stack/wallet-stack}
{:name :profile-stack
@@ -1,6 +1,5 @@
(ns status-im.ui.screens.routing.wallet-stack
(:require [status-im.ui.screens.currency-settings.views :as currency-settings]
[status-im.ui.screens.wallet.collectibles.views :as collectibles]
[status-im.ui.screens.wallet.settings.views :as wallet-settings]
[status-im.ui.screens.wallet.transactions.views :as wallet-transactions]
[status-im.ui.screens.wallet.custom-tokens.views :as custom-tokens]
@@ -29,8 +28,6 @@
:component add-account/pin}
{:name :account-settings
:component account-settings/account-settings}
{:name :collectibles-list
:component collectibles/collectibles-list}
{:name :wallet-transaction-details
:component wallet-transactions/transaction-details}
{:name :wallet-settings-assets
-5
View File
@@ -15,11 +15,6 @@
[status-im.ui.screens.multiaccounts.recover.views :as recover.views]
[status-im.ui.screens.wallet.send.views :as wallet]
[status-im.ui.components.status-bar.view :as statusbar]
status-im.ui.screens.wallet.collectibles.etheremon.views
status-im.ui.screens.wallet.collectibles.cryptostrikers.views
status-im.ui.screens.wallet.collectibles.cryptokitties.views
status-im.ui.screens.wallet.collectibles.superrare.views
status-im.ui.screens.wallet.collectibles.kudos.views
[status-im.ui.components.colors :as colors]
[status-im.keycard.test-menu :as keycard.test-menu]
[quo.core :as quo]
@@ -80,26 +80,38 @@
colors/white-persist
#(re-frame/dispatch [:show-popover {:view :share-account :address address}])]]]))
(defn render-collectible [address]
(fn [{:keys [name icon amount] :as collectible}]
(let [items-number (money/to-fixed amount)
details? (pos? items-number)]
[quo/list-item
{:title (wallet.utils/display-symbol collectible)
:subtitle name
:icon [list/item-image icon]
:on-press (when details?
#(re-frame/dispatch
[:show-collectibles-list collectible address]))
:chevron :true
:accessory :text
:accessory-text items-number}])))
(defn render-collectible [{:keys [name icon amount] :as collectible}]
(let [items-number (money/to-fixed amount)]
[quo/list-item
{:title (wallet.utils/display-symbol collectible)
:subtitle name
:icon [list/item-image icon]
:accessory :text
:accessory-text items-number}]))
(views/defview transactions [address]
(views/letsubs [{:keys [transaction-history-sections]}
[:wallet.transactions.history/screen address]]
[history/history-list transaction-history-sections address]))
(defn collectibles-link []
[react/touchable-highlight
{:on-press #(re-frame/dispatch [:browser.ui/open-url "https://opensea.io/account/"])}
[react/view
{:style {:flex 1
:padding-horizontal 14
:flex-direction :row
:align-items :center
:background-color colors/blue-light
:height 52}}
[icons/tiny-icon
:tiny-icons/tiny-external
{:color colors/blue
:container-style {:margin-right 5}}]
[react/text
{:style {:color colors/blue}}
(i18n/label :t/check-on-opensea)]]])
(views/defview assets-and-collections [address]
(views/letsubs [{:keys [tokens nfts]} [:wallet/visible-assets-with-values address]
currency [:wallet/currency]]
@@ -116,14 +128,16 @@
:key-fn :name
:render-fn (accounts/render-asset (:code currency))}]
(= tab :nft)
(if (seq nfts)
[list/flat-list {:data nfts
:default-separator? false
:key-fn :name
:render-fn (render-collectible address)}]
[react/view {:align-items :center :margin-top 32}
[react/text {:style {:color colors/gray}}
(i18n/label :t/no-collectibles)]])
[react/view
[collectibles-link]
(if (seq nfts)
[list/flat-list {:data nfts
:default-separator? false
:key-fn :name
:render-fn render-collectible}]
[react/view {:align-items :center :margin-top 32}
[react/text {:style {:color colors/gray}}
(i18n/label :t/no-collectibles)]])]
(= tab :history)
[transactions address])])))
@@ -74,12 +74,14 @@
[quo/list-item
(merge {:title [quo/text {:weight :medium}
[quo/text {:weight :inherit}
(str (wallet.utils/format-amount amount decimals)
(str (if amount
(wallet.utils/format-amount amount decimals)
"...")
" ")]
[quo/text {:color :secondary
:weight :inherit}
(wallet.utils/display-symbol token)]]
:subtitle (str (if value value "0.00") " " currency)
:subtitle (str (if value value "...") " " currency)
:accessibility-label (str (:symbol token) "-asset-value")
:icon (if icon
[list/item-image icon]
@@ -1,27 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.cryptokitties.views
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.screens.wallet.collectibles.views :as collectibles]
[status-im.ui.components.svgimage :as svgimage]
[quo.core :as quo]))
(defmethod collectibles/render-collectible :CK [_ {:keys [id name bio image_url]}]
[react/view {:style styles/details}
[react/view {:style styles/details-text}
[svgimage/svgimage {:style styles/details-image
:source {:uri image_url}}]
[react/view {:flex 1}
[react/text {:style styles/details-name}
(or name (i18n/label :t/cryptokitty-name {:id id}))]
[react/text {:number-of-lines 3
:ellipsize-mode :tail}
bio]]]
[quo/list-item
{:theme :accent
:title (i18n/label :t/view-cryptokitties)
:icon :main-icons/address
:accessibility-label :open-collectible-button
:on-press #(re-frame/dispatch [:open-collectible-in-browser
(str "https://www.cryptokitties.co/kitty/" id)])}]])
@@ -1,26 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.cryptostrikers.views
(:require [re-frame.core :as re-frame]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.components.svgimage :as svgimage]
[status-im.ui.screens.wallet.collectibles.views :as collectibles]
[status-im.i18n :as i18n]
[quo.core :as quo]))
(defmethod collectibles/render-collectible :STRK [_ {:keys [external_url description name image]}]
[react/view {:style styles/details}
[react/view {:style styles/details-text}
[svgimage/svgimage {:style styles/details-image
:source {:uri image
:k 1.4}}]
[react/view {:flex 1 :justify-content :center}
[react/text {:style styles/details-name}
name]
[react/text
description]]]
[quo/list-item
{:theme :accent
:title (i18n/label :t/view-cryptostrikers)
:icon :main-icons/address
:accessibility-label :open-collectible-button
:on-press #(re-frame/dispatch [:open-collectible-in-browser external_url])}]])
@@ -1,26 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.etheremon.views
(:require [re-frame.core :as re-frame]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.components.svgimage :as svgimage]
[status-im.ui.screens.wallet.collectibles.views :as collectibles]
[status-im.i18n :as i18n]
[quo.core :as quo]))
(defmethod collectibles/render-collectible :EMONA [_ {:keys [user_defined_name image class_id]}]
[react/view {:style styles/details}
[react/view {:style styles/details-text}
[react/view {:flex 1}
[svgimage/svgimage {:style styles/details-image
:source {:uri image
:k 2}}]]
[react/view {:flex 1 :justify-content :center}
[react/text {:style styles/details-name}
user_defined_name]]]
[quo/list-item
{:theme :accent
:title (i18n/label :t/view-etheremon)
:icon :main-icons/address
:accessibility-label :open-collectible-button
:on-press #(re-frame/dispatch [:open-collectible-in-browser
(str "https://www.etheremon.com/#/mons/" class_id)])}]])
@@ -1,26 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.kudos.views
(:require [status-im.ui.screens.wallet.collectibles.views :as collectibles]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.components.svgimage :as svgimage]
[re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[quo.core :as quo]))
(defmethod collectibles/render-collectible :KDO [_ {:keys [external_url description name image]}]
[react/view {:style styles/details}
[react/view {:style styles/details-text}
[svgimage/svgimage {:style styles/details-image
:source {:uri image
:k 1.4}}]
[react/view {:flex 1 :justify-content :center}
[react/text {:style styles/details-name}
name]
[react/text
description]]]
[quo/list-item
{:theme :accent
:title (i18n/label :t/view-gitcoin)
:icon :main-icons/address
:accessibility-label :open-collectible-button
:on-press #(re-frame/dispatch [:open-collectible-in-browser external_url])}]])
@@ -1,27 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.styles)
(def default-collectible
{:padding-left 10
:padding-vertical 20})
(def loading-indicator
{:flex 1
:align-items :center
:justify-content :center})
(def details
{:padding-vertical 10})
(def details-text
{:flex 1
:flex-direction :row
:align-items :center
:padding-horizontal 16})
(def details-name
{:text-align-vertical :center
:margin-bottom 10})
(def details-image
{:flex 1
:margin 10})
@@ -1,26 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.superrare.views
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.screens.wallet.collectibles.views :as collectibles]
[quo.core :as quo]))
(defmethod collectibles/render-collectible :SUPR [_ {tokenId :tokenId {:keys [description name imageUri]} :metadata}]
[react/view {:style styles/details}
[react/view {:style styles/details-text}
[react/image {:style (merge {:resize-mode :contain :width 100 :height 100} styles/details-image)
:source {:uri imageUri
:k 1.4}}]
[react/view {:flex 1 :justify-content :center}
[react/text {:style styles/details-name}
name]
[react/text
description]]]
[quo/list-item
{:theme :accent
:title (i18n/label :t/view-superrare)
:icon :main-icons/address
:accessibility-label :open-collectible-button
:on-press #(re-frame/dispatch [:open-collectible-in-browser
(str "https://superrare.co/artwork/" name "-" tokenId)])}]])
@@ -1,34 +0,0 @@
(ns status-im.ui.screens.wallet.collectibles.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [status-im.i18n :as i18n]
[status-im.ui.components.colors :as colors]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.styles :as component.styles]
[status-im.ui.screens.wallet.collectibles.styles :as styles]
[status-im.ui.components.topbar :as topbar]))
(defmulti render-collectible (fn [symbol _] symbol))
(defmethod render-collectible :default [symbol {:keys [id name]}]
[react/view {:style styles/default-collectible}
[react/text (str (clojure.core/name symbol) " #" (or id name))]])
(defview collectibles-list []
(letsubs [{:keys [name symbol]} [:get-screen-params]
collectibles [:screen-collectibles]]
[react/view {:style component.styles/flex}
[topbar/topbar {:title name}]
(cond
(nil? collectibles)
[react/view {:style styles/loading-indicator}
[react/activity-indicator {:animating true :size :large :color colors/blue}]]
(seq collectibles)
[list/flat-list {:data collectibles
:key-fn (comp str :id)
:render-fn #(render-collectible symbol %)}]
:else
;; Should never happen. Less confusing to debug new NFT support.
[react/view {:style styles/loading-indicator}
[react/text (i18n/label :t/error)]])]))
+12 -11
View File
@@ -1,17 +1,18 @@
(ns status-im.ui.screens.wallet.events
(:require [status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[status-im.utils.handlers :as handlers]))
[status-im.utils.handlers :as handlers]
[status-im.utils.fx :as fx]))
(handlers/register-handler-fx
::wallet-stack
(fn [{:keys [db]}]
(let [wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?])
sign-phrase-showed? (get db :wallet/sign-phrase-showed?)]
{:dispatch [:wallet.ui/pull-to-refresh] ;TODO temporary simple fix for v1
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
db
(assoc db :popover/popover {:view [signing-phrase/signing-phrase]}
:wallet/sign-phrase-showed? true))})))
(fx/defn wallet-will-focus
{:events [::wallet-stack]}
[{:keys [db]}]
(let [wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?])
sign-phrase-showed? (get db :wallet/sign-phrase-showed?)]
{:dispatch [:wallet.ui/pull-to-refresh] ;TODO temporary simple fix for v1
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
db
(assoc db :popover/popover {:view [signing-phrase/signing-phrase]}
:wallet/sign-phrase-showed? true))}))
(handlers/register-handler-fx
::wallet-add-custom-token
+1 -1
View File
@@ -201,7 +201,7 @@
(fx/merge cofx
{:db (update-in db [:add-account :account] merge account)}
(save-new-account)
(wallet/update-balances nil)
(wallet/update-balances nil true)
(prices/update-prices)
(navigation/navigate-back)))))
-197
View File
@@ -1,197 +0,0 @@
(ns status-im.wallet.collectibles.core
(:require [re-frame.core :as re-frame]
[status-im.browser.core :as browser]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.erc721 :as erc721]
[status-im.ethereum.tokens :as tokens]
[status-im.utils.handlers :as handlers]
[status-im.utils.money :as money]
[status-im.utils.http :as http]
[clojure.string :as string]
[status-im.utils.types :as types]))
;;TODO: REPLACE ALL HANDLERS BY FX/DEFN
(defmulti load-collectible-fx (fn [_ symbol _] symbol))
(defmethod load-collectible-fx :default [_ _ _] nil)
(defmulti load-collectibles-fx (fn [_ symbol _ _ _] symbol))
(defmethod load-collectibles-fx :default [all-tokens symbol items-number address]
{:load-collectibles-fx [all-tokens symbol items-number address]})
(defn load-token [i items-number contract address symbol]
(when (< i items-number)
(erc721/token-of-owner-by-index contract address i
(fn [response]
(load-token (inc i) items-number contract address symbol)
(re-frame/dispatch [:load-collectible symbol response])))))
(re-frame/reg-fx
:load-collectibles-fx
(fn [[all-tokens symbol items-number address]]
(let [contract (:address (tokens/symbol->token all-tokens symbol))]
(load-token 0 items-number contract address symbol))))
(handlers/register-handler-fx
:show-collectibles-list
(fn [{:keys [db]} [_ {:keys [symbol amount] :as collectible} address]]
(let [all-tokens (:wallet/all-tokens db)
items-number (money/to-number amount)
loaded-items-number (count (get-in db [:collectibles symbol]))]
(merge (when (not= items-number loaded-items-number)
(load-collectibles-fx all-tokens symbol items-number address))
{:dispatch [:navigate-to :collectibles-list collectible]}))))
;; Crypto Kitties
(def ck :CK)
(handlers/register-handler-fx
:load-kitties
(fn [{db :db} [_ ids]]
{:db (update-in db [:collectibles] merge {ck (sorted-map-by >)})
:http-get-n (mapv (fn [id]
{:url (str "https://api.cryptokitties.co/kitties/" id)
:on-success (fn [o]
(re-frame/dispatch [:load-collectible-success ck {id (http/parse-payload o)}]))
:on-error (fn [o]
(re-frame/dispatch [:load-collectible-failure ck {id (http/parse-payload o)}]))})
ids)}))
(defmethod load-collectibles-fx ck [_ _ items-number address _]
{:http-get-n (mapv (fn [offset]
{:url (str "https://api.cryptokitties.co/kitties?limit=20&offset="
offset
"&owner_wallet_address="
address
"&parents=false")
:on-success (fn [o]
(re-frame/dispatch [:load-kitties (map :id (:kitties (http/parse-payload o)))]))
:on-error (fn [o]
(re-frame/dispatch [:load-collectibles-failure (http/parse-payload o)]))
:timeout-ms 10000})
(range 0 items-number 20))}) ;; Cryptokitties API limited to 20 items per request
;; Crypto Strikers
(def strikers :STRK)
(defmethod load-collectible-fx strikers [_ _ id]
{:http-get {:url (str "https://us-central1-cryptostrikers-prod.cloudfunctions.net/cards/" id)
:on-success (fn [o]
(re-frame/dispatch [:load-collectible-success strikers {id (http/parse-payload o)}]))
:on-error (fn [o]
(re-frame/dispatch [:load-collectible-failure strikers {id (http/parse-payload o)}]))}})
;;Etheremona
(def emona :EMONA)
(defmethod load-collectible-fx emona [_ _ id]
{:http-get {:url (str "https://www.etheremon.com/api/monster/get_data?monster_ids=" id)
:on-success (fn [o]
(re-frame/dispatch [:load-collectible-success emona (:data (http/parse-payload o))]))
:on-error (fn [o]
(re-frame/dispatch [:load-collectible-failure emona {id (http/parse-payload o)}]))}})
;;Kudos
(def kudos :KDO)
(defmethod load-collectible-fx kudos [{db :db} symbol id]
{:erc721-token-uri [(:wallet/all-tokens db) symbol id]})
(re-frame/reg-fx
:erc721-token-uri
(fn [[all-tokens symbol tokenId]]
(let [contract (:address (tokens/symbol->token all-tokens symbol))]
(erc721/token-uri contract
tokenId
#(re-frame/dispatch [:token-uri-success
tokenId
(when %
(subs % (.indexOf ^js % "http")))]))))) ;; extra chars in rinkeby
;;Superrare
(def superrare :SUPR)
(defmethod load-collectible-fx superrare [_ _ ids]
{:http-get-n (mapv (fn [id]
{:url id
:on-success (fn [o]
(re-frame/dispatch [:load-collectible-success superrare {id (http/parse-payload o)}]))
:on-error (fn [o]
(re-frame/dispatch [:load-collectible-failure superrare {id (http/parse-payload o)}]))})
ids)})
(def graphql-url "https://api.pixura.io/graphql")
(defn graphql-query [address]
(str "{
collectiblesByOwner: allErc721Tokens(condition: {owner: \"" address "\"}) {
collectibles: nodes {
tokenId,
metadata: erc721MetadatumByTokenId {
metadataUri,
description,
name,
imageUri
}}}}"))
(defmethod load-collectibles-fx superrare [_ _ _ address _]
{:http-post {:url graphql-url
:data (types/clj->json {:query (graphql-query (ethereum/naked-address address))})
:opts {:headers {"Content-Type" "application/json"}}
:on-success (fn [{:keys [response-body]}]
(re-frame/dispatch [:store-collectibles superrare
(get-in (http/parse-payload response-body)
[:data :collectiblesByOwner :collectibles])]))
:on-error (fn [{:keys [response-body]}]
(re-frame/dispatch [:load-collectibles-failure (http/parse-payload response-body)]))
:timeout-ms 10000}})
(handlers/register-handler-fx
:token-uri-success
(fn [_ [_ tokenId token-uri]]
{:http-get {:url
token-uri
:on-success
(fn [o]
(re-frame/dispatch [:load-collectible-success kudos
{tokenId (update (http/parse-payload o)
:image
string/replace
#"http:"
"https:")}])) ;; http in mainnet
:on-error
(fn [o]
(re-frame/dispatch [:load-collectible-failure kudos {tokenId (http/parse-payload o)}]))}}))
(handlers/register-handler-fx
:load-collectible
(fn [cofx [_ symbol token-id]]
(load-collectible-fx cofx symbol token-id)))
(handlers/register-handler-fx
:store-collectibles
(fn [{db :db} [_ symbol collectibles]]
{:db (update-in db [:collectibles symbol] merge
(reduce #(assoc %1 (:tokenId %2) %2) {} collectibles))}))
(handlers/register-handler-fx
:load-collectible-success
(fn [{db :db} [_ symbol collectibles]]
{:db (update-in db [:collectibles symbol] merge collectibles)}))
(handlers/register-handler-fx
:load-collectibles-failure
(fn [{db :db} [_ reason]]
{:db (update-in db [:collectibles symbol :errors] merge reason)}))
(handlers/register-handler-fx
:load-collectible-failure
(fn [{db :db} [_]]
{:db db}))
(handlers/register-handler-fx
:open-collectible-in-browser
(fn [cofx [_ url]]
(browser/open-url cofx url)))
+13 -14
View File
@@ -88,7 +88,7 @@
(defn- validate-token-symbol!
[{:keys [address symbol]}]
(when-not (= symbol :DCN) ;; ignore this symbol because it has weird symbol
(when-not (or (= symbol :DCN) (= symbol :SUPRR)) ;; ignore this symbol because it has weird symbol
(json-rpc/eth-call
{:contract address
:method "symbol()"
@@ -203,7 +203,8 @@
(let [all-default-tokens (get tokens/all-default-tokens
(ethereum/chain-keyword db))
default-tokens (utils.core/index-by :address all-default-tokens)
all-tokens (merge default-tokens (rpc->token custom-tokens))]
;;we want to override custom-tokens by default
all-tokens (merge (rpc->token custom-tokens) default-tokens)]
(merge
{:db (assoc db :wallet/all-tokens all-tokens)}
(when config/erc20-contract-warnings-enabled?
@@ -219,13 +220,11 @@
(fx/defn update-balances
[{{:keys [network-status :wallet/all-tokens
multiaccount :multiaccount/accounts] :as db} :db
:as cofx} addresses]
:as cofx} addresses init?]
(let [addresses (or addresses (map (comp string/lower-case :address) accounts))
{:keys [:wallet/visible-tokens]} multiaccount
chain (ethereum/chain-keyword db)
assets (get visible-tokens chain)
init? (or (empty? assets)
(= assets (constants/default-visible-tokens chain)))
tokens (->> (vals all-tokens)
(remove #(or (:hidden? %)
;;if not init remove not visible tokens
@@ -266,12 +265,14 @@
[{{:keys [multiaccount] :as db} :db :as cofx} symbol checked?]
(let [chain (ethereum/chain-keyword db)
visible-tokens (get multiaccount :wallet/visible-tokens)]
(multiaccounts.update/multiaccount-update
cofx
:wallet/visible-tokens (update visible-tokens
chain
#(set-checked % symbol checked?))
{})))
(fx/merge cofx
(multiaccounts.update/multiaccount-update
:wallet/visible-tokens (update visible-tokens
chain
#(set-checked % symbol checked?))
{})
#(when checked?
(update-balances % nil nil)))))
(fx/defn toggle-visible-token
[cofx symbol checked?]
@@ -314,9 +315,7 @@
(fx/defn add-custom-token
[cofx {:keys [symbol]}]
(fx/merge cofx
(update-toggle-in-settings symbol true)
(update-balances nil)))
(update-toggle-in-settings cofx symbol true))
(fx/defn remove-custom-token
[cofx {:keys [symbol]}]
+3 -3
View File
@@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.62.3",
"commit-sha1": "397ee840c650b7fd4a414b38e200274d2d1b716c",
"src-sha256": "1x6cs06qqbncvlbkw2ch3alkrhf24m966c7jkvvz6rb9fhbxgrgj"
"version": "v0.62.3.hotfix.4",
"commit-sha1": "e8bdf89abbf13abeccd9da04705555c53020a988",
"src-sha256": "1pvw2jkm1c8ik1k9qgymf68xahiiid5dlrhbdm331k8hjhpwkgb5"
}
@@ -215,8 +215,10 @@ class TestWalletManagement(SingleDeviceTestCase):
if not wallet_view.element_by_text('1').is_element_displayed():
self.driver.fail('User collectibles amount does not match')
# TODO: redo to open with Opensea
@marks.testrail_id(5346)
@marks.high
@marks.skip
def test_collectible_from_wallet_opens_in_browser_view(self):
passphrase = wallet_users['F']['passphrase']
signin_view = SignInView(self.driver)
+1
View File
@@ -1203,6 +1203,7 @@
"cant-report-bug": "Can't report a bug",
"mail-should-be-configured": "Mail client should be configured",
"check-on-etherscan": "Check on etherscan",
"check-on-opensea": "Check on opensea",
"transactions-load-more": "Load more",
"private-key": "Private key",
"generate-an-account": "Generate an account",