UNPKG

@erc7824/nitrolite

Version:

The Nitrolite SDK empowers developers to build high-performance, scalable web3 applications using state channels. It's designed to provide near-instant transactions and significantly improved user experiences by minimizing direct blockchain interactions.

41 lines (40 loc) 1.08 kB
import { Address, Hex } from 'viem'; import { Channel, State } from '../client/types'; export declare enum Role { UNDEFINED = -1, HOST = 0, GUEST = 1 } export declare namespace AppDataTypes { interface NumericState { value: bigint; } interface SequentialState { sequence: bigint; value: bigint; } interface TurnBasedState { data: any; turn: number; status: number; isComplete: boolean; } } export interface Metadata { channel: Channel; challengeExpire?: bigint; lastValidState?: State; } export interface AppLogic<T = unknown> { encode: (data: T) => Hex; decode: (encoded: Hex) => T; validateTransition?: (channel: Channel, prevState: T, nextState: T) => boolean; provideProofs?: (channel: Channel, state: T, previousStates: State[]) => State[]; isFinal?: (state: T) => boolean; getAdjudicatorAddress: () => Address; getAdjudicatorType?: () => string; } export interface AppConfig<T = unknown> { appLogic: AppLogic<T>; initialState?: T; }