Main Concepts
OKCore
Type: CoreExecution
Instance: One per application
The OKCore
is the backbone of the OKcontract SDK. It initializes and manages common resources that are shared across the entire application. This includes wallet connections, chain configurations, and other core functionalities that need to be globally accessible.
Features:
- Manages wallet connections and authentication
- Configures and handles multiple blockchain networks
- Acts as a central point for other components to access shared resources.
OKInstance
Instance: One per page
The OKInstance
handles the context-specific configuration and operations required for each page in your application. It manages data caching, RPC calls, and other page-specific interactions.
Features:
- Manages OKcontract Network data caching
- Handles RPC calls for contract interactions
- Maintains context-specific settings and data.
OKInteraction
Instance: One per interaction (multi-step)
The OKInteraction
component is designed to manage a sequence of steps involved in a single interaction with a smart contract. It simplifies multi-step processes by breaking them down into manageable transactions.
Features:
- Manages multi-step contract interactions.
- Keeps track of the current step and progresses through each step sequentially.
- Handles user inputs and transaction submissions.
OKTransaction
Instance: One per step in an interaction
The OKTransaction
represents a single step within a OKInteraction
. It encapsulates all the details and state necessary to execute and monitor a transaction.
Features:
- Manages user inputs data required for the transaction
- Manages the state of the transaction, including submission status and responses
- Manages state related to the contract's transactions (after submission)
- Captures logs and events emitted during transaction mining.
OKContract
Instance: One per contract (possibly reused)
The OKContract
component encapsulates all the necessary information and functionality related to a specific smart contract. This includes the contract's ABI, address, and methods for interacting with the contract.
Features:
- Stores contract data, including ABI and address
- Reads from the smart contract and calls methods.