Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
arobsn committed Sep 15, 2024
1 parent 85f049d commit 029faa8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
22 changes: 7 additions & 15 deletions packages/core/src/builder/pluginContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
}
4 changes: 2 additions & 2 deletions packages/core/src/builder/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 029faa8

Please sign in to comment.