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.

29 lines (28 loc) 1.93 kB
import { Account, Address, Chain, ParseAccount, SimulateContractReturnType, Transport, WalletClient } from 'viem'; import { ContractAddresses } from '../abis'; import { Erc20Service, NitroliteService } from './services'; import { ChallengeChannelParams, CheckpointChannelParams, CloseChannelParams, CreateChannelParams, ResizeChannelParams } from './types'; export type PreparedTransaction = SimulateContractReturnType['request']; export interface PreparerDependencies { nitroliteService: NitroliteService; erc20Service: Erc20Service; addresses: ContractAddresses; account: ParseAccount<Account>; walletClient: WalletClient<Transport, Chain, ParseAccount<Account>>; stateWalletClient: WalletClient<Transport, Chain, ParseAccount<Account>>; challengeDuration: bigint; chainId: number; } export declare class NitroliteTransactionPreparer { private readonly deps; constructor(dependencies: PreparerDependencies); prepareDepositTransactions(tokenAddress: Address, amount: bigint): Promise<PreparedTransaction[]>; prepareCreateChannelTransaction(tokenAddress: Address, params: CreateChannelParams): Promise<PreparedTransaction>; prepareDepositAndCreateChannelTransactions(tokenAddress: Address, amount: bigint, params: CreateChannelParams): Promise<PreparedTransaction[]>; prepareCheckpointChannelTransaction(params: CheckpointChannelParams): Promise<PreparedTransaction>; prepareChallengeChannelTransaction(params: ChallengeChannelParams): Promise<PreparedTransaction>; prepareResizeChannelTransaction(params: ResizeChannelParams): Promise<PreparedTransaction>; prepareCloseChannelTransaction(params: CloseChannelParams): Promise<PreparedTransaction>; prepareWithdrawalTransaction(tokenAddress: Address, amount: bigint): Promise<PreparedTransaction>; prepareApproveTokensTransaction(tokenAddress: Address, amount: bigint): Promise<PreparedTransaction>; }