Skip to content

Commit

Permalink
fix: add MsgAcknowledgement
Browse files Browse the repository at this point in the history
  • Loading branch information
vien.nguyen2-tiki committed Feb 7, 2023
1 parent 5d5bfe9 commit f93c9ea
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 3 deletions.
46 changes: 46 additions & 0 deletions types/message.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,3 +546,49 @@ interface CommunityPoolSpendProposalContent {
'recipientAddress': string
}
}

interface MsgAcknowledgementContent {
uuid: string
height: number
params: {
packet: {
sequence: string
sourcePort: string
sourceChannel: string
timeoutHeight: {
revisionHeight: string
revisionNumber: string
}
destinationPort: string
timeoutTimestamp: string
destinationChannel: string
data: string
}
signer: string
connectionId: string
packetSequence: string
maybeMsgTransfer: {
success: boolean
receiver: string
acknowledgement: string
denom: string
error: null
amount: string
sender: string
}
proofAcked: string
application: string
messageType: string
proofHeight: {
revisionHeight: string
revisionNumber: string
}
acknowledgement: string
channelOrdering: string
}
txHash: string
msgName: string
version: number
msgIndex: number
name: string
}
3 changes: 3 additions & 0 deletions types/transactions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ interface CosmosTxMessage {
titles: string[]
content: string[][]
}

acknowledgement?: string
proofAcked?: string
}

interface TransactionDetail {
Expand Down
10 changes: 8 additions & 2 deletions utils/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export enum TransactionTypeEnum {
MsgTransfer = '/ibc.applications.transfer.v1.MsgTransfer',
MsgCreateClient = '/ibc.core.client.v1.MsgCreateClient',
MsgCreateClawbackVestingAccount = '/evmos.vesting.v1.MsgCreateClawbackVestingAccount',
CommunityPoolSpendProposal = '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal'
CommunityPoolSpendProposal = '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal',
MsgAcknowledgement = '/ibc.core.channel.v1.MsgAcknowledgement'
}

export enum AddressTypeEnum {
Expand Down Expand Up @@ -111,7 +112,12 @@ export enum CardInfoLabels {

startTime = 'Start Time',
lockupPeriods = 'Lockup Periods',
vestingPeriods = 'Vesting Periods'
vestingPeriods = 'Vesting Periods',

packet = 'Packet: ',
acknowledgement = 'Acknowledgement: ',
proofAcked = 'Proof Acked: ',
proofHeigh = 'Proof Height: '
}

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 @@ -62,6 +62,9 @@ export const handleCosmosMsg = (messages: TransactionMessage[]) => {
case TransactionTypeEnum.MsgCreateClawbackVestingAccount:
messageData.push(_mapMsgCreateClawbackVestingAccount(msg))
break
case TransactionTypeEnum.MsgAcknowledgement:
messageData.push(_mapMsgAcknowledgement(msg))
break
}
}
return {
Expand Down Expand Up @@ -344,3 +347,17 @@ const _mapMsgCreateClawbackVestingAccount = (msg: TransactionMessage): CosmosTxM
}
}
}

const _mapMsgAcknowledgement = (msg: TransactionMessage): CosmosTxMessage => {
const content = msg.content as unknown as MsgAcknowledgementContent
const { params } = content
if (msg && content) {
return {
type: msg.type,
dynamicRender: [{ packet: params.packet }, { proofHeigh: params.proofHeight }],
acknowledgement: params.acknowledgement,
proofAcked: params.proofAcked,
signer: params.signer
}
}
}
7 changes: 6 additions & 1 deletion views/transactions/hook/convertDataConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export const COSMOS_MESSAGE_SORT_FIELD = [

CardInfoLabels.startTime,
CardInfoLabels.lockupPeriods,
CardInfoLabels.vestingPeriods
CardInfoLabels.vestingPeriods,

CardInfoLabels.packet,
CardInfoLabels.acknowledgement,
CardInfoLabels.proofAcked,
CardInfoLabels.proofHeigh
]

export const GAS_ITEM_FIELD_SORT_ORDER = [
Expand Down
2 changes: 2 additions & 0 deletions views/transactions/hook/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ export const _cardData = (data: TransactionDetail, astraPrice: string) => {
case 'sourceChannel':
case 'timeoutTimestamp':
case 'token':
case 'proofAcked':
case 'acknowledgement':
if (data[key] !== undefined && data[key] !== null)
items.push({
label: CardInfoLabels[key],
Expand Down

0 comments on commit f93c9ea

Please sign in to comment.