diff --git a/packages/engine/src/vaults/VaultBase.ts b/packages/engine/src/vaults/VaultBase.ts index 80cd90b322a..07af08d0a54 100644 --- a/packages/engine/src/vaults/VaultBase.ts +++ b/packages/engine/src/vaults/VaultBase.ts @@ -786,34 +786,6 @@ export abstract class VaultBase extends VaultBaseChainOnly { return nextNonce; } - getConfirmedUTXOs( - utxos: T[], - amount: string, - minTransferAmount = '0', - ): T[] { - const transactionAmount = new BigNumber(amount).plus(minTransferAmount); - const confirmedUTXOs = utxos.sort((a, b) => - new BigNumber(b.value).gt(a.value) ? 1 : -1, - ); - let sum = new BigNumber(0); - let i = 0; - for (i = 0; i < confirmedUTXOs.length; i += 1) { - sum = sum.plus(confirmedUTXOs[i].value); - if (sum.gt(transactionAmount)) { - break; - } - } - if (sum.lt(transactionAmount)) { - if (sum.gt(amount)) { - break; - } - } - if (sum.lt(amount)) { - return []; - } - return confirmedUTXOs.slice(0, i + 1); - } - validateSendAmount(amount: string, tokenBalance: string, to: string) { return Promise.resolve(true); } diff --git a/packages/engine/src/vaults/impl/nexa/Vault.ts b/packages/engine/src/vaults/impl/nexa/Vault.ts index fb954bbbc87..98edf494b95 100644 --- a/packages/engine/src/vaults/impl/nexa/Vault.ts +++ b/packages/engine/src/vaults/impl/nexa/Vault.ts @@ -243,6 +243,29 @@ export default class Vault extends VaultBase { return Promise.resolve({} as IDecodedTxLegacy); } + getConfirmedUTXOs( + utxos: T[], + amount: string, + minTransferAmount = '0', + ): T[] { + const transactionAmount = new BigNumber(amount).plus(minTransferAmount); + const confirmedUTXOs = utxos.sort((a, b) => + new BigNumber(b.value).gt(a.value) ? 1 : -1, + ); + let sum = new BigNumber(0); + let i = 0; + for (i = 0; i < confirmedUTXOs.length; i += 1) { + sum = sum.plus(confirmedUTXOs[i].value); + if (sum.gt(transactionAmount)) { + break; + } + } + if (sum.lt(transactionAmount)) { + return []; + } + return confirmedUTXOs.slice(0, i + 1); + } + override async buildEncodedTxFromTransfer( transferInfo: ITransferInfo, ): Promise {