Interface EventListeners

A set of non-blocking callback functions that are triggered in response to the widget events.

Example

<SuperfluidWidget eventListeners={{
onButtonClick: (props) => console.log(`${props?.type} button is clicked`),
onRouteChange: (props) => console.log(`Route is changed to ${props?.route}`),
onSuccess: () => console.log('Checkout is successfully finished!'),
onSuccessButtonClick: () => console.log('Merchant success button is clicked!')
onPaymentOptionUpdate: (paymentOption) => setChainId(paymentOption?.chainId);
}} />

Hierarchy

  • EventListeners

Properties

onButtonClick?: ((props?) => void)

Type declaration

    • (props?): void
    • Called when a button is pressed. Usually a call to action (CTA).

      Parameters

      • Optional props: {
            type: "next_step" | "skip_step" | "step_label" | "connect_wallet" | "switch_network" | "invoke_transaction" | "back_transactions" | "success_button" | "superfluid_dashboard" | "retry_gas_estimation" | "force_invoke_transaction" | "skip_to_next" | "copy_account_address" | "view_transaction_on_block_explorer";
        }
        • type: "next_step" | "skip_step" | "step_label" | "connect_wallet" | "switch_network" | "invoke_transaction" | "back_transactions" | "success_button" | "superfluid_dashboard" | "retry_gas_estimation" | "force_invoke_transaction" | "skip_to_next" | "copy_account_address" | "view_transaction_on_block_explorer"

      Returns void

onPaymentOptionUpdate?: ((paymentOption?) => void)

Type declaration

    • (paymentOption?): void
    • Called when the payment option is initialized or changed by the user.

      Parameters

      Returns void

onRouteChange?: ((props?) => void)

Type declaration

    • (props?): void
    • Called when the widget route changes. "Route" is a term to define the view the user sees.

      Parameters

      • Optional props: {
            route: "transactions" | "step_payment_option" | "step_wrap" | "step_review" | "success_summary";
        }
        • route: "transactions" | "step_payment_option" | "step_wrap" | "step_review" | "success_summary"

      Returns void

onSuccess?: (() => void)

Type declaration

    • (): void
    • Called when the checkout is successfully finished.

      Returns void

      Deprecated

      Use onTransactionExecuted instead (filter for functionName === 'createFlow | 'updateFlow').

onSuccessButtonClick?: (() => void)

Type declaration

    • (): void
    • Called when the merchant's success button is defined in the schema and it's clicked.

      Returns void

onTransactionSent?: ((props?) => void)

Type declaration

    • (props?): void
    • Called when a transaction is executed.

      Parameters

      • Optional props: {
            functionName?: "createFlow" | "deleteFlow" | "grantPermissions" | "revokePermissions" | "setFlowrate" | "setFlowrateFrom" | "updateFlow" | "updateFlowOperatorPermissions";
            hash?: `0x${string}`;
        }
        • Optional functionName?: "createFlow" | "deleteFlow" | "grantPermissions" | "revokePermissions" | "setFlowrate" | "setFlowrateFrom" | "updateFlow" | "updateFlowOperatorPermissions"
        • Optional hash?: `0x${string}`

      Returns void

Generated using TypeDoc