UNPKG

@0xsplits/splits-sdk

Version:

SDK for the 0xSplits protocol

46 lines (45 loc) 2.79 kB
import { Address, Hex } from 'viem'; import { ContractRecoupTranche, RecoupTrancheInput, SplitRecipient, SplitsPublicClient, SplitV2Type, WaterfallTrancheInput } from '../types'; import { IRecipient } from '../subgraph/types'; export * from './ens'; export * from './numbers'; export * from './swapper'; export * from './validation'; export * from './balances'; export * from './requests'; export * from './tokens'; export declare const getRecipientSortedAddressesAndAllocations: (recipients: SplitRecipient[]) => [Address[], bigint[]]; export declare const getNftCountsFromPercents: (percentAllocations: bigint[]) => number[]; export declare const getTrancheRecipientsAndSizes: (chainId: number, token: Address, tranches: WaterfallTrancheInput[], publicClient: SplitsPublicClient) => Promise<[Address[], bigint[]]>; export declare const getRecoupTranchesAndSizes: (chainId: number, token: Address, tranches: RecoupTrancheInput[], publicClient: SplitsPublicClient) => Promise<[ContractRecoupTranche[], bigint[]]>; export declare const getAddressAndAllocationFromRecipients: (recipients: SplitRecipient[]) => { recipientAddresses: Address[]; recipientAllocations: bigint[]; }; export declare const MAX_V2_DISTRIBUTION_INCENTIVE = 6.5535; export declare const MAX_PULL_SPLIT_RECIPIENTS = 500; export declare const MAX_PUSH_SPLIT_RECIPIENTS = 400; export declare const getValidatedSplitV2Config: (recipients: SplitRecipient[], distributorFeePercent: number, totalAllocationPercent?: number, maxRecipients?: number) => { recipientAddresses: Address[]; recipientAllocations: bigint[]; distributionIncentive: number; totalAllocation: bigint; }; export declare const getSplitType: (chainId: number, factoryAddress: Address) => SplitV2Type; /** * Determines the SplitV2 type (Pull or Push) by analyzing the contract bytecode * @param code - The contract bytecode * @returns The type of split (SplitV2Type.Pull or SplitV2Type.Push) * @throws Error if split type cannot be determined from bytecode */ export declare const getSplitV2TypeFromBytecode: (code: Hex | undefined) => SplitV2Type; /** * Returns the maximum number of recipients allowed for a given SplitV2 type * @param splitType - The type of split (SplitV2Type.Pull or SplitV2Type.Push) * @returns The maximum number of recipients allowed */ export declare const getMaxSplitV2Recipients: (splitType: SplitV2Type) => number; export declare const getAccountsAndPercentAllocations: (arg0: IRecipient[], arg1?: boolean) => [Address[], bigint[]]; export declare const hashSplitV2: (arg0: Address[], arg1: bigint[], arg2: bigint, arg3: number) => string; export declare const hashSplitV1: (arg0: Address[], arg1: number[], arg2: number) => string; export declare const sleep: (timeMs: number) => Promise<unknown>;