starknet 6.23.0 → 6.24.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 +13 -0
- package/README.md +3 -0
- package/dist/index.d.ts +140 -10
- package/dist/index.global.js +251 -24
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +252 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [6.24.0](https://github.com/starknet-io/starknet.js/compare/v6.23.1...v6.24.0) (2025-03-12)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- add simulate and estimate fee utility methods for outside execution ([#1327](https://github.com/starknet-io/starknet.js/issues/1327)) ([3668b01](https://github.com/starknet-io/starknet.js/commit/3668b01c4f63969bb0770ee6120fe3eac72d0335))
|
|
6
|
+
- implement cairo fixed array support ([#1310](https://github.com/starknet-io/starknet.js/issues/1310)) ([45df63e](https://github.com/starknet-io/starknet.js/commit/45df63e7bb7f7cb2de2e98900387b1c44a95f257))
|
|
7
|
+
|
|
8
|
+
## [6.23.1](https://github.com/starknet-io/starknet.js/compare/v6.23.0...v6.23.1) (2025-02-05)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
- conf. TxV in Account, conf. string auto. all methods, fix unbdef… ([#1311](https://github.com/starknet-io/starknet.js/issues/1311)) ([1d91ec0](https://github.com/starknet-io/starknet.js/commit/1d91ec00c9b3f5c47dfc77946c7250b7022728a6))
|
|
13
|
+
|
|
1
14
|
# [6.23.0](https://github.com/starknet-io/starknet.js/compare/v6.22.0...v6.23.0) (2025-01-29)
|
|
2
15
|
|
|
3
16
|
### Features
|
package/README.md
CHANGED
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
<a href="https://twitter.com/starknetjs">
|
|
33
33
|
<img src="https://img.shields.io/badge/follow_us-Twitter-blue">
|
|
34
34
|
</a>
|
|
35
|
+
<a href="https://www.drips.network/app/projects/github/starknet-io/starknet.js" target="_blank">
|
|
36
|
+
<img src="https://www.drips.network/api/embed/project/https%3A%2F%2Fgithub.com%2Fstarknet-io%2Fstarknet.js/support.png?background=light&style=github&text=project&stat=none" alt="Support starknet.js on drips.network" height="20">
|
|
37
|
+
</a>
|
|
35
38
|
</p>
|
|
36
39
|
|
|
37
40
|
## Installation
|
package/dist/index.d.ts
CHANGED
|
@@ -1668,6 +1668,7 @@ declare const HARDENING_4BYTES = 2147483648n;
|
|
|
1668
1668
|
declare const DEFAULT_GLOBAL_CONFIG: {
|
|
1669
1669
|
legacyMode: boolean;
|
|
1670
1670
|
logLevel: LogLevel;
|
|
1671
|
+
accountTxVersion: typeof ETransactionVersion$1.V2 | typeof ETransactionVersion$1.V3;
|
|
1671
1672
|
};
|
|
1672
1673
|
declare const SYSTEM_MESSAGES: {
|
|
1673
1674
|
legacyTxWarningMessage: string;
|
|
@@ -7278,7 +7279,7 @@ declare function getOutsideCall(call: Call): OutsideCall;
|
|
|
7278
7279
|
*/
|
|
7279
7280
|
declare function getTypedData(chainId: string, options: OutsideExecutionOptions, nonce: BigNumberish, myCalls: Call[], version: OutsideExecutionVersion): TypedData;
|
|
7280
7281
|
/**
|
|
7281
|
-
* Builds a
|
|
7282
|
+
* Builds a Calldata for the execute_from_outside() entrypoint.
|
|
7282
7283
|
* @param {OutsideTransaction} outsideTransaction an object that contains all the data for a Outside Execution.
|
|
7283
7284
|
* @returns {Calldata} The Calldata related to this Outside transaction
|
|
7284
7285
|
* @example
|
|
@@ -7302,12 +7303,39 @@ declare function getTypedData(chainId: string, options: OutsideExecutionOptions,
|
|
|
7302
7303
|
* ```
|
|
7303
7304
|
*/
|
|
7304
7305
|
declare function buildExecuteFromOutsideCallData(outsideTransaction: OutsideTransaction): Calldata;
|
|
7306
|
+
/**
|
|
7307
|
+
* Builds a Call for execute(), estimateFee() and simulateTransaction() functions.
|
|
7308
|
+
* @param {AllowArray<OutsideTransaction>} outsideTransaction an object that contains all the data for an Outside Execution.
|
|
7309
|
+
* @returns {Call[]} The Call related to this Outside transaction
|
|
7310
|
+
* @example
|
|
7311
|
+
* ```typescript
|
|
7312
|
+
* const outsideTransaction: OutsideTransaction = {
|
|
7313
|
+
* outsideExecution: {
|
|
7314
|
+
* caller: '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691',
|
|
7315
|
+
* nonce: '0x7d0b4b4fce4b236e63d2bb5fc321935d52935cd3b268248cf9cf29c496bd0ae',
|
|
7316
|
+
* execute_after: 500, execute_before: 600,
|
|
7317
|
+
* calls: [{ to: '0x678', selector: '0x890', calldata: [12, 13] }],
|
|
7318
|
+
* },
|
|
7319
|
+
* signature: ['0x123', '0x456'],
|
|
7320
|
+
* signerAddress: '0x3b278ebae434f283f9340587a7f2dd4282658ac8e03cb9b0956db23a0a83657',
|
|
7321
|
+
* version: EOutsideExecutionVersion.V2,
|
|
7322
|
+
* };
|
|
7323
|
+
*
|
|
7324
|
+
* const result: Call[] = outsideExecution.buildExecuteFromOutsideCall(outsideTransaction);
|
|
7325
|
+
* // result = [{contractAddress: '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691',
|
|
7326
|
+
* // entrypoint: 'execute_from_outside_v2',
|
|
7327
|
+
* // calldata: [ ... ],
|
|
7328
|
+
* // }]
|
|
7329
|
+
* ```
|
|
7330
|
+
*/
|
|
7331
|
+
declare function buildExecuteFromOutsideCall(outsideTransaction: AllowArray<OutsideTransaction>): Call[];
|
|
7305
7332
|
|
|
7333
|
+
declare const outsideExecution_buildExecuteFromOutsideCall: typeof buildExecuteFromOutsideCall;
|
|
7306
7334
|
declare const outsideExecution_buildExecuteFromOutsideCallData: typeof buildExecuteFromOutsideCallData;
|
|
7307
7335
|
declare const outsideExecution_getOutsideCall: typeof getOutsideCall;
|
|
7308
7336
|
declare const outsideExecution_getTypedData: typeof getTypedData;
|
|
7309
7337
|
declare namespace outsideExecution {
|
|
7310
|
-
export { outsideExecution_buildExecuteFromOutsideCallData as buildExecuteFromOutsideCallData, outsideExecution_getOutsideCall as getOutsideCall, outsideExecution_getTypedData as getTypedData };
|
|
7338
|
+
export { outsideExecution_buildExecuteFromOutsideCall as buildExecuteFromOutsideCall, outsideExecution_buildExecuteFromOutsideCallData as buildExecuteFromOutsideCallData, outsideExecution_getOutsideCall as getOutsideCall, outsideExecution_getTypedData as getTypedData };
|
|
7311
7339
|
}
|
|
7312
7340
|
|
|
7313
7341
|
/**
|
|
@@ -7442,6 +7470,102 @@ declare class CairoUint512 {
|
|
|
7442
7470
|
toApiRequest(): string[];
|
|
7443
7471
|
}
|
|
7444
7472
|
|
|
7473
|
+
declare class CairoFixedArray {
|
|
7474
|
+
/**
|
|
7475
|
+
* JS array representing a Cairo fixed array.
|
|
7476
|
+
*/
|
|
7477
|
+
readonly content: any[];
|
|
7478
|
+
/**
|
|
7479
|
+
* Cairo fixed array type.
|
|
7480
|
+
*/
|
|
7481
|
+
readonly arrayType: string;
|
|
7482
|
+
/**
|
|
7483
|
+
* Create an instance representing a Cairo fixed Array.
|
|
7484
|
+
* @param {any[]} content JS array representing a Cairo fixed array.
|
|
7485
|
+
* @param {string} arrayType Cairo fixed array type.
|
|
7486
|
+
*/
|
|
7487
|
+
constructor(content: any[], arrayType: string);
|
|
7488
|
+
/**
|
|
7489
|
+
* Retrieves the array size from the given type string representing a Cairo fixed array.
|
|
7490
|
+
* @param {string} type - The Cairo fixed array type.
|
|
7491
|
+
* @returns {number} The array size.
|
|
7492
|
+
* @example
|
|
7493
|
+
* ```typescript
|
|
7494
|
+
* const result = CairoFixedArray.getFixedArraySize("[core::integer::u32; 8]");
|
|
7495
|
+
* // result = 8
|
|
7496
|
+
* ```
|
|
7497
|
+
*/
|
|
7498
|
+
static getFixedArraySize(type: string): number;
|
|
7499
|
+
/**
|
|
7500
|
+
* Retrieves the Cairo fixed array size from the CairoFixedArray instance.
|
|
7501
|
+
* @returns {number} The fixed array size.
|
|
7502
|
+
* @example
|
|
7503
|
+
* ```typescript
|
|
7504
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
7505
|
+
* const result = fArray.getFixedArraySize();
|
|
7506
|
+
* // result = 3
|
|
7507
|
+
* ```
|
|
7508
|
+
*/
|
|
7509
|
+
getFixedArraySize(): number;
|
|
7510
|
+
/**
|
|
7511
|
+
* Retrieve the Cairo content type from a Cairo fixed array type.
|
|
7512
|
+
* @param {string} type - The type string.
|
|
7513
|
+
* @returns {string} The fixed-array type.
|
|
7514
|
+
* @example
|
|
7515
|
+
* ```typescript
|
|
7516
|
+
* const result = CairoFixedArray.getFixedArrayType("[core::integer::u32; 8]");
|
|
7517
|
+
* // result = "core::integer::u32"
|
|
7518
|
+
* ```
|
|
7519
|
+
*/
|
|
7520
|
+
static getFixedArrayType: (type: string) => string;
|
|
7521
|
+
/**
|
|
7522
|
+
* Retrieve the Cairo content type of the Cairo fixed array.
|
|
7523
|
+
* @returns {string} The fixed-array content type.
|
|
7524
|
+
* @example
|
|
7525
|
+
* ```typescript
|
|
7526
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
7527
|
+
* const result = fArray.getFixedArrayType();
|
|
7528
|
+
* // result = "core::integer::u32"
|
|
7529
|
+
* ```
|
|
7530
|
+
*/
|
|
7531
|
+
getFixedArrayType(): string;
|
|
7532
|
+
/**
|
|
7533
|
+
* Create an object from a Cairo fixed array.
|
|
7534
|
+
* Be sure to have an array length conform to the ABI.
|
|
7535
|
+
* To be used with CallData.compile().
|
|
7536
|
+
* @param {Array<any>} input JS array representing a Cairo fixed array.
|
|
7537
|
+
* @returns {Object} a specific struct representing a fixed Array.
|
|
7538
|
+
* @example
|
|
7539
|
+
* ```typescript
|
|
7540
|
+
* const result = CairoFixedArray.compile([10,20,30]);
|
|
7541
|
+
* // result = { '0': 10, '1': 20, '2': 30 }
|
|
7542
|
+
* ```
|
|
7543
|
+
*/
|
|
7544
|
+
static compile(input: Array<any>): Object;
|
|
7545
|
+
/**
|
|
7546
|
+
* Generate an object from the Cairo fixed array instance.
|
|
7547
|
+
* To be used with CallData.compile().
|
|
7548
|
+
* @returns a specific struct representing a fixed array.
|
|
7549
|
+
* @example
|
|
7550
|
+
* ```typescript
|
|
7551
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
7552
|
+
* const result = fArray.compile();
|
|
7553
|
+
* // result = { '0': 10, '1': 20, '2': 30 }
|
|
7554
|
+
* ```
|
|
7555
|
+
*/
|
|
7556
|
+
compile(): Object;
|
|
7557
|
+
/**
|
|
7558
|
+
* Checks if the given Cairo type is a fixed-array type.
|
|
7559
|
+
*
|
|
7560
|
+
* @param {string} type - The type to check.
|
|
7561
|
+
* @returns - `true` if the type is a fixed array type, `false` otherwise.
|
|
7562
|
+
* ```typescript
|
|
7563
|
+
* const result = CairoFixedArray.isTypeFixedArray("[core::integer::u32; 8]");
|
|
7564
|
+
* // result = true
|
|
7565
|
+
*/
|
|
7566
|
+
static isTypeFixedArray(type: string): boolean;
|
|
7567
|
+
}
|
|
7568
|
+
|
|
7445
7569
|
/**
|
|
7446
7570
|
* Format a hex number to '0x' and 64 characters, adding leading zeros if necessary.
|
|
7447
7571
|
*
|
|
@@ -8073,22 +8197,28 @@ declare namespace connect {
|
|
|
8073
8197
|
export { connect_addDeclareTransaction as addDeclareTransaction, connect_addInvokeTransaction as addInvokeTransaction, connect_addStarknetChain as addStarknetChain, connect_deploymentData as deploymentData, connect_getPermissions as getPermissions, connect_onAccountChange as onAccountChange, connect_onNetworkChanged as onNetworkChanged, connect_requestAccounts as requestAccounts, connect_requestChainId as requestChainId, connect_signMessage as signMessage, connect_supportedSpecs as supportedSpecs, connect_switchStarknetChain as switchStarknetChain, connect_watchAsset as watchAsset };
|
|
8074
8198
|
}
|
|
8075
8199
|
|
|
8076
|
-
type
|
|
8200
|
+
type DefaultConfig = typeof DEFAULT_GLOBAL_CONFIG;
|
|
8201
|
+
type CustomConfig = {
|
|
8077
8202
|
[key: string]: any;
|
|
8078
|
-
}
|
|
8203
|
+
};
|
|
8204
|
+
type ConfigData = DefaultConfig & CustomConfig;
|
|
8079
8205
|
declare class Configuration {
|
|
8080
8206
|
private static instance;
|
|
8081
8207
|
private config;
|
|
8082
8208
|
private constructor();
|
|
8083
8209
|
private initialize;
|
|
8084
8210
|
static getInstance(): Configuration;
|
|
8085
|
-
get<K extends keyof
|
|
8086
|
-
|
|
8087
|
-
|
|
8211
|
+
get<K extends keyof DefaultConfig>(key: K): DefaultConfig[K];
|
|
8212
|
+
get(key: string, defaultValue?: any): any;
|
|
8213
|
+
set<K extends keyof DefaultConfig>(key: K, value: DefaultConfig[K]): void;
|
|
8214
|
+
set(key: string, value: any): void;
|
|
8215
|
+
update(configData: Partial<DefaultConfig> & CustomConfig): void;
|
|
8088
8216
|
getAll(): ConfigData;
|
|
8089
8217
|
reset(): void;
|
|
8090
|
-
delete(key:
|
|
8091
|
-
|
|
8218
|
+
delete<K extends keyof DefaultConfig>(key: K): void;
|
|
8219
|
+
delete(key: string): void;
|
|
8220
|
+
hasKey<K extends keyof DefaultConfig>(key: K): boolean;
|
|
8221
|
+
hasKey(key: string): boolean;
|
|
8092
8222
|
}
|
|
8093
8223
|
declare const config: Configuration;
|
|
8094
8224
|
|
|
@@ -8161,4 +8291,4 @@ declare const logger: Logger;
|
|
|
8161
8291
|
/** @deprecated prefer the 'num' naming */
|
|
8162
8292
|
declare const number: typeof num;
|
|
8163
8293
|
|
|
8164
|
-
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, 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, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, ETH_ADDRESS, EntryPointType, type EntryPointsByType, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventEntry, type FeeEstimate, type FunctionAbi, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type MessageToL1, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, ReceiptTx, type RejectedTransactionReceiptResponse, ResponseParser, type Result, type RevertedTransactionReceiptResponse, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SuccessfulTransactionReceiptResponse, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptUtilityInterface, type TransactionReceiptValue, TransactionStatus, type TransactionStatusReceiptSets, TransactionType, 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 UniversalSuggestedFee, type V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, type WeierstrassSignatureType, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, index$1 as hash, isSierra, json, logger, merkle, num, number, outsideExecution, parseCalldataField, provider, selector, shortString, splitArgsAndOptions, src5, stark, starknetId, transaction, typedData, index$2 as types, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, connect as wallet };
|
|
8294
|
+
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, 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, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, ETH_ADDRESS, EntryPointType, type EntryPointsByType, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventEntry, type FeeEstimate, type FunctionAbi, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type MessageToL1, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, ReceiptTx, type RejectedTransactionReceiptResponse, ResponseParser, type Result, type RevertedTransactionReceiptResponse, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SuccessfulTransactionReceiptResponse, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptUtilityInterface, type TransactionReceiptValue, TransactionStatus, type TransactionStatusReceiptSets, TransactionType, 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 UniversalSuggestedFee, type V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, type WeierstrassSignatureType, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, index$1 as hash, isSierra, json, logger, merkle, num, number, outsideExecution, parseCalldataField, provider, selector, shortString, splitArgsAndOptions, src5, stark, starknetId, transaction, typedData, index$2 as types, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, connect as wallet };
|
package/dist/index.global.js
CHANGED
|
@@ -3212,6 +3212,7 @@ var starknet = (() => {
|
|
|
3212
3212
|
BlockStatus: () => BlockStatus,
|
|
3213
3213
|
BlockTag: () => BlockTag,
|
|
3214
3214
|
CairoCustomEnum: () => CairoCustomEnum,
|
|
3215
|
+
CairoFixedArray: () => CairoFixedArray,
|
|
3215
3216
|
CairoOption: () => CairoOption,
|
|
3216
3217
|
CairoOptionVariant: () => CairoOptionVariant,
|
|
3217
3218
|
CairoResult: () => CairoResult,
|
|
@@ -3911,7 +3912,8 @@ var starknet = (() => {
|
|
|
3911
3912
|
var HARDENING_4BYTES = 2147483648n;
|
|
3912
3913
|
var DEFAULT_GLOBAL_CONFIG = {
|
|
3913
3914
|
legacyMode: false,
|
|
3914
|
-
logLevel: "INFO"
|
|
3915
|
+
logLevel: "INFO",
|
|
3916
|
+
accountTxVersion: ETransactionVersion4.V2
|
|
3915
3917
|
};
|
|
3916
3918
|
var SYSTEM_MESSAGES = {
|
|
3917
3919
|
legacyTxWarningMessage: "You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"
|
|
@@ -8600,6 +8602,151 @@ ${indent}}` : "}";
|
|
|
8600
8602
|
return isCairo1Type(type) ? extractCairo1Tuple(type) : extractCairo0Tuple(type);
|
|
8601
8603
|
}
|
|
8602
8604
|
|
|
8605
|
+
// src/utils/cairoDataTypes/fixedArray.ts
|
|
8606
|
+
var CairoFixedArray = class _CairoFixedArray {
|
|
8607
|
+
/**
|
|
8608
|
+
* JS array representing a Cairo fixed array.
|
|
8609
|
+
*/
|
|
8610
|
+
content;
|
|
8611
|
+
/**
|
|
8612
|
+
* Cairo fixed array type.
|
|
8613
|
+
*/
|
|
8614
|
+
arrayType;
|
|
8615
|
+
/**
|
|
8616
|
+
* Create an instance representing a Cairo fixed Array.
|
|
8617
|
+
* @param {any[]} content JS array representing a Cairo fixed array.
|
|
8618
|
+
* @param {string} arrayType Cairo fixed array type.
|
|
8619
|
+
*/
|
|
8620
|
+
constructor(content, arrayType) {
|
|
8621
|
+
assert(
|
|
8622
|
+
_CairoFixedArray.isTypeFixedArray(arrayType),
|
|
8623
|
+
`The type ${arrayType} is not a Cairo fixed array. Needs [type; length].`
|
|
8624
|
+
);
|
|
8625
|
+
try {
|
|
8626
|
+
_CairoFixedArray.getFixedArrayType(arrayType);
|
|
8627
|
+
} catch {
|
|
8628
|
+
throw new Error(
|
|
8629
|
+
`The type ${arrayType} do not includes any content type. Needs [type; length].`
|
|
8630
|
+
);
|
|
8631
|
+
}
|
|
8632
|
+
try {
|
|
8633
|
+
_CairoFixedArray.getFixedArraySize(arrayType);
|
|
8634
|
+
} catch {
|
|
8635
|
+
throw new Error(
|
|
8636
|
+
`The type ${arrayType} type do not includes any length. Needs [type; length].`
|
|
8637
|
+
);
|
|
8638
|
+
}
|
|
8639
|
+
assert(
|
|
8640
|
+
_CairoFixedArray.getFixedArraySize(arrayType) === content.length,
|
|
8641
|
+
`The ABI type ${arrayType} is expecting ${_CairoFixedArray.getFixedArraySize(arrayType)} items. ${content.length} items provided.`
|
|
8642
|
+
);
|
|
8643
|
+
this.content = content;
|
|
8644
|
+
this.arrayType = arrayType;
|
|
8645
|
+
}
|
|
8646
|
+
/**
|
|
8647
|
+
* Retrieves the array size from the given type string representing a Cairo fixed array.
|
|
8648
|
+
* @param {string} type - The Cairo fixed array type.
|
|
8649
|
+
* @returns {number} The array size.
|
|
8650
|
+
* @example
|
|
8651
|
+
* ```typescript
|
|
8652
|
+
* const result = CairoFixedArray.getFixedArraySize("[core::integer::u32; 8]");
|
|
8653
|
+
* // result = 8
|
|
8654
|
+
* ```
|
|
8655
|
+
*/
|
|
8656
|
+
static getFixedArraySize(type) {
|
|
8657
|
+
const matchArray = type.match(/(?<=; )\d+(?=\])/);
|
|
8658
|
+
if (matchArray === null)
|
|
8659
|
+
throw new Error(`ABI type ${type} do not includes a valid number after ';' character.`);
|
|
8660
|
+
return Number(matchArray[0]);
|
|
8661
|
+
}
|
|
8662
|
+
/**
|
|
8663
|
+
* Retrieves the Cairo fixed array size from the CairoFixedArray instance.
|
|
8664
|
+
* @returns {number} The fixed array size.
|
|
8665
|
+
* @example
|
|
8666
|
+
* ```typescript
|
|
8667
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
8668
|
+
* const result = fArray.getFixedArraySize();
|
|
8669
|
+
* // result = 3
|
|
8670
|
+
* ```
|
|
8671
|
+
*/
|
|
8672
|
+
getFixedArraySize() {
|
|
8673
|
+
return _CairoFixedArray.getFixedArraySize(this.arrayType);
|
|
8674
|
+
}
|
|
8675
|
+
/**
|
|
8676
|
+
* Retrieve the Cairo content type from a Cairo fixed array type.
|
|
8677
|
+
* @param {string} type - The type string.
|
|
8678
|
+
* @returns {string} The fixed-array type.
|
|
8679
|
+
* @example
|
|
8680
|
+
* ```typescript
|
|
8681
|
+
* const result = CairoFixedArray.getFixedArrayType("[core::integer::u32; 8]");
|
|
8682
|
+
* // result = "core::integer::u32"
|
|
8683
|
+
* ```
|
|
8684
|
+
*/
|
|
8685
|
+
static getFixedArrayType = (type) => {
|
|
8686
|
+
const matchArray = type.match(/(?<=\[).+(?=;)/);
|
|
8687
|
+
if (matchArray === null)
|
|
8688
|
+
throw new Error(`ABI type ${type} do not includes a valid type of data.`);
|
|
8689
|
+
return matchArray[0];
|
|
8690
|
+
};
|
|
8691
|
+
/**
|
|
8692
|
+
* Retrieve the Cairo content type of the Cairo fixed array.
|
|
8693
|
+
* @returns {string} The fixed-array content type.
|
|
8694
|
+
* @example
|
|
8695
|
+
* ```typescript
|
|
8696
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
8697
|
+
* const result = fArray.getFixedArrayType();
|
|
8698
|
+
* // result = "core::integer::u32"
|
|
8699
|
+
* ```
|
|
8700
|
+
*/
|
|
8701
|
+
getFixedArrayType() {
|
|
8702
|
+
return _CairoFixedArray.getFixedArrayType(this.arrayType);
|
|
8703
|
+
}
|
|
8704
|
+
/**
|
|
8705
|
+
* Create an object from a Cairo fixed array.
|
|
8706
|
+
* Be sure to have an array length conform to the ABI.
|
|
8707
|
+
* To be used with CallData.compile().
|
|
8708
|
+
* @param {Array<any>} input JS array representing a Cairo fixed array.
|
|
8709
|
+
* @returns {Object} a specific struct representing a fixed Array.
|
|
8710
|
+
* @example
|
|
8711
|
+
* ```typescript
|
|
8712
|
+
* const result = CairoFixedArray.compile([10,20,30]);
|
|
8713
|
+
* // result = { '0': 10, '1': 20, '2': 30 }
|
|
8714
|
+
* ```
|
|
8715
|
+
*/
|
|
8716
|
+
static compile(input) {
|
|
8717
|
+
return input.reduce((acc, item, idx) => {
|
|
8718
|
+
acc[idx] = item;
|
|
8719
|
+
return acc;
|
|
8720
|
+
}, {});
|
|
8721
|
+
}
|
|
8722
|
+
/**
|
|
8723
|
+
* Generate an object from the Cairo fixed array instance.
|
|
8724
|
+
* To be used with CallData.compile().
|
|
8725
|
+
* @returns a specific struct representing a fixed array.
|
|
8726
|
+
* @example
|
|
8727
|
+
* ```typescript
|
|
8728
|
+
* const fArray = new CairoFixedArray([10,20,30], "[core::integer::u32; 3]");
|
|
8729
|
+
* const result = fArray.compile();
|
|
8730
|
+
* // result = { '0': 10, '1': 20, '2': 30 }
|
|
8731
|
+
* ```
|
|
8732
|
+
*/
|
|
8733
|
+
compile() {
|
|
8734
|
+
return _CairoFixedArray.compile(this.content);
|
|
8735
|
+
}
|
|
8736
|
+
/**
|
|
8737
|
+
* Checks if the given Cairo type is a fixed-array type.
|
|
8738
|
+
*
|
|
8739
|
+
* @param {string} type - The type to check.
|
|
8740
|
+
* @returns - `true` if the type is a fixed array type, `false` otherwise.
|
|
8741
|
+
* ```typescript
|
|
8742
|
+
* const result = CairoFixedArray.isTypeFixedArray("[core::integer::u32; 8]");
|
|
8743
|
+
* // result = true
|
|
8744
|
+
*/
|
|
8745
|
+
static isTypeFixedArray(type) {
|
|
8746
|
+
return /^\[.*;\s.*\]$/.test(type) && /(?<=\[).+(?=;)/.test(type) && /(?<=; )\d+(?=\])/.test(type);
|
|
8747
|
+
}
|
|
8748
|
+
};
|
|
8749
|
+
|
|
8603
8750
|
// src/utils/calldata/propertyOrder.ts
|
|
8604
8751
|
function errorU256(key) {
|
|
8605
8752
|
return Error(
|
|
@@ -8613,6 +8760,9 @@ ${indent}}` : "}";
|
|
|
8613
8760
|
}
|
|
8614
8761
|
function orderPropsByAbi(unorderedObject, abiOfObject, structs, enums) {
|
|
8615
8762
|
const orderInput = (unorderedItem, abiType) => {
|
|
8763
|
+
if (CairoFixedArray.isTypeFixedArray(abiType)) {
|
|
8764
|
+
return orderFixedArray(unorderedItem, abiType);
|
|
8765
|
+
}
|
|
8616
8766
|
if (isTypeArray(abiType)) {
|
|
8617
8767
|
return orderArray(unorderedItem, abiType);
|
|
8618
8768
|
}
|
|
@@ -8687,6 +8837,24 @@ ${indent}}` : "}";
|
|
|
8687
8837
|
}
|
|
8688
8838
|
return myArray.map((myElem) => orderInput(myElem, typeInArray));
|
|
8689
8839
|
}
|
|
8840
|
+
function orderFixedArray(input, abiParam) {
|
|
8841
|
+
const typeInFixedArray = CairoFixedArray.getFixedArrayType(abiParam);
|
|
8842
|
+
const arraySize = CairoFixedArray.getFixedArraySize(abiParam);
|
|
8843
|
+
if (Array.isArray(input)) {
|
|
8844
|
+
if (arraySize !== input.length) {
|
|
8845
|
+
throw new Error(
|
|
8846
|
+
`ABI type ${abiParam}: array provided do not includes ${arraySize} items. ${input.length} items provided.`
|
|
8847
|
+
);
|
|
8848
|
+
}
|
|
8849
|
+
return input.map((myElem) => orderInput(myElem, typeInFixedArray));
|
|
8850
|
+
}
|
|
8851
|
+
if (arraySize !== Object.keys(input).length) {
|
|
8852
|
+
throw new Error(
|
|
8853
|
+
`ABI type ${abiParam}: object provided do not includes ${arraySize} properties. ${Object.keys(input).length} items provided.`
|
|
8854
|
+
);
|
|
8855
|
+
}
|
|
8856
|
+
return orderInput(input, typeInFixedArray);
|
|
8857
|
+
}
|
|
8690
8858
|
function orderTuple(unorderedObject2, abiParam) {
|
|
8691
8859
|
const typeList = extractTupleMemberTypes(abiParam);
|
|
8692
8860
|
const orderedObject2 = typeList.reduce((orderedObject, abiTypeCairoX, index) => {
|
|
@@ -8822,6 +8990,25 @@ ${indent}}` : "}";
|
|
|
8822
8990
|
if (element === void 0) {
|
|
8823
8991
|
throw Error(`Missing parameter for type ${type}`);
|
|
8824
8992
|
}
|
|
8993
|
+
if (CairoFixedArray.isTypeFixedArray(type)) {
|
|
8994
|
+
const arrayType = CairoFixedArray.getFixedArrayType(type);
|
|
8995
|
+
let values = [];
|
|
8996
|
+
if (Array.isArray(element)) {
|
|
8997
|
+
const array = new CairoFixedArray(element, type);
|
|
8998
|
+
values = array.content;
|
|
8999
|
+
} else if (typeof element === "object") {
|
|
9000
|
+
values = Object.values(element);
|
|
9001
|
+
assert(
|
|
9002
|
+
values.length === CairoFixedArray.getFixedArraySize(type),
|
|
9003
|
+
`ABI type ${type}: object provided do not includes ${CairoFixedArray.getFixedArraySize(type)} items. ${values.length} items provided.`
|
|
9004
|
+
);
|
|
9005
|
+
} else {
|
|
9006
|
+
throw new Error(`ABI type ${type}: not an Array representing a cairo.fixedArray() provided.`);
|
|
9007
|
+
}
|
|
9008
|
+
return values.reduce((acc, it) => {
|
|
9009
|
+
return acc.concat(parseCalldataValue(it, arrayType, structs, enums));
|
|
9010
|
+
}, []);
|
|
9011
|
+
}
|
|
8825
9012
|
if (Array.isArray(element)) {
|
|
8826
9013
|
const result = [];
|
|
8827
9014
|
result.push(felt(element.length));
|
|
@@ -8949,7 +9136,13 @@ ${indent}}` : "}";
|
|
|
8949
9136
|
const { name, type } = input;
|
|
8950
9137
|
let { value } = argsIterator.next();
|
|
8951
9138
|
switch (true) {
|
|
8952
|
-
//
|
|
9139
|
+
// Fixed array
|
|
9140
|
+
case CairoFixedArray.isTypeFixedArray(type):
|
|
9141
|
+
if (!Array.isArray(value) && !(typeof value === "object")) {
|
|
9142
|
+
throw Error(`ABI expected parameter ${name} to be an array or an object, got ${value}`);
|
|
9143
|
+
}
|
|
9144
|
+
return parseCalldataValue(value, input.type, structs, enums);
|
|
9145
|
+
// Normal Array
|
|
8953
9146
|
case isTypeArray(type):
|
|
8954
9147
|
if (!Array.isArray(value) && !isText(value)) {
|
|
8955
9148
|
throw Error(`ABI expected parameter ${name} to be array or long string, got ${value}`);
|
|
@@ -9045,6 +9238,15 @@ ${indent}}` : "}";
|
|
|
9045
9238
|
};
|
|
9046
9239
|
return stringFromByteArray(myByteArray);
|
|
9047
9240
|
}
|
|
9241
|
+
if (CairoFixedArray.isTypeFixedArray(element.type)) {
|
|
9242
|
+
const parsedDataArr = [];
|
|
9243
|
+
const el = { name: "", type: CairoFixedArray.getFixedArrayType(element.type) };
|
|
9244
|
+
const arraySize = CairoFixedArray.getFixedArraySize(element.type);
|
|
9245
|
+
while (parsedDataArr.length < arraySize) {
|
|
9246
|
+
parsedDataArr.push(parseResponseValue(responseIterator, el, structs, enums));
|
|
9247
|
+
}
|
|
9248
|
+
return parsedDataArr;
|
|
9249
|
+
}
|
|
9048
9250
|
if (isTypeArray(element.type)) {
|
|
9049
9251
|
const parsedDataArr = [];
|
|
9050
9252
|
const el = { name: "", type: getArrayType(element.type) };
|
|
@@ -9130,6 +9332,8 @@ ${indent}}` : "}";
|
|
|
9130
9332
|
return parseResponseValue(responseIterator, output, structs, enums);
|
|
9131
9333
|
case (enums && isTypeEnum(type, enums)):
|
|
9132
9334
|
return parseResponseValue(responseIterator, output, structs, enums);
|
|
9335
|
+
case CairoFixedArray.isTypeFixedArray(type):
|
|
9336
|
+
return parseResponseValue(responseIterator, output, structs, enums);
|
|
9133
9337
|
case isTypeArray(type):
|
|
9134
9338
|
if (isCairo1Type(type)) {
|
|
9135
9339
|
return parseResponseValue(responseIterator, output, structs, enums);
|
|
@@ -9332,12 +9536,28 @@ ${indent}}` : "}";
|
|
|
9332
9536
|
var validateTuple = (parameter, input) => {
|
|
9333
9537
|
assert(isObject2(parameter), `Validate: arg ${input.name} should be a tuple (defined as object)`);
|
|
9334
9538
|
};
|
|
9335
|
-
var validateArray = (
|
|
9336
|
-
const
|
|
9337
|
-
|
|
9539
|
+
var validateArray = (parameterArray, input, structs, enums) => {
|
|
9540
|
+
const isNormalArray = isTypeArray(input.type);
|
|
9541
|
+
const baseType = isNormalArray ? getArrayType(input.type) : CairoFixedArray.getFixedArrayType(input.type);
|
|
9542
|
+
if (isNormalArray && isTypeFelt(baseType) && isLongText(parameterArray)) {
|
|
9338
9543
|
return;
|
|
9339
9544
|
}
|
|
9340
|
-
|
|
9545
|
+
let parameter = [];
|
|
9546
|
+
if (isNormalArray) {
|
|
9547
|
+
assert(Array.isArray(parameterArray), `Validate: arg ${input.name} should be an Array`);
|
|
9548
|
+
parameter = parameterArray;
|
|
9549
|
+
} else {
|
|
9550
|
+
switch (true) {
|
|
9551
|
+
case Array.isArray(parameterArray):
|
|
9552
|
+
parameter = parameterArray;
|
|
9553
|
+
break;
|
|
9554
|
+
case typeof parameterArray === "object":
|
|
9555
|
+
parameter = Object.values(parameterArray);
|
|
9556
|
+
break;
|
|
9557
|
+
default:
|
|
9558
|
+
throw new Error(`Validate: arg ${input.name} should be an Array or an object.`);
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9341
9561
|
switch (true) {
|
|
9342
9562
|
case isTypeFelt(baseType):
|
|
9343
9563
|
parameter.forEach((param) => validateFelt(param, input));
|
|
@@ -9427,7 +9647,7 @@ ${indent}}` : "}";
|
|
|
9427
9647
|
case isTypeByteArray(input.type):
|
|
9428
9648
|
validateByteArray(parameter, input);
|
|
9429
9649
|
break;
|
|
9430
|
-
case isTypeArray(input.type):
|
|
9650
|
+
case (isTypeArray(input.type) || CairoFixedArray.isTypeFixedArray(input.type)):
|
|
9431
9651
|
validateArray(parameter, input, structs, enums);
|
|
9432
9652
|
break;
|
|
9433
9653
|
case isTypeStruct(input.type, structs):
|
|
@@ -19197,6 +19417,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
19197
19417
|
// src/utils/outsideExecution.ts
|
|
19198
19418
|
var outsideExecution_exports = {};
|
|
19199
19419
|
__export(outsideExecution_exports, {
|
|
19420
|
+
buildExecuteFromOutsideCall: () => buildExecuteFromOutsideCall,
|
|
19200
19421
|
buildExecuteFromOutsideCallData: () => buildExecuteFromOutsideCallData,
|
|
19201
19422
|
getOutsideCall: () => getOutsideCall,
|
|
19202
19423
|
getTypedData: () => getTypedData
|
|
@@ -19268,6 +19489,25 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
19268
19489
|
signature: formattedSignature
|
|
19269
19490
|
});
|
|
19270
19491
|
}
|
|
19492
|
+
function buildExecuteFromOutsideCall(outsideTransaction) {
|
|
19493
|
+
const myOutsideTransactions = Array.isArray(outsideTransaction) ? outsideTransaction : [outsideTransaction];
|
|
19494
|
+
const multiCall = myOutsideTransactions.map((outsideTx) => {
|
|
19495
|
+
let entrypoint;
|
|
19496
|
+
if (outsideTx.version === "1" /* V1 */) {
|
|
19497
|
+
entrypoint = "execute_from_outside";
|
|
19498
|
+
} else if (outsideTx.version === "2" /* V2 */) {
|
|
19499
|
+
entrypoint = "execute_from_outside_v2";
|
|
19500
|
+
} else {
|
|
19501
|
+
throw new Error("Unsupported OutsideExecution version");
|
|
19502
|
+
}
|
|
19503
|
+
return {
|
|
19504
|
+
contractAddress: toHex(outsideTx.signerAddress),
|
|
19505
|
+
entrypoint,
|
|
19506
|
+
calldata: buildExecuteFromOutsideCallData(outsideTx)
|
|
19507
|
+
};
|
|
19508
|
+
});
|
|
19509
|
+
return multiCall;
|
|
19510
|
+
}
|
|
19271
19511
|
|
|
19272
19512
|
// src/utils/src5.ts
|
|
19273
19513
|
var src5_exports = {};
|
|
@@ -19294,7 +19534,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
19294
19534
|
address;
|
|
19295
19535
|
cairoVersion;
|
|
19296
19536
|
transactionVersion;
|
|
19297
|
-
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion =
|
|
19537
|
+
constructor(providerOrOptions, address, pkOrSigner, cairoVersion, transactionVersion = config2.get(
|
|
19538
|
+
"accountTxVersion"
|
|
19539
|
+
)) {
|
|
19298
19540
|
super(providerOrOptions);
|
|
19299
19541
|
this.address = address.toLowerCase();
|
|
19300
19542
|
this.signer = isString(pkOrSigner) || pkOrSigner instanceof Uint8Array ? new Signer(pkOrSigner) : pkOrSigner;
|
|
@@ -19823,22 +20065,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
19823
20065
|
* ```
|
|
19824
20066
|
*/
|
|
19825
20067
|
async executeFromOutside(outsideTransaction, opts) {
|
|
19826
|
-
const
|
|
19827
|
-
const multiCall = myOutsideTransactions.map((outsideTx) => {
|
|
19828
|
-
let entrypoint;
|
|
19829
|
-
if (outsideTx.version === "1" /* V1 */) {
|
|
19830
|
-
entrypoint = "execute_from_outside";
|
|
19831
|
-
} else if (outsideTx.version === "2" /* V2 */) {
|
|
19832
|
-
entrypoint = "execute_from_outside_v2";
|
|
19833
|
-
} else {
|
|
19834
|
-
throw new Error("Unsupported OutsideExecution version");
|
|
19835
|
-
}
|
|
19836
|
-
return {
|
|
19837
|
-
contractAddress: toHex(outsideTx.signerAddress),
|
|
19838
|
-
entrypoint,
|
|
19839
|
-
calldata: buildExecuteFromOutsideCallData(outsideTx)
|
|
19840
|
-
};
|
|
19841
|
-
});
|
|
20068
|
+
const multiCall = buildExecuteFromOutsideCall(outsideTransaction);
|
|
19842
20069
|
return this.execute(multiCall, opts);
|
|
19843
20070
|
}
|
|
19844
20071
|
/*
|