starknet 5.0.0-beta.1 → 5.0.0-beta.3

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 CHANGED
@@ -1,3 +1,31 @@
1
+ # [5.0.0-beta.3](https://github.com/0xs34n/starknet.js/compare/v5.0.0-beta.2...v5.0.0-beta.3) (2023-01-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ - describeIfDevnetSequencer ([4a088ad](https://github.com/0xs34n/starknet.js/commit/4a088ada404ef912976141d8fba1c66d791c273c))
6
+ - es6 ([e85ad45](https://github.com/0xs34n/starknet.js/commit/e85ad45c5565d93417b1a18e3663bd6c5e8861c1))
7
+ - estimate fee response bulk type ([78a1444](https://github.com/0xs34n/starknet.js/commit/78a14445c75b7ec259d6cfecd1cc17869b507dd8))
8
+ - merge develop into feat/add_estimate_fee_bulk ([88e76af](https://github.com/0xs34n/starknet.js/commit/88e76af68dd711b3f277c0a6d4f1935710aba4d7))
9
+ - remove any type in simulateTransaction ([a94db18](https://github.com/0xs34n/starknet.js/commit/a94db1887c9fee676ac9b313190453abd5ea2554))
10
+ - repair and unify transaction retrieval error ([ea5e646](https://github.com/0xs34n/starknet.js/commit/ea5e64651bf47824b254ae73ed8aa88998a5be44))
11
+ - tests ([5ab047f](https://github.com/0xs34n/starknet.js/commit/5ab047ff0b272057e70a29e909084d083db36a96))
12
+ - update account.simulateTransaction return type ([3c3d397](https://github.com/0xs34n/starknet.js/commit/3c3d397a4fb1042c7358f70f50df0a4ce2893220))
13
+ - update getEstimateFeeBulk function ([4b22c82](https://github.com/0xs34n/starknet.js/commit/4b22c8212f4586b37dc7c8ddfad77955e44b1b12))
14
+ - update types & add separate responseParser for estimateFeeBulk ([52110b2](https://github.com/0xs34n/starknet.js/commit/52110b289e3dfbbe449cf195709b2714f295a70d))
15
+
16
+ ### Features
17
+
18
+ - add function estimateInvokeFeeBulk ([e716a18](https://github.com/0xs34n/starknet.js/commit/e716a1882f3ac37d17eae72a51cd3c4fc4649bcb))
19
+ - update estimateFeeBulk ([5ee94f7](https://github.com/0xs34n/starknet.js/commit/5ee94f78af681690905e1ead1de711e3a43c0774))
20
+ - update estimateFeeBulk function & doc ([ce20139](https://github.com/0xs34n/starknet.js/commit/ce201394142a19c4810a1e44cb3f601b815a11fe))
21
+ - update sequencer api ([a12f99e](https://github.com/0xs34n/starknet.js/commit/a12f99ea6e93fb5d44d4d07f7fa8cc2d997db91a))
22
+
23
+ # [5.0.0-beta.2](https://github.com/0xs34n/starknet.js/compare/v5.0.0-beta.1...v5.0.0-beta.2) (2023-01-11)
24
+
25
+ ### Bug Fixes
26
+
27
+ - bnToUint256 and add more tests ([baa9d61](https://github.com/0xs34n/starknet.js/commit/baa9d611b18725ba269818631f668183212988df))
28
+
1
29
  # [5.0.0-beta.1](https://github.com/0xs34n/starknet.js/compare/v4.18.0...v5.0.0-beta.1) (2023-01-07)
2
30
 
3
31
  ### Bug Fixes
@@ -27,6 +55,43 @@
27
55
 
28
56
  - uses BigInt and Faster Hashing
29
57
 
58
+ ## [4.19.3](https://github.com/0xs34n/starknet.js/compare/v4.19.2...v4.19.3) (2023-01-12)
59
+
60
+ ### Bug Fixes
61
+
62
+ - remove any type in simulateTransaction ([a94db18](https://github.com/0xs34n/starknet.js/commit/a94db1887c9fee676ac9b313190453abd5ea2554))
63
+ - update account.simulateTransaction return type ([3c3d397](https://github.com/0xs34n/starknet.js/commit/3c3d397a4fb1042c7358f70f50df0a4ce2893220))
64
+
65
+ ## [4.19.2](https://github.com/0xs34n/starknet.js/compare/v4.19.1...v4.19.2) (2023-01-11)
66
+
67
+ ### Bug Fixes
68
+
69
+ - repair and unify transaction retrieval error ([ea5e646](https://github.com/0xs34n/starknet.js/commit/ea5e64651bf47824b254ae73ed8aa88998a5be44))
70
+
71
+ ## [4.19.1](https://github.com/0xs34n/starknet.js/compare/v4.19.0...v4.19.1) (2023-01-10)
72
+
73
+ ### Bug Fixes
74
+
75
+ - describeIfDevnetSequencer ([4a088ad](https://github.com/0xs34n/starknet.js/commit/4a088ada404ef912976141d8fba1c66d791c273c))
76
+ - es6 ([e85ad45](https://github.com/0xs34n/starknet.js/commit/e85ad45c5565d93417b1a18e3663bd6c5e8861c1))
77
+ - estimate fee response bulk type ([78a1444](https://github.com/0xs34n/starknet.js/commit/78a14445c75b7ec259d6cfecd1cc17869b507dd8))
78
+ - tests ([5ab047f](https://github.com/0xs34n/starknet.js/commit/5ab047ff0b272057e70a29e909084d083db36a96))
79
+
80
+ # [4.19.0](https://github.com/0xs34n/starknet.js/compare/v4.18.0...v4.19.0) (2023-01-09)
81
+
82
+ ### Bug Fixes
83
+
84
+ - merge develop into feat/add_estimate_fee_bulk ([88e76af](https://github.com/0xs34n/starknet.js/commit/88e76af68dd711b3f277c0a6d4f1935710aba4d7))
85
+ - update getEstimateFeeBulk function ([4b22c82](https://github.com/0xs34n/starknet.js/commit/4b22c8212f4586b37dc7c8ddfad77955e44b1b12))
86
+ - update types & add separate responseParser for estimateFeeBulk ([52110b2](https://github.com/0xs34n/starknet.js/commit/52110b289e3dfbbe449cf195709b2714f295a70d))
87
+
88
+ ### Features
89
+
90
+ - add function estimateInvokeFeeBulk ([e716a18](https://github.com/0xs34n/starknet.js/commit/e716a1882f3ac37d17eae72a51cd3c4fc4649bcb))
91
+ - update estimateFeeBulk ([5ee94f7](https://github.com/0xs34n/starknet.js/commit/5ee94f78af681690905e1ead1de711e3a43c0774))
92
+ - update estimateFeeBulk function & doc ([ce20139](https://github.com/0xs34n/starknet.js/commit/ce201394142a19c4810a1e44cb3f601b815a11fe))
93
+ - update sequencer api ([a12f99e](https://github.com/0xs34n/starknet.js/commit/a12f99ea6e93fb5d44d4d07f7fa8cc2d997db91a))
94
+
30
95
  # [4.18.0](https://github.com/0xs34n/starknet.js/compare/v4.17.1...v4.18.0) (2022-12-23)
31
96
 
32
97
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -742,6 +742,32 @@ declare type InvocationsDetails = {
742
742
  declare type InvocationsDetailsWithNonce = InvocationsDetails & {
743
743
  nonce: BigNumberish;
744
744
  };
745
+ declare type TransactionBulk = Array<({
746
+ type: 'DECLARE';
747
+ } & {
748
+ payload: DeclareContractPayload;
749
+ }) | ({
750
+ type: 'DEPLOY';
751
+ } & {
752
+ payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[];
753
+ }) | ({
754
+ type: 'DEPLOY_ACCOUNT';
755
+ } & {
756
+ payload: DeployAccountContractPayload;
757
+ }) | ({
758
+ type: 'INVOKE_FUNCTION';
759
+ } & {
760
+ payload: AllowArray<Call>;
761
+ })>;
762
+ declare type InvocationBulk = Array<(({
763
+ type: 'DECLARE';
764
+ } & DeclareContractTransaction) | ({
765
+ type: 'DEPLOY_ACCOUNT';
766
+ } & DeployAccountContractTransaction) | ({
767
+ type: 'INVOKE_FUNCTION';
768
+ } & Invocation)) & InvocationsDetailsWithNonce & {
769
+ blockIdentifier: BlockNumber | BigNumberish;
770
+ }>;
745
771
  declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
746
772
  declare type TransactionStatus = 'TRANSACTION_RECEIVED';
747
773
  declare type TransactionType = 'DECLARE' | 'DEPLOY' | 'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT';
@@ -954,137 +980,6 @@ interface Result extends Array<any> {
954
980
 
955
981
  declare type BlockIdentifier = BlockNumber | BigNumberish;
956
982
 
957
- /**
958
- * Common interface response
959
- * Intersection (sequencer response ∩ (∪ rpc responses))
960
- */
961
-
962
- interface GetBlockResponse {
963
- timestamp: number;
964
- block_hash: string;
965
- block_number: number;
966
- new_root: string;
967
- parent_hash: string;
968
- status: Status;
969
- transactions: Array<string>;
970
- gas_price?: string;
971
- sequencer_address?: string;
972
- starknet_version?: string;
973
- transaction_receipts?: any;
974
- }
975
- interface GetCodeResponse {
976
- bytecode: string[];
977
- }
978
- declare type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
979
- interface CommonTransactionResponse {
980
- transaction_hash?: string;
981
- version?: string;
982
- signature?: Signature;
983
- max_fee?: string;
984
- nonce?: string;
985
- }
986
- interface InvokeTransactionResponse extends CommonTransactionResponse {
987
- contract_address?: string;
988
- entry_point_selector?: string;
989
- calldata: RawCalldata;
990
- }
991
- interface ContractEntryPoint {
992
- offset: string;
993
- selector: string;
994
- }
995
- interface DeclareTransactionResponse extends CommonTransactionResponse {
996
- contract_class?: any;
997
- sender_address?: string;
998
- }
999
- declare type GetTransactionReceiptResponse = InvokeTransactionReceiptResponse | DeclareTransactionReceiptResponse;
1000
- interface CommonTransactionReceiptResponse {
1001
- transaction_hash: string;
1002
- status?: Status;
1003
- actual_fee?: string;
1004
- status_data?: string;
1005
- }
1006
- interface MessageToL1 {
1007
- to_address: string;
1008
- payload: Array<string>;
1009
- }
1010
- interface Event {
1011
- from_address: string;
1012
- keys: Array<string>;
1013
- data: Array<string>;
1014
- }
1015
- interface MessageToL2 {
1016
- from_address: string;
1017
- payload: Array<string>;
1018
- }
1019
- interface InvokeTransactionReceiptResponse extends CommonTransactionReceiptResponse {
1020
- /** @deprecated Use l2_to_l1_messages */
1021
- messages_sent?: Array<MessageToL1>;
1022
- events?: Array<Event>;
1023
- l1_origin_message?: MessageToL2;
1024
- }
1025
- declare type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse;
1026
- interface EstimateFeeResponse {
1027
- overall_fee: bigint;
1028
- gas_consumed?: bigint;
1029
- gas_price?: bigint;
1030
- }
1031
- interface InvokeFunctionResponse {
1032
- transaction_hash: string;
1033
- }
1034
- interface DeclareContractResponse {
1035
- transaction_hash: string;
1036
- class_hash: string;
1037
- }
1038
- declare type CallContractResponse = {
1039
- result: Array<string>;
1040
- };
1041
- declare type EstimateFeeAction = {
1042
- type: 'INVOKE';
1043
- payload: AllowArray<Call>;
1044
- } | {
1045
- type: 'DECLARE';
1046
- payload: DeclareContractPayload;
1047
- } | {
1048
- type: 'DEPLOY_ACCOUNT';
1049
- payload: DeployAccountContractPayload;
1050
- } | {
1051
- type: 'DEPLOY';
1052
- payload: UniversalDeployerContractPayload;
1053
- };
1054
-
1055
- interface EstimateFee extends EstimateFeeResponse {
1056
- suggestedMaxFee: bigint;
1057
- }
1058
- interface EstimateFeeDetails {
1059
- nonce?: BigNumberish;
1060
- blockIdentifier?: BlockIdentifier;
1061
- }
1062
- interface DeployContractResponse {
1063
- contract_address: string;
1064
- transaction_hash: string;
1065
- }
1066
- declare type MultiDeployContractResponse = {
1067
- contract_address: Array<string>;
1068
- transaction_hash: string;
1069
- };
1070
- declare type DeployContractUDCResponse = {
1071
- contract_address: string;
1072
- transaction_hash: string;
1073
- address: string;
1074
- deployer: string;
1075
- unique: string;
1076
- classHash: string;
1077
- calldata_len: string;
1078
- calldata: Array<string>;
1079
- salt: string;
1080
- };
1081
- declare type DeclareDeployUDCResponse = {
1082
- declare: {
1083
- class_hash: BigNumberish;
1084
- } & DeclareTransactionReceiptResponse;
1085
- deploy: DeployContractUDCResponse;
1086
- };
1087
-
1088
983
  declare type GetTransactionStatusResponse = {
1089
984
  tx_status: Status;
1090
985
  block_hash?: string;
@@ -1270,6 +1165,7 @@ declare namespace Sequencer {
1270
1165
  fee_estimation: Sequencer.EstimateFeeResponse;
1271
1166
  };
1272
1167
  type SimulateTransaction = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
1168
+ type EstimateFeeRequestBulk = AllowArray<InvokeEstimateFee | DeclareEstimateFee | DeployEstimateFee | DeployAccountEstimateFee>;
1273
1169
  type EstimateFeeResponse = {
1274
1170
  overall_fee: number;
1275
1171
  gas_price: number;
@@ -1279,6 +1175,7 @@ declare namespace Sequencer {
1279
1175
  amount: bigint;
1280
1176
  unit: string;
1281
1177
  };
1178
+ type EstimateFeeResponseBulk = AllowArray<EstimateFeeResponse>;
1282
1179
  type Endpoints = {
1283
1180
  get_contract_addresses: {
1284
1181
  QUERY: never;
@@ -1406,11 +1303,157 @@ declare namespace Sequencer {
1406
1303
  REQUEST: SimulateTransaction;
1407
1304
  RESPONSE: TransactionSimulationResponse;
1408
1305
  };
1306
+ estimate_fee_bulk: {
1307
+ QUERY: {
1308
+ blockIdentifier: BlockIdentifier;
1309
+ };
1310
+ REQUEST: EstimateFeeRequestBulk;
1311
+ RESPONSE: EstimateFeeResponseBulk;
1312
+ };
1409
1313
  };
1410
1314
  }
1411
1315
 
1316
+ /**
1317
+ * Common interface response
1318
+ * Intersection (sequencer response ∩ (∪ rpc responses))
1319
+ */
1320
+
1321
+ interface GetBlockResponse {
1322
+ timestamp: number;
1323
+ block_hash: string;
1324
+ block_number: number;
1325
+ new_root: string;
1326
+ parent_hash: string;
1327
+ status: Status;
1328
+ transactions: Array<string>;
1329
+ gas_price?: string;
1330
+ sequencer_address?: string;
1331
+ starknet_version?: string;
1332
+ transaction_receipts?: any;
1333
+ }
1334
+ interface GetCodeResponse {
1335
+ bytecode: string[];
1336
+ }
1337
+ declare type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
1338
+ interface CommonTransactionResponse {
1339
+ transaction_hash?: string;
1340
+ version?: string;
1341
+ signature?: Signature;
1342
+ max_fee?: string;
1343
+ nonce?: string;
1344
+ }
1345
+ interface InvokeTransactionResponse extends CommonTransactionResponse {
1346
+ contract_address?: string;
1347
+ entry_point_selector?: string;
1348
+ calldata: RawCalldata;
1349
+ }
1350
+ interface ContractEntryPoint {
1351
+ offset: string;
1352
+ selector: string;
1353
+ }
1354
+ interface DeclareTransactionResponse extends CommonTransactionResponse {
1355
+ contract_class?: any;
1356
+ sender_address?: string;
1357
+ }
1358
+ declare type GetTransactionReceiptResponse = InvokeTransactionReceiptResponse | DeclareTransactionReceiptResponse;
1359
+ interface CommonTransactionReceiptResponse {
1360
+ transaction_hash: string;
1361
+ status?: Status;
1362
+ actual_fee?: string;
1363
+ status_data?: string;
1364
+ }
1365
+ interface MessageToL1 {
1366
+ to_address: string;
1367
+ payload: Array<string>;
1368
+ }
1369
+ interface Event {
1370
+ from_address: string;
1371
+ keys: Array<string>;
1372
+ data: Array<string>;
1373
+ }
1374
+ interface MessageToL2 {
1375
+ from_address: string;
1376
+ payload: Array<string>;
1377
+ }
1378
+ interface InvokeTransactionReceiptResponse extends CommonTransactionReceiptResponse {
1379
+ /** @deprecated Use l2_to_l1_messages */
1380
+ messages_sent?: Array<MessageToL1>;
1381
+ events?: Array<Event>;
1382
+ l1_origin_message?: MessageToL2;
1383
+ }
1384
+ declare type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse;
1385
+ interface EstimateFeeResponse {
1386
+ overall_fee: bigint;
1387
+ gas_consumed?: bigint;
1388
+ gas_price?: bigint;
1389
+ }
1390
+ interface InvokeFunctionResponse {
1391
+ transaction_hash: string;
1392
+ }
1393
+ interface DeclareContractResponse {
1394
+ transaction_hash: string;
1395
+ class_hash: string;
1396
+ }
1397
+ declare type CallContractResponse = {
1398
+ result: Array<string>;
1399
+ };
1400
+ declare type EstimateFeeAction = {
1401
+ type: 'INVOKE';
1402
+ payload: AllowArray<Call>;
1403
+ } | {
1404
+ type: 'DECLARE';
1405
+ payload: DeclareContractPayload;
1406
+ } | {
1407
+ type: 'DEPLOY_ACCOUNT';
1408
+ payload: DeployAccountContractPayload;
1409
+ } | {
1410
+ type: 'DEPLOY';
1411
+ payload: UniversalDeployerContractPayload;
1412
+ };
1413
+ declare type EstimateFeeResponseBulk = Array<EstimateFeeResponse>;
1414
+ interface TransactionSimulationResponse {
1415
+ trace: TransactionTraceResponse;
1416
+ fee_estimation: EstimateFeeResponse;
1417
+ }
1418
+
1419
+ interface EstimateFee extends EstimateFeeResponse {
1420
+ suggestedMaxFee: bigint;
1421
+ }
1422
+ declare type EstimateFeeBulk = Array<EstimateFee>;
1423
+ interface EstimateFeeDetails {
1424
+ nonce?: BigNumberish;
1425
+ blockIdentifier?: BlockIdentifier;
1426
+ }
1427
+ interface DeployContractResponse {
1428
+ contract_address: string;
1429
+ transaction_hash: string;
1430
+ }
1431
+ declare type MultiDeployContractResponse = {
1432
+ contract_address: Array<string>;
1433
+ transaction_hash: string;
1434
+ };
1435
+ declare type DeployContractUDCResponse = {
1436
+ contract_address: string;
1437
+ transaction_hash: string;
1438
+ address: string;
1439
+ deployer: string;
1440
+ unique: string;
1441
+ classHash: string;
1442
+ calldata_len: string;
1443
+ calldata: Array<string>;
1444
+ salt: string;
1445
+ };
1446
+ declare type DeclareDeployUDCResponse = {
1447
+ declare: {
1448
+ class_hash: BigNumberish;
1449
+ } & DeclareTransactionReceiptResponse;
1450
+ deploy: DeployContractUDCResponse;
1451
+ };
1452
+ interface TransactionSimulation extends TransactionSimulationResponse {
1453
+ fee_estimation: EstimateFee;
1454
+ }
1455
+
1412
1456
  declare abstract class ProviderInterface {
1413
- abstract chainId: StarknetChainId;
1414
1457
  /**
1415
1458
  * Gets the Starknet chain Id
1416
1459
  *
@@ -1590,6 +1633,19 @@ declare abstract class ProviderInterface {
1590
1633
  * @returns the estimated fee
1591
1634
  */
1592
1635
  abstract getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1636
+ /**
1637
+ * Estimates the fee for a list of INVOKE transaction
1638
+ *
1639
+ * @param invocations the array of invocation and invocation details object containing:
1640
+ * - contractAddress - the address of the account
1641
+ * - calldata - (defaults to []) the calldata
1642
+ * - signature - (defaults to []) the signature
1643
+ * - nonce - optional nonce
1644
+ * - version - optional version
1645
+ * @param blockIdentifier - block identifier
1646
+ * @returns the estimated fee
1647
+ */
1648
+ abstract getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1593
1649
  /**
1594
1650
  * Wait for the transaction to be accepted
1595
1651
  * @param txHash - transaction hash
@@ -1597,6 +1653,21 @@ declare abstract class ProviderInterface {
1597
1653
  * @return GetTransactionReceiptResponse
1598
1654
  */
1599
1655
  abstract waitForTransaction(txHash: BigNumberish, retryInterval?: number, successStates?: Array<Status>): Promise<GetTransactionReceiptResponse>;
1656
+ /**
1657
+ * Simulates the transaction and returns the transaction trace and estimated fee.
1658
+ *
1659
+ * @param invocation the invocation object containing:
1660
+ * - contractAddress - the address of the contract
1661
+ * - entrypoint - the entrypoint of the contract
1662
+ * - calldata - (defaults to []) the calldata
1663
+ * - signature - (defaults to []) the signature
1664
+ * @param details - optional details containing:
1665
+ * - nonce - optional nonce
1666
+ * - version - optional version
1667
+ * @param blockIdentifier - block identifier
1668
+ * @returns the transaction trace and estimated fee
1669
+ */
1670
+ abstract getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
1600
1671
  }
1601
1672
 
1602
1673
  declare type RpcProviderOptions = {
@@ -1607,8 +1678,8 @@ declare type RpcProviderOptions = {
1607
1678
  };
1608
1679
  declare class RpcProvider implements ProviderInterface {
1609
1680
  nodeUrl: string;
1610
- chainId: StarknetChainId;
1611
1681
  headers: object;
1682
+ private chainId;
1612
1683
  private responseParser;
1613
1684
  private retries;
1614
1685
  private blockIdentifier;
@@ -1616,7 +1687,7 @@ declare class RpcProvider implements ProviderInterface {
1616
1687
  fetch(method: any, params: any): Promise<any>;
1617
1688
  protected errorHandler(error: any): void;
1618
1689
  protected fetchEndpoint<T extends keyof RPC.Methods>(method: T, params?: RPC.Methods[T]['params']): Promise<RPC.Methods[T]['result']>;
1619
- getChainId(): Promise<any>;
1690
+ getChainId(): Promise<StarknetChainId>;
1620
1691
  getBlock(blockIdentifier?: BlockIdentifier): Promise<GetBlockResponse>;
1621
1692
  getBlockHashAndNumber(): Promise<RPC.BlockHashAndNumber>;
1622
1693
  getBlockWithTxHashes(blockIdentifier?: BlockIdentifier): Promise<RPC.GetBlockWithTxHashesResponse>;
@@ -1639,6 +1710,7 @@ declare class RpcProvider implements ProviderInterface {
1639
1710
  getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1640
1711
  getDeclareEstimateFee({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1641
1712
  getDeployAccountEstimateFee({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1713
+ getEstimateFeeBulk(_invocations: InvocationBulk, _blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1642
1714
  declareContract({ contractDefinition, signature, senderAddress }: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
1643
1715
  deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
1644
1716
  invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
@@ -1675,6 +1747,7 @@ declare class RpcProvider implements ProviderInterface {
1675
1747
  * @returns events and the pagination of the events
1676
1748
  */
1677
1749
  getEvents(eventFilter: RPC.EventFilter): Promise<RPC.GetEventsResponse>;
1750
+ getSimulateTransaction(_invocation: Invocation, _invocationDetails: InvocationsDetailsWithNonce, _blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
1678
1751
  }
1679
1752
 
1680
1753
  declare type NetworkName = 'mainnet-alpha' | 'goerli-alpha' | 'goerli-alpha-2';
@@ -1694,8 +1767,8 @@ declare class SequencerProvider implements ProviderInterface {
1694
1767
  baseUrl: string;
1695
1768
  feederGatewayUrl: string;
1696
1769
  gatewayUrl: string;
1697
- chainId: StarknetChainId;
1698
1770
  headers: object | undefined;
1771
+ private chainId;
1699
1772
  private responseParser;
1700
1773
  private blockIdentifier;
1701
1774
  constructor(optionsOrProvider?: SequencerProviderOptions);
@@ -1723,6 +1796,7 @@ declare class SequencerProvider implements ProviderInterface {
1723
1796
  getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1724
1797
  getDeclareEstimateFee({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1725
1798
  getDeployAccountEstimateFee({ classHash, addressSalt, constructorCalldata, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1799
+ getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1726
1800
  getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Sequencer.GetCodeResponse>;
1727
1801
  waitForTransaction(txHash: BigNumberish, retryInterval?: number, successStates?: string[]): Promise<GetTransactionReceiptResponse>;
1728
1802
  /**
@@ -1749,7 +1823,7 @@ declare class SequencerProvider implements ProviderInterface {
1749
1823
  */
1750
1824
  getTransactionTrace(txHash: BigNumberish): Promise<TransactionTraceResponse>;
1751
1825
  estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
1752
- simulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<Sequencer.TransactionSimulationResponse>;
1826
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
1753
1827
  }
1754
1828
 
1755
1829
  interface ProviderOptions {
@@ -1759,7 +1833,6 @@ interface ProviderOptions {
1759
1833
  declare class Provider implements ProviderInterface {
1760
1834
  private provider;
1761
1835
  constructor(providerOrOptions?: ProviderOptions | ProviderInterface);
1762
- get chainId(): StarknetChainId;
1763
1836
  getChainId(): Promise<StarknetChainId>;
1764
1837
  getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
1765
1838
  getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass>;
@@ -1767,6 +1840,7 @@ declare class Provider implements ProviderInterface {
1767
1840
  getClassByHash(classHash: string): Promise<ContractClass>;
1768
1841
  getEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
1769
1842
  getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1843
+ getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1770
1844
  getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1771
1845
  getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1772
1846
  getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
@@ -1779,13 +1853,16 @@ declare class Provider implements ProviderInterface {
1779
1853
  getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1780
1854
  getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
1781
1855
  waitForTransaction(txHash: BigNumberish, retryInterval?: number, successStates?: Array<Status>): Promise<GetTransactionReceiptResponse>;
1856
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
1782
1857
  }
1783
1858
 
1784
- declare class GatewayError extends CustomError {
1859
+ declare class LibraryError extends CustomError {
1860
+ }
1861
+ declare class GatewayError extends LibraryError {
1785
1862
  errorCode: string;
1786
1863
  constructor(message: string, errorCode: string);
1787
1864
  }
1788
- declare class HttpError extends CustomError {
1865
+ declare class HttpError extends LibraryError {
1789
1866
  errorCode: number;
1790
1867
  constructor(message: string, errorCode: number);
1791
1868
  }
@@ -2058,6 +2135,17 @@ declare abstract class AccountInterface extends ProviderInterface {
2058
2135
  * - optional maxFee
2059
2136
  */
2060
2137
  abstract estimateDeployFee(deployContractPayload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails): Promise<EstimateFeeResponse>;
2138
+ /**
2139
+ * Estimate Fee for executing a list of transactions on starknet
2140
+ * Contract must be deployed for fee estimation to be possible
2141
+ *
2142
+ * @param transactions array of transaction object containing :
2143
+ * - type - the type of transaction : 'DECLARE' | 'DEPLOY' | 'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT'
2144
+ * - payload - the payload of the transaction
2145
+ *
2146
+ * @returns response from estimate_fee
2147
+ */
2148
+ abstract estimateFeeBulk(transactions: TransactionBulk, estimateFeeDetails?: EstimateFeeDetails): Promise<EstimateFeeResponseBulk>;
2061
2149
  /**
2062
2150
  * Invoke execute function in account contract
2063
2151
  *
@@ -2223,6 +2311,17 @@ declare abstract class AccountInterface extends ProviderInterface {
2223
2311
  * @returns suggestedMaxFee
2224
2312
  */
2225
2313
  abstract getSuggestedMaxFee(estimateFeeAction: EstimateFeeAction, details: EstimateFeeDetails): Promise<BigNumberish>;
2314
+ /**
2315
+ * Simulates the transaction and returns the transaction trace and estimated fee.
2316
+ *
2317
+ * @param calls the invocation object containing:
2318
+ * - contractAddress - the address of the contract
2319
+ * - entrypoint - the entrypoint of the contract
2320
+ * - calldata - (defaults to []) the calldata
2321
+ *
2322
+ * @returns response from estimate_fee
2323
+ */
2324
+ abstract simulateTransaction(calls: AllowArray<Call>, estimateFeeDetails?: EstimateFeeDetails): Promise<TransactionSimulation>;
2226
2325
  }
2227
2326
 
2228
2327
  declare class Account extends Provider implements AccountInterface {
@@ -2237,6 +2336,8 @@ declare class Account extends Provider implements AccountInterface {
2237
2336
  estimateDeclareFee({ contract, classHash: providedClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce }?: EstimateFeeDetails): Promise<EstimateFee>;
2238
2337
  estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
2239
2338
  estimateDeployFee(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails | undefined): Promise<EstimateFee>;
2339
+ estimateFeeBulk(transactions: TransactionBulk, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFeeBulk>;
2340
+ buildInvocation(call: Array<Call>, signerDetails: InvocationsSignerDetails): Promise<Invocation>;
2240
2341
  execute(calls: AllowArray<Call>, abis?: Abi[] | undefined, transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
2241
2342
  declare({ contract, classHash: providedClassHash }: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
2242
2343
  deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], details?: InvocationsDetails | undefined): Promise<MultiDeployContractResponse>;
@@ -2248,6 +2349,10 @@ declare class Account extends Provider implements AccountInterface {
2248
2349
  verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
2249
2350
  verifyMessage(typedData: TypedData, signature: Signature): Promise<boolean>;
2250
2351
  getSuggestedMaxFee({ type, payload }: EstimateFeeAction, details: EstimateFeeDetails): Promise<string>;
2352
+ buildDeclarePayload({ classHash: providedClassHash, contract }: DeclareContractPayload, { nonce, chainId, version, walletAddress, maxFee }: InvocationsSignerDetails): Promise<DeclareContractTransaction>;
2353
+ buildAccountDeployPayload({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { nonce, chainId, version, maxFee }: InvocationsSignerDetails): Promise<DeployAccountContractTransaction>;
2354
+ buildUDCContractPayload(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Call[];
2355
+ simulateTransaction(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<TransactionSimulation>;
2251
2356
  }
2252
2357
 
2253
2358
  declare type CallOptions = {
@@ -2672,4 +2777,4 @@ declare function validateChecksumAddress(address: string): boolean;
2672
2777
  declare function isUrl(s?: string): boolean;
2673
2778
  declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
2674
2779
 
2675
- export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeDetails, EstimateFeeResponse, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HttpError, Invocation, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, MessageToL1, MessageToL2, MultiDeployContractResponse, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, Status, Struct, StructAbi, TransactionStatus, TransactionTraceResponse, TransactionType, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };
2780
+ export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, Status, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };