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

Configure KRNL Protocol Connection


Setup Providers


Authorize KRNL Delegated Account

Authorization Process:

  1. User signs an EIP-7702 authorization message via Privy

  2. Delegates specific permissions to the KRNL contract

  3. Account gains smart account capabilities without deploying a new contract

  4. Delegation is temporary and revocable


Execute KRNL Workflows

Execute a Basic Workflow

Execute Workflow From Template


Workflow Execution Flow

  1. Submit to KRNL: DSL sent to nodes → PENDING

  2. Admission Control: Workflow validated & queued → PENDING

  3. Processing: Execution off-chain → PROCESSING

  4. Completion: Success or failure → SUCCESS / FAILED / ERROR_CODES

  5. On-chain Settlement: Results trigger transaction intent on-chain

  6. Confirmation: Transaction hash & block number returned


Step-by-Step Progress Tracking

Steps Array Structure

Workflow Steps

  1. Submit: Send workflow to KRNL node

  2. Execute: Off-chain execution (PENDING → PROCESSING → SUCCESS)

  3. On-chain Status: Monitor blockchain transaction confirmation

Current Step Values

  • 0 = Idle

  • 1 = Submitting workflow

  • 2 = Executing workflow

  • 3 = Monitoring on-chain transaction


Workflow Status Codes

Code
Meaning

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


Template Utilities

Processing Templates

Development

Last updated