import { ProjectivePoint as SheProjectivePoint, type ProjectivePoint as SheProjectivePointType } from "@fatsolutions/she"; import { BigNumberish } from "starknet"; export interface GeneralPrefixData { chain_id: bigint; tongo_address: bigint; sender_address: bigint; } export declare const ProjectivePoint: typeof SheProjectivePoint; export type ProjectivePoint = SheProjectivePointType; export type TongoAddress = string & { __type: "tongo"; }; /** * This struct is intended to wrap the coordinates of a NonZeroEcPoint. */ export interface StarkPoint { x: BigNumberish; y: BigNumberish; } /** * Balances are encrypted with ElGammal, which consists in a tuple of curve points (L, R). Internally the points * are constructed with L = g**b y**r, R = g**r where g is the generator of the starknet curve, y is a pubkey, r is * a random value and b is the balance to encrypt. */ export interface CipherBalance { L: ProjectivePoint; R: ProjectivePoint; } export declare function createCipherBalance(y: ProjectivePoint, amount: bigint, random: bigint): CipherBalance; /** * This function coincides with cairo compute_prefix * @param seq - Array of bigint values to hash * @returns The computed prefix hash */ export declare function compute_prefix(seq: bigint[]): bigint; /** * Converts a StarkPoint to a ProjectivePoint. This operation could throw an error * if the x and y are not coordinates from a point in the starknet curve. * @param {PubKey} param0 - The public key with x and y coordinates * @returns {ProjectivePoint} The resulting ProjectivePoint * @throws {Error} If the coordinates are not valid points on the starknet curve */ export declare function starkPointToProjectivePoint({ x, y }: PubKey): ProjectivePoint; /** * Converts the ProjectivePoint to a StarkPoint * @param {ProjectivePoint} p - The ProjectivePoint to convert * @returns {StarkPoint} The resulting StarkPoint */ export declare function projectivePointToStarkPoint(p: ProjectivePoint): StarkPoint; /** * Represents a user public key. Private keys are numbers x ∈ (0, core::ec::stark_curve::CURVE_ORDER) and * public keys are the NonZeroEcPoint y = g**x where g is the starknet curve generator. */ export type PubKey = StarkPoint; /** * Constructs a public key from a given private key. * @param {bigint} privateKey - The private key to derive from * @returns {PubKey} The derived public key */ export declare function derivePublicKey(privateKey: bigint): StarkPoint; /** * Converts a public key to hex format (assumes compressed format) * @param {PubKey} pub - The public key to convert * @returns {string} The hex representation of the public key */ export declare function pubKeyAffineToHex(pub: PubKey): string; /** * Converts a public key to base58 format (assumes compressed format) * @param {PubKey} pub - The public key to convert * @returns {TongoAddress} The base58 representation as a TongoAddress */ export declare function pubKeyAffineToBase58(pub: PubKey): TongoAddress; /** * Converts a base58 string to affine coordinates (assumes compressed format) * @param {string} b58string - The base58 encoded string * @returns {{x: bigint, y: bigint}} The affine coordinates */ export declare function pubKeyBase58ToAffine(b58string: string): { x: bigint; y: bigint; }; /** * Converts a base58 string to hex format (assumes compressed format) * @param {string} b58string - The base58 encoded string * @returns {string} The hex representation */ export declare function pubKeyBase58ToHex(b58string: string): string; /** * Converts a pair of StarkPoints to a CipherBalance. * @param {object} param0 - Object containing L and R StarkPoints * @param {StarkPoint} param0.L - The left point * @param {StarkPoint} param0.R - The right point * @returns {CipherBalance} The resulting CipherBalance */ export declare function parseCipherBalance({ L, R }: { L: StarkPoint; R: StarkPoint; }): CipherBalance;