File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @skip-router/core " : patch
3
+ ---
4
+
5
+ backward compatible addressList
Original file line number Diff line number Diff line change @@ -204,13 +204,28 @@ export class SkipRouter {
204
204
async executeRoute ( options : clientTypes . ExecuteRouteOptions ) {
205
205
const { route, userAddresses } = options ;
206
206
207
- const addressList = userAddresses . map ( ( { chainID, address } , i ) => {
208
- if ( route . requiredChainAddresses [ i ] !== chainID ) {
209
- raise ( `executeRoute error: invalid address for chain '${ chainID } '` ) ;
207
+ let addressList : string [ ] = [ ] ;
208
+ let i = 0 ;
209
+ for ( let j = 0 ; j < userAddresses . length ; j ++ ) {
210
+ if ( route . requiredChainAddresses [ i ] !== userAddresses [ j ] ?. chainID ) {
211
+ i = j ;
212
+ continue ;
210
213
}
214
+ addressList . push ( userAddresses [ j ] ! . address ! ) ;
215
+ i ++ ;
216
+ }
211
217
212
- return address ;
213
- } ) ;
218
+ if ( addressList . length !== route . requiredChainAddresses . length ) {
219
+ addressList = userAddresses . map ( ( x ) => x . address ) ;
220
+ }
221
+
222
+ const validLength =
223
+ addressList . length === route . requiredChainAddresses . length ||
224
+ addressList . length === route . chainIDs . length ;
225
+
226
+ if ( ! validLength ) {
227
+ raise ( "executeRoute error: invalid address list" ) ;
228
+ }
214
229
215
230
const messages = await this . messages ( {
216
231
sourceAssetDenom : route . sourceAssetDenom ,
You can’t perform that action at this time.
0 commit comments