diff --git a/packages/core/src/builder/pluginContext.ts b/packages/core/src/builder/pluginContext.ts index 78bca2c..2be5012 100644 --- a/packages/core/src/builder/pluginContext.ts +++ b/packages/core/src/builder/pluginContext.ts @@ -52,24 +52,16 @@ export type FleetPluginContext = { setFee: (amount: Amount) => void; }; -export function createPluginContext( - transactionBuilder: TransactionBuilder -): FleetPluginContext { +export function createPluginContext(builder: TransactionBuilder): FleetPluginContext { return { - addInputs: (inputs) => - transactionBuilder - .from(inputs, { ensureInclusion: true }) - .inputs.length, - addOutputs: (outputs, options) => - transactionBuilder.to(outputs, options).outputs.length, + addInputs: (inputs) => builder.from(inputs, { ensureInclusion: true }).inputs.length, + addOutputs: (outputs, options) => builder.to(outputs, options).outputs.length, addDataInputs: (dataInputs, options) => - transactionBuilder.withDataFrom(dataInputs, options).dataInputs.length, + builder.withDataFrom(dataInputs, options).dataInputs.length, burnTokens: (tokens) => { - if (!transactionBuilder.settings.canBurnTokensFromPlugins) { - throw new NotAllowedTokenBurning(); - } - transactionBuilder.burnTokens(tokens); + if (!builder.settings.canBurnTokensFromPlugins) throw new NotAllowedTokenBurning(); + builder.burnTokens(tokens); }, - setFee: (amount) => transactionBuilder.payFee(amount) + setFee: (amount) => builder.payFee(amount) }; } diff --git a/packages/core/src/builder/transactionBuilder.ts b/packages/core/src/builder/transactionBuilder.ts index a7e2b78..bbc141d 100644 --- a/packages/core/src/builder/transactionBuilder.ts +++ b/packages/core/src/builder/transactionBuilder.ts @@ -281,10 +281,10 @@ export class TransactionBuilder { } const selector = new BoxSelector(this.inputs.toArray()); - if (this._ensureInclusion?.size) { + if (this._ensureInclusion?.size) { selector.ensureInclusion(Array.from(this._ensureInclusion)); } - + if (some(this._selectorCallbacks)) { for (const selectorCallBack of this._selectorCallbacks) { selectorCallBack(selector);