Skip to content

Commit

Permalink
Merge pull request #79 from CudoVentures/CUDOS-2088-/-Fix-inject-with…
Browse files Browse the repository at this point in the history
…draw-reward-type

CUDOS-2088 / Fix inject withdraw reward type
  • Loading branch information
SpaghettiOverload authored Jan 19, 2023
2 parents f43447a + 9643c61 commit d991014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const nextTranslate = require('next-translate');

module.exports = nextTranslate({
poweredByHeader: false,
productionBrowserSourceMaps: true,
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
Expand Down
10 changes: 5 additions & 5 deletions src/components/msg/mutate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const insertMissingWithdrawRewardsMsgWhenDelegating = (transaction: any) => {
for (let i = 0; i < messages.length; i += 1) {
const model = getMessageModelByType(messages[i]?.['@type']);

if (model === MODELS.MsgDelegate) {
if (model === MODELS.MsgRedelegate) {
const coinReceivedEvent = getEventAtIndex(transaction, i, 'coin_received');
const coinSpentEvent = getEventAtIndex(transaction, i, 'coin_spent');

Expand Down Expand Up @@ -66,12 +66,12 @@ const getEventAtIndex = (transaction: any, index: number, eventType: string) =>
}
};

const buildWithdrawRewardsMessage = (delegateMsg: any, coinReceivedEvent: any,
const buildWithdrawRewardsMessage = (redelegateMsg: any, coinReceivedEvent: any,
coinSpentEvent: any) => {
const withdrawMsg = {
'@type': '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
delegator_address: delegateMsg.delegator_address,
validator_address: delegateMsg.validator_address,
delegator_address: redelegateMsg.delegator_address,
validator_address: redelegateMsg.validator_src_address,
};

const events = [];
Expand Down Expand Up @@ -126,7 +126,7 @@ const buildWithdrawRewardsMessage = (delegateMsg: any, coinReceivedEvent: any,
key: 'amount', value: coinReceivedEvent.attributes[1].value,
},
{
key: 'validator', value: delegateMsg.validator_address,
key: 'validator', value: redelegateMsg.validator_src_address,
},
]));

Expand Down

0 comments on commit d991014

Please sign in to comment.