@@ -104,6 +104,31 @@ export const createIbcTransferMessage = (
104
104
} ;
105
105
} ;
106
106
107
+ const getIbcTransferAttributes = (
108
+ tx : DeliverTxResponse
109
+ ) : Record < string , string > => {
110
+ const transferAttributes = getEventAttribute ( tx , "ibc_transfer" ) ;
111
+ if ( "amount" in transferAttributes ) {
112
+ return transferAttributes ;
113
+ }
114
+
115
+ // Fallback to send_packet event if ibc_transfer doesn't contain amount
116
+ const sendPackageAttributes = getEventAttribute ( tx , "send_packet" ) ;
117
+ if ( "packet_data" in sendPackageAttributes ) {
118
+ const packetData = JSON . parse ( sendPackageAttributes . packet_data ) ;
119
+ return {
120
+ ...transferAttributes ,
121
+ amount : packetData . amount || "" ,
122
+ receiver : packetData . receiver || "" ,
123
+ sender : packetData . sender || "" ,
124
+ } ;
125
+ }
126
+
127
+ throw new Error (
128
+ "Unable to find the correct amount value in the IBC transaction"
129
+ ) ;
130
+ } ;
131
+
107
132
export const createTransferDataFromIbc = (
108
133
tx : DeliverTxResponse ,
109
134
rpc : string ,
@@ -113,7 +138,7 @@ export const createTransferDataFromIbc = (
113
138
details : IbcTransferStage ,
114
139
isShieldedTx : boolean
115
140
) : TransferTransactionData => {
116
- const transferAttributes = getEventAttribute ( tx , "ibc_transfer" ) ;
141
+ const transferAttributes = getIbcTransferAttributes ( tx ) ;
117
142
const packetAttributes = getEventAttribute ( tx , "send_packet" ) ;
118
143
const feeAttributes = getEventAttribute ( tx , "fee_pay" ) ;
119
144
const tipAttributes = getEventAttribute ( tx , "tip_pay" ) ;
0 commit comments