run

The run method on executes the generated actions from the getActions method. It sends a transaction to the blockchain to finalize the sale.

Parameters

An IFinishSaleConfig object which contains:

  • saleId: The ID of the sale to finalize.
  • chainId: The blockchain chain ID where the sale needs to be finalized.

Returns

Promise<IFinishSaleOutput> - A promise that resolves to the result of the actions execution, including transaction details and context.

Usage

// Step 1: Generate the actions required for finalizing the sale
const actions = sdk.finishSaleService.getActions();

// Step 2: Optionally, subscribe to the execution state to track progress
actions.on('state', (state) => {
  console.log('Current state:', state);
});

// Step 3: Prepare the configuration for sale finalization
const saleFinalizationConfig = {
  saleId: 123,
  chainId: 1,
};

// Step 4: Execute the actions to finalize the sale
try {
  const result = await actions.run(saleFinalizationConfig);
  console.log('Sale finalized successfully:', result);
} catch (error) {
  console.error('Error during sale finalization:', error);
}