Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
767be39673 | ||
|
|
714d966d48 | ||
|
|
11d66e5bc2 |
@@ -109,10 +109,19 @@ pipeline {
|
||||
stage('Upload') {
|
||||
steps { script {
|
||||
sshagent(credentials: ['nix-cache-ssh']) {
|
||||
nix.shell("""
|
||||
nix.shell(
|
||||
"""
|
||||
find /nix/store/ -mindepth 1 -maxdepth 1 -type d \
|
||||
-not -name '*.links' -and -not -name '*-status-mobile-*' \
|
||||
| xargs nix copy --to ${NIX_SSH_REMOTE}
|
||||
-not -name "*.links" -and -not -name "*-status-mobile-*" \
|
||||
-and -not -name "tmp-*" \
|
||||
-print0 | xargs -0 nix-store -qR | sort -u > "${WORKSPACE_TMP}"/store-paths.txt
|
||||
""",
|
||||
pure: false
|
||||
)
|
||||
nix.shell(
|
||||
"""
|
||||
nix-store --export < "${WORKSPACE_TMP}"/store-paths.txt | \\
|
||||
ssh ${env.NIX_SSHOPTS} ${params.NIX_CACHE_USER}@${params.NIX_CACHE_HOST} ${env.NIX_STORE_CMD} --import
|
||||
""",
|
||||
pure: false
|
||||
)
|
||||
|
||||
@@ -39,19 +39,12 @@
|
||||
"wallet.suggested.routes"
|
||||
{:fx [[:dispatch [:wallet/handle-suggested-routes (transforms/js->clj event-js)]]]}
|
||||
|
||||
"wallet.router.sending-transactions-started"
|
||||
{:fx [[:dispatch
|
||||
[:wallet/sending-transactions-started-signal-received (transforms/js->clj event-js)]]]}
|
||||
|
||||
"wallet.router.sign-transactions"
|
||||
{:fx [[:dispatch [:wallet/sign-transactions-signal-received (transforms/js->clj event-js)]]]}
|
||||
|
||||
"wallet.router.transactions-sent"
|
||||
{:fx [[:dispatch [:wallet/transactions-sent-signal-received (transforms/js->clj event-js)]]]}
|
||||
|
||||
"wallet.transaction.status-changed"
|
||||
{:fx [[:dispatch [:wallet/status-changed-signal-received (transforms/js->clj event-js)]]]}
|
||||
|
||||
"envelope.sent"
|
||||
(messages.transport/update-envelopes-status
|
||||
cofx
|
||||
|
||||
@@ -275,7 +275,8 @@
|
||||
{:events [:chat/unmute-chat-community]}
|
||||
[{:keys [db]} chat-id]
|
||||
(let [{:keys [community-id]} (get-in db [:chats chat-id])]
|
||||
{:db (assoc-in db [:communities community-id :muted] false)}))
|
||||
(when community-id
|
||||
{:db (assoc-in db [:communities community-id :muted] false)})))
|
||||
|
||||
(rf/defn mute-chat-failed
|
||||
{:events [:chat/mute-failed]}
|
||||
|
||||
@@ -480,87 +480,3 @@
|
||||
(filter (fn [{:keys [tokens]}]
|
||||
(some positive-balance-in-any-chain? tokens))
|
||||
operable-account))))
|
||||
|
||||
(defn send-details-map
|
||||
"Generates a new map with all the sen details using the original
|
||||
details we've received from `status-go`. The new one contains only
|
||||
the keys we need."
|
||||
[send-details]
|
||||
(let [{:keys [uuid
|
||||
sendType
|
||||
fromAddress
|
||||
toAddress
|
||||
fromChain
|
||||
toChain
|
||||
fromAmount
|
||||
toAmount
|
||||
fromAsset
|
||||
toAsset
|
||||
username
|
||||
publicKey
|
||||
packId]} send-details]
|
||||
{:uuid uuid
|
||||
:send-type sendType
|
||||
:address-from fromAddress
|
||||
:address-to toAddress
|
||||
:tx-to ""
|
||||
:from-chain fromChain
|
||||
:to-chain toChain
|
||||
:from-amount fromAmount
|
||||
:to-amount toAmount
|
||||
:from-asset fromAsset
|
||||
:to-asset toAsset
|
||||
:username username
|
||||
:public-key publicKey
|
||||
:pack-id packId
|
||||
:tx-hash ""
|
||||
:approval-tx? false}))
|
||||
|
||||
(defn details-map
|
||||
"Generates map with all the transaction details based on what we've
|
||||
got from status-go as `send-details` and `sent-transaction`."
|
||||
[send-details sent-transaction]
|
||||
(let [send-details (send-details-map send-details)
|
||||
{:keys [toAddress fromChain toChain amountIn
|
||||
amountOut fromToken toToken hash
|
||||
approvalTx]} sent-transaction
|
||||
amount-in (money/from-hex amountIn)
|
||||
amount-out (money/from-hex amountOut)
|
||||
sent-transaction? (and sent-transaction (> (-> sent-transaction :hash count) 0))]
|
||||
(if sent-transaction?
|
||||
(cond-> send-details
|
||||
true (assoc :tx-to toAddress)
|
||||
(> fromChain 0) (assoc :from-chain fromChain)
|
||||
(> toChain 0) (assoc :to-chain toChain)
|
||||
(not= amount-in "0") (assoc :from-amount amount-in)
|
||||
(not= amount-out "0") (assoc :to-amount amount-out)
|
||||
(> (count fromToken) 0) (assoc :from-asset fromToken)
|
||||
(> (count toToken) 0) (assoc :to-asset toToken)
|
||||
true (assoc :tx-hash hash)
|
||||
true (assoc :approval-tx? approvalTx))
|
||||
send-details)))
|
||||
|
||||
(defn contact-name-by-address
|
||||
[db address]
|
||||
(or (get-in db [:wallet :accounts address :name])
|
||||
(get-in db [:contacts/contacts address :primary-name])))
|
||||
|
||||
(defn tx-to-name
|
||||
"Returns the transaction name that will be used for certain types of transactions."
|
||||
[send-type]
|
||||
(cond
|
||||
(= send-type constants/send-type-bridge) "Hop"
|
||||
(= send-type constants/send-type-swap) "ParaSwap"
|
||||
:else nil))
|
||||
|
||||
(defn transaction-approval-required?
|
||||
"Indicates whether the transaction needs approval based on the information
|
||||
from the database."
|
||||
[transactions {:keys [swap-proposal approval-transaction-id]}]
|
||||
(let [approval-transaction (when approval-transaction-id
|
||||
(get transactions approval-transaction-id))
|
||||
already-approved? (and approval-transaction
|
||||
(= (:status approval-transaction)
|
||||
:confirmed))]
|
||||
(and (:approval-required swap-proposal)
|
||||
(not already-approved?))))
|
||||
|
||||
@@ -783,72 +783,17 @@
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/transactions-sent-signal-received
|
||||
(fn [_
|
||||
(fn [{:keys [db]}
|
||||
[{sent-transactions :sentTransactions
|
||||
send-details :sendDetails}]]
|
||||
{:fx [[:dispatch
|
||||
[:wallet/show-transaction-notification
|
||||
{:status :sent
|
||||
:send-details send-details
|
||||
:sent-transaction (first sent-transactions)}]]
|
||||
[:dispatch
|
||||
(if (:errorResponse send-details)
|
||||
[:wallet/transaction-failure send-details]
|
||||
[(if (= (:sendType send-details) constants/send-type-swap)
|
||||
:wallet.swap/transaction-success
|
||||
:wallet/transaction-success)
|
||||
sent-transactions])]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/sending-transactions-started-signal-received
|
||||
(fn [_
|
||||
[{sent-transactions :sentTransactions
|
||||
send-details :sendDetails}]]
|
||||
{:fx [[:dispatch
|
||||
[:wallet/show-transaction-notification
|
||||
{:status :sending
|
||||
:send-details send-details
|
||||
:sent-transaction (first sent-transactions)}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/status-changed-signal-received
|
||||
(fn [_
|
||||
[{sent-transactions :sentTransactions
|
||||
send-details :sendDetails}]]
|
||||
{:fx [[:dispatch
|
||||
[:wallet/show-transaction-notification
|
||||
{:status :status-changed
|
||||
:send-details send-details
|
||||
:sent-transaction (first sent-transactions)}]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/show-transaction-notification
|
||||
(fn [{:keys [db]} [{:keys [status send-details sent-transaction]}]]
|
||||
(let [{:keys [error send-type]
|
||||
:as details}
|
||||
(as-> (utils/details-map send-details sent-transaction) $
|
||||
(assoc $ :error (get-in send-details [:ErrorResponse :details]))
|
||||
(assoc $ :account-from-name (utils/contact-name-by-address db (:address-from $)))
|
||||
(assoc $ :account-to-name (utils/contact-name-by-address db (:address-to $)))
|
||||
(assoc $
|
||||
:tx-to-name
|
||||
(or (utils/tx-to-name (:send-type $))
|
||||
(utils/contact-name-by-address db (:tx-to $)))))]
|
||||
(cond
|
||||
;; handle errors and show notifications about errors
|
||||
error
|
||||
(do
|
||||
(log/warn "Error when sending transaction" details)
|
||||
{:fx [[:dispatch
|
||||
[:toasts/upsert
|
||||
{:id (keyword (str status "-failure"))
|
||||
:type :negative
|
||||
:text error}]]]})
|
||||
|
||||
;; handle swap notifications in a separate fx
|
||||
(= send-type constants/send-type-swap)
|
||||
{:fx [[:dispatch
|
||||
[:wallet.swap/show-transaction-notification
|
||||
{:status status
|
||||
:send-details details}]]]}))))
|
||||
|
||||
(let [swap? (get-in db [:wallet :ui :swap])]
|
||||
{:fx [[:dispatch
|
||||
(if-let [error-response (:errorResponse send-details)]
|
||||
[(if swap?
|
||||
:wallet.swap/transaction-failure
|
||||
:wallet/transaction-failure)
|
||||
error-response]
|
||||
[(if swap?
|
||||
:wallet.swap/transaction-success
|
||||
:wallet/transaction-success)
|
||||
sent-transactions])]]})))
|
||||
|
||||
@@ -546,6 +546,7 @@
|
||||
token-decimal (when token (:decimals token))
|
||||
token-id (utils/format-token-id token collectible)
|
||||
to-token-id ""
|
||||
gas-rates constants/gas-rate-medium
|
||||
to-hex (fn [v] (send-utils/amount-in-hex v (if token token-decimal 0)))
|
||||
amount-in (to-hex amount)
|
||||
amount-out (to-hex amount-out)
|
||||
@@ -581,11 +582,10 @@
|
||||
:amountIn amount-in
|
||||
:amountOut amount-out
|
||||
:tokenID token-id
|
||||
:tokenIDIsOwnerToken false
|
||||
:toTokenID to-token-id
|
||||
:disabledFromChainIDs disabled-from-chain-ids
|
||||
:disabledToChainIDs disabled-to-chain-ids
|
||||
:gasFeeMode constants/gas-rate-medium
|
||||
:gasFeeMode gas-rates
|
||||
:fromLockedAmount {}
|
||||
:username (:username args)
|
||||
:publicKey (:publicKey args)
|
||||
@@ -660,20 +660,19 @@
|
||||
(update :best best-routes-fix)
|
||||
(update :candidates candidates-fix)))
|
||||
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/handle-suggested-routes
|
||||
(fn [{:keys [db]} [data]]
|
||||
(let [{:keys [send swap]} (-> db :wallet :ui)
|
||||
skip-processing-routes? (:skip-processing-suggested-routes? send)
|
||||
clean-user-tx-settings? (get-in db
|
||||
[:wallet :ui :send :custom-tx-settings
|
||||
:delete-on-routes-update?])]
|
||||
(when (or swap (not skip-processing-routes?))
|
||||
(let [{send :send swap? :swap} (-> db :wallet :ui)
|
||||
skip-processing-routes? (:skip-processing-suggested-routes? send)
|
||||
clean-user-tx-settings? (get-in db
|
||||
[:wallet :ui :send :custom-tx-settings
|
||||
:delete-on-routes-update?])]
|
||||
(when (or swap? (not skip-processing-routes?))
|
||||
(let [{error-code :code
|
||||
:as error} (:ErrorResponse data)
|
||||
enough-assets? (not (and (:Best data) (= error-code "WR-002")))
|
||||
failure? (and error enough-assets? (not swap))
|
||||
failure? (and error enough-assets? (not swap?))
|
||||
error-message (if (zero? error-code) "An error occurred" (:details error))]
|
||||
(when failure?
|
||||
(log/error "failed to get suggested routes (async)"
|
||||
@@ -684,11 +683,11 @@
|
||||
{:db (update-in db [:wallet :ui :send] dissoc :custom-tx-settings)})
|
||||
{:fx [[:dispatch
|
||||
(cond
|
||||
(and failure? swap) [:wallet/swap-proposal-error error]
|
||||
failure? [:wallet/suggested-routes-error error-message]
|
||||
swap [:wallet/swap-proposal-success (fix-routes data)]
|
||||
:else [:wallet/suggested-routes-success (fix-routes data)
|
||||
enough-assets?])]]}))))))
|
||||
(and failure? swap?) [:wallet/swap-proposal-error error]
|
||||
failure? [:wallet/suggested-routes-error error-message]
|
||||
swap? [:wallet/swap-proposal-success (fix-routes data)]
|
||||
:else [:wallet/suggested-routes-success (fix-routes data)
|
||||
enough-assets?])]]}))))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/transaction-success
|
||||
@@ -712,14 +711,16 @@
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet/transaction-failure
|
||||
(fn [_ [send-details]]
|
||||
(if (= (:sendType send-details) constants/send-type-swap)
|
||||
{:fx [[:dispatch [:wallet.swap/track-transaction-execution-failed (:errorResponse send-details)]]
|
||||
[:dispatch [:wallet.swap/end-transaction-flow]]]}
|
||||
{:fx [[:dispatch [:wallet/end-transaction-flow]]
|
||||
[:dispatch-later
|
||||
[{:ms 2000
|
||||
:dispatch [:wallet/stop-and-clean-suggested-routes]}]]]})))
|
||||
(fn [_ [{:keys [details]}]]
|
||||
{:fx [[:dispatch [:wallet/end-transaction-flow]]
|
||||
[:dispatch-later
|
||||
[{:ms 2000
|
||||
:dispatch [:wallet/stop-and-clean-suggested-routes]}]]
|
||||
[:dispatch
|
||||
[:toasts/upsert
|
||||
{:id :send-transaction-failure
|
||||
:type :negative
|
||||
:text (or details "An error occured")}]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/clean-just-completed-transaction
|
||||
(fn [{:keys [db]}]
|
||||
|
||||
@@ -432,6 +432,16 @@
|
||||
[:wallet.swap/set-sign-transactions-callback-fx
|
||||
[:dispatch [:wallet/prepare-signatures-for-transactions :swap]]]]]})))
|
||||
|
||||
(defn transaction-approval-required?
|
||||
[transactions {:keys [swap-proposal approval-transaction-id]}]
|
||||
(let [approval-transaction (when approval-transaction-id
|
||||
(get transactions approval-transaction-id))
|
||||
already-approved? (and approval-transaction
|
||||
(= (:status approval-transaction)
|
||||
:confirmed))]
|
||||
(and (:approval-required swap-proposal)
|
||||
(not already-approved?))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet.swap/mark-as-pending
|
||||
(fn [{:keys [db]} [transaction-id]]
|
||||
@@ -458,7 +468,7 @@
|
||||
(-> amount-out
|
||||
(number/hex->whole receive-token-decimals)
|
||||
(money/to-fixed receive-token-decimals)))
|
||||
approval-required? (utils/transaction-approval-required? transactions swap)]
|
||||
approval-required? (transaction-approval-required? transactions swap)]
|
||||
{:fx [[:dispatch
|
||||
[:centralized-metrics/track
|
||||
(if approval-required?
|
||||
@@ -486,11 +496,23 @@
|
||||
[:dispatch [:wallet.swap/mark-as-pending (-> sent-transactions first :hash)]])
|
||||
(when-not approval-required?
|
||||
;; just end the whole transaction flow if no approval needed
|
||||
[:dispatch [:wallet.swap/end-transaction-flow]])]})))
|
||||
[:dispatch [:wallet.swap/end-transaction-flow]])
|
||||
(when-not approval-required?
|
||||
[:dispatch-later
|
||||
{:ms 500
|
||||
:dispatch [:toasts/upsert
|
||||
{:id :swap-transaction-pending
|
||||
:icon :i/info
|
||||
:type :neutral
|
||||
:text (i18n/label :t/swapping-to
|
||||
{:pay-amount amount
|
||||
:pay-token-symbol token-id-from
|
||||
:receive-token-symbol token-id-to
|
||||
:receive-amount receive-amount})}]}])]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet.swap/track-transaction-execution-failed
|
||||
(fn [{:keys [db]} [error]]
|
||||
:wallet.swap/transaction-failure
|
||||
(fn [{:keys [db]} [{:keys [details] :as error}]]
|
||||
(let [transactions (get-in db [:wallet :transactions])
|
||||
{:keys [asset-to-pay
|
||||
asset-to-receive
|
||||
@@ -499,7 +521,7 @@
|
||||
swap-chain-id (:chain-id network)
|
||||
token-id-from (:symbol asset-to-pay)
|
||||
token-id-to (:symbol asset-to-receive)
|
||||
approval-required? (utils/transaction-approval-required? transactions swap)]
|
||||
approval-required? (transaction-approval-required? transactions swap)]
|
||||
{:fx [[:centralized-metrics/track
|
||||
(if approval-required?
|
||||
:metric/swap-approval-execution-failed
|
||||
@@ -508,14 +530,20 @@
|
||||
:error error
|
||||
:pay_token token-id-from}
|
||||
(not approval-required?)
|
||||
(assoc :receive_token token-id-to))]]})))
|
||||
(assoc :receive_token token-id-to))]
|
||||
[:dispatch [:wallet.swap/end-transaction-flow]]
|
||||
[:dispatch
|
||||
[:toasts/upsert
|
||||
{:id :send-transaction-error
|
||||
:type :negative
|
||||
:text (or details "An error occured")}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet.swap/clean-up-transaction-flow
|
||||
(fn [{:keys [db]}]
|
||||
(let [transactions (get-in db [:wallet :transactions])
|
||||
swap (get-in db [:wallet :ui :swap])
|
||||
approval-required? (utils/transaction-approval-required? transactions swap)]
|
||||
approval-required? (transaction-approval-required? transactions swap)]
|
||||
{:db (update-in db [:wallet :ui] dissoc :swap)
|
||||
:fx [[:dispatch
|
||||
[:dismiss-modal
|
||||
@@ -549,29 +577,3 @@
|
||||
[:dispatch
|
||||
[:navigate-to-within-stack
|
||||
[:screen/wallet.swap-select-asset-to-pay :screen/wallet.swap-select-account]]]])})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet.swap/show-transaction-notification
|
||||
(fn [{:keys [db]} [{:keys [status send-details]}]]
|
||||
(let [transactions (get-in db [:wallet :transactions])
|
||||
{:keys [asset-to-pay asset-to-receive] :as swap} (get-in db [:wallet :ui :swap])]
|
||||
;; show toast when approval is not required
|
||||
(when (and (= status :sent)
|
||||
(not (utils/transaction-approval-required? transactions swap)))
|
||||
{:fx [[:dispatch-later
|
||||
{:ms 500
|
||||
:dispatch [:toasts/upsert
|
||||
{:id :swap-transaction-pending
|
||||
:icon :i/info
|
||||
:type :neutral
|
||||
:text (i18n/label :t/swapping-to
|
||||
{:pay-amount (-> send-details
|
||||
:from-amount
|
||||
(money/token->unit
|
||||
(:decimals asset-to-pay)))
|
||||
:receive-amount (-> send-details
|
||||
:to-amount
|
||||
(money/token->unit
|
||||
(:decimals asset-to-receive)))
|
||||
:pay-token-symbol (:from-asset send-details)
|
||||
:receive-token-symbol (:to-asset send-details)})}]}]]}))))
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestWalletCollectibles(MultipleSharedDeviceTestCase):
|
||||
self.wallet_view.collectibles_tab.click()
|
||||
self.wallet_view.set_network_in_wallet(self.network_name)
|
||||
collectibles = {
|
||||
"BVL": {"quantity": 2,
|
||||
"BVL": {"quantity": 1,
|
||||
"info": {"Account": "Account 1",
|
||||
"Network": "Base",
|
||||
"category": "Football Player",
|
||||
@@ -102,8 +102,8 @@ class TestWalletCollectibles(MultipleSharedDeviceTestCase):
|
||||
self.wallet_view.collectibles_tab_on_select_token_view.click()
|
||||
time.sleep(5)
|
||||
self.wallet_view.get_collectible_element('BVL').click()
|
||||
self.wallet_view.amount_input_increase_button.click()
|
||||
self.wallet_view.confirm_button.click()
|
||||
# self.wallet_view.amount_input_increase_button.click()
|
||||
# self.wallet_view.confirm_button.click()
|
||||
for text in [self.account_name, self.sender_short_address]:
|
||||
if not self.wallet_view.from_data_container.get_child_element_by_text(text).is_element_displayed():
|
||||
self.errors.append(self.wallet_view,
|
||||
@@ -118,7 +118,7 @@ class TestWalletCollectibles(MultipleSharedDeviceTestCase):
|
||||
data_to_check = {
|
||||
'Est. time': ' min',
|
||||
'Max fees': r"[$]\d+.\d+",
|
||||
'Recipient gets': '2 '
|
||||
'Recipient gets': '1 '
|
||||
}
|
||||
for key, expected_value in data_to_check.items():
|
||||
try:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 329 KiB After Width: | Height: | Size: 330 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Reference in New Issue
Block a user