Skip to content

Commit

Permalink
feat: add MsgClawback
Browse files Browse the repository at this point in the history
  • Loading branch information
vien.nguyen2-tiki committed Feb 13, 2023
1 parent aa922c3 commit 50ae043
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 4 deletions.
16 changes: 16 additions & 0 deletions types/message.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,3 +608,19 @@ interface MsgRevokeContent {
'msgTypeUrl': string
}
}

interface MsgClawbackContent {
name: string
uuid: string
height: number
params: {
'funder_address': string
'account_address': string
'@type': string
'dest_address': string
}
txHash: string
msgName: string
version: number
msgIndex: number
}
4 changes: 4 additions & 0 deletions types/transactions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ interface CosmosTxMessage {
titles: string[]
content: string[][]
}

funderAddress?: string
accountAddress?: string
destAddress?: string
}

interface TransactionDetail {
Expand Down
9 changes: 7 additions & 2 deletions utils/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export enum TransactionTypeEnum {
MsgCreateClawbackVestingAccount = '/evmos.vesting.v1.MsgCreateClawbackVestingAccount',
CommunityPoolSpendProposal = '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal',
MsgAcknowledgement = '/ibc.core.channel.v1.MsgAcknowledgement',
MsgRevoke = '/cosmos.authz.v1beta1.MsgRevoke'
MsgRevoke = '/cosmos.authz.v1beta1.MsgRevoke',
MsgClawback = '/evmos.vesting.v1.MsgClawback'
}

export enum AddressTypeEnum {
Expand Down Expand Up @@ -119,7 +120,11 @@ export enum CardInfoLabels {
acknowledgement = 'Acknowledgement: ',
proofAcked = 'Proof Acked: ',
proofHeigh = 'Proof Height: ',
msgs = 'Msgs: '
msgs = 'Msgs: ',

funderAddress = 'Funder Address:',
accountAddress = 'Account Address: ',
destAddress = 'Dest Address:'
}

export enum ErcTypeEnum {
Expand Down
17 changes: 17 additions & 0 deletions views/transactions/cosmosMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export const handleCosmosMsg = (messages: TransactionMessage[]) => {
case TransactionTypeEnum.MsgAcknowledgement:
messageData.push(_mapMsgAcknowledgement(msg))
break
case TransactionTypeEnum.MsgClawback:
console.log('error')
messageData.push(_mapMsgClawback(msg))
break
}
}
return {
Expand Down Expand Up @@ -396,3 +400,16 @@ const _mapMsgAcknowledgement = (msg: TransactionMessage): CosmosTxMessage => {
}
}
}

const _mapMsgClawback = (msg: TransactionMessage): CosmosTxMessage => {
const content = msg.content as unknown as MsgClawbackContent
const { params } = content
if (msg && content) {
return {
type: msg.type,
funderAddress: params.funder_address,
accountAddress: params.account_address,
destAddress: params.dest_address || ' '
}
}
}
6 changes: 5 additions & 1 deletion views/transactions/hook/convertDataConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export const COSMOS_MESSAGE_SORT_FIELD = [
CardInfoLabels.acknowledgement,
CardInfoLabels.proofAcked,
CardInfoLabels.proofHeigh,
CardInfoLabels.msgs
CardInfoLabels.msgs,

CardInfoLabels.funderAddress,
CardInfoLabels.accountAddress,
CardInfoLabels.destAddress
]

export const GAS_ITEM_FIELD_SORT_ORDER = [
Expand Down
4 changes: 3 additions & 1 deletion views/transactions/hook/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ export const _cardData = (data: TransactionDetail, astraPrice: string) => {
case 'validatorAddress':
case 'validatorSrcAddress':
case 'validatorDstAddress':
case 'validatorDstAddress':
case 'funderAddress':
case 'accountAddress':
case 'destAddress':
if (!isEmpty(data[key]))
items.push({
label: CardInfoLabels[key],
Expand Down

0 comments on commit 50ae043

Please sign in to comment.