starknet 8.3.1 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +47 -1
- package/dist/index.global.js +111 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# [8.4.0](https://github.com/starknet-io/starknet.js/compare/v8.3.1...v8.4.0) (2025-08-15)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- fast execute ([#1463](https://github.com/starknet-io/starknet.js/issues/1463)) ([d76fb63](https://github.com/starknet-io/starknet.js/commit/d76fb6321782b87a9bfc18c9ac859d21acb4f47e))
|
|
6
|
+
|
|
1
7
|
## [8.3.1](https://github.com/starknet-io/starknet.js/compare/v8.3.0...v8.3.1) (2025-08-15)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -833,6 +833,10 @@ type waitForTransactionOptions = {
|
|
|
833
833
|
successStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
|
|
834
834
|
errorStates?: Array<TransactionFinalityStatus | TransactionExecutionStatus>;
|
|
835
835
|
};
|
|
836
|
+
type fastWaitForTransactionOptions = {
|
|
837
|
+
retries?: number;
|
|
838
|
+
retryInterval?: number;
|
|
839
|
+
};
|
|
836
840
|
type getSimulateTransactionOptions = {
|
|
837
841
|
blockIdentifier?: BlockIdentifier;
|
|
838
842
|
skipValidate?: boolean;
|
|
@@ -2524,6 +2528,10 @@ type StarkProfile = {
|
|
|
2524
2528
|
github?: string;
|
|
2525
2529
|
proofOfPersonhood?: boolean;
|
|
2526
2530
|
};
|
|
2531
|
+
type fastExecuteResponse = {
|
|
2532
|
+
txResult: InvokeFunctionResponse;
|
|
2533
|
+
isReady: boolean;
|
|
2534
|
+
};
|
|
2527
2535
|
|
|
2528
2536
|
declare const ValidateType: {
|
|
2529
2537
|
readonly DEPLOY: "DEPLOY";
|
|
@@ -4172,6 +4180,7 @@ declare class RpcChannel {
|
|
|
4172
4180
|
*/
|
|
4173
4181
|
simulateTransaction(invocations: AccountInvocations, simulateTransactionOptions?: getSimulateTransactionOptions): Promise<RPC.SimulateTransactionResponse>;
|
|
4174
4182
|
waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<RPC.TXN_RECEIPT>;
|
|
4183
|
+
fastWaitForTransaction(txHash: BigNumberish, address: string, initNonceBN: BigNumberish, options?: fastWaitForTransactionOptions): Promise<boolean>;
|
|
4175
4184
|
getStorageAt(contractAddress: BigNumberish, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
4176
4185
|
getClassHashAt(contractAddress: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
4177
4186
|
getClass(classHash: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<(RPC.CONTRACT_CLASS & {
|
|
@@ -4740,6 +4749,20 @@ declare class RpcProvider$1 implements ProviderInterface {
|
|
|
4740
4749
|
getTransactionStatus(transactionHash: BigNumberish): Promise<RPCSPEC08.TXN_STATUS_RESULT | TXN_STATUS_RESULT>;
|
|
4741
4750
|
getSimulateTransaction(invocations: AccountInvocations, options?: getSimulateTransactionOptions): Promise<SimulateTransactionOverheadResponse>;
|
|
4742
4751
|
waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
|
|
4752
|
+
/**
|
|
4753
|
+
* Wait up until a new transaction is possible with same the account.
|
|
4754
|
+
* This method is fast, but Events and transaction report are not yet
|
|
4755
|
+
* available. Useful for gaming activity.
|
|
4756
|
+
* - only rpc 0.9 and onwards.
|
|
4757
|
+
* @param {BigNumberish} txHash - transaction hash
|
|
4758
|
+
* @param {string} address - address of the account
|
|
4759
|
+
* @param {BigNumberish} initNonce - initial nonce of the account (before the transaction).
|
|
4760
|
+
* @param {fastWaitForTransactionOptions} [options={retries: 50, retryInterval: 500}] - options to scan the network for the next possible transaction. `retries` is the number of times to retry.
|
|
4761
|
+
* @returns {Promise<boolean>} Returns true if the next transaction is possible,
|
|
4762
|
+
* false if the timeout has been reached,
|
|
4763
|
+
* throw an error in case of provider communication.
|
|
4764
|
+
*/
|
|
4765
|
+
fastWaitForTransaction(txHash: BigNumberish, address: string, initNonce: BigNumberish, options?: fastWaitForTransactionOptions): Promise<boolean>;
|
|
4743
4766
|
getStorageAt(contractAddress: BigNumberish, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
4744
4767
|
getClassHashAt(contractAddress: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
4745
4768
|
getClassByHash(classHash: BigNumberish): Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>;
|
|
@@ -4847,6 +4870,29 @@ declare class Account extends RpcProvider implements AccountInterface {
|
|
|
4847
4870
|
estimateFeeBulk(invocations: Invocations, details?: UniversalDetails): Promise<EstimateFeeBulk>;
|
|
4848
4871
|
simulateTransaction(invocations: Invocations, details?: SimulateTransactionDetails): Promise<SimulateTransactionOverheadResponse>;
|
|
4849
4872
|
execute(transactions: AllowArray<Call>, transactionsDetail?: UniversalDetails): Promise<InvokeFunctionResponse>;
|
|
4873
|
+
/**
|
|
4874
|
+
* Execute one or multiple calls through the account contract,
|
|
4875
|
+
* responding as soon as a new transaction is possible with the same account.
|
|
4876
|
+
* Useful for gaming usage.
|
|
4877
|
+
* - This method requires the provider to be initialized with `pre_confirmed` blockIdentifier option.
|
|
4878
|
+
* - Rpc 0.9 minimum.
|
|
4879
|
+
* - In a normal myAccount.execute() call, followed by myProvider.waitForTransaction(), you have an immediate access to the events and to the transaction report. Here, we are processing consecutive transactions faster, but events & transaction reports are not available immediately.
|
|
4880
|
+
* - As a consequence of the previous point, do not use contract/account deployment with this method.
|
|
4881
|
+
* @param {AllowArray<Call>} transactions - Single call or array of calls to execute
|
|
4882
|
+
* @param {UniversalDetails} [transactionsDetail] - Transaction execution options
|
|
4883
|
+
* @param {fastWaitForTransactionOptions} [waitDetail={retries: 50, retryInterval: 500}] - options to scan the network for the next possible transaction. `retries` is the number of times to retry, `retryInterval` is the time in ms between retries.
|
|
4884
|
+
* @returns {Promise<fastExecuteResponse>} Response containing the transaction result and status for the next transaction. If `isReady` is true, you can execute the next transaction. If false, timeout has been reached before the next transaction was possible.
|
|
4885
|
+
* @example
|
|
4886
|
+
* ```typescript
|
|
4887
|
+
* const myProvider = new RpcProvider({ nodeUrl: url, blockIdentifier: BlockTag.PRE_CONFIRMED });
|
|
4888
|
+
* const myAccount = new Account({ provider: myProvider, address: accountAddress0, signer: privateKey0 });
|
|
4889
|
+
* const resp = await myAccount.fastExecute(
|
|
4890
|
+
* call, { tip: recommendedTip},
|
|
4891
|
+
* { retries: 30, retryInterval: 500 });
|
|
4892
|
+
* // if resp.isReady is true, you can launch immediately a new tx.
|
|
4893
|
+
* ```
|
|
4894
|
+
*/
|
|
4895
|
+
fastExecute(transactions: AllowArray<Call>, transactionsDetail?: UniversalDetails, waitDetail?: fastWaitForTransactionOptions): Promise<fastExecuteResponse>;
|
|
4850
4896
|
/**
|
|
4851
4897
|
* First check if contract is already declared, if not declare it
|
|
4852
4898
|
* If contract already declared returned transaction_hash is ''.
|
|
@@ -9249,4 +9295,4 @@ declare class Logger {
|
|
|
9249
9295
|
*/
|
|
9250
9296
|
declare const logger: Logger;
|
|
9251
9297
|
|
|
9252
|
-
export { type Abi, type AbiEntry, type AbiEntryType, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, AbiParser1, AbiParser2, AbiParserInterface, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AccountOptions, type AllowArray, type ApiEstimateFeeResponse, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, CairoByteArray, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoInt128, CairoInt16, CairoInt32, CairoInt64, CairoInt8, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint128, CairoUint16, CairoUint256, CairoUint512, CairoUint64, CairoUint8, CairoUint96, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallResult, type Calldata, type CommonContractOptions, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeclaredTransaction, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployAndInvokeTransaction, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransaction, type DeployTransactionReceiptResponse, type DeployedAccountTransaction, Deployer, type DeployerCall, DeployerInterface, type Details, EDAMode, EDataAvailabilityMode, ETH_ADDRESS, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type ErrorReceiptResponseHelper, type EstimateFeeBulk, type EstimateFeeResponseBulkOverhead, type EstimateFeeResponseOverhead, EthSigner, type Event$1 as Event, type EventEntry, type EventFilter, type ExecutableDeployAndInvokeTransaction, type ExecutableDeployTransaction, type ExecutableInvokeTransaction, type ExecutableUserInvoke, type ExecutableUserTransaction, type ExecuteOptions, type ExecutionParameters, type FEE_ESTIMATE, type FELT, type FactoryParams, type FeeEstimate, type FeeMode, type FormatResponse, type FunctionAbi, type GasPrices, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, Int, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeTransaction, type InvokeTransactionReceiptResponse, type InvokedTransaction, type L1HandlerTransactionReceiptResponse, type L1_HANDLER_TXN, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, LedgerSigner231, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type Methods, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type PENDING_DECLARE_TXN_RECEIPT, type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT, type PENDING_INVOKE_TXN_RECEIPT, type PENDING_L1_HANDLER_TXN_RECEIPT, type PENDING_STATE_UPDATE, type PRE_CONFIRMED_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type ParsingStrategy, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PendingBlock, type PendingReceipt, type PendingStateUpdate, type PreConfirmedStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type ProviderOrAccount, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_8_1 as RPC08, rpc_0_9_0 as RPC09, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Receipt, ReceiptTx, type ReconnectOptions, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsBN, type ResourceBoundsOverhead, ResponseParser, type RevertedTransactionReceiptResponse, type RevertedTransactionReceiptResponseHelper, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type Simplify, type SimulateTransaction, type SimulateTransactionDetails, type SimulateTransactionOverhead, type SimulateTransactionOverheadResponse, type SimulateTransactionResponse, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SubscribeEventsParams, type SubscribeNewHeadsParams, type SubscribeNewTransactionReceiptsParams, type SubscribeNewTransactionsParams, type SubscribeTransactionStatusParams, Subscription, type SubscriptionBlockIdentifier, type SubscriptionNewHeadsEvent, type SubscriptionNewTransactionEvent, type SubscriptionNewTransactionReceiptsEvent, type SubscriptionOptions, type SubscriptionStarknetEventsEvent, type SubscriptionTransactionStatusEvent, type SuccessfulTransactionReceiptResponse, type SuccessfulTransactionReceiptResponseHelper, type TXN_EXECUTION_STATUS, type TXN_HASH, type TXN_STATUS, TimeoutError, type TipAnalysisOptions, type TipEstimate, type TipType, type TokenData, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptValue, type TransactionStatus, type TransactionStatusReceiptSets, type TransactionTrace, TransactionType, type TransactionWithHash, type Tupled, type TypedContractV2, UINT_128_MAX, UINT_128_MIN, UINT_256_HIGH_MAX, UINT_256_HIGH_MIN, UINT_256_LOW_MAX, UINT_256_LOW_MIN, UINT_256_MAX, UINT_256_MIN, UINT_512_MAX, UINT_512_MIN, Uint, type Uint256, type Uint512, type UniversalDeployerContractPayload, type UniversalDetails, type UserInvoke, type UserTransaction, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, WebSocketChannel, type WebSocketModule, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, createAbiParser, createTransactionReceipt, defaultDeployer, defaultPaymaster, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fastParsingStrategy, getAbiVersion, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getGasPrices, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, getTipStatsFromBlocks, index$3 as hash, hdParsingStrategy, isAccount, isNoConstructorValid, isPendingBlock, isPendingStateUpdate, isPendingTransaction, isRPC08Plus_ResourceBounds, isRPC08Plus_ResourceBoundsBN, isSierra, isSupportedSpecVersion, isV3Tx, isVersion, json, legacyDeployer, logger, merkle, num, outsideExecution, parseCalldataField, paymaster, provider, selector, shortString, src5, index$1 as stark, starknetId, toAnyPatchVersion, toApiVersion, index$2 as transaction, typedData, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, verifyMessageInStarknet, type waitForTransactionOptions, connect as wallet };
|
|
9298
|
+
export { type Abi, type AbiEntry, type AbiEntryType, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, AbiParser1, AbiParser2, AbiParserInterface, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AccountOptions, type AllowArray, type ApiEstimateFeeResponse, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, CairoByteArray, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoInt128, CairoInt16, CairoInt32, CairoInt64, CairoInt8, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint128, CairoUint16, CairoUint256, CairoUint512, CairoUint64, CairoUint8, CairoUint96, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallResult, type Calldata, type CommonContractOptions, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeclaredTransaction, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployAndInvokeTransaction, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransaction, type DeployTransactionReceiptResponse, type DeployedAccountTransaction, Deployer, type DeployerCall, DeployerInterface, type Details, EDAMode, EDataAvailabilityMode, ETH_ADDRESS, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type ErrorReceiptResponseHelper, type EstimateFeeBulk, type EstimateFeeResponseBulkOverhead, type EstimateFeeResponseOverhead, EthSigner, type Event$1 as Event, type EventEntry, type EventFilter, type ExecutableDeployAndInvokeTransaction, type ExecutableDeployTransaction, type ExecutableInvokeTransaction, type ExecutableUserInvoke, type ExecutableUserTransaction, type ExecuteOptions, type ExecutionParameters, type FEE_ESTIMATE, type FELT, type FactoryParams, type FeeEstimate, type FeeMode, type FormatResponse, type FunctionAbi, type GasPrices, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, Int, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeTransaction, type InvokeTransactionReceiptResponse, type InvokedTransaction, type L1HandlerTransactionReceiptResponse, type L1_HANDLER_TXN, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, LedgerSigner231, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type Methods, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type PENDING_DECLARE_TXN_RECEIPT, type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT, type PENDING_INVOKE_TXN_RECEIPT, type PENDING_L1_HANDLER_TXN_RECEIPT, type PENDING_STATE_UPDATE, type PRE_CONFIRMED_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type ParsingStrategy, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PendingBlock, type PendingReceipt, type PendingStateUpdate, type PreConfirmedStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type ProviderOrAccount, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_8_1 as RPC08, rpc_0_9_0 as RPC09, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Receipt, ReceiptTx, type ReconnectOptions, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsBN, type ResourceBoundsOverhead, ResponseParser, type RevertedTransactionReceiptResponse, type RevertedTransactionReceiptResponseHelper, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type Simplify, type SimulateTransaction, type SimulateTransactionDetails, type SimulateTransactionOverhead, type SimulateTransactionOverheadResponse, type SimulateTransactionResponse, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SubscribeEventsParams, type SubscribeNewHeadsParams, type SubscribeNewTransactionReceiptsParams, type SubscribeNewTransactionsParams, type SubscribeTransactionStatusParams, Subscription, type SubscriptionBlockIdentifier, type SubscriptionNewHeadsEvent, type SubscriptionNewTransactionEvent, type SubscriptionNewTransactionReceiptsEvent, type SubscriptionOptions, type SubscriptionStarknetEventsEvent, type SubscriptionTransactionStatusEvent, type SuccessfulTransactionReceiptResponse, type SuccessfulTransactionReceiptResponseHelper, type TXN_EXECUTION_STATUS, type TXN_HASH, type TXN_STATUS, TimeoutError, type TipAnalysisOptions, type TipEstimate, type TipType, type TokenData, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptValue, type TransactionStatus, type TransactionStatusReceiptSets, type TransactionTrace, TransactionType, type TransactionWithHash, type Tupled, type TypedContractV2, UINT_128_MAX, UINT_128_MIN, UINT_256_HIGH_MAX, UINT_256_HIGH_MIN, UINT_256_LOW_MAX, UINT_256_LOW_MIN, UINT_256_MAX, UINT_256_MIN, UINT_512_MAX, UINT_512_MIN, Uint, type Uint256, type Uint512, type UniversalDeployerContractPayload, type UniversalDetails, type UserInvoke, type UserTransaction, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, WebSocketChannel, type WebSocketModule, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, createAbiParser, createTransactionReceipt, defaultDeployer, defaultPaymaster, defaultProvider, ec, encode, eth, index as events, extractContractHashes, type fastExecuteResponse, fastParsingStrategy, type fastWaitForTransactionOptions, getAbiVersion, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getGasPrices, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, getTipStatsFromBlocks, index$3 as hash, hdParsingStrategy, isAccount, isNoConstructorValid, isPendingBlock, isPendingStateUpdate, isPendingTransaction, isRPC08Plus_ResourceBounds, isRPC08Plus_ResourceBoundsBN, isSierra, isSupportedSpecVersion, isV3Tx, isVersion, json, legacyDeployer, logger, merkle, num, outsideExecution, parseCalldataField, paymaster, provider, selector, shortString, src5, index$1 as stark, starknetId, toAnyPatchVersion, toApiVersion, index$2 as transaction, typedData, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, verifyMessageInStarknet, type waitForTransactionOptions, connect as wallet };
|
package/dist/index.global.js
CHANGED
|
@@ -15014,6 +15014,48 @@ ${indent}}` : "}";
|
|
|
15014
15014
|
}
|
|
15015
15015
|
return txReceipt;
|
|
15016
15016
|
}
|
|
15017
|
+
async fastWaitForTransaction(txHash, address, initNonceBN, options) {
|
|
15018
|
+
const initNonce = BigInt(initNonceBN);
|
|
15019
|
+
let retries = options?.retries ?? 50;
|
|
15020
|
+
const retryInterval = options?.retryInterval ?? 500;
|
|
15021
|
+
const errorStates = [esm_exports2.ETransactionExecutionStatus.REVERTED];
|
|
15022
|
+
const successStates = [
|
|
15023
|
+
esm_exports2.ETransactionFinalityStatus.ACCEPTED_ON_L2,
|
|
15024
|
+
esm_exports2.ETransactionFinalityStatus.ACCEPTED_ON_L1,
|
|
15025
|
+
esm_exports2.ETransactionFinalityStatus.PRE_CONFIRMED
|
|
15026
|
+
];
|
|
15027
|
+
let txStatus;
|
|
15028
|
+
const start = (/* @__PURE__ */ new Date()).getTime();
|
|
15029
|
+
while (retries > 0) {
|
|
15030
|
+
await wait(retryInterval);
|
|
15031
|
+
txStatus = await this.getTransactionStatus(txHash);
|
|
15032
|
+
logger.info(
|
|
15033
|
+
`${retries} ${JSON.stringify(txStatus)} ${((/* @__PURE__ */ new Date()).getTime() - start) / 1e3}s.`
|
|
15034
|
+
);
|
|
15035
|
+
const executionStatus = txStatus.execution_status ?? "";
|
|
15036
|
+
const finalityStatus = txStatus.finality_status;
|
|
15037
|
+
if (errorStates.includes(executionStatus)) {
|
|
15038
|
+
const message = `${executionStatus}: ${finalityStatus}`;
|
|
15039
|
+
const error = new Error(message);
|
|
15040
|
+
error.response = txStatus;
|
|
15041
|
+
throw error;
|
|
15042
|
+
} else if (successStates.includes(finalityStatus)) {
|
|
15043
|
+
let currentNonce = initNonce;
|
|
15044
|
+
while (currentNonce === initNonce && retries > 0) {
|
|
15045
|
+
currentNonce = BigInt(await this.getNonceForAddress(address, BlockTag.PRE_CONFIRMED));
|
|
15046
|
+
logger.info(
|
|
15047
|
+
`${retries} Checking new nonce ${currentNonce} ${((/* @__PURE__ */ new Date()).getTime() - start) / 1e3}s.`
|
|
15048
|
+
);
|
|
15049
|
+
if (currentNonce !== initNonce) return true;
|
|
15050
|
+
await wait(retryInterval);
|
|
15051
|
+
retries -= 1;
|
|
15052
|
+
}
|
|
15053
|
+
return false;
|
|
15054
|
+
}
|
|
15055
|
+
retries -= 1;
|
|
15056
|
+
}
|
|
15057
|
+
return false;
|
|
15058
|
+
}
|
|
15017
15059
|
getStorageAt(contractAddress, key, blockIdentifier = this.blockIdentifier) {
|
|
15018
15060
|
const contract_address = toHex(contractAddress);
|
|
15019
15061
|
const parsedKey = toStorageKey(key);
|
|
@@ -16861,6 +16903,31 @@ ${indent}}` : "}";
|
|
|
16861
16903
|
);
|
|
16862
16904
|
return createTransactionReceipt(receiptWoHelper);
|
|
16863
16905
|
}
|
|
16906
|
+
/**
|
|
16907
|
+
* Wait up until a new transaction is possible with same the account.
|
|
16908
|
+
* This method is fast, but Events and transaction report are not yet
|
|
16909
|
+
* available. Useful for gaming activity.
|
|
16910
|
+
* - only rpc 0.9 and onwards.
|
|
16911
|
+
* @param {BigNumberish} txHash - transaction hash
|
|
16912
|
+
* @param {string} address - address of the account
|
|
16913
|
+
* @param {BigNumberish} initNonce - initial nonce of the account (before the transaction).
|
|
16914
|
+
* @param {fastWaitForTransactionOptions} [options={retries: 50, retryInterval: 500}] - options to scan the network for the next possible transaction. `retries` is the number of times to retry.
|
|
16915
|
+
* @returns {Promise<boolean>} Returns true if the next transaction is possible,
|
|
16916
|
+
* false if the timeout has been reached,
|
|
16917
|
+
* throw an error in case of provider communication.
|
|
16918
|
+
*/
|
|
16919
|
+
async fastWaitForTransaction(txHash, address, initNonce, options) {
|
|
16920
|
+
if (this.channel instanceof rpc_0_9_0_exports.RpcChannel) {
|
|
16921
|
+
const isSuccess = await this.channel.fastWaitForTransaction(
|
|
16922
|
+
txHash,
|
|
16923
|
+
address,
|
|
16924
|
+
initNonce,
|
|
16925
|
+
options
|
|
16926
|
+
);
|
|
16927
|
+
return isSuccess;
|
|
16928
|
+
}
|
|
16929
|
+
throw new Error("Unsupported channel type");
|
|
16930
|
+
}
|
|
16864
16931
|
async getStorageAt(contractAddress, key, blockIdentifier) {
|
|
16865
16932
|
return this.channel.getStorageAt(contractAddress, key, blockIdentifier);
|
|
16866
16933
|
}
|
|
@@ -19485,6 +19552,50 @@ ${indent}}` : "}";
|
|
|
19485
19552
|
}
|
|
19486
19553
|
);
|
|
19487
19554
|
}
|
|
19555
|
+
/**
|
|
19556
|
+
* Execute one or multiple calls through the account contract,
|
|
19557
|
+
* responding as soon as a new transaction is possible with the same account.
|
|
19558
|
+
* Useful for gaming usage.
|
|
19559
|
+
* - This method requires the provider to be initialized with `pre_confirmed` blockIdentifier option.
|
|
19560
|
+
* - Rpc 0.9 minimum.
|
|
19561
|
+
* - In a normal myAccount.execute() call, followed by myProvider.waitForTransaction(), you have an immediate access to the events and to the transaction report. Here, we are processing consecutive transactions faster, but events & transaction reports are not available immediately.
|
|
19562
|
+
* - As a consequence of the previous point, do not use contract/account deployment with this method.
|
|
19563
|
+
* @param {AllowArray<Call>} transactions - Single call or array of calls to execute
|
|
19564
|
+
* @param {UniversalDetails} [transactionsDetail] - Transaction execution options
|
|
19565
|
+
* @param {fastWaitForTransactionOptions} [waitDetail={retries: 50, retryInterval: 500}] - options to scan the network for the next possible transaction. `retries` is the number of times to retry, `retryInterval` is the time in ms between retries.
|
|
19566
|
+
* @returns {Promise<fastExecuteResponse>} Response containing the transaction result and status for the next transaction. If `isReady` is true, you can execute the next transaction. If false, timeout has been reached before the next transaction was possible.
|
|
19567
|
+
* @example
|
|
19568
|
+
* ```typescript
|
|
19569
|
+
* const myProvider = new RpcProvider({ nodeUrl: url, blockIdentifier: BlockTag.PRE_CONFIRMED });
|
|
19570
|
+
* const myAccount = new Account({ provider: myProvider, address: accountAddress0, signer: privateKey0 });
|
|
19571
|
+
* const resp = await myAccount.fastExecute(
|
|
19572
|
+
* call, { tip: recommendedTip},
|
|
19573
|
+
* { retries: 30, retryInterval: 500 });
|
|
19574
|
+
* // if resp.isReady is true, you can launch immediately a new tx.
|
|
19575
|
+
* ```
|
|
19576
|
+
*/
|
|
19577
|
+
async fastExecute(transactions, transactionsDetail = {}, waitDetail = {}) {
|
|
19578
|
+
assert(
|
|
19579
|
+
this.channel instanceof rpc_0_9_0_exports.RpcChannel,
|
|
19580
|
+
"Wrong Rpc version in Provider. At least Rpc v0.9 required."
|
|
19581
|
+
);
|
|
19582
|
+
assert(
|
|
19583
|
+
this.channel.blockIdentifier === BlockTag.PRE_CONFIRMED,
|
|
19584
|
+
"Provider needs to be initialized with `pre_confirmed` blockIdentifier option."
|
|
19585
|
+
);
|
|
19586
|
+
const initNonce = BigInt(
|
|
19587
|
+
transactionsDetail.nonce ?? await this.getNonceForAddress(this.address, BlockTag.PRE_CONFIRMED)
|
|
19588
|
+
);
|
|
19589
|
+
const details = { ...transactionsDetail, nonce: initNonce };
|
|
19590
|
+
const resultTx = await this.execute(transactions, details);
|
|
19591
|
+
const resultWait = await this.fastWaitForTransaction(
|
|
19592
|
+
resultTx.transaction_hash,
|
|
19593
|
+
this.address,
|
|
19594
|
+
initNonce,
|
|
19595
|
+
waitDetail
|
|
19596
|
+
);
|
|
19597
|
+
return { txResult: resultTx, isReady: resultWait };
|
|
19598
|
+
}
|
|
19488
19599
|
/**
|
|
19489
19600
|
* First check if contract is already declared, if not declare it
|
|
19490
19601
|
* If contract already declared returned transaction_hash is ''.
|