@@ -214,19 +214,19 @@ func buildTxForPath(transactor transactions.TransactorIface, path *routes.Path,
214
214
}
215
215
216
216
func (tm * TransactionManager ) BuildTransactionsFromRoute (route routes.Route , pathProcessors map [string ]pathprocessor.PathProcessor ,
217
- params BuildRouteExtraParams ) (* responses.SigningDetails , error ) {
217
+ params BuildRouteExtraParams ) (* responses.SigningDetails , uint64 , uint64 , error ) {
218
218
if len (route ) == 0 {
219
- return nil , ErrNoRoute
219
+ return nil , 0 , 0 , ErrNoRoute
220
220
}
221
221
222
222
accFrom , err := tm .accountsDB .GetAccountByAddress (types .Address (params .AddressFrom ))
223
223
if err != nil {
224
- return nil , err
224
+ return nil , 0 , 0 , err
225
225
}
226
226
227
227
keypair , err := tm .accountsDB .GetKeypairByKeyUID (accFrom .KeyUID )
228
228
if err != nil {
229
- return nil , err
229
+ return nil , 0 , 0 , err
230
230
}
231
231
232
232
response := & responses.SigningDetails {
@@ -246,7 +246,7 @@ func (tm *TransactionManager) BuildTransactionsFromRoute(route routes.Route, pat
246
246
if path .ApprovalRequired && ! tm .ApprovalPlacedForPath (path .ProcessorName ) {
247
247
txDetails .ApprovalTxData , err = buildApprovalTxForPath (tm .transactor , path , params .AddressFrom , usedNonces , signer )
248
248
if err != nil {
249
- return nil , err
249
+ return nil , path . FromChain . ChainID , path . ToChain . ChainID , err
250
250
}
251
251
response .Hashes = append (response .Hashes , txDetails .ApprovalTxData .HashToSign )
252
252
@@ -259,12 +259,12 @@ func (tm *TransactionManager) BuildTransactionsFromRoute(route routes.Route, pat
259
259
// build tx for the path
260
260
txDetails .TxData , err = buildTxForPath (tm .transactor , path , pathProcessors , usedNonces , signer , params )
261
261
if err != nil {
262
- return nil , err
262
+ return nil , path . FromChain . ChainID , path . ToChain . ChainID , err
263
263
}
264
264
response .Hashes = append (response .Hashes , txDetails .TxData .HashToSign )
265
265
}
266
266
267
- return response , nil
267
+ return response , 0 , 0 , nil
268
268
}
269
269
270
270
func getSignatureForTxHash (txHash string , signatures map [string ]requests.SignatureDetails ) ([]byte , error ) {
@@ -309,26 +309,26 @@ func validateAndAddSignature(txData *wallettypes.TransactionData, signatures map
309
309
return nil
310
310
}
311
311
312
- func (tm * TransactionManager ) ValidateAndAddSignaturesToRouterTransactions (signatures map [string ]requests.SignatureDetails ) error {
312
+ func (tm * TransactionManager ) ValidateAndAddSignaturesToRouterTransactions (signatures map [string ]requests.SignatureDetails ) ( uint64 , uint64 , error ) {
313
313
if len (tm .routerTransactions ) == 0 {
314
- return ErrNoTrsansactionsBeingBuilt
314
+ return 0 , 0 , ErrNoTrsansactionsBeingBuilt
315
315
}
316
316
317
317
// check if all transactions have been signed
318
318
var err error
319
319
for _ , desc := range tm .routerTransactions {
320
320
err = validateAndAddSignature (desc .ApprovalTxData , signatures )
321
321
if err != nil {
322
- return err
322
+ return desc . RouterPath . FromChain . ChainID , desc . RouterPath . ToChain . ChainID , err
323
323
}
324
324
325
325
err = validateAndAddSignature (desc .TxData , signatures )
326
326
if err != nil {
327
- return err
327
+ return desc . RouterPath . FromChain . ChainID , desc . RouterPath . ToChain . ChainID , err
328
328
}
329
329
}
330
330
331
- return nil
331
+ return 0 , 0 , nil
332
332
}
333
333
334
334
func addSignatureAndSendTransaction (
@@ -355,11 +355,13 @@ func addSignatureAndSendTransaction(
355
355
return responses .NewRouterSentTransaction (txData .TxArgs , txData .SentHash , isApproval ), nil
356
356
}
357
357
358
- func (tm * TransactionManager ) SendRouterTransactions (ctx context.Context , multiTx * MultiTransaction ) (transactions []* responses.RouterSentTransaction , err error ) {
358
+ func (tm * TransactionManager ) SendRouterTransactions (ctx context.Context , multiTx * MultiTransaction ) (transactions []* responses.RouterSentTransaction , fromChainID uint64 , toChainID uint64 , err error ) {
359
359
transactions = make ([]* responses.RouterSentTransaction , 0 )
360
360
361
361
// send transactions
362
362
for _ , desc := range tm .routerTransactions {
363
+ fromChainID = desc .RouterPath .FromChain .ChainID
364
+ toChainID = desc .RouterPath .ToChain .ChainID
363
365
if desc .ApprovalTxData != nil && ! desc .IsApprovalPlaced () {
364
366
var response * responses.RouterSentTransaction
365
367
response , err = addSignatureAndSendTransaction (tm .transactor , desc .ApprovalTxData , multiTx .ID , true )
0 commit comments