diff --git a/src/cross-chain-order/cross-chain-order.ts b/src/cross-chain-order/cross-chain-order.ts index 177d2c2..f5eb0f0 100644 --- a/src/cross-chain-order/cross-chain-order.ts +++ b/src/cross-chain-order/cross-chain-order.ts @@ -330,10 +330,15 @@ export class CrossChainOrder { ) const partsCount = this.escrowExtension.hashLockInfo.getPartsCount() + const calculatedIndex = + ((this.makingAmount - remainingAmount + this.makingAmount - 1n) * + partsCount) / + this.makingAmount + if (remainingAmount === fillAmount) { - return Number(partsCount) + return Number(calculatedIndex + 2n) } - return Number((partsCount * (fillAmount - 1n)) / this.makingAmount) + return Number(calculatedIndex + 1n) } }