Skip to content

Commit

Permalink
Merge pull request #611 from forbole/dev
Browse files Browse the repository at this point in the history
v0.18.2
  • Loading branch information
calvinkei authored Feb 10, 2022
2 parents 1ceb0a3 + 4389c99 commit 3260e95
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ValidatorAvatar from '../../ValidatorAvatar'
import cryptocurrencies from '../../../misc/cryptocurrencies'

interface ClaimRewardsContentProps {
msgs: TransactionMsgWithdrawReward[]
msgs: (TransactionMsgWithdrawReward | TransactionMsgWithdrawCommission)[]
account: Account
validators: { [address: string]: Validator }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ const ConfirmStageContent: React.FC<ConfirmStageContentProps> = ({
/>
)
case '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward':
case '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission':
return (
<ClaimRewardsContent
account={account}
msgs={transactionData.msgs as TransactionMsgWithdrawReward[]}
msgs={
transactionData.msgs as (
| TransactionMsgWithdrawReward
| TransactionMsgWithdrawCommission
)[]
}
validators={validators}
/>
)
Expand Down
2 changes: 2 additions & 0 deletions components/ConfirmTransactionDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ConfirmTransactionDialog: React.FC<ConfirmTransactionDialogProps> = ({
case '/cosmos.staking.v1beta1.MsgUndelegate':
return [m.value.validatorAddress]
case '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward':
case '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission':
return [m.value.validatorAddress]
default:
return []
Expand Down Expand Up @@ -151,6 +152,7 @@ const ConfirmTransactionDialog: React.FC<ConfirmTransactionDialogProps> = ({
title: formatTokenAmount(totalAmount, crypto, lang),
})
case '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward':
case '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission':
return t('rewards was successfully withdrew')
case '/cosmos.gov.v1beta1.MsgDeposit':
return t('successfully deposited', {
Expand Down
2 changes: 1 addition & 1 deletion components/Layout/LeftMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const LeftMenu: React.FC<LeftMenuProps> = ({ activeItem, isMenuExpanded, setIsMe
{items.map((item) => {
const selected = item.href === activeItem
return (
<Link key={item.title} href={item.href} passHref>
<Link key={item.title} href={item.href} as={`${item.href}`} passHref>
<ListItem
selected={selected}
className={classes.menuItem}
Expand Down
26 changes: 18 additions & 8 deletions components/WithdrawRewardsDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ const WithdrawRewardsDialog: React.FC<WithdrawRewardsDialogProps> = ({
async (delegations: Array<ValidatorTag>, memo: string) => {
try {
setLoading(true)
const msgs: TransactionMsgWithdrawReward[] = delegations.map((r) => ({
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
value: {
delegatorAddress: account.address,
validatorAddress: r.address,
},
}))
const msgs: (TransactionMsgWithdrawReward | TransactionMsgWithdrawCommission)[] =
delegations.map((r) =>
currentTab === 0
? {
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
value: {
delegatorAddress: account.address,
validatorAddress: r.address,
},
}
: {
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission',
value: {
validatorAddress: r.address,
},
}
)
await sendTransaction(password, account.address, {
msgs,
memo,
Expand All @@ -69,7 +79,7 @@ const WithdrawRewardsDialog: React.FC<WithdrawRewardsDialogProps> = ({
setLoading(false)
}
},
[password, account, sendTransaction]
[password, account, sendTransaction, currentTab]
)

const totalAmount = React.useMemo(() => {
Expand Down
8 changes: 8 additions & 0 deletions custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ interface TransactionMsgWithdrawReward {
}
}

interface TransactionMsgWithdrawCommission {
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission'
value: {
validatorAddress: string
}
}

interface TransactionMsgSend {
typeUrl: '/cosmos.bank.v1beta1.MsgSend'
value: {
Expand Down Expand Up @@ -455,6 +462,7 @@ type TransactionMsg =
| TransactionMsgUndelegate
| TransactionMsgRedelegate
| TransactionMsgWithdrawReward
| TransactionMsgWithdrawCommission
| TransactionMsgSend
| TransactionMsgMultiSend
| TransactionMsgIBCTransfer
Expand Down
6 changes: 3 additions & 3 deletions locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"unlock password description": "Enter password to unlock your application",
"unlock pasword helper text": "* Require after 15 minutes",
"incorrect password": "Incorrect password",
"security password title": "Wallet Security Password",
"security password title": "Wallet Password",
"security password description": "Create a password to access your wallet",
"import wallet title": "Import Wallet",
"password security level 0": "Weak",
Expand Down Expand Up @@ -76,15 +76,15 @@
"by validators": "by validators",
"accounts": "Accounts",
"change wallet moniker": "Change wallet moniker",
"change security password": "Change wallet security password",
"change security password": "Change wallet password",
"view secret recovery phrase": "View secret recovery phrase",
"add account to wallet": "Add account to wallet",
"delete wallet": "Delete Wallet",
"wallet moniker": "Wallet Moniker",
"current password": "Current Password",
"new password": "New Password",
"save": "Save",
"enter security password": "Please enter wallet security password",
"enter security password": "Please enter wallet password",
"backup password title": "Export Mnemonic",
"export secret recovery phrase title": "Export Secret Recovery Phrase",
"backup password description": "In oder to export your secret recovery phrase properly, we need a password with it will be encrypted for security reasons. Please insert below passwords that you will also be required later when importing it.",
Expand Down
2 changes: 1 addition & 1 deletion locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"unlock password title": "[zh] Unlock Password",
"unlock password description": "[zh] Enter password to unlock your application",
"incorrect password": "[zh] Incorrect password",
"security password title": "[zh] Wallet Security Password",
"security password title": "[zh] Wallet Password",
"security password description": "[zh] Create a password to access your wallet",
"import wallet title": "[zh] Import Wallet",
"password security level 0": "[zh] Weak",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forbole-x",
"version": "0.18.1",
"version": "0.18.2",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down

0 comments on commit 3260e95

Please sign in to comment.