rewards-frontend-package


rewards-frontend-package / ReclaimAllocationsComponent / ReclaimAllocationsComponent

Class: ReclaimAllocationsComponent

Defined in: src/ReclaimAllocationsComponent.ts:17

Component for managing and reclaiming allocated rewards.

Handles the display and transaction submission for reclaiming allocations from addresses that are no longer eligible. Provides a list of reclaimable addresses with individual reclaim buttons.

Example

const reclaimComponent = new ReclaimAllocationsComponent(rewardsClient, walletManager)
reclaimComponent.bind(document.getElementById('reclaim-allocations-container'))

Constructors

Constructor

new ReclaimAllocationsComponent(rewardsClient, walletManager): ReclaimAllocationsComponent

Defined in: src/ReclaimAllocationsComponent.ts:29

Creates an instance of ReclaimAllocationsComponent.

Parameters

rewardsClient

RewardsClient

The client for interacting with rewards contract and API

walletManager

WalletManager

The wallet manager for account and network state

Returns

ReclaimAllocationsComponent

Properties

element

private element: HTMLElement | null = null

Defined in: src/ReclaimAllocationsComponent.ts:18


reclaimableAddresses

private reclaimableAddresses: string[] = []

Defined in: src/ReclaimAllocationsComponent.ts:21


rewardsClient

private rewardsClient: RewardsClient

Defined in: src/ReclaimAllocationsComponent.ts:19


walletManager

private walletManager: WalletManager

Defined in: src/ReclaimAllocationsComponent.ts:20

Methods

addEventListeners()

private addEventListeners(): void

Defined in: src/ReclaimAllocationsComponent.ts:134

Adds event listeners for reclaim button clicks.

Listens for click events on dynamically generated reclaim buttons and triggers the reclaim process for the corresponding address.

Returns

void


bind()

bind(element): void

Defined in: src/ReclaimAllocationsComponent.ts:40

Binds the component to a DOM element and initializes event listeners.

Parameters

element

HTMLElement

The HTML element to bind the component to

Returns

void


destroy()

destroy(): void

Defined in: src/ReclaimAllocationsComponent.ts:165

Cleans up the component.

Currently no specific cleanup needed, but provided for interface consistency.

Returns

void


fetchReclaimAllocationsData()

private fetchReclaimAllocationsData(): Promise<void>

Defined in: src/ReclaimAllocationsComponent.ts:59

Fetches reclaimable allocation data from the backend API.

Retrieves the list of addresses that have allocations that can be reclaimed. Updates the internal state with the results.

Returns

Promise<void>


getReclaimableAddresses()

getReclaimableAddresses(): string[]

Defined in: src/ReclaimAllocationsComponent.ts:156

Gets the current list of reclaimable addresses.

Returns

string[]

Array of reclaimable addresses


handleReclaimAllocation()

private handleReclaimAllocation(address): Promise<void>

Defined in: src/ReclaimAllocationsComponent.ts:101

Handles reclaim transaction submission for a specific address.

Submits a reclaim transaction for the specified address and refreshes the data on success. Handles errors appropriately.

Parameters

address

string

The address to reclaim allocations from

Returns

Promise<void>


handleReclaimError()

private handleReclaimError(address, error): void

Defined in: src/ReclaimAllocationsComponent.ts:87

Handles errors during reclaim operations.

Logs the error and displays an alert to the user with the specific address that failed and the error message.

Parameters

address

string

The address that failed to reclaim

error

unknown

The error that occurred

Returns

void