starknet
Version:
JavaScript library for Starknet
1,428 lines (1,396 loc) • 372 kB
TypeScript
import * as RPCSPEC07 from '@starknet-io/starknet-types-07';
import { STRUCT_EVENT, EVENT_FIELD, ENUM_EVENT, BlockHash, TransactionHash, StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision, StarknetWindowObject, Address, Permission, WatchAssetParameters as WatchAssetParameters$1, AddStarknetChainParameters as AddStarknetChainParameters$1, ChainId, AccountDeploymentData, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddDeclareTransactionParameters, AddDeclareTransactionResult, Signature as Signature$2, SpecVersion, AccountChangeEventHandler as AccountChangeEventHandler$1, NetworkChangeEventHandler as NetworkChangeEventHandler$1 } from '@starknet-io/starknet-types-07';
export { StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision } from '@starknet-io/starknet-types-07';
import * as RPCSPEC08 from '@starknet-io/starknet-types-08';
import { PAYMASTER_API, EDataAvailabilityMode as EDataAvailabilityMode$1, SUBSCRIPTION_BLOCK_TAG, BLOCK_WITH_TX_HASHES, PENDING_BLOCK_WITH_TX_HASHES, BlockWithTxHashes as BlockWithTxHashes$1, TransactionReceipt as TransactionReceipt$1, IsSucceeded, IsReverted, IsType, OutsideExecutionTypedData, ETransactionVersion as ETransactionVersion$1, ETransactionVersion2 as ETransactionVersion2$1, ETransactionVersion3 as ETransactionVersion3$1, SUBSCRIPTION_ID, BLOCK_HEADER, EMITTED_EVENT, NEW_TXN_STATUS, TXN_HASH as TXN_HASH$1, TXN_WITH_HASH, BLOCK_STATUS, BLOCK_BODY_WITH_RECEIPTS, PENDING_BLOCK_HEADER, BlockTransactionsTraces, L1L2MessagesStatus, CONTRACT_STORAGE_KEYS, StorageProof, CASM_COMPILED_CONTRACT_CLASS, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, EDAMode as EDAMode$1, PRICE_UNIT as PRICE_UNIT$1, OutsideCallV1, OutsideCallV2, EmittedEvent as EmittedEvent$1, Methods as Methods$1 } from '@starknet-io/starknet-types-08';
import * as weierstrass from '@noble/curves/abstract/weierstrass';
import { RecoveredSignatureType } from '@noble/curves/abstract/weierstrass';
import { Abi as Abi$1, TypedContract } from 'abi-wan-kanabi';
import * as ts_mixer_dist_types_types from 'ts-mixer/dist/types/types';
import * as poseidon from '@noble/curves/abstract/poseidon';
import * as json$1 from 'lossless-json';
import * as starknet from '@scure/starknet';
function _mergeNamespaces(n, m) {
m.forEach(function (e) {
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
});
return Object.freeze(n);
}
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 index$5_ErrorResponseBody = ErrorResponseBody;
type index$5_RequestBody = RequestBody;
type index$5_ResponseBody = ResponseBody;
type index$5_SuccessResponseBody = SuccessResponseBody;
type index$5_WebSocketEvent = WebSocketEvent;
declare namespace index$5 {
export type { Error$1 as Error, index$5_ErrorResponseBody as ErrorResponseBody, index$5_RequestBody as RequestBody, index$5_ResponseBody as ResponseBody, index$5_SuccessResponseBody as SuccessResponseBody, index$5_WebSocketEvent as WebSocketEvent };
}
var index$4 = /*#__PURE__*/_mergeNamespaces({
__proto__: null,
JRPC: index$5,
PAYMASTER_API: PAYMASTER_API,
RPCSPEC07: RPCSPEC07,
RPCSPEC08: RPCSPEC08
}, [RPCSPEC08]);
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 = STRUCT_EVENT & {
name: string;
type: 'event';
};
type CairoEventVariant = ENUM_EVENT & {
name: string;
type: string;
};
type LegacyEvent = {
name: string;
type: 'event';
data: EVENT_FIELD[];
keys: 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[]>;
}>;
}
/** SYSTEM TYPES */
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_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 = RPCSPEC08.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 = RPCSPEC08.ETransactionVersion2;
declare const ETransactionVersion2: {
readonly V0: "0x0";
readonly V1: "0x1";
readonly V2: "0x2";
readonly F0: "0x100000000000000000000000000000000";
readonly F1: "0x100000000000000000000000000000001";
readonly F2: "0x100000000000000000000000000000002";
};
type ETransactionVersion3 = RPCSPEC08.ETransactionVersion3;
declare const ETransactionVersion3: {
readonly V3: "0x3";
readonly F3: "0x100000000000000000000000000000003";
};
type BLOCK_HASH = Merge<RPCSPEC08.BLOCK_HASH, RPCSPEC07.SPEC.BLOCK_HASH>;
type BLOCK_NUMBER = Merge<RPCSPEC08.BLOCK_NUMBER, RPCSPEC07.SPEC.BLOCK_NUMBER>;
type FELT = Merge<RPCSPEC08.FELT, RPCSPEC07.SPEC.FELT>;
type TXN_HASH = Merge<RPCSPEC08.TXN_HASH, RPCSPEC07.SPEC.TXN_HASH>;
type PRICE_UNIT = Merge<RPCSPEC08.PRICE_UNIT, RPCSPEC07.SPEC.PRICE_UNIT>;
type RESOURCE_PRICE = Merge<RPCSPEC08.RESOURCE_PRICE, RPCSPEC07.SPEC.RESOURCE_PRICE>;
type SIMULATION_FLAG = Merge<RPCSPEC08.SIMULATION_FLAG, RPCSPEC07.SPEC.SIMULATION_FLAG>;
type STATE_UPDATE = Merge<RPCSPEC08.STATE_UPDATE, RPCSPEC07.SPEC.STATE_UPDATE>;
type PENDING_STATE_UPDATE = Merge<RPCSPEC08.PENDING_STATE_UPDATE, RPCSPEC07.SPEC.PENDING_STATE_UPDATE>;
type PENDING_INVOKE_TXN_RECEIPT = RPCSPEC08.IsPending<RPCSPEC08.IsType<RPCSPEC08.TransactionReceipt, 'INVOKE'>>;
type PENDING_DECLARE_TXN_RECEIPT = RPCSPEC08.IsPending<RPCSPEC08.IsType<RPCSPEC08.TransactionReceipt, 'DECLARE'>>;
type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT = RPCSPEC08.IsPending<RPCSPEC08.IsType<RPCSPEC08.TransactionReceipt, 'DEPLOY_ACCOUNT'>>;
type PENDING_L1_HANDLER_TXN_RECEIPT = RPCSPEC08.IsPending<RPCSPEC08.IsType<RPCSPEC08.TransactionReceipt, 'L1_HANDLER'>>;
type BlockWithTxHashes = Merge<RPCSPEC08.BlockWithTxHashes, RPCSPEC07.BlockWithTxHashes>;
type ContractClassPayload = Merge<RPCSPEC08.ContractClass, RPCSPEC07.ContractClass>;
type DeclaredTransaction = Merge<RPCSPEC08.DeclaredTransaction, RPCSPEC07.DeclaredTransaction>;
type InvokedTransaction = Merge<RPCSPEC08.InvokedTransaction, RPCSPEC07.InvokedTransaction>;
type DeployedAccountTransaction = Merge<RPCSPEC08.DeployedAccountTransaction, RPCSPEC07.DeployedAccountTransaction>;
type L1Message = Merge<RPCSPEC08.L1Message, RPCSPEC07.L1Message>;
type EventFilter = RPCSPEC08.EventFilter;
type L1_HANDLER_TXN = RPCSPEC08.L1_HANDLER_TXN;
type EDataAvailabilityMode = RPCSPEC08.EDataAvailabilityMode;
declare const EDataAvailabilityMode: {
readonly L1: "L1";
readonly L2: "L2";
};
type EDAMode = RPCSPEC08.EDAMode;
declare const EDAMode: {
readonly L1: 0;
readonly L2: 1;
};
type EmittedEvent = Merge<RPCSPEC08.EmittedEvent, RPCSPEC07.EmittedEvent>;
type Event$1 = Merge<RPCSPEC08.Event, RPCSPEC07.Event>;
type PendingReceipt = Merge<RPCSPEC08.TransactionReceiptPendingBlock, RPCSPEC07.PendingReceipt>;
type Receipt = Merge<RPCSPEC08.TransactionReceiptProductionBlock, RPCSPEC07.Receipt>;
type FeeEstimate = SimpleOneOf<RPCSPEC08.FEE_ESTIMATE, RPCSPEC07.SPEC.FEE_ESTIMATE>;
declare function isRPC08_FeeEstimate(entry: FeeEstimate): entry is RPCSPEC08.FEE_ESTIMATE;
type ResourceBounds = Simplify<SimpleOneOf<RPCSPEC08.ResourceBounds, RPCSPEC07.ResourceBounds>>;
declare function isRPC08_ResourceBounds(entry: ResourceBounds): entry is RPCSPEC08.ResourceBounds;
/**
* overhead percentage on estimate fee
*/
type ResourceBoundsOverhead = ResourceBoundsOverheadRPC08 | ResourceBoundsOverheadRPC07;
/**
* percentage overhead on estimated fee
*/
type ResourceBoundsOverheadRPC08 = {
l1_gas: {
max_amount: number;
max_price_per_unit: number;
};
l2_gas: {
max_amount: number;
max_price_per_unit: number;
};
l1_data_gas: {
max_amount: number;
max_price_per_unit: number;
};
};
type ResourceBoundsOverheadRPC07 = {
l1_gas: {
max_amount: number;
max_price_per_unit: number;
};
};
type SimulateTransaction = RPCSPEC08.SimulateTransaction;
type TransactionWithHash = Merge<RPCSPEC08.TransactionWithHash, RPCSPEC07.TransactionWithHash>;
type TransactionReceipt = Merge<RPCSPEC08.TransactionReceipt, RPCSPEC07.TransactionReceipt>;
type Methods = RPCSPEC08.Methods;
type TXN_STATUS = Merge<RPCSPEC08.TXN_STATUS, RPCSPEC07.SPEC.TXN_STATUS>;
type TXN_EXECUTION_STATUS = Merge<RPCSPEC08.TXN_EXECUTION_STATUS, RPCSPEC07.SPEC.TXN_EXECUTION_STATUS>;
type TransactionStatus = Merge<RPCSPEC08.TransactionStatus, RPCSPEC07.TransactionStatus>;
type ETransactionStatus = RPCSPEC08.ETransactionStatus;
declare const ETransactionStatus: {
readonly RECEIVED: "RECEIVED";
readonly REJECTED: "REJECTED";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
};
type ETransactionExecutionStatus = RPCSPEC08.ETransactionExecutionStatus;
declare const ETransactionExecutionStatus: {
readonly SUCCEEDED: "SUCCEEDED";
readonly REVERTED: "REVERTED";
};
type TRANSACTION_TRACE = Merge<RPCSPEC08.TRANSACTION_TRACE, RPCSPEC07.SPEC.TRANSACTION_TRACE>;
type FEE_ESTIMATE = Merge<RPCSPEC08.FEE_ESTIMATE, RPCSPEC07.SPEC.FEE_ESTIMATE>;
type EVENTS_CHUNK = Merge<RPCSPEC08.EVENTS_CHUNK, RPCSPEC07.SPEC.EVENTS_CHUNK>;
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;
};
/**
* 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;
};
type DeployAccountContractPayload = {
classHash: string;
constructorCalldata?: RawArgs;
addressSalt?: BigNumberish;
contractAddress?: string;
};
type DeployAccountContractTransaction = Omit<DeployAccountContractPayload, 'contractAddress'> & {
signature?: Signature;
};
type DeclareContractPayload = {
contract: CompiledContract | string;
classHash?: string;
casm?: CompiledSierraCasm;
compiledClassHash?: string;
};
/**
* 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;
entrypoint?: string;
};
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: ResourceBounds;
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;
declare const TransactionType: {
readonly DECLARE: "DECLARE";
readonly DEPLOY: "DEPLOY";
readonly DEPLOY_ACCOUNT: "DEPLOY_ACCOUNT";
readonly INVOKE: "INVOKE_FUNCTION";
};
type TransactionType = ValuesType<typeof TransactionType>;
/**
* new statuses are defined by props: finality_status and execution_status
* to be #deprecated
*/
declare const TransactionFinalityStatus: {
readonly NOT_RECEIVED: "NOT_RECEIVED";
readonly RECEIVED: "RECEIVED";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
};
type TransactionFinalityStatus = ValuesType<typeof TransactionFinalityStatus>;
declare const TransactionExecutionStatus: {
readonly REJECTED: "REJECTED";
readonly REVERTED: "REVERTED";
readonly SUCCEEDED: "SUCCEEDED";
};
type TransactionExecutionStatus = ValuesType<typeof TransactionExecutionStatus>;
declare const BlockStatus: {
readonly PENDING: "PENDING";
readonly ACCEPTED_ON_L1: "ACCEPTED_ON_L1";
readonly ACCEPTED_ON_L2: "ACCEPTED_ON_L2";
readonly REJECTED: "REJECTED";
};
type BlockStatus = ValuesType<typeof BlockStatus>;
declare const BlockTag: {
readonly PENDING: "pending";
readonly LATEST: "latest";
};
type BlockTag = ValuesType<typeof BlockTag>;
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 'pending' block tag
*/
type BlockIdentifier = BlockNumber | BigNumberish;
type SubscriptionBlockIdentifier = SUBSCRIPTION_BLOCK_TAG | (string & {}) | number | bigint;
/**
* items used by AccountInvocations
*/
type AccountInvocationItem = (({
type: typeof TransactionType.DECLARE;
} & DeclareContractTransaction) | ({
type: typeof TransactionType.DEPLOY_ACCOUNT;
} & DeployAccountContractTransaction) | ({
type: typeof TransactionType.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 TransactionType.DECLARE;
} & OptionalPayload<DeclareContractPayload>) | ({
type: typeof TransactionType.DEPLOY;
} & OptionalPayload<AllowArray<UniversalDeployerContractPayload>>) | ({
type: typeof TransactionType.DEPLOY_ACCOUNT;
} & OptionalPayload<DeployAccountContractPayload>) | ({
type: typeof TransactionType.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 = {
retryInterval?: number;
successStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
errorStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
};
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;
};
interface ProviderOptions extends RpcProviderOptions {
}
type FeeMarginPercentage = {
bounds: ResourceBoundsOverhead;
maxFee: number;
};
type RpcProviderOptions = {
nodeUrl?: string | _NetworkName;
retries?: number;
transactionRetryIntervalFallback?: number;
headers?: object;
blockIdentifier?: BlockIdentifier;
chainId?: _StarknetChainId;
specVersion?: _SupportedRpcVersion;
default?: boolean;
waitMode?: boolean;
baseFetch?: WindowOrWorkerGlobalScope['fetch'];
feeMarginPercentage?: FeeMarginPercentage;
batch?: false | number;
};
/**
* Common interface response
* Intersection (sequencer response ∩ (∪ rpc responses))
*/
type Block$1 = Simplify<BLOCK_WITH_TX_HASHES>;
type PendingBlock = Simplify<PENDING_BLOCK_WITH_TX_HASHES>;
type GetBlockResponse = Simplify<BlockWithTxHashes$1>;
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;
type EstimateFeeResponse = {
overall_fee: bigint;
unit: PRICE_UNIT;
l1_gas_consumed: bigint;
l1_gas_price: bigint;
l2_gas_consumed: bigint | undefined;
l2_gas_price: bigint | undefined;
l1_data_gas_consumed: bigint;
l1_data_gas_price: bigint;
suggestedMaxFee: bigint;
resourceBounds: ResourceBounds;
};
type EstimateFeeResponseBulk = Array<EstimateFeeResponse>;
type InvokeFunctionResponse = InvokedTransaction;
type DeclareContractResponse = DeclaredTransaction;
type CallContractResponse = string[];
type Storage = FELT;
type Nonce = string;
type SimulationFlags = Array<SIMULATION_FLAG>;
type SimulatedTransaction = SimulateTransaction & {
suggestedMaxFee: bigint;
resourceBounds: ResourceBounds;
};
type SimulateTransactionResponse = SimulatedTransaction[];
type StateUpdateResponse = StateUpdate | PendingStateUpdate;
type StateUpdate = STATE_UPDATE;
type PendingStateUpdate = PENDING_STATE_UPDATE;
/**
* 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'>;
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;
}
interface EstimateFee extends EstimateFeeResponse {
}
type UniversalSuggestedFee = {
maxFee: BigNumberish;
resourceBounds: ResourceBounds;
};
type EstimateFeeBulk = Array<EstimateFee>;
type AccountInvocationsFactoryDetails = {
versions: Array<`${ETransactionVersion$1}`>;
nonce?: BigNumberish;
blockIdentifier?: BlockIdentifier;
skipValidate?: boolean;
} & Partial<V3TransactionDetails>;
interface UniversalDetails {
nonce?: BigNumberish;
blockIdentifier?: BlockIdentifier;
/**
* Max fee to pay for V2 transaction
*/
maxFee?: BigNumberish;
tip?: BigNumberish;
paymasterData?: BigNumberish[];
accountDeploymentData?: BigNumberish[];
nonceDataAvailabilityMode?: EDataAvailabilityMode$1;
feeDataAvailabilityMode?: EDataAvailabilityMode$1;
version?: BigNumberish;
resourceBounds?: ResourceBounds;
skipValidate?: boolean;
}
interface PaymasterDetails {
feeMode: FeeMode;
deploymentData?: PAYMASTER_API.AccountDeploymentData;
timeBounds?: PaymasterTimeBounds;
}
interface EstimateFeeDetails extends UniversalDetails {
}
interface DeployContractResponse {
contract_address: string;
transaction_hash: string;
}
type MultiDeployContractResponse = {
contract_address: Array<string>;
transaction_hash: string;
};
type DeployContractUDCResponse = {
contract_address: string;
transaction_hash: string;
address: string;
deployer: string;
unique: string;
classHash: string;
calldata_len: string;
calldata: Array<string>;
salt: string;
};
type DeclareDeployUDCResponse = {
declare: {
class_hash: BigNumberish;
} & Partial<DeclareTransactionReceiptResponse>;
deploy: DeployContractUDCResponse;
};
type SimulateTransactionDetails = {
nonce?: BigNumberish;
blockIdentifier?: BlockIdentifier;
skipValidate?: boolean;
skipExecute?: boolean;
} & Partial<V3TransactionDetails>;
type EstimateFeeAction = {
type: typeof TransactionType.INVOKE;
payload: AllowArray<Call>;
} | {
type: typeof TransactionType.DECLARE;
payload: DeclareContractPayload;
} | {
type: typeof TransactionType.DEPLOY_ACCOUNT;
payload: DeployAccountContractPayload;
} | {
type: typeof TransactionType.DEPLOY;
payload: UniversalDeployerContractPayload;
};
type StarkProfile = {
name?: string;
profilePicture?: string;
discord?: string;
twitter?: string;
github?: string;
proofOfPersonhood?: boolean;
};
declare const ValidateType: {
readonly DEPLOY: "DEPLOY";
readonly CALL: "CALL";
readonly INVOKE: "INVOKE";
};
type ValidateType = ValuesType<typeof ValidateType>;
declare const Uint: {
readonly u8: "core::integer::u8";
readonly u16: "core::integer::u16";
readonly u32: "core::integer::u32";
readonly u64: "core::integer::u64";
readonly u128: "core::integer::u128";
readonly u256: "core::integer::u256";
readonly u512: "core::integer::u512";
};
type Uint = ValuesType<typeof Uint>;
declare const Literal: {
readonly ClassHash: "core::starknet::class_hash::ClassHash";
readonly ContractAddress: "core::starknet::contract_address::ContractAddress";
readonly Secp256k1Point: "core::starknet::secp256k1::Secp256k1Point";
readonly U96: "core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>";
};
type Literal = ValuesType<typeof Literal>;
declare const ETH_ADDRESS = "core::starknet::eth_address::EthAddress";
declare const NON_ZERO_PREFIX = "core::zeroable::NonZero::";
type AsyncContractFunction<T = any> = (...args: ArgsOrCalldataWithOptions) => Promise<T>;
type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
type Result = {
[key: string]: any;
} | Result[] | bigint | string | boolean | CairoEnum;
type ArgsOrCalldata = RawArgsArray | [Calldata] | Calldata;
type ArgsOrCalldataWithOptions = [...RawArgsArray] | [...RawArgsArray, ContractOptions] | [Calldata] | [Calldata, ContractOptions] | [...Calldata] | [...Calldata, ContractOptions];
type ContractOptions = {
blockIdentifier?: BlockIdentifier;
/**
* compile and validate arguments
*/
parseRequest?: boolean;
/**
* Parse elements of the response array and structuring them into response object
*/
parseResponse?: boolean;
/**
* Advance formatting used to get js types data as result
* @description https://starknetjs.com/docs/guides/define_call_message/#formatresponse
* @example
* ```typescript
* // assign custom or existing method to resulting data
* formatResponse: { balance: uint256ToBN },
* ```
* @example
* ```typescript
* // define resulting data js types
* const formatAnswer = { id: 'number', description: 'string' };
* ```
*/
formatResponse?: {
[key: string]: any;
};
signature?: Signature;
addressSalt?: string;
} & Partial<UniversalDetails>;
type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'parseResponse' | 'formatResponse'>;
type InvokeOptions = ContractOptions;
type ParsedEvent = {
[name: string]: ParsedStruct;
} & {
block_hash?: BlockHash;
block_number?: BlockNumber;
transaction_hash?: TransactionHash;
};
type ParsedEvents = Array<ParsedEvent>;
type RPC_ERROR_SET = {
FAILED_TO_RECEIVE_TXN: RPCSPEC08.FAILED_TO_RECEIVE_TXN;
NO_TRACE_AVAILABLE: RPCSPEC08.NO_TRACE_AVAILABLE;
CONTRACT_NOT_FOUND: RPCSPEC08.CONTRACT_NOT_FOUND;
ENTRYPOINT_NOT_FOUND: RPCSPEC08.ENTRYPOINT_NOT_FOUND;
BLOCK_NOT_FOUND: RPCSPEC08.BLOCK_NOT_FOUND;
INVALID_TXN_INDEX: RPCSPEC08.INVALID_TXN_INDEX;
CLASS_HASH_NOT_FOUND: RPCSPEC08.CLASS_HASH_NOT_FOUND;
TXN_HASH_NOT_FOUND: RPCSPEC08.TXN_HASH_NOT_FOUND;
PAGE_SIZE_TOO_BIG: RPCSPEC08.PAGE_SIZE_TOO_BIG;
NO_BLOCKS: RPCSPEC08.NO_BLOCKS;
INVALID_CONTINUATION_TOKEN: RPCSPEC08.INVALID_CONTINUATION_TOKEN;
TOO_MANY_KEYS_IN_FILTER: RPCSPEC08.TOO_MANY_KEYS_IN_FILTER;
CONTRACT_ERROR: RPCSPEC08.CONTRACT_ERROR;
TRANSACTION_EXECUTION_ERROR: RPCSPEC08.TRANSACTION_EXECUTION_ERROR;
STORAGE_PROOF_NOT_SUPPORTED: RPCSPEC08.STORAGE_PROOF_NOT_SUPPORTED;
CLASS_ALREADY_DECLARED: RPCSPEC08.CLASS_ALREADY_DECLARED;
INVALID_TRANSACTION_NONCE: RPCSPEC08.INVALID_TRANSACTION_NONCE;
INSUFFICIENT_RESOURCES_FOR_VALIDATE: RPCSPEC08.INSUFFICIENT_RESOURCES_FOR_VALIDATE;
INSUFFICIENT_ACCOUNT_BALANCE: RPCSPEC08.INSUFFICIENT_ACCOUNT_BALANCE;
VALIDATION_FAILURE: RPCSPEC08.VALIDATION_FAILURE;
COMPILATION_FAILED: RPCSPEC08.COMPILATION_FAILED;
CONTRACT_CLASS_SIZE_IS_TOO_LARGE: RPCSPEC08.CONTRACT_CLASS_SIZE_IS_TOO_LARGE;
NON_ACCOUNT: RPCSPEC08.NON_ACCOUNT;
DUPLICATE_TX: RPCSPEC08.DUPLICATE_TX;
COMPILED_CLASS_HASH_MISMATCH: RPCSPEC08.COMPILED_CLASS_HASH_MISMATCH;
UNSUPPORTED_TX_VERSION: RPCSPEC08.UNSUPPORTED_TX_VERSION;
UNSUPPORTED_CONTRACT_CLASS_VERSION: RPCSPEC08.UNSUPPORTED_CONTRACT_CLASS_VERSION;
UNEXPECTED_ERROR: RPCSPEC08.UNEXPECTED_ERROR;
INVALID_SUBSCRIPTION_ID: RPCSPEC08.INVALID_SUBSCRIPTION_ID;
TOO_MANY_ADDRESSES_IN_FILTER: RPCSPEC08.TOO_MANY_ADDRESSES_IN_FILTER;
TOO_MANY_BLOCKS_BACK: RPCSPEC08.TOO_MANY_BLOCKS_BACK;
COMPILATION_ERROR: RPCSPEC08.COMPILATION_ERROR;
INVALID_ADDRESS: PAYMASTER_API.INVALID_ADDRESS;
TOKEN_NOT_SUPPORTED: PAYMASTER_API.TOKEN_NOT_SUPPORTED;
INVALID_SIGNATURE: PAYMASTER_API.INVALID_SIGNATURE;
MAX_AMOUNT_TOO_LOW: PAYMASTER_API.MAX_AMOUNT_TOO_LOW;
CLASS_HASH_NOT_SUPPORTED: PAYMASTER_API.CLASS_HASH_NOT_SUPPORTED;
PAYMASTER_TRANSACTION_EXECUTION_ERROR: PAYMASTER_API.TRANSACTION_EXECUTION_ERROR;
INVALID_TIME_BOUNDS: PAYMASTER_API.INVALID_TIME_BOUNDS;
INVALID_DEPLOYMENT_DATA: PAYMASTER_API.INVALID_DEPLOYMENT_DATA;
INVALID_CLASS_HASH: PAYMASTER_API.INVALID_CLASS_HASH;
INVALID_ID: PAYMASTER_API.INVALID_ID;
UNKNOWN_ERROR: PAYMASTER_API.UNKNOWN_ERROR;
};
type RPC_ERROR = RPC_ERROR_SET[keyof RPC_ERROR_SET];
interface OutsideExecutionOptions {
/** authorized executer of the transaction(s): Hex address or "ANY_CALLER" or shortString.encodeShortString(constants.OutsideExecutionCallerAny) */
caller: string;
/** Unix timestamp of the beginning of the timeframe */
execute_after: BigNumberish;
/** Unix timestamp of the end of the timeframe */
execute_before: BigNumberish;
}
interface OutsideCall {
to: string;
selector: BigNumberish;
calldata: RawArgs;
}
interface OutsideExecution {
caller: string;
nonce: BigNumberish;
execute_after: BigNumberish;
execute_before: BigNumberish;
calls: OutsideCall[];
}
interface OutsideTransaction {
outsideExecution: OutsideExecution;
signature: Signature;
signerAddress: BigNumberish;
version: OutsideExecutionVersion;
}
declare const OutsideExecutionTypesV1: {
StarkNetDomain: {
name: string;
type: string;
}[];
OutsideExecution: {
name: string;
type: string;
}[];
OutsideCall: {
name: string;
type: string;
}[];
};
declare const OutsideExecutionTypesV2: {
StarknetDomain: {
name: string;
type: string;
}[];
OutsideExecution: {
name: string;
type: string;
}[];
Call: {
name: string;
type: string;
}[];
};
declare const OutsideExecutionVersion: {
readonly UNSUPPORTED: "0";
readonly V1: "1";
readonly V2: "2";
};
type OutsideExecutionVersion = ValuesType<typeof OutsideExecutionVersion>;
type InvocationsSignerDetails = (V2InvocationsSignerDetails | V3InvocationsSignerDetails) & {
version: `${ETransactionVersion$1}`;
skipValidate?: boolean;
};
type V2InvocationsSignerDetails = {
walletAddress: string;
cairoVersion: CairoVersion;
chainId: _StarknetChainId;
nonce: BigNumberish;
maxFee: BigNumberish;
version: `${ETransactionVersion2$1}`;
};
type V3InvocationsSignerDetails = V3TransactionDetails & {
walletAddress: string;
cairoVersion: CairoVersion;
chainId: _StarknetChainId;
version: `${ETransactionVersion3$1}`;
};
type DeclareSignerDetails = (V3DeclareSignerDetails | V2DeclareSignerDetails) & {
version: `${ETransactionVersion$1}`;
};
type V2DeclareSignerDetails = Required<InvocationsDetails> & {
classHash: string;
compiledClassHash?: string;
senderAddress: string;
chainId: _StarknetChainId;
version: `${ETransactionVersion2$1}`;
};
type V3DeclareSignerDetails = V3TransactionDetails & {
classHash: string;
compiledClassHash: string;
senderAddress: string;
chainId: _StarknetChainId;
version: `${ETransactionVersion3$1}`;
};
type DeployAccountSignerDetails = V2DeployAccountSignerDetails | V3DeployAccountSignerDetails;
type V2DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
contractAddress: BigNumberish;
chainId: _StarknetChainId;
version: `${ETransactionVersion2$1}`;
};
type V3DeployAccountSignerDetails = Required<DeployAccountContractPayload> & V3TransactionDetails & {
contractAddress: BigNumberish;
chainId: _StarknetChainId;
version: `${ETransactionVersion3$1}`;
};
type LedgerPathCalculation = (accountId: number, applicationName: string) => Uint8Array;
type TransactionStatusReceiptSets = {
success: SuccessfulTransactionReceiptResponse;
reverted: RevertedTransactionReceiptResponse;
error: Error;
};
type TransactionReceiptStatus = keyof TransactionStatusReceiptSets;
type TransactionReceiptValue = TransactionStatusReceiptSets[TransactionReceiptStatus];
type TransactionReceiptCallbacksDefined = {
[key in TransactionReceiptStatus]: (response: TransactionStatusReceiptSets[key]) => void;
};
type TransactionReceiptCallbacksDefault = Partial<TransactionReceiptCallbacksDefined> & {
_: () => void;
};
type TransactionReceiptCallbacks = TransactionReceiptCallbacksDefined | TransactionReceiptCallbacksDefault;
type TransactionReceiptStatusFromMethod<T extends `is${Capitalize<TransactionReceiptStatus>}`> = T extends `is${infer R}` ? Uncapitalize<R> : never;
type GetTransactionReceiptResponse<T extends TransactionReceiptStatus = TransactionReceiptStatus> = {
readonly statusReceipt: T;
readonly value: TransactionStatusReceiptSets[T];
match(callbacks: TransactionReceiptCallbacks): void;
} & {
[key in `is${Capitalize<TransactionReceiptStatus>}`]: () => this is GetTransactionReceiptResponse<TransactionReceiptStatusFromMethod<key>>;
};
type index$3_Abi = Abi;
type index$3_AbiEntry = AbiEntry;
type index$3_AbiEnum = AbiEnum;
type index$3_AbiEnums = AbiEnums;
type index$3_AbiEvent = AbiEvent;
type index$3_AbiEvents = AbiEvents;
type index$3_AbiInterfaces = AbiInterfaces;
type index$3_AbiStruct = AbiStruct;
type index$3_AbiStructs = AbiStructs;
type index$3_AccountInvocationItem = AccountInvocationItem;
type index$3_AccountInvocations = AccountInvocations;
type index$3_AccountInvocationsFactoryDetails = AccountInvocationsFactoryDetails;
type index$3_AllowArray<T> = AllowArray<T>;
type index$3_Args = Args;
type index$3_ArgsOrCalldata = ArgsOrCalldata;
type index$3_ArgsOrCalldataWithOptions = ArgsOrCalldataWithOptions;
type index$3_ArraySignatureType = ArraySignatureType;
type index$3_AsyncContractFunction<T = any> = AsyncContractFunction<T>;
type index$3_BLOCK_HASH = BLOCK_HASH;
type index$3_BLOCK_NUMBER = BLOCK_NUMBER;
type index$3_BigNumberish = BigNumberish;
type index$3_BlockIdentifier = BlockIdentifier;
type index$3_BlockNumber = BlockNumber;
type index$3_BlockStatus = BlockStatus;
type index$3_BlockTag = BlockTag;
type index$3_BlockWithTxHashes = BlockWithTxHashes;
type index$3_Builtins = Builtins;
type index$3_ByteArray = ByteArray;
type index$3_ByteCode = ByteCode;
type index$3_CairoAssembly = CairoAssembly;
type index$3_CairoContract = CairoContract;
type index$3_CairoEnum = CairoEnum;
type index$3_CairoEvent = CairoEvent;
type index$3_CairoEventDefinition = CairoEventDefinition;
type index$3_CairoEventVariant = CairoEventVariant;
type index$3_CairoVersion = CairoVersion;
type index$3_Call = Call;
type index$3_CallContractResponse = CallContractResponse;
type index$3_CallDetails = CallDetails;
type index$3_CallOptions = CallOptions;
type index$3_Calldata = Calldata;
type index$3_CompiledContract = CompiledContract;
type index$3_CompiledSierra = CompiledSierra;
type index$3_CompiledSierraCasm = CompiledSierraCasm;
type index$3_CompilerVersion = CompilerVersion;
type index$3_CompleteDeclareContractPayload = CompleteDeclareContractPayload;
type index$3_CompressedProgram = CompressedProgram;
type index$3_ContractClass = ContractClass;
type index$3_ContractClassIdentifier = ContractClassIdentifier;
type index$3_ContractClassPayload = ContractClassPayload;
type index$3_ContractClassResponse = ContractClassResponse;
type index$3_ContractEntryPointFields = ContractEntryPointFields;
type index$3_ContractFunction = ContractFunction;
type index$3_ContractOptions = ContractOptions;
type index$3_ContractVersion = ContractVersion;
type index$3_DeclareAndDeployContractPayload = DeclareAndDeployContractPayload;
type index$3_DeclareContractPayload = DeclareContractPayload;
type index$3_DeclareContractResponse = DeclareContractResponse;
type index$3_DeclareContractTransaction = DeclareContractTransaction;
type index$3_DeclareDeployUDCResponse = DeclareDeployUDCResponse;
type index$3_DeclareSignerDetails = DeclareSignerDetails;
type index$3_DeclareTransactionReceiptResponse = DeclareTransactionReceiptResponse;
type index$3_DeclaredTransaction = DeclaredTransaction;
type index$3_DeployAccountContractPayload = DeployAccountContractPayload;
type index$3_DeployAccountContractTransaction = DeployAccountContractTransaction;
type index$3_DeployAccountSignerDetails = DeployAccountSignerDetails;
type index$3_DeployAccountTransactionReceiptResponse = DeployAccountTransactionReceiptResponse;
type index$3_DeployAndInvokeTransaction = DeployAndInvokeTransaction;
type index$3_DeployContractResponse = DeployContractRespo