Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
into release/0.5.0
  • Loading branch information
veado committed Oct 31, 2021
2 parents df53c36 + 7600f42 commit bbb30e9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [Header] Make rune price visible for smaller window sizes [#1880](https://github.com/thorchain/asgardex-electron/pull/1880)
- [Header] Tooltip to explain VOLUME (24h) [#1885](https://github.com/thorchain/asgardex-electron/pull/1885)
- [ERC] Update whitelist (incl. icon support for ETH.THOR, ETH.FOX) [#1894](https://github.com/thorchain/asgardex-electron/issues/1894), [#1896](https://github.com/thorchain/asgardex-electron/issues/1896)
- Use sync mode for broadcasting transactions to THORChain [#1919](https://github.com/thorchain/asgardex-electron/pull/1919)

## Fix

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
"@xchainjs/xchain-bitcoin": "0.15.12",
"@xchainjs/xchain-bitcoincash": "0.11.9",
"@xchainjs/xchain-client": "^0.10.3",
"@xchainjs/xchain-cosmos": "^0.13.7",
"@xchainjs/xchain-cosmos": "^0.13.8",
"@xchainjs/xchain-crypto": "^0.2.6",
"@xchainjs/xchain-ethereum": "^0.22.5",
"@xchainjs/xchain-litecoin": "^0.6.10",
"@xchainjs/xchain-thorchain": "^0.19.2",
"@xchainjs/xchain-thorchain": "^0.19.3",
"@xchainjs/xchain-util": "^0.3.1",
"antd": "^4.16.13",
"axios": "^0.23.0",
Expand Down
4 changes: 2 additions & 2 deletions src/main/api/ledger/thorchain/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const send = async ({
// Send signed StdTx
const {
data: { txhash }
} = await auth.txsPost(cosmosClient.sdk, stdTx, 'block')
} = await auth.txsPost(cosmosClient.sdk, stdTx, 'sync')

if (!txhash) {
return E.left({
Expand Down Expand Up @@ -252,7 +252,7 @@ export const deposit = async ({
// Send signed StdTx
const {
data: { txhash }
} = await auth.txsPost(cosmosClient.sdk, stdTx, 'block')
} = await auth.txsPost(cosmosClient.sdk, stdTx, 'sync')

if (!txhash) {
return E.left({
Expand Down
26 changes: 12 additions & 14 deletions src/renderer/components/swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ export const Swap = ({
return O.some('ledger')
}
// Check for keystore
if (eqOAddress.equals(editableTargetWalletAddress, oTargetWalletAddress)) {
if (eqOAddress.equals(editableTargetWalletAddress, oInitialTargetWalletAddress)) {
return O.some('keystore')
}
// unknown type
return O.none
}, [editableTargetWalletAddress, oTargetLedgerAddress, oTargetWalletAddress])
}, [editableTargetWalletAddress, oInitialTargetWalletAddress, oTargetLedgerAddress])

// `AssetWB` of source asset - which might be none (user has no balances for this asset or wallet is locked)
const oSourceAssetWB: O.Option<WalletBalance> = useMemo(
Expand Down Expand Up @@ -1236,15 +1236,15 @@ export const Swap = ({

const onChangeTargetAddress = useCallback(
(address: Address) => {
const useLedger = FP.pipe(
setTargetWalletAddress(O.some(address))

// update state of `useTargetAssetLedger`
const isTargetLedgerAddress = FP.pipe(
oTargetLedgerAddress,
O.map((ledgerAddress) => eqAddress.equals(ledgerAddress, address)),
O.getOrElse(() => false)
)
// whenever target address has been changed,
// update state of `useTargetAssetLedger`
// which will update `targetWalletAddress` / `setEditableTargetWalletAddress` within another `useEffect` handler
setUseTargetAssetLedger(useLedger)
setUseTargetAssetLedger(isTargetLedgerAddress)
},
[oTargetLedgerAddress]
)
Expand Down Expand Up @@ -1283,12 +1283,10 @@ export const Swap = ({
)
}, [oTargetWalletType])

/**
* Effect to update target address
* whenever walletType of the target changed
*/
useEffect(() => {
const oAddress = useTargetAssetLedger ? oTargetLedgerAddress : oInitialTargetWalletAddress
const onClickUseTargetAssetLedger = useCallback(() => {
const useLedger = !useTargetAssetLedger
setUseTargetAssetLedger(useLedger)
const oAddress = useLedger ? oTargetLedgerAddress : oInitialTargetWalletAddress
setTargetWalletAddress(oAddress)
setEditableTargetWalletAddress(oAddress)
}, [oInitialTargetWalletAddress, oTargetLedgerAddress, useTargetAssetLedger])
Expand Down Expand Up @@ -1383,7 +1381,7 @@ export const Swap = ({
/>
<Styled.CheckButton
checked={useTargetAssetLedger}
clickHandler={() => setUseTargetAssetLedger(() => !useTargetAssetLedger)}
clickHandler={onClickUseTargetAssetLedger}
disabled={!hasTargetAssetLedger}>
{intl.formatMessage({ id: 'ledger.title' })}
</Styled.CheckButton>
Expand Down
20 changes: 13 additions & 7 deletions src/renderer/components/uielements/button/CheckButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback } from 'react'
import React, { useState, useCallback, useEffect } from 'react'

import * as FP from 'fp-ts/function'

Expand All @@ -12,19 +12,25 @@ export type Props = {
}

export const CheckButton: React.FC<Props> = (props): JSX.Element => {
const { clickHandler = FP.constVoid, disabled, checked, className, children } = props
const { clickHandler = FP.constVoid, disabled, checked: checkedProp, className, children } = props

const [isChecked, setChecked] = useState(checked)
const [checked, setChecked] = useState(checkedProp)

// update internal state of `isChecked` whenever `checked` prop has been changed,
// internal state won't be updated in other case
useEffect(() => {
setChecked(checkedProp)
}, [checkedProp])

const onClickHandler = useCallback(() => {
setChecked(() => !isChecked)
setChecked(() => !checked)
clickHandler && clickHandler()
}, [isChecked, clickHandler])
}, [checked, clickHandler])

return (
<Styled.Button onClick={onClickHandler} disabled={disabled} checked={isChecked} className={className}>
<Styled.Button onClick={onClickHandler} disabled={disabled} checked={checked} className={className}>
<Styled.ContentWrapper>
<Styled.CheckCircleOutlined checked={isChecked} />
<Styled.CheckCircleOutlined checked={checked} />
{children}
</Styled.ContentWrapper>
</Styled.Button>
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4501,10 +4501,10 @@
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-client/-/xchain-client-0.10.3.tgz#178fa21d0e59ba660b3bcd85c0b859e309f60d2a"
integrity sha512-+RhRwOmlBZYnSsZJ4XchJM0bxTROUqKBo7/N4N3KWmmWG3MQ8kx8qENCEU8wSlqXoJt9fNOztQBlq/ypRijO6w==

"@xchainjs/xchain-cosmos@^0.13.7":
version "0.13.7"
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-cosmos/-/xchain-cosmos-0.13.7.tgz#f0e512d300d08886db1af0484f3c423ea6e6ff11"
integrity sha512-P1OQZjfa6B0/fyxjfawWVtsqyavtivGrDgJAKTfR2RlGjAjyhLZ4mlspNPn8tav970L3rjItqlYW4Oqihqdbzg==
"@xchainjs/xchain-cosmos@^0.13.8":
version "0.13.8"
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-cosmos/-/xchain-cosmos-0.13.8.tgz#9f8c5a263a40b54f4b3a861346f19d1eefc933b2"
integrity sha512-GCgXo90e4hDOuO7jD0EjnB9d10g+9L/h4q174x5SlpWkXhoboh4PSTGojdZfZh7OEoE2a+sEB099/RpUnt6CpA==

"@xchainjs/xchain-crypto@^0.2.6":
version "0.2.6"
Expand All @@ -4528,10 +4528,10 @@
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-litecoin/-/xchain-litecoin-0.6.10.tgz#13844b420619c2f1bedcee0ef208a1b3111a095c"
integrity sha512-LTQVULn9chLGFAy4AfZvVeAko8PDPJ6lAB1xzTFXU2f54HjNJS6eL+DTNBtrt6HFGfL2MImaShmuFaHsIB1kJA==

"@xchainjs/xchain-thorchain@^0.19.2":
version "0.19.2"
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-thorchain/-/xchain-thorchain-0.19.2.tgz#c8a96b7c9f8d49c5f9f8d4839ed3b59d6d2982a9"
integrity sha512-FIxgzufyV4T7kajZpqmuqjV7HYFqHOh9Y4Wvb9Tr/kFK+m2zGj728z1Fo1WJmuXPU58ClSQ80O+q/FLrRQxhUA==
"@xchainjs/xchain-thorchain@^0.19.3":
version "0.19.3"
resolved "https://registry.yarnpkg.com/@xchainjs/xchain-thorchain/-/xchain-thorchain-0.19.3.tgz#36df44be29799665855d7723207ec809f7caef7d"
integrity sha512-daiwjHCA0uhBueNw7FMGxmpVWAL8e6kX+Bx7wyXPUURIOx6YoklFEaw+Utc3ar96DqjtoV4ceHc0l+7Fr5RRuw==

"@xchainjs/xchain-util@^0.3.1":
version "0.3.1"
Expand Down

0 comments on commit bbb30e9

Please sign in to comment.