@@ -36,13 +36,15 @@ multiMapper("gateway:PrepareMessage", async ({ event, context }) => {
3636
3737 const rawData = `0x${ Buffer . from ( messageBuffer . toString ( "hex" ) ) } ` as `0x${string } `;
3838 const data = decodeMessage ( messageType , messagePayload , versionIndex ) ;
39+ const tokenId = data && "scId" in data ? ( data . scId ! as `0x${string } `) : null ;
3940
4041 const _crosschainMessage = ( await CrosschainMessageService . insert (
4142 context ,
4243 {
4344 id : messageId ,
4445 index : messageCount ,
4546 poolId : poolId || null ,
47+ tokenId,
4648 fromCentrifugeId,
4749 toCentrifugeId : toCentrifugeId . toString ( ) ,
4850 messageType : messageType ,
@@ -77,6 +79,7 @@ multiMapper("gateway:UnderpaidBatch", async ({ event, context }) => {
7779 } ) ;
7880
7981 const poolIdSet = new Set < bigint > ( ) ;
82+ const tokenIdSet = new Set < `0x${string } `> ( ) ;
8083 const messages = extractMessagesFromPayload ( batch , versionIndex ) ;
8184 for ( const message of messages ) {
8285 const messageBuffer = Buffer . from ( message . substring ( 2 ) , "hex" ) ;
@@ -116,12 +119,16 @@ multiMapper("gateway:UnderpaidBatch", async ({ event, context }) => {
116119 const poolId = "poolId" in data ? BigInt ( data . poolId ! ) : null ;
117120 if ( poolId ) poolIdSet . add ( poolId ) ;
118121
122+ const tokenId = "scId" in data ? ( data . scId as `0x${string } `) : null ;
123+ if ( tokenId ) tokenIdSet . add ( tokenId ) ;
124+
119125 const _crosschainMessage = ( await CrosschainMessageService . insert (
120126 context ,
121127 {
122128 id : messageId ,
123129 index : messageIndex ,
124130 poolId,
131+ tokenId,
125132 fromCentrifugeId,
126133 toCentrifugeId : toCentrifugeId . toString ( ) ,
127134 messageType : messageType ,
@@ -142,13 +149,15 @@ multiMapper("gateway:UnderpaidBatch", async ({ event, context }) => {
142149 return ;
143150 }
144151 const poolId = Array . from ( poolIdSet ) . pop ( ) ?? null ;
152+ const tokenId = Array . from ( tokenIdSet ) . pop ( ) ?? null ;
145153
146154 const crosschainPayload = ( await CrosschainPayloadService . insert (
147155 context ,
148156 {
149157 id : payloadId ,
150158 index : payloadIndex ,
151159 poolId,
160+ tokenId,
152161 rawData : batch ,
153162 toCentrifugeId : toCentrifugeId . toString ( ) ,
154163 fromCentrifugeId : fromCentrifugeId ,
0 commit comments