import type { Account, Address, Client, SendTransactionParameters, TransactionRequest, } from 'viem' import type { ChainWithPns } from './contracts/consts.js' export type Prettify = { [K in keyof T]: T[K] } & {} type AssignI = { [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K] } export type Assign = AssignI & U export type SimpleTransactionRequest = { [P in keyof Pick]-?: Exclude< TransactionRequest[P], null > } export type TransactionRequestWithPassthrough = SimpleTransactionRequest & { passthrough?: TPassthrough } export type GenericPassthrough = { args: any; address: Address } export type Extended = { [K in keyof Client]?: undefined } & { [key: string]: unknown } type AllowedWriteParameters = | 'gas' | 'gasPrice' | 'maxFeePerGas' | 'maxPriorityFeePerGas' | 'nonce' | 'account' export type WriteTransactionParameters< TChain extends ChainWithPns, TAccount extends Account | undefined, TChainOverride extends ChainWithPns | undefined = ChainWithPns, > = Pick< SendTransactionParameters, AllowedWriteParameters > export type DateWithValue = { date: Date value: T } export type DecodedAbi = { contentType: 1 | 2 | 4 | 8 | number decoded: boolean abi: string | object } export type DecodedAddr = { id: number name: string value: string } export type DecodedText = { key: string value: string } export type AnyDate = string | number | bigint | Date export type RootName = '' export type TldName = `${string}` export type PlsTldName = `pls` export type Pls2ldName = `${string}.pls` export type PlsAnyName = PlsTldName | Pls2ldName export type PlsSubname = `${string}.${string}.pls` export type Other2ldName = `${string}.${string}` export type OtherSubname = `${string}.${string}.${string}` export type NameOption = | TldName | Pls2ldName | PlsSubname | Other2ldName | OtherSubname export type TldNameSpecifier = 'tld' export type Pls2ldNameSpecifier = 'pls-2ld' export type PlsSubnameSpecifier = 'pls-subname' export type Other2ldNameSpecifier = 'other-2ld' export type OtherSubnameSpecifier = 'other-subname' export type RootNameSpecifier = 'root' export type PlsTldNameSpecifier = 'pls-tld' export type NameType = | TldNameSpecifier | Pls2ldNameSpecifier | PlsSubnameSpecifier | Other2ldNameSpecifier | OtherSubnameSpecifier | RootNameSpecifier | PlsTldNameSpecifier type GetPlsNameType = TString extends PlsTldName ? PlsTldNameSpecifier : TString extends PlsSubname ? PlsSubnameSpecifier : Pls2ldNameSpecifier type GetOtherNameType = TString extends OtherSubname ? OtherSubnameSpecifier : TString extends Other2ldName ? Other2ldNameSpecifier : TldNameSpecifier export type GetNameType = TString extends RootName ? RootNameSpecifier : TString extends PlsAnyName ? GetPlsNameType : GetOtherNameType