onTransactionSuccess, onTransactionError, onWidgetClose and onWidgetOpen
FKEvents
TheFKEvents defines callback functions for various events that can occur during the operation of the widget. Here’s a breakdown of each event:
| Event | Type | Description |
|---|---|---|
| onTransactionSuccess | (data: TransactionSuccessData) => void | undefined | Called when a transaction is successful. |
| onTransactionError | (data: TransactionErrorData) => void | undefined | Called when a transaction encounters an error. |
| onWidgetClose | (error?: Error) => void | undefined | Called when the widget is closed. |
| onWidgetOpen | () => void | undefined | Called when the widget is opened. |
Event Data Types
TransactionSuccessData
| Property | Type | Description |
|---|---|---|
| status | string | The status of the transaction. |
| message | string | A message describing the transaction result. |
| data | object | Additional data about the transaction. |
| data.txHash | string | undefined | The transaction hash, if available. |
| data[key: string] | string | number | undefined | Any additional key-value pairs. |
TransactionErrorData
| Property | Type | Description |
|---|---|---|
| status | string | The status of the transaction (presumably an error status). |
| message | string | A message describing the error. |
| data | string | Additional data about the error. |
