Skip to content

Commit d7a909a

Browse files
authored
Merge pull request #231 from skip-mev/kiki/fre-787-ibcfunhttpibcfun-broken-for-noble-forwarding-frontend
2 parents 83a0e1b + d1d0161 commit d7a909a

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.changeset/healthy-queens-leave.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@skip-router/core": patch
3+
---
4+
5+
backward compatible addressList

packages/core/src/client.ts

+20-5
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,28 @@ export class SkipRouter {
204204
async executeRoute(options: clientTypes.ExecuteRouteOptions) {
205205
const { route, userAddresses } = options;
206206

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;
210213
}
214+
addressList.push(userAddresses[j]!.address!);
215+
i++;
216+
}
211217

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+
}
214229

215230
const messages = await this.messages({
216231
sourceAssetDenom: route.sourceAssetDenom,

0 commit comments

Comments
 (0)