WA-232 Adding move tokens feature to Safe route view
This commit is contained in:
parent
3fbf63e257
commit
731e591218
|
@ -18,6 +18,7 @@ import Threshold from '~/routes/safe/component/Threshold'
|
||||||
import AddOwner from '~/routes/safe/component/AddOwner'
|
import AddOwner from '~/routes/safe/component/AddOwner'
|
||||||
import RemoveOwner from '~/routes/safe/component/RemoveOwner'
|
import RemoveOwner from '~/routes/safe/component/RemoveOwner'
|
||||||
import EditDailyLimit from '~/routes/safe/component/EditDailyLimit'
|
import EditDailyLimit from '~/routes/safe/component/EditDailyLimit'
|
||||||
|
import SendToken from '~/routes/safe/component/SendToken'
|
||||||
|
|
||||||
import Address from './Address'
|
import Address from './Address'
|
||||||
import BalanceInfo from './BalanceInfo'
|
import BalanceInfo from './BalanceInfo'
|
||||||
|
@ -102,6 +103,14 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
|
||||||
this.setState({ component: <RemoveOwner safeAddress={safe.get('address')} threshold={safe.get('threshold')} safe={safe} name={name} userToRemove={address} /> })
|
this.setState({ component: <RemoveOwner safeAddress={safe.get('address')} threshold={safe.get('threshold')} safe={safe} name={name} userToRemove={address} /> })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMoveTokens = (ercToken: Balance) => {
|
||||||
|
const { safe } = this.props
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
component: <SendToken safe={safe} balance={ercToken} onReset={this.onListTransactions} />,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { safe, balances, userAddress } = this.props
|
const { safe, balances, userAddress } = this.props
|
||||||
const { component } = this.state
|
const { component } = this.state
|
||||||
|
@ -111,7 +120,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
|
||||||
<Row grow>
|
<Row grow>
|
||||||
<Col sm={12} top="xs" md={5} margin="xl" overflow>
|
<Col sm={12} top="xs" md={5} margin="xl" overflow>
|
||||||
<List style={listStyle}>
|
<List style={listStyle}>
|
||||||
<BalanceInfo balances={balances} />
|
<BalanceInfo balances={balances} onMoveFunds={this.onMoveTokens} />
|
||||||
<Owners
|
<Owners
|
||||||
owners={safe.owners}
|
owners={safe.owners}
|
||||||
onAddOwner={this.onAddOwner}
|
onAddOwner={this.onAddOwner}
|
||||||
|
|
|
@ -9,11 +9,18 @@ import { makeBalance, type Balance, type BalanceProps } from '~/routes/safe/stor
|
||||||
import logo from '~/assets/icons/icon_etherTokens.svg'
|
import logo from '~/assets/icons/icon_etherTokens.svg'
|
||||||
import addBalances from './addBalances'
|
import addBalances from './addBalances'
|
||||||
|
|
||||||
export const calculateBalanceOf = async (tokenAddress: string, address: string) => {
|
|
||||||
|
export const getStandardTokenContract = async () => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const erc20Token = await contract(StandardToken)
|
const erc20Token = await contract(StandardToken)
|
||||||
erc20Token.setProvider(web3.currentProvider)
|
erc20Token.setProvider(web3.currentProvider)
|
||||||
|
|
||||||
|
return erc20Token
|
||||||
|
}
|
||||||
|
|
||||||
|
export const calculateBalanceOf = async (tokenAddress: string, address: string) => {
|
||||||
|
const erc20Token = await getStandardTokenContract()
|
||||||
|
|
||||||
return erc20Token.at(tokenAddress)
|
return erc20Token.at(tokenAddress)
|
||||||
.then(instance => instance.balanceOf(address).then(funds => funds.toString()))
|
.then(instance => instance.balanceOf(address).then(funds => funds.toString()))
|
||||||
.catch(() => '0')
|
.catch(() => '0')
|
||||||
|
|
Loading…
Reference in New Issue