import { Hex, Signature, SignedAuthorizationList } from "viem"; //#region src/to-viem-transaction-serializable.d.ts type Quantity$1 = Hex | number | bigint; type BytesLike = ArrayLike | Hex; type AccessList$1 = readonly { address: Hex; storageKeys: readonly Hex[]; }[]; type AccessListish$1 = AccessList$1 | Array<[Hex, readonly Hex[]]> | Record; /** * Similar to our base UnsignedTransactionRequest type but with stricter * types (e.g. Hex for strings and readonly for arrays) which match the Viem expected * types. */ type StrictUnsignedTransactionRequest = { to?: Hex | null | undefined; from?: Hex; nonce?: Quantity$1; gasLimit?: Quantity$1; gasPrice?: Quantity$1; data?: BytesLike; /** Integer of the value sent with this transaction, in Wei. */ value?: Quantity$1; chainId?: number; type?: 0 | 1 | 2 | 3 | 4 | undefined; gas?: Quantity$1; accessList?: AccessListish$1; maxPriorityFeePerGas?: Quantity$1; maxFeePerGas?: Quantity$1; authorizationList?: readonly { address: Hex; chainId: Quantity$1; nonce: Quantity$1; r: Hex; s: Hex; yParity?: number; v?: Quantity$1; }[]; }; /** * Similar to our base UnsignedTransactionRequestWithChainId type but with stricter * types (e.g. Hex for strings and readonly for arrays) which match the Viem expected * types. */ type StrictUnsignedTransactionRequestWithChainId = StrictUnsignedTransactionRequest & { chainId: number; }; /** * Maps the string transaction types from viem to the numeric transaction types * used in our wallet interface. */ declare const STRING_TO_NUMBER_TXN_TYPE: { readonly legacy: 0; readonly eip2930: 1; readonly eip1559: 2; readonly eip4844: 3; readonly eip7702: 4; }; /** * Utility to convert a defined value into a bigint, returns undefined otherwise. * * @example * toBigIntIfDefined(undefined) // undefined * toBigIntIfDefined(0) // 0n * toBigIntIfDefined('0xF') // 15n */ declare const toBigIntIfDefined: (val: Hex | number | bigint | undefined) => bigint | undefined; /** * Convert a `StrictUnsignedTransactionRequest` to a viem `TransactionSerializable` * * This is necessary since viem is strict with the types it accepts and requires correctly formed * requests to be signed. * * > Note: * > - JSON.parse is primarily used as a safe way to access `chainId` * > - ^ The same thing could be accomplished using some regex replacing, but would much more error prone * * @example * const tx: StrictUnsignedTransactionRequest = { chainId: '0x1', ... } * const result = toViemTransactionSerializable(tx) // => { chainId: 1, ... } * * const tx: StrictUnsignedTransactionRequest = { chainId: 1, ... } * const result = toViemTransactionSerializable(tx) // => { chainId: 1, ... } */ declare function toViemTransactionSerializable(input: StrictUnsignedTransactionRequest | string): PrivyTransactionSerializable; type PrivyTransactionSerializable = { readonly gasPrice: bigint | undefined; readonly accessList: undefined; readonly maxFeePerGas: undefined; readonly maxPriorityFeePerGas: undefined; readonly chainId: number; readonly data: `0x${string}` | undefined; readonly nonce: number | undefined; readonly value: bigint | undefined; readonly gas: bigint | undefined; readonly type: 'legacy'; readonly from?: Hex; readonly gasLimit?: Quantity$1; readonly to?: `0x${string}` | null; } | { readonly gasPrice: bigint | undefined; readonly accessList: AccessList$1 | undefined; readonly maxFeePerGas: undefined; readonly maxPriorityFeePerGas: undefined; readonly chainId: number; readonly data: `0x${string}` | undefined; readonly nonce: number | undefined; readonly value: bigint | undefined; readonly gas: bigint | undefined; readonly type: 'eip2930'; readonly from?: Hex; readonly gasLimit?: Quantity$1; readonly to?: `0x${string}` | null; } | { readonly nonce: number | undefined; readonly accessList: AccessList$1 | undefined; readonly maxFeePerGas: bigint | undefined; readonly maxPriorityFeePerGas: bigint | undefined; readonly gasPrice: undefined; readonly maxFeePerBlobGas: undefined; readonly chainId: number; readonly data: `0x${string}` | undefined; readonly value: bigint | undefined; readonly gas: bigint | undefined; readonly type: 'eip1559'; readonly from?: Hex; readonly gasLimit?: Quantity$1; readonly to?: `0x${string}` | null; } | { readonly nonce: number | undefined; readonly accessList: AccessList$1 | undefined; readonly maxFeePerGas: bigint | undefined; readonly maxPriorityFeePerGas: bigint | undefined; readonly authorizationList: SignedAuthorizationList; readonly gasPrice: undefined; readonly maxFeePerBlobGas: undefined; readonly chainId: number; readonly data: `0x${string}` | undefined; readonly value: bigint | undefined; readonly gas: bigint | undefined; readonly type: 'eip7702'; readonly from?: Hex; readonly gasLimit?: Quantity$1; readonly to?: `0x${string}` | null; }; //#endregion //#region src/to-viem-tempo-transaction-serializable.d.ts type Quantity = Hex | number | bigint; type AccessList = readonly { address: Hex; storageKeys: readonly Hex[]; }[]; type AccessListish = AccessList | Array<[Hex, readonly Hex[]]> | Record; declare const TEMPO_TXN_TYPE_NUMBER: 118; declare const TEMPO_TXN_TYPE_STRING: 'tempo'; /** A single call within a Tempo (type 118) batched transaction. */ type StrictTempoCall = { to: Hex; data?: Hex; /** Integer of the value sent with this call, in Wei. */ value?: Quantity; }; type TempoFeePayerSignature = Signature; /** * The strict request shape for an unsigned Tempo (type 118 / 0x76) transaction. * * Mirrors the wallet-API `UnsignedTempoTransaction` schema in camelCase. */ type StrictUnsignedTempoTransactionRequest = { /** Numeric (118) or viem string form ('tempo'). */ type: 118 | 'tempo'; from?: Hex; chainId?: number; nonce?: Quantity; gasLimit?: Quantity; maxFeePerGas?: Quantity; maxPriorityFeePerGas?: Quantity; /** Batch of calls to execute atomically. At least one call is required. */ calls: readonly StrictTempoCall[]; feeToken?: Hex; /** 2D nonce key (0 = protocol nonce, >0 = user nonces). */ nonceKey?: Quantity; /** Transaction expiration timestamp (seconds since epoch). */ validBefore?: Quantity; /** Earliest inclusion timestamp (seconds since epoch). */ validAfter?: Quantity; /** Fee payer signature for sponsored transactions. */ feePayerSignature?: TempoFeePayerSignature; accessList?: AccessListish; }; /** * Type guard for Tempo (type 118 / 0x76) requests. Returns true when `type` * is `118` or `'tempo'` (case-insensitive) and `calls` is a non-empty array. * String forms `'118'` / `'0x76'` are not accepted because they don't satisfy * the narrowed `type: 118 | 'tempo'` union — pass raw JSON strings directly * to `toViemTempoTransactionSerializable` instead. */ declare function isTempoTransactionRequest(input: { type?: unknown; calls?: unknown; } | null | undefined): input is StrictUnsignedTempoTransactionRequest; /** * Convert a `StrictUnsignedTempoTransactionRequest` to a viem-compatible * Tempo `TransactionSerializable` shape. Kept as a parallel pipeline to * `toViemTransactionSerializable` because Tempo has its own envelope (0x76) * and required fields (`calls`, `chainId`). * * @example * toViemTempoTransactionSerializable({ * type: 118, * chainId: 42431, * calls: [{to: '0x0000000000000000000000000000000000000000', value: '0x1'}], * }) */ declare function toViemTempoTransactionSerializable(input: StrictUnsignedTempoTransactionRequest | string): PrivyTempoTransactionSerializable; /** * Normalize the result of viem's `prepareTransactionRequest` for a Tempo * transaction back into a Privy-compatible shape: strips the `chain` field and * renames viem's `gas` key back to `gasLimit` (only when the caller did not * supply `gasLimit` themselves, so a caller-provided value always wins). */ declare function normalizeViemPreparedTempoTransaction(prepared: T, inputGasLimit?: Quantity | null): Omit & { gasLimit?: bigint; }; type PrivyTempoTransactionSerializable = { readonly type: 'tempo'; readonly chainId: number; readonly from: Hex | undefined; readonly nonce: number | undefined; readonly gas: bigint | undefined; readonly maxFeePerGas: bigint | undefined; readonly maxPriorityFeePerGas: bigint | undefined; readonly calls: ReadonlyArray<{ readonly to: Hex; readonly data: Hex | undefined; readonly value: bigint | undefined; }>; readonly feeToken: Hex | undefined; readonly nonceKey: bigint | undefined; readonly validBefore: number | undefined; readonly validAfter: number | undefined; readonly feePayerSignature: TempoFeePayerSignature | undefined; readonly accessList: AccessList | undefined; }; //#endregion //#region src/index.d.ts declare const VERSION = "__VERSION__"; //#endregion export { STRING_TO_NUMBER_TXN_TYPE, StrictTempoCall, StrictUnsignedTempoTransactionRequest, StrictUnsignedTransactionRequest, StrictUnsignedTransactionRequestWithChainId, TEMPO_TXN_TYPE_NUMBER, TEMPO_TXN_TYPE_STRING, TempoFeePayerSignature, VERSION, isTempoTransactionRequest, normalizeViemPreparedTempoTransaction, toBigIntIfDefined, toViemTempoTransactionSerializable, toViemTransactionSerializable };