Therun
method executes the generated actions from the getActions
method. It sends a transaction to the blockchain to approve the sale.
Parameters
An IApproveSaleConfig
object which contains:
saleId
: The ID of the sale to approve.chainId
: The blockchain chain ID where the sale needs to be approved.
Returns
Promise<IApproveSaleOutput>
- A promise that resolves to the result of the actions execution, including transaction details and the updated sale object.
Usage
// Step 1: Generate the actions required for approving the sale
const actions = sdk.approveSaleService.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 approval
const saleApprovalConfig = {
saleId: 123,
chainId: 1,
};
// Step 4: Execute the actions to approve the sale
try {
const result = await actions.run(saleApprovalConfig);
console.log('Sale approved successfully:', result);
} catch (error) {
console.error('Error during sale approval:', error);
}