Usage
What is KRNL SDK?
The KRNL SDK is a developer toolkit for interacting with the KRNL Protocol, enabling seamless workflow execution, delegated account management, and real-time monitoring. With the SDK, you can:
Execute workflows using a simple DSL (domain-specific language)
Track step-by-step workflow progress off-chain
Monitor workflow status and on-chain settlement
Integrate smart account functionality with delegated authority
The SDK provides React hooks, utilities, and type definitions to simplify development of KRNL-native dApps.
Important: Privy Wallet Requirement
The KRNL SDK requires Privy for wallet integration and must be used with @privy-io/react-auth.
Privy is currently one of the few wallet providers that fully supports EIP-7702 account abstraction, which is essential for KRNL Protocol’s delegated account functionality.
EIP-7702 enables:
Temporary delegation of account authority
Smart account capabilities on existing EOAs
Gasless transactions via delegation
Enhanced security without deploying separate smart contracts
Without Privy and EIP-7702 support, the SDK cannot enable the smart account features required for KRNL workflow execution.
Configure KRNL Protocol Connection
Setup Providers
Authorize KRNL Delegated Account
Authorization Process:
User signs an EIP-7702 authorization message via Privy
Delegates specific permissions to the KRNL contract
Account gains smart account capabilities without deploying a new contract
Delegation is temporary and revocable
Execute KRNL Workflows
Execute a Basic Workflow
Execute Workflow From Template
Workflow Execution Flow
Submit to KRNL: DSL sent to nodes →
PENDINGAdmission Control: Workflow validated & queued →
PENDINGProcessing: Execution off-chain →
PROCESSINGCompletion: Success or failure →
SUCCESS/FAILED/ERROR_CODESOn-chain Settlement: Results trigger transaction intent on-chain
Confirmation: Transaction hash & block number returned
Step-by-Step Progress Tracking
Steps Array Structure
Workflow Steps
Submit: Send workflow to KRNL node
Execute: Off-chain execution (PENDING → PROCESSING → SUCCESS)
On-chain Status: Monitor blockchain transaction confirmation
Current Step Values
0= Idle1= Submitting workflow2= Executing workflow3= Monitoring on-chain transaction
Workflow Status Codes
0
PENDING – Workflow queued
1
PROCESSING – Workflow executing
2
SUCCESS – Workflow completed successfully
3
FAILED – Execution failed
4
INTENT_NOT_FOUND – Intent ID missing
5
WORKFLOW_NOT_FOUND – Workflow definition missing
6
INVALID – Invalid request
useKRNL() Hook
useKRNL() HookTemplate Utilities
Processing Templates
Development
Last updated

