Lifecycle Status · OnchainKit
How to influence the behavior of your components and onchain data with Lifecycle Status.
OnchainKit Lifecycle Status allows you to manage the state of APIs and onchain transactions seamlessly within components.
How to listen to the Lifecycle Status
The Lifecycle Status is a TypeScript object that provides easy access to the statusName
and statusData
properties,
allowing you to stay informed and responsive.
Lifecycle Status
The Lifecycle Status includes 3 states common to all components:
init
The component is initialized and ready for use.
success
The component has successfully completed its main action, such as swap
or transaction
.
error
The component has encountered an issue while fetching API data, executing an onchain operation, or needs to display a visual message to the user.
Each component brings its own unique experience, and we have explored both the swap and transaction processes.
Lifecycle Status with <Swap />
amountChange
Any of the Swap Input fields have been updated.
transactionPending
The transaction has been submitted to the network but has not yet been confirmed to be included in a block. During this pending state, the transaction is waiting to be validated by the network’s consensus mechanism.
transactionApproved
The transaction has been verified to be valid and it has been included in a block however the transaction is not yet finalized.
success
The transaction has been added to the blockchain and the transaction is considered final.
Lifecycle Status with <Transaction />
transactionIdle
The transaction component is waiting for the user to take action.
transactionPending
The transaction has been submitted to the network but has not yet been confirmed to be included in a block. During this pending state, the transaction is waiting to be validated by the network’s consensus mechanism.
success
The transaction has been added to the blockchain and the transaction is considered final.