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.

44 lines (43 loc) 2.33 kB
import { Account, Address, Chain, Hash, ParseAccount, PublicClient, Transport, WalletClient } from 'viem'; import { ContractAddresses } from '../abis'; import { NitroliteTransactionPreparer } from './prepare'; import { ChallengeChannelParams, ChannelData, ChannelId, CheckpointChannelParams, CloseChannelParams, CreateChannelParams, NitroliteClientConfig, ResizeChannelParams, State } from './types'; export declare class NitroliteClient { readonly publicClient: PublicClient; readonly walletClient: WalletClient<Transport, Chain, ParseAccount<Account>>; readonly account: ParseAccount<Account>; readonly addresses: ContractAddresses; readonly challengeDuration: bigint; readonly txPreparer: NitroliteTransactionPreparer; readonly chainId: number; private readonly stateSigner; private readonly nitroliteService; private readonly erc20Service; private readonly sharedDeps; constructor(config: NitroliteClientConfig); deposit(tokenAddress: Address, amount: bigint): Promise<Hash>; createChannel(params: CreateChannelParams): Promise<{ channelId: ChannelId; initialState: State; txHash: Hash; }>; depositAndCreateChannel(tokenAddress: Address, depositAmount: bigint, params: CreateChannelParams): Promise<{ channelId: ChannelId; initialState: State; txHash: Hash; }>; checkpointChannel(params: CheckpointChannelParams): Promise<Hash>; challengeChannel(params: ChallengeChannelParams): Promise<Hash>; resizeChannel(params: ResizeChannelParams): Promise<Hash>; closeChannel(params: CloseChannelParams): Promise<Hash>; withdrawal(tokenAddress: Address, amount: bigint): Promise<Hash>; getOpenChannels(): Promise<ChannelId[]>; getAccountBalance(tokenAddress: Address): Promise<bigint>; getAccountBalance(tokenAddress: Address[]): Promise<bigint[]>; getChannelBalance(channelId: ChannelId, tokenAddress: Address): Promise<bigint>; getChannelBalance(channelId: ChannelId, tokenAddress: Address[]): Promise<bigint[]>; getChannelData(channelId: ChannelId): Promise<ChannelData>; approveTokens(tokenAddress: Address, amount: bigint): Promise<Hash>; getTokenAllowance(tokenAddress: Address): Promise<bigint>; getTokenBalance(tokenAddress: Address): Promise<bigint>; }