starknet
Version:
JavaScript library for Starknet
1,374 lines (1,345 loc) • 421 kB
TypeScript
import * as RPC from '@starknet-io/starknet-types-010';
import { PAYMASTER_API, CONTRACT, ETransactionType, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_ID, IsSucceeded, TransactionReceipt as TransactionReceipt$1, IsReverted, PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, BLOCK_WITH_TX_HASHES, IsType, OutsideExecutionTypedData, TypedData, CONTRACT_STORAGE_KEYS, StorageProof, CASM_COMPILED_CONTRACT_CLASS, ETransactionVersion3 as ETransactionVersion3$1, TransactionHash, BlockHash, FAILED_TO_RECEIVE_TXN, NO_TRACE_AVAILABLE, CONTRACT_NOT_FOUND, ENTRYPOINT_NOT_FOUND, BLOCK_NOT_FOUND, INVALID_TXN_INDEX, CLASS_HASH_NOT_FOUND, TXN_HASH_NOT_FOUND, PAGE_SIZE_TOO_BIG, NO_BLOCKS, INVALID_CONTINUATION_TOKEN, TOO_MANY_KEYS_IN_FILTER, CONTRACT_ERROR, TRANSACTION_EXECUTION_ERROR, STORAGE_PROOF_NOT_SUPPORTED, CLASS_ALREADY_DECLARED, INVALID_TRANSACTION_NONCE, INSUFFICIENT_RESOURCES_FOR_VALIDATE, INSUFFICIENT_ACCOUNT_BALANCE, VALIDATION_FAILURE, COMPILATION_FAILED, CONTRACT_CLASS_SIZE_IS_TOO_LARGE, NON_ACCOUNT, DUPLICATE_TX, COMPILED_CLASS_HASH_MISMATCH, UNSUPPORTED_TX_VERSION, UNSUPPORTED_CONTRACT_CLASS_VERSION, UNEXPECTED_ERROR, REPLACEMENT_TRANSACTION_UNDERPRICED, FEE_BELOW_MINIMUM, INVALID_SUBSCRIPTION_ID, TOO_MANY_ADDRESSES_IN_FILTER, TOO_MANY_BLOCKS_BACK, COMPILATION_ERROR, ETransactionVersion as ETransactionVersion$1, SUBSCRIPTION_ID, TXN_FINALITY_STATUS, STATUS_ACCEPTED_ON_L1, TXN_STATUS_WITHOUT_L1, StarknetEventsEvent, TransactionsStatusEvent, NewTransactionReceiptsEvent, NewTransactionEvent, NewHeadsEvent, StarknetWindowObject, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, EDAMode as EDAMode$1, StarknetType, StarknetMerkleType, TypedDataRevision, OutsideCallV1, OutsideCallV2, EmittedEvent as EmittedEvent$1, Event as Event$2, Address, Permission, ChainId, AccountDeploymentData, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddDeclareTransactionParameters, AddDeclareTransactionResult, SpecVersion } from '@starknet-io/starknet-types-010';
export { StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision } from '@starknet-io/starknet-types-010';
import * as RPC$1 from '@starknet-io/starknet-types-09';
import { Abi as Abi$1, TypedContract } from 'abi-wan-kanabi';
import * as weierstrass from '@noble/curves/abstract/weierstrass';
import { RecoveredSignatureType } from '@noble/curves/abstract/weierstrass';
import * as ts_mixer_dist_types_types from 'ts-mixer/dist/types/types';
import { WalletWithStarknetFeatures, StandardEventsChangeProperties } from '@starknet-io/get-starknet-wallet-standard/features';
import * as poseidon from '@noble/curves/abstract/poseidon';
import * as json$1 from 'lossless-json';
import * as starknet from '@scure/starknet';
import { StandardEventsChangeProperties as StandardEventsChangeProperties$1 } from '@wallet-standard/features';
declare const ec_weierstrass: typeof weierstrass;
declare namespace ec {
export { starknet as starkCurve, ec_weierstrass as weierstrass };
}
type RequestBody = {
id: number | string;
jsonrpc: '2.0';
method: string;
params?: {};
};
type ResponseBody = {
id: number | string;
jsonrpc: '2.0';
} & (SuccessResponseBody | ErrorResponseBody);
type SuccessResponseBody = {
result: unknown;
};
type ErrorResponseBody = {
error: Error$1;
};
type Error$1 = {
code: number;
message: string;
data?: unknown;
};
type WebSocketEvent = Omit<RequestBody, 'id'> & {
params: {};
};
type jsonrpc_ErrorResponseBody = ErrorResponseBody;
type jsonrpc_RequestBody = RequestBody;
type jsonrpc_ResponseBody = ResponseBody;
type jsonrpc_SuccessResponseBody = SuccessResponseBody;
type jsonrpc_WebSocketEvent = WebSocketEvent;
declare namespace jsonrpc {
export type { Error$1 as Error, jsonrpc_ErrorResponseBody as ErrorResponseBody, jsonrpc_RequestBody as RequestBody, jsonrpc_ResponseBody as ResponseBody, jsonrpc_SuccessResponseBody as SuccessResponseBody, jsonrpc_WebSocketEvent as WebSocketEvent };
}
declare const index$4_PAYMASTER_API: typeof PAYMASTER_API;
declare namespace index$4 {
export { jsonrpc as JRPC, index$4_PAYMASTER_API as PAYMASTER_API, RPC as RPCSPEC010, RPC$1 as RPCSPEC09 };
}
type CairoEnumRaw = Record<string, any>;
/**
* Class to handle Cairo custom Enum
* @param enumContent object containing the variants and its content. Example :
* {Success: 234, Warning: undefined, Error: undefined}.
* Only one variant with a value, object, array.
* @returns an instance representing a Cairo custom Enum.
* @example
* ```typescript
* const myCairoEnum = new CairoCustomEnum( {Success: undefined, Warning: "0x7f32ea", Error: undefined})
* ```
*/
declare class CairoCustomEnum {
/**
* direct readonly access to variants of the Cairo Custom Enum.
* @returns a value of type any
* @example
* ```typescript
* const successValue = myCairoEnum.variant.Success;
*/
readonly variant: CairoEnumRaw;
/**
* @param enumContent an object with the variants as keys and the content as value. Only one content shall be defined.
*/
constructor(enumContent: CairoEnumRaw);
/**
*
* @returns the content of the valid variant of a Cairo custom Enum.
*/
unwrap(): any;
/**
*
* @returns the name of the valid variant of a Cairo custom Enum.
*/
activeVariant(): string;
}
type ValuesType<T extends ReadonlyArray<any> | ArrayLike<any> | Record<any, any>> = T extends ReadonlyArray<any> ? T[number] : T extends ArrayLike<any> ? T[number] : T extends object ? T[keyof T] : never;
declare const CairoOptionVariant: {
readonly Some: 0;
readonly None: 1;
};
type CairoOptionVariant = ValuesType<typeof CairoOptionVariant>;
/**
* Class to handle Cairo Option
* @param variant CairoOptionVariant.Some or CairoOptionVariant.None
* @param content value of type T.
* @returns an instance representing a Cairo Option.
* @example
* ```typescript
* const myOption = new CairoOption<BigNumberish>(CairoOptionVariant.Some, "0x54dda8");
* ```
*/
declare class CairoOption<T> {
readonly Some?: T;
readonly None?: boolean;
constructor(variant: CairoOptionVariant | number, content?: T);
/**
*
* @returns the content of the valid variant of a Cairo custom Enum.
* If None, returns 'undefined'.
*/
unwrap(): T | undefined;
/**
*
* @returns true if the valid variant is 'isSome'.
*/
isSome(): boolean;
/**
*
* @returns true if the valid variant is 'isNone'.
*/
isNone(): boolean;
}
declare const CairoResultVariant: {
readonly Ok: 0;
readonly Err: 1;
};
type CairoResultVariant = ValuesType<typeof CairoResultVariant>;
/**
* Class to handle Cairo Result
* @param variant CairoResultVariant.Ok or CairoResultVariant.Err
* @param resultContent value of type T or U.
* @returns an instance representing a Cairo Result.
* @example
* ```typescript
* const myOption = new CairoResult<BigNumberish, CustomError>(CairoResultVariant.Ok, "0x54dda8");
* ```
*/
declare class CairoResult<T, U> {
readonly Ok?: T;
readonly Err?: U;
constructor(variant: CairoResultVariant | number, resultContent: T | U);
/**
*
* @returns the content of the valid variant of a Cairo Result.
*/
unwrap(): T | U;
/**
*
* @returns true if the valid variant is 'Ok'.
*/
isOk(): boolean;
/**
*
* @returns true if the valid variant is 'isErr'.
*/
isErr(): boolean;
}
type CairoEnum = CairoCustomEnum | CairoOption<any> | CairoResult<any, any>;
/** ABI */
type Abi = ReadonlyArray<FunctionAbi | AbiEvent | AbiStruct | InterfaceAbi | any>;
type AbiEntry = {
name: string;
type: 'felt' | 'felt*' | 'event' | string;
};
type EventEntry = {
name: string;
type: 'felt' | 'felt*' | string;
kind: 'key' | 'data';
};
type FunctionAbiType = 'function' | 'l1_handler' | 'constructor';
type FunctionAbi = {
inputs: AbiEntry[];
name: string;
outputs: AbiEntry[];
stateMutability?: 'view';
state_mutability?: string;
type: FunctionAbiType;
};
type AbiStructs = {
[name: string]: AbiStruct;
};
type AbiStruct = {
members: (AbiEntry & {
offset: number;
})[];
name: string;
size: number;
type: 'struct';
};
type AbiInterfaces = {
[name: string]: InterfaceAbi;
};
type InterfaceAbi = {
items: FunctionAbi[];
name: string;
type: 'interface';
};
type AbiEnums = {
[name: string]: AbiEnum;
};
type AbiEnum = {
variants: (AbiEntry & {
offset: number;
})[];
name: string;
size: number;
type: 'enum';
};
type AbiEvents = {
[hash: string]: AbiEvent;
};
type AbiEvent = CairoEvent | LegacyEvent;
type CairoEvent = CairoEventDefinition | AbiEvents;
type CairoEventDefinition = CONTRACT.STRUCT_EVENT & {
name: string;
type: 'event';
};
type CairoEventVariant = CONTRACT.ENUM_EVENT & {
name: string;
type: string;
};
type LegacyEvent = {
name: string;
type: 'event';
data: CONTRACT.EVENT_FIELD[];
keys: CONTRACT.EVENT_FIELD[];
};
/** LEGACY CONTRACT */
/**
* format produced after compressing 'program' property
*/
type LegacyContractClass = {
program: CompressedProgram;
entry_points_by_type: EntryPointsByType;
abi: Abi;
};
/**
* format produced after compiling .cairo to .json
*/
type LegacyCompiledContract = Omit<LegacyContractClass, 'program'> & {
program: Program;
};
/** SUBTYPES */
type Builtins = string[];
type CompressedProgram = string;
type Hint = Record<string, unknown>;
type EntryPointsByType = {
CONSTRUCTOR: ContractEntryPointFields[];
EXTERNAL: ContractEntryPointFields[];
L1_HANDLER: ContractEntryPointFields[];
};
type ContractEntryPointFields = {
selector: string;
offset: string | number;
builtins?: Builtins;
};
interface Program {
builtins: string[];
data: string[];
hints: Record<string, Hint[]>;
prime: string;
attributes?: Array<{
accessible_scopes?: string[];
end_pc?: number;
flow_tracking_data?: {
ap_tracking?: {
group?: number;
offset?: number;
};
reference_ids?: Record<string, number>;
};
name?: string;
start_pc?: number;
value?: string | number;
}>;
compiler_version?: string;
main_scope?: string;
identifiers?: Record<string, {
destination: string;
type: 'alias';
} | {
decorators: string[];
pc: number;
type: 'function';
implicit_args?: {
full_name: string;
members: Record<string, {
cairo_type: string;
offset: number;
}>;
size: number;
type: 'struct';
};
explicit_args?: {
full_name: string;
members: Record<string, {
cairo_type: string;
offset: number;
}>;
size: number;
type: 'struct';
};
return_type?: {
cairo_type: string;
type: 'type_definition';
};
} | {
full_name: string;
members: Record<string, {
cairo_type: string;
offset: number;
}> | Record<string, never>;
size: number;
type: 'struct';
} | {
cairo_type: string;
type: 'type_definition';
} | {
type: 'namespace';
} | {
type: 'const';
value: string | number;
} | {
pc: number;
type: 'label';
} | {
cairo_type: string;
full_name: string;
references: Array<{
ap_tracking_data: {
group: number;
offset: number;
};
pc: number;
value: string;
}>;
type: 'reference';
}>;
reference_manager?: Record<string, {
references: unknown[];
}>;
debug_info?: Record<string, {
file_contents?: Record<string, string>;
instruction_locations?: Record<string, unknown[]>;
}>;
}
/** Cairo Assembly .casm */
type CairoAssembly = {
prime: string;
compiler_version: string;
bytecode: ByteCode;
hints: any[];
pythonic_hints?: PythonicHints;
bytecode_segment_lengths?: number[];
entry_points_by_type: EntryPointsByType;
};
/** COMPILED CONTRACT */
/**
* format produced after starknet-compile .cairo to .json
*
* sierra_program is hex array
*/
type CompiledSierra = {
sierra_program: ByteCode;
sierra_program_debug_info?: SierraProgramDebugInfo;
contract_class_version: string;
entry_points_by_type: SierraEntryPointsByType;
abi: Abi;
};
/**
* format produced after compressing 'sierra_program', stringifies 'abi' property and omit sierra_program_debug_info
*
* CompressedCompiledSierra
*/
type SierraContractClass = Omit<CompiledSierra, 'abi' | 'sierra_program' | 'sierra_program_debug_info'> & {
sierra_program: string;
abi: string;
};
type CompiledSierraCasm = CairoAssembly;
/** SUBTYPES */
type ByteCode = string[];
type PythonicHints = [number, string[]][];
type SierraProgramDebugInfo = {
type_names: [number, string][];
libfunc_names: [number, string][];
user_func_names: [number, string][];
};
type SierraEntryPointsByType = {
CONSTRUCTOR: SierraContractEntryPointFields[];
EXTERNAL: SierraContractEntryPointFields[];
L1_HANDLER: SierraContractEntryPointFields[];
};
type SierraContractEntryPointFields = {
selector: string;
function_idx: number;
};
/**
* format produced after compressing compiled contract
*
* CompressedCompiledContract
*/
type ContractClass = LegacyContractClass | SierraContractClass;
/**
* format produced after compile .cairo to .json
*/
type CompiledContract = LegacyCompiledContract | CompiledSierra;
/**
* Compressed or decompressed Cairo0 or Cairo1 Contract
*/
type CairoContract = ContractClass | CompiledContract;
declare const EntryPointType: {
readonly EXTERNAL: "EXTERNAL";
readonly L1_HANDLER: "L1_HANDLER";
readonly CONSTRUCTOR: "CONSTRUCTOR";
};
type EntryPointType = ValuesType<typeof EntryPointType>;
type SimpleOneOf<F, S> = OnlyFirst<F, S> | OnlyFirst<S, F>;
type OnlyFirst<F, S> = F & {
[Key in keyof Omit<S, keyof F>]?: undefined;
};
type Simplify<T> = {
[K in keyof T]: T[K];
} & {};
type RequiredKeysOf<T extends object> = Exclude<{
[K in keyof T]: T extends Record<K, T[K]> ? K : never;
}[keyof T], undefined>;
type ArrayElement<T> = T extends Array<infer U> ? U : never;
type MergeProperties<T1 extends Record<any, any>, T2 extends Record<any, any>> = {
[K in RequiredKeysOf<T1> & RequiredKeysOf<T2>]: Merge<T1[K], T2[K]>;
} & {
[K in keyof T1 & keyof T2]?: Merge<T1[K], T2[K]>;
} & {
[K in Exclude<keyof T1, keyof T2>]?: T1[K];
} & {
[K in Exclude<keyof T2, keyof T1>]?: T2[K];
};
/**
* type a = { w: bigint[]; x: bigint; y: string };
type b = { w: number[]; x: number; z: string };
type c = Merge<a, b>; // { w: (bigint | number)[] x: bigint | number; y?: string; z?: string; }
NOTE: handling for ambiguous overlaps, such as a shared property being an array or object,
is simplified to resolve to only one type since there shouldn't be such occurrences in the
currently supported RPC specifications
*/
type Merge<T1, T2> = Simplify<T1 extends Array<any> ? T2 extends Array<any> ? Array<Merge<ArrayElement<T1>, ArrayElement<T2>>> : T1 : T2 extends Array<any> ? T2 : T1 extends object ? T2 extends object ? MergeProperties<T1, T2> : T1 : T2 extends object ? T2 : T1 | T2>;
type ETransactionVersion = RPC$1.ETransactionVersion;
declare const ETransactionVersion: {
readonly V0: "0x0";
readonly V1: "0x1";
readonly V2: "0x2";
readonly V3: "0x3";
readonly F0: "0x100000000000000000000000000000000";
readonly F1: "0x100000000000000000000000000000001";
readonly F2: "0x100000000000000000000000000000002";
readonly F3: "0x100000000000000000000000000000003";
};
type ETransactionVersion2 = RPC$1.ETransactionVersion2;
declare const ETransactionVersion2: {
readonly V0: "0x0";
readonly V1: "0x1";
readonly V2: "0x2";
readonly F0: "0x100000000000000000000000000000000";
readonly F1: "0x100000000000000000000000000000001";
readonly F2: "0x100000000000000000000000000000002";
};
type ETransactionVersion3 = RPC$1.ETransactionVersion3;
declare const ETransactionVersion3: {
readonly V3: "0x3";
readonly F3: "0x100000000000000000000000000000003";
};
type BLOCK_HASH = Merge<RPC.BLOCK_HASH, RPC$1.BLOCK_HASH>;
type BLOCK_NUMBER = Merge<RPC.BLOCK_NUMBER, RPC$1.BLOCK_NUMBER>;
type FELT = Merge<RPC.FELT, RPC$1.FELT>;
type TXN_HASH = Merge<RPC.TXN_HASH, RPC$1.TXN_HASH>;
type PRICE_UNIT = Merge<RPC.PRICE_UNIT, RPC$1.PRICE_UNIT>;
type RESOURCE_PRICE = Merge<RPC.RESOURCE_PRICE, RPC$1.RESOURCE_PRICE>;
type SIMULATION_FLAG = Merge<RPC.SIMULATION_FLAG, RPC$1.SIMULATION_FLAG>;
type STATE_UPDATE = Merge<RPC.STATE_UPDATE, RPC$1.STATE_UPDATE>;
type PRE_CONFIRMED_STATE_UPDATE = Merge<RPC.PRE_CONFIRMED_STATE_UPDATE, RPC$1.PRE_CONFIRMED_STATE_UPDATE>;
type BlockWithTxHashes = Merge<RPC.BlockWithTxHashes, RPC$1.BlockWithTxHashes>;
type ContractClassPayload = Merge<RPC.ContractClass, RPC$1.ContractClass>;
type DeclaredTransaction = Merge<RPC.DeclaredTransaction, RPC$1.DeclaredTransaction>;
type InvokedTransaction = Merge<RPC.InvokedTransaction, RPC$1.InvokedTransaction>;
type DeployedAccountTransaction = Merge<RPC.DeployedAccountTransaction, RPC$1.DeployedAccountTransaction>;
type L1_HANDLER_TXN = RPC.L1_HANDLER_TXN;
type EDataAvailabilityMode = RPC.EDataAvailabilityMode;
declare const EDataAvailabilityMode: {
readonly L1: "L1";
readonly L2: "L2";
};
type EDAMode = RPC.EDAMode;
declare const EDAMode: {
readonly L1: 0;
readonly L2: 1;
};
type EmittedEvent = Merge<RPC.EmittedEvent, RPC$1.EmittedEvent>;
type Event$1 = Merge<RPC.Event, RPC$1.Event>;
type Receipt = Merge<RPC.TransactionReceiptProductionBlock, RPC$1.TransactionReceiptProductionBlock>;
/**
* original response from estimate fee without parsing
*/
type FeeEstimate = Merge<RPC.FEE_ESTIMATE, RPC$1.FEE_ESTIMATE>;
type ApiEstimateFeeResponse = FeeEstimate[];
declare function isRPC08Plus_ResourceBounds(entry: ResourceBounds): entry is RPC.ResourceBounds;
declare function isRPC08Plus_ResourceBoundsBN(entry: ResourceBoundsBN): entry is ResourceBoundsBN;
type ResourceBounds = Merge<RPC.ResourceBounds, RPC$1.ResourceBounds>;
type EventFilter = RPC$1.EventFilter;
/**
* Represents percentage overhead for each resource bound
* numerical 50 means 50% overhead
*/
type ResourceBoundsOverhead = {
[K in keyof ResourceBounds]: ResourceBounds[K] extends object ? {
[P in keyof ResourceBounds[K]]: number;
} : number;
};
/**
* Resource bounds in big number format
*/
type ResourceBoundsBN = {
[K in keyof ResourceBounds]: ResourceBounds[K] extends object ? {
[P in keyof ResourceBounds[K]]: bigint;
} : number;
};
type SimulateTransaction = SimpleOneOf<RPC$1.SimulateTransaction, RPC.SimulateTransaction>;
type SimulateTransactionResponse = SimpleOneOf<RPC$1.SimulateTransactionResponse, RPC.SimulateTransactionResponse>;
type TransactionTrace = SimpleOneOf<RPC$1.TRANSACTION_TRACE, RPC.TRANSACTION_TRACE>;
type TransactionWithHash = Merge<RPC.TransactionWithHash, RPC$1.TransactionWithHash>;
type TransactionReceipt = Merge<RPC.TransactionReceipt, RPC$1.TransactionReceipt>;
type Methods = RPC.Methods;
type TXN_STATUS = Merge<RPC.TXN_STATUS, RPC$1.TXN_STATUS>;
type TXN_EXECUTION_STATUS = Merge<RPC.TXN_EXECUTION_STATUS, RPC$1.TXN_EXECUTION_STATUS>;
type TransactionStatus = Merge<RPC.TransactionStatus, RPC$1.TransactionStatus>;
type ETransactionStatus = RPC.ETransactionStatus;
declare const ETransactionStatus: {
readonly RECEIVED: "RECEIVED";
readonly CANDIDATE: "CANDIDATE";
readonly PRE_CONFIRMED: "PRE_CONFIRMED";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
};
type ETransactionExecutionStatus = RPC.ETransactionExecutionStatus;
declare const ETransactionExecutionStatus: {
readonly SUCCEEDED: "SUCCEEDED";
readonly REVERTED: "REVERTED";
};
type FEE_ESTIMATE = Merge<RPC.FEE_ESTIMATE, RPC$1.FEE_ESTIMATE>;
type EVENTS_CHUNK = Merge<RPC.EVENTS_CHUNK, RPC$1.EVENTS_CHUNK>;
type TransactionType = RPC$1.ETransactionType;
declare const TransactionType: {
readonly DECLARE: "DECLARE";
readonly DEPLOY: "DEPLOY";
readonly DEPLOY_ACCOUNT: "DEPLOY_ACCOUNT";
readonly INVOKE: "INVOKE";
readonly L1_HANDLER: "L1_HANDLER";
};
type BlockStatus = RPC$1.EBlockStatus;
declare const BlockStatus: {
readonly PRE_CONFIRMED: "PRE_CONFIRMED";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
};
type TransactionFinalityStatus = RPC$1.ETransactionFinalityStatus;
declare const TransactionFinalityStatus: {
readonly PRE_CONFIRMED: "PRE_CONFIRMED";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
};
type TransactionExecutionStatus = RPC$1.ETransactionExecutionStatus;
declare const TransactionExecutionStatus: {
readonly SUCCEEDED: "SUCCEEDED";
readonly REVERTED: "REVERTED";
};
type BlockTag = RPC$1.EBlockTag;
declare const BlockTag: {
readonly LATEST: "latest";
readonly PRE_CONFIRMED: "pre_confirmed";
readonly L1_ACCEPTED: "l1_accepted";
};
type WeierstrassSignatureType = weierstrass.SignatureType;
type ArraySignatureType = string[];
type Signature = ArraySignatureType | WeierstrassSignatureType;
type BigNumberish = string | number | bigint;
type ByteArray = {
data: BigNumberish[];
pending_word: BigNumberish;
pending_word_len: BigNumberish;
};
/**
* Compiled calldata ready to be sent
*
* decimal-string array
*/
type Calldata = string[] & {
readonly __compiled__?: true;
};
/**
* "Abi Entry type"
* @example
* 'core::bytes_31::bytes31'
* 'core::bool'
* 'core::felt'
* 'core::uint256'
* 'core::uint512'
*/
type AbiEntryType = AbiEntry['type'];
/**
* Represents an integer in the range [0, 2^256)
*/
interface Uint256 {
low: BigNumberish;
high: BigNumberish;
}
/**
* Represents an integer in the range [0, 2^256)
*/
interface Uint512 {
limb0: BigNumberish;
limb1: BigNumberish;
limb2: BigNumberish;
limb3: BigNumberish;
}
/**
* BigNumberish array
*
* use CallData.compile() to convert to Calldata
*/
type RawCalldata = BigNumberish[];
/**
* Hexadecimal-string array
*/
type HexCalldata = string[];
type AllowArray<T> = T | T[];
type OptionalPayload<T> = {
payload: T;
} | T;
type RawArgs = RawArgsObject | RawArgsArray;
type RawArgsObject = {
[inputName: string]: MultiType | MultiType[] | RawArgs;
};
type RawArgsArray = Array<MultiType | MultiType[] | RawArgs>;
type MultiType = BigNumberish | Uint256 | object | boolean | CairoEnum;
type UniversalDeployerContractPayload = {
classHash: BigNumberish;
salt?: string;
unique?: boolean;
constructorCalldata?: RawArgs;
abi?: Abi;
};
type DeployAccountContractPayload = {
classHash: string;
constructorCalldata?: RawArgs;
addressSalt?: BigNumberish;
contractAddress?: string;
};
type DeployAccountContractTransaction = Omit<DeployAccountContractPayload, 'contractAddress'> & {
signature?: Signature;
};
/**
* Base payload for declaring a contract on Starknet
*/
type BaseDeclareContractPayload = {
/** The compiled contract (JSON object) or path to compiled contract file */
contract: CompiledContract | string;
/**
* Class hash of the contract. Optional optimization - if not provided,
* it will be computed from the contract
*/
classHash?: string;
};
/**
* Declare contract with CASM code
*/
type DeclareWithCasm = BaseDeclareContractPayload & {
/** Compiled Sierra Assembly (CASM) code */
casm: CompiledSierraCasm;
/** Hash of the compiled CASM. Optional - will be computed from casm if not provided */
compiledClassHash?: string;
};
/**
* Declare contract with pre-computed compiled class hash (optimization)
*/
type DeclareWithCompiledClassHash = BaseDeclareContractPayload & {
/** Hash of the compiled CASM */
compiledClassHash: string;
/** CASM is not needed when compiledClassHash is provided */
casm?: never;
};
/**
* Payload for declaring a contract on Starknet.
* Either provide CASM code, or a pre-computed compiledClassHash for optimization.
*/
type DeclareContractPayload = DeclareWithCasm | DeclareWithCompiledClassHash;
/**
* DeclareContractPayload with classHash or contract defined
*/
type ContractClassIdentifier = DeclareContractPayload | {
classHash: string;
};
type CompleteDeclareContractPayload = {
contract: CompiledContract | string;
classHash: string;
casm?: CompiledSierraCasm;
compiledClassHash: string;
};
type DeclareAndDeployContractPayload = Omit<UniversalDeployerContractPayload, 'classHash'> & DeclareContractPayload;
type DeclareContractTransaction = {
contract: ContractClass;
senderAddress: string;
signature?: Signature;
compiledClassHash?: string;
};
type CallDetails = {
contractAddress: string;
calldata?: RawArgs | Calldata;
};
type Invocation = CallDetails & {
signature?: Signature;
};
type Call = CallDetails & {
entrypoint: string;
};
type CairoVersion = '0' | '1' | undefined;
type CompilerVersion = '0' | '1' | '2' | undefined;
type InvocationsDetails = {
nonce?: BigNumberish;
maxFee?: BigNumberish;
version?: BigNumberish;
} & Partial<V3TransactionDetails>;
type V3TransactionDetails = {
nonce: BigNumberish;
version: BigNumberish;
resourceBounds: ResourceBoundsBN;
tip: BigNumberish;
paymasterData: BigNumberish[];
accountDeploymentData: BigNumberish[];
nonceDataAvailabilityMode: EDataAvailabilityMode$1;
feeDataAvailabilityMode: EDataAvailabilityMode$1;
};
/**
* Contain all additional details params
*/
type Details = {
nonce: BigNumberish;
maxFee: BigNumberish;
version: BigNumberish;
chainId: _StarknetChainId;
};
type InvocationsDetailsWithNonce = (InvocationsDetails & {
nonce: BigNumberish;
}) | V3TransactionDetails;
/**
* new statuses are defined by props: finality_status and execution_status
* to be #deprecated
*/
type BlockNumber = BlockTag | null | number;
/**
* hex string and BigInt are detected as block hashes
*
* decimal string and number are detected as block numbers
*
* text string are detected as block tag
*
* null return 'latest' block tag
*/
type BlockIdentifier = BlockNumber | BigNumberish;
type SubscriptionBlockTag = Extract<SUBSCRIPTION_BLOCK_ID, string>;
type SubscriptionBlockIdentifier = SubscriptionBlockTag | (string & {}) | number | bigint;
/**
* items used by AccountInvocations
*/
type AccountInvocationItem = (({
type: typeof ETransactionType.DECLARE;
} & DeclareContractTransaction) | ({
type: typeof ETransactionType.DEPLOY_ACCOUNT;
} & DeployAccountContractTransaction) | ({
type: typeof ETransactionType.INVOKE;
} & Invocation)) & InvocationsDetailsWithNonce;
/**
* Complete invocations array with account details (internal type from account -> provider)
*/
type AccountInvocations = AccountInvocationItem[];
/**
* Invocations array user provide to bulk method (simulate)
*/
type Invocations = Array<({
type: typeof ETransactionType.DECLARE;
} & OptionalPayload<DeclareContractPayload>) | ({
type: typeof ETransactionType.DEPLOY;
} & OptionalPayload<AllowArray<UniversalDeployerContractPayload>>) | ({
type: typeof ETransactionType.DEPLOY_ACCOUNT;
} & OptionalPayload<DeployAccountContractPayload>) | ({
type: typeof ETransactionType.INVOKE;
} & OptionalPayload<AllowArray<Call>>)>;
type Tupled = {
element: any;
type: string;
};
type Args = {
[inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
};
type ParsedStruct = {
[key: string]: BigNumberish | BigNumberish[] | ParsedStruct | Uint256;
};
type waitForTransactionOptions = {
/**
* Define the number of retries before throwing an error for the transaction life cycle when the transaction is not found after it had a valid status.
* This is useful for nodes that are not fully synced yet when connecting to service that rotate nodes.
*/
lifeCycleRetries?: number;
/**
* Define the number of retries before throwing an error
*/
retries?: number;
/**
* Define the time interval between retries in milliseconds
*/
retryInterval?: number;
/**
* Define which states are considered as successful
*/
successStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
/**
* Define which states are considered as errors
*/
errorStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
};
type fastWaitForTransactionOptions = {
retries?: number;
retryInterval?: number;
};
type getSimulateTransactionOptions = {
blockIdentifier?: BlockIdentifier;
skipValidate?: boolean;
skipExecute?: boolean;
skipFeeCharge?: boolean;
};
type getContractVersionOptions = {
blockIdentifier?: BlockIdentifier;
compiler?: boolean;
};
type getEstimateFeeBulkOptions = {
blockIdentifier?: BlockIdentifier;
skipValidate?: boolean;
};
/**
* Represent Contract version
*/
type ContractVersion = {
/** version of the cairo language */
cairo: CairoVersion;
/** version of the cairo compiler used to compile the contract */
compiler: CompilerVersion;
};
declare const LogLevelIndex: {
DEBUG: number;
INFO: number;
WARN: number;
ERROR: number;
FATAL: number;
OFF: number;
};
type LogLevelIndex = ValuesType<typeof LogLevelIndex>;
type LogLevel = keyof typeof LogLevelIndex;
interface ProviderOptions extends RpcProviderOptions {
}
type RpcProviderOptions = {
nodeUrl?: string | _NetworkName;
/**
* Define the number of retries for waitForTransaction
*/
retries?: waitForTransactionOptions['retries'];
/**
* Define the time interval between retries in milliseconds
*/
transactionRetryIntervalFallback?: number;
/**
* Define the headers
*/
headers?: object;
blockIdentifier?: BlockIdentifier;
chainId?: _StarknetChainId;
specVersion?: _SupportedRpcVersion;
default?: boolean;
waitMode?: boolean;
baseFetch?: WindowOrWorkerGlobalScope['fetch'];
resourceBoundsOverhead?: ResourceBoundsOverhead | false;
batch?: false | number;
};
/**
* Common interface response
* Intersection (sequencer response ∩ (∪ rpc responses))
*/
type Block$1 = Simplify<BLOCK_WITH_TX_HASHES>;
type PreConfirmedBlock = Simplify<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES>;
type GetBlockResponse = Simplify<BlockWithTxHashes>;
type GetTxReceiptResponseWithoutHelper = TransactionReceipt$1;
type SuccessfulTransactionReceiptResponse = IsSucceeded<TransactionReceipt$1>;
type RevertedTransactionReceiptResponse = IsReverted<TransactionReceipt$1>;
type InvokeTransactionReceiptResponse = IsType<TransactionReceipt$1, 'INVOKE'>;
type DeployTransactionReceiptResponse = InvokeTransactionReceiptResponse;
type DeclareTransactionReceiptResponse = IsType<TransactionReceipt$1, 'DECLARE'>;
type DeployAccountTransactionReceiptResponse = IsType<TransactionReceipt$1, 'DEPLOY_ACCOUNT'>;
type L1HandlerTransactionReceiptResponse = IsType<TransactionReceipt$1, 'L1_HANDLER'>;
type GetTransactionResponse = TransactionWithHash;
/**
* Estimate fee response with overhead
*/
type EstimateFeeResponseOverhead = {
resourceBounds: ResourceBoundsBN;
overall_fee: bigint;
unit: PRICE_UNIT;
};
type EstimateFeeResponseBulkOverhead = Array<EstimateFeeResponseOverhead>;
type InvokeFunctionResponse = InvokedTransaction;
type DeclareContractResponse = DeclaredTransaction;
type CallContractResponse = string[];
type Storage = FELT;
type Nonce = string;
type SimulationFlags = Array<SIMULATION_FLAG>;
type SimulateTransactionOverhead = {
transaction_trace: TransactionTrace;
} & EstimateFeeResponseOverhead;
type SimulateTransactionOverheadResponse = SimulateTransactionOverhead[];
type PreConfirmedStateUpdate = PRE_CONFIRMED_STATE_UPDATE;
type StateUpdate = STATE_UPDATE;
type StateUpdateResponse = StateUpdate | PreConfirmedStateUpdate;
/**
* Standardized type
*
* Cairo0 program compressed and Cairo1 sierra_program decompressed
*
* abi Abi
*
* CompiledSierra without '.sierra_program_debug_info'
*/
type ContractClassResponse = LegacyContractClass | Omit<CompiledSierra, 'sierra_program_debug_info'>;
/**
* Result of provider.getGasPrices().
* @param {bigint} l1DataGasPrice - price in fri of the layer 1 data gas price.
* @param {bigint} l1GasPrice - price in fri of the layer 1 gas price.
* @param {bigint} l2GasPrice - price in fri of the layer 2 gas price.
*/
type GasPrices = {
l1DataGasPrice: bigint;
l1GasPrice: bigint;
l2GasPrice: bigint;
};
interface PaymasterOptions extends PaymasterRpcOptions {
}
type PaymasterRpcOptions = {
nodeUrl?: string | _NetworkName;
default?: boolean;
headers?: object;
baseFetch?: WindowOrWorkerGlobalScope['fetch'];
};
/**
* Common interface response
* Intersection (sequencer response ∩ (∪ rpc responses))
*/
type PaymasterFeeEstimate = {
gas_token_price_in_strk: BigNumberish;
estimated_fee_in_strk: BigNumberish;
estimated_fee_in_gas_token: BigNumberish;
suggested_max_fee_in_strk: BigNumberish;
suggested_max_fee_in_gas_token: BigNumberish;
};
type PreparedDeployTransaction = {
type: 'deploy';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
parameters: ExecutionParameters;
fee: PaymasterFeeEstimate;
};
type PreparedInvokeTransaction = {
type: 'invoke';
typed_data: OutsideExecutionTypedData;
parameters: ExecutionParameters;
fee: PaymasterFeeEstimate;
};
type PreparedDeployAndInvokeTransaction = {
type: 'deploy_and_invoke';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
typed_data: OutsideExecutionTypedData;
parameters: ExecutionParameters;
fee: PaymasterFeeEstimate;
};
type PreparedTransaction = PreparedDeployTransaction | PreparedInvokeTransaction | PreparedDeployAndInvokeTransaction;
interface TokenData {
token_address: string;
decimals: number;
priceInStrk: BigNumberish;
}
type DeployTransaction = {
type: 'deploy';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
};
type InvokeTransaction = {
type: 'invoke';
invoke: UserInvoke;
};
type UserInvoke = {
userAddress: string;
calls: Call[];
};
type DeployAndInvokeTransaction = {
type: 'deploy_and_invoke';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
invoke: UserInvoke;
};
type UserTransaction = DeployTransaction | InvokeTransaction | DeployAndInvokeTransaction;
type ExecutableDeployTransaction = {
type: 'deploy';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
};
type ExecutableInvokeTransaction = {
type: 'invoke';
invoke: ExecutableUserInvoke;
};
type ExecutableUserInvoke = {
userAddress: string;
typedData: OutsideExecutionTypedData;
signature: string[];
};
type ExecutableDeployAndInvokeTransaction = {
type: 'deploy_and_invoke';
deployment: PAYMASTER_API.ACCOUNT_DEPLOYMENT_DATA;
invoke: ExecutableUserInvoke;
};
type ExecutableUserTransaction = ExecutableDeployTransaction | ExecutableInvokeTransaction | ExecutableDeployAndInvokeTransaction;
type FeeMode = {
mode: 'sponsored';
} | {
mode: 'default';
gasToken: string;
};
type ExecutionParameters = {
version: '0x1';
feeMode: FeeMode;
timeBounds?: PaymasterTimeBounds;
};
interface PaymasterTimeBounds {
executeAfter?: number;
executeBefore: number;
}
declare abstract class SignerInterface {
/**
* Method to get the public key of the signer
*
* @returns {Promise<string>} hex-string public key
* @example
* ```typescript
* const mySigner = new Signer("0x123");
* const result = await mySigner.getPubKey();
* // result = "0x566d69d8c99f62bc71118399bab25c1f03719463eab8d6a444cd11ece131616"
* ```
*/
abstract getPubKey(): Promise<string>;
/**
* Signs a JSON object for off-chain usage with the private key and returns the signature.
* This adds a message prefix so it can't be interchanged with transactions
*
* @param {TypedData} typedData - JSON object to be signed
* @param {string} accountAddress - Hex string of the account's address
* @returns {Promise<Signature>} the signature of the message
* @example
* ```typescript
* const mySigner = new Signer("0x123");
* const myTypedData: TypedData = {
* domain: {
* name: "Example DApp",
* chainId: constants.StarknetChainId.SN_SEPOLIA,
* version: "0.0.3"
* },
* types: {
* StarkNetDomain: [
* { name: "name", type: "string" },
* { name: "chainId", type: "felt" },
* { name: "version", type: "string" }
* ],
* Message: [{ name: "message", type: "felt" }]
* },
* primaryType: "Message",
* message: { message: "1234" }
* };
* const result = await mySigner.signMessage(myTypedData, "0x5d08a4e9188429da4e993c9bf25aafe5cd491ee2b501505d4d059f0c938f82d");
* // result = Signature {r: 684915484701699003335398790608214855489903651271362390249153620883122231253n,
* // s: 1399150959912500412309102776989465580949387575375484933432871778355496929189n, recovery: 1}
* ```
*/
abstract signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
/**
* Signs INVOKE transactions with the private key and returns the signature
*
* @param {Call[]} transactions - Array of Call objects representing the transactions
* @param {InvocationsSignerDetails} transactionsDetail - Transaction details including V3 fields
* @returns {Promise<Signature>} the signature of the transaction
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
* @example
* ```typescript
* const mySigner = new Signer("0x123");
* const calls: Call[] = [{
* contractAddress: "0x1234567890123456789012345678901234567890",
* entrypoint: "transfer",
* calldata: ["0xRecipient", "1000", "0"]
* }];
* const transactionsDetail: InvocationsSignerDetails = {
* walletAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
* chainId: constants.StarknetChainId.SN_MAIN,
* cairoVersion: "1",
* version: "0x3",
* nonce: 1,
* resourceBounds: {
* l1_gas: { amount: "0x1000", price: "0x20" },
* l2_gas: { amount: "0x200", price: "0x5" },
* l1_data_gas: { amount: "0x500", price: "0x10" }
* },
* tip: 0,
* paymasterData: [],
* accountDeploymentData: [],
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
* };
* const result = await mySigner.signTransaction(calls, transactionsDetail);
* // result = Signature {r: 304910226421970384958146916800275294114105560641204815169249090836676768876n,
* // s: 1072798866000813654190523783606274062837012608648308896325315895472901074693n, recovery: 0}
* ```
*/
abstract signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails): Promise<Signature>;
/**
* Signs a DEPLOY_ACCOUNT transaction with the private key and returns the signature
*
* @param {DeployAccountSignerDetails} transaction - Transaction details to deploy an account contract
* @returns {Promise<Signature>} the signature of the transaction to deploy an account
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
* @example
* ```typescript
* const mySigner = new Signer("0x123");
* const myDeployAcc: DeployAccountSignerDetails = {
* contractAddress: "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641",
* version: "0x3",
* chainId: constants.StarknetChainId.SN_SEPOLIA,
* classHash: "0x5f3614e8671257aff9ac38e929c74d65b02d460ae966cd826c9f04a7fa8e0d4",
* constructorCalldata: ["0x123", "0x456"],
* addressSalt: "0x789",
* nonce: 0,
* resourceBounds: {
* l1_gas: { amount: "0x1000", price: "0x20" },
* l2_gas: { amount: "0x200", price: "0x5" },
* l1_data_gas: { amount: "0x500", price: "0x10" }
* },
* tip: 0,
* paymasterData: [],
* accountDeploymentData: [],
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
* };
* const result = await mySigner.signDeployAccountTransaction(myDeployAcc);
* // result = Signature {r: 2871311234341436528393212130310036951068553852419934781736214693308640202748n,
* // s: 1746271646048888422437132495446973163454853863041370993384284773665861377605n, recovery: 1}
* ```
*/
abstract signDeployAccountTransaction(transaction: DeployAccountSignerDetails): Promise<Signature>;
/**
* Signs a DECLARE transaction with the private key and returns the signature
*
* @param {DeclareSignerDetails} transaction - Transaction details to declare a contract class
* @returns {Promise<Signature>} the signature of the transaction to declare a class
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
* @example
* ```typescript
* const mySigner = new Signer("0x123");
* const myDeclare: DeclareSignerDetails = {
* version: "0x3",
* chainId: constants.StarknetChainId.SN_SEPOLIA,
* senderAddress: "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641",
* classHash: "0x5f3614e8671257aff9ac38e929c74d65b02d460ae966cd826c9f04a7fa8e0d4",
* compiledClassHash: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
* nonce: 45,
* resourceBounds: {
* l1_gas: { amount: "0x1000", price: "0x20" },
* l2_gas: { amount: "0x200", price: "0x5" },
* l1_data_gas: { amount: "0x500", price: "0x10" }
* },
* tip: 0,
* paymasterData: [],
* accountDeploymentData: [],
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
* };
* const result = await mySigner.signDeclareTransaction(myDeclare);
* // result = Signature {r: 2432056944313955951711774394836075930010416436707488863728289188289211995670n,
* // s: 3407649393310177489888603098175002856596469926897298636282244411990343146307n, recovery: 1}
* ```
*/
abstract signDeclareTransaction(transaction: DeclareSignerDetails): Promise<Signature>;
}
declare class Signer implements SignerInterface {
protected pk: Uint8Array | string;
constructor(pk?: Uint8Array | string);
getPubKey(): Promise<string>;
signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
signTransaction(transactions: Call[], details: InvocationsSignerDetails): Promise<Signature>;
signDeployAccountTransaction(details: DeployAccountSignerDetails): Promise<Signature>;
signDeclareTransaction(details: DeclareSignerDetails): Promise<Signature>;
protected signRaw(msgHash: string): Promise<Signature>;
}
/**
* Signer for accounts using Ethereum signature
*/
declare class EthSigner implements SignerInterface {
protected pk: string;
constructor(pk?: Uint8Array | string);
/**
* provides the Ethereum full public key (without parity prefix)
* @returns an hex string : 64 first characters are Point X coordinate. 64 last characters are Point Y coordinate.
*/
getPubKey(): Promise<string>;
signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
signTransaction(transactions: Call[], details: InvocationsSignerDetails): Promise<Signature>;
signDeployAccountTransaction(details: DeployAccountSignerDetails): Promise<Signature>;
signDeclareTransaction(details: DeclareSignerDetails): Promise<Signature>;
/**
* Serialize the signature in conformity with starknet::eth_signature::Signature
* @param ethSignature secp256k1 signature from Noble curves library
* @return an array of felts, representing a Cairo Eth Signature.
*/
protected formatEthSignature(ethSignature: RecoveredSignatureType): ArraySignatureType;
}
type _Transport = any;
/**
* Signer for accounts using a Ledger Nano S+/X signature (Starknet Ledger APP version 1.1.1)
*
* The Ledger has to be connected, unlocked and the Starknet APP has to be selected prior of use of this class.
*/
declare class LedgerSigner111<Transport extends Record<any, any> = any> implements SignerInterface {
readonly transporter: Transport;
protected _transporter: _Transport;
readonly accountID: number;
readonly eip2645applicationName: string;
readonly pathBuffer: Uint8Array;
protected appVersion: string;
protected pubKey: string;
protected fullPubKey: string;
/**
* constructor of the LedgerSigner class.
* @param {Transport} transport 5 transports are available to handle USB, bluetooth, Node, Web, Mobile.
* See Guides for more details.
* @param {number} accountID ID of Ledger Nano (can handle 2**31 accounts).
* @param {string} [eip2645application='LedgerW'] A wallet is defined by an ERC2645 derivation path (6 items),
* and one item is the `application` and can be customized.
* Default value is `LedgerW`.
* @param {LedgerPathCalculation} [pathFunction=getLedgerPathBuffer111]
* defines the function that will calculate the path. By default `getLedgerPathBuffer111` is selected.
* @example
* ```typescript
* import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
* const myNodeTransport = await TransportNodeHid.create();
* const myLedgerSigner = new LedgerSigner111(myNodeTransport, 0);
* ```
*/
constructor(transport: Transport, accountID: number, eip2645application?: string, pathFunction?: LedgerPathCalculation);
/**
* provides the Starknet public key
* @returns an hex string : 64 characters are Point X coordinate.
* @example
* ```typescript
* const result = await myLedgerSigner.getPubKey();
* // result= "0x03681417ba3e1f050dd3ccdceb8d22b5e44fa70ee7844d472c6a768bded5174e"
* ```
*/
getPubKey(): Promise<string>;
/**
* provides the full public key (with parity prefix)
* @returns an hex string : 2 first characters are the parity, the 64 following characters are Point X coordinate. 64 last characters are Point Y coordinate.
* @example
* ```typescript
* const result = await myLedgerSigner.getFullPubKey();
* // result= "0x0403681417ba3e1f050dd3ccdceb8d22b5e44fa70ee7844d472c6a768bded5174e03cbc86f805dcfcb0c1922dd4daf181afa289d86223a18bc856276615bcc7787"
* ```
*/
getFullPubKey(): Promise<string>;
/**
* Returns the version of the Starknet APP implemented in the Ledger.
* @returns {string} version.
* @example
* ```typescript
* const result = await myLedgerSigner.getAppVersion();
* // result= "1.1.1"
* ```
*/
getAppVersion(): Promise<string>;
/**
* Sign a TypedData message (SNIP-12) in a Ledger.
* @param {typedDataToHash} typedDataToHash A TypedData message compatible with SNIP-12.
* @param {string} accountAddress Signer account address (Hex or num string)
* @returns {Signature} The signed message.
* @example
* ```typescript
* const result = myLedgerSigner.signMessage(snip12Message, account0.address);
* // result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
* // s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
* // recovery: 0}
* ```
*/
signMessage(typedDataToHash: TypedData, accountAddress: string): Promise<Signature>;
/**
* Sign in a Ledger a V1 or a V3 transaction. This is a blind sign on the Ledger screen.
* @param {Call1[]} transactions An array of `Call` transactions (generated for example by `myContract.populate()`).
* @param {InvocationsSignerDetails} transactionsDetail An object that includes all the necessary inputs to hash the transaction. Can be `V2InvocationsSignerDetails` or `V3InvocationsSignerDetails` type.
* @returns {Signature} The signed transaction.
* @example
* ```typescript
* const txDetailsV3: V3InvocationsSignerDetails = {
* chainId: constants.StarknetChainId.SN_MAIN,
* nonce: "28",
* accountDeploymentData: [],
* paymasterData: [],
* cairoVersion: "1",
* feeDataAvailabilityMode: "L1",
* nonceDataAvailabilityMode: "L1",
* resourceBounds: {
* l1_gas: {
* max_amount: "0x2a00",
* max_price_per_unit: "0x5c00000"
* },
* l2_gas: {
* max_amount: "0x00",
* max_price_per_unit: "0x00"
* },
* },
* tip: 0,
* version: "0x3",
* walletAddress: account0.address
* }
* const result = myLedgerSigner.signTransaction([call0, call1], txDetailsV3);
* // result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
* // s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
* // recovery: 0}
* ```
*/
signTransaction(transactions: Call[], trans