starknet 4.17.0 → 4.18.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.
Files changed (150) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +2 -10
  3. package/dist/index.d.ts +27 -9
  4. package/dist/index.global.js +30 -13
  5. package/dist/index.global.js.map +1 -1
  6. package/dist/index.js +30 -13
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +30 -13
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +5 -1
  11. package/.babelrc +0 -6
  12. package/.commitlintrc +0 -22
  13. package/.eslintignore +0 -2
  14. package/.eslintrc +0 -28
  15. package/.prettierrc +0 -6
  16. package/.releaserc +0 -28
  17. package/CODE_OF_CONDUCT.md +0 -128
  18. package/CONTRIBUTING.md +0 -52
  19. package/__mocks__/Account.json +0 -25486
  20. package/__mocks__/ERC20.json +0 -40027
  21. package/__mocks__/TestDapp.json +0 -12962
  22. package/__mocks__/contract.json +0 -33191
  23. package/__mocks__/l1l2_compiled.json +0 -10107
  24. package/__mocks__/multicall.json +0 -8139
  25. package/__mocks__/naming_compiled.json +0 -53283
  26. package/__mocks__/starknetId_compiled.json +0 -44703
  27. package/__mocks__/typedDataExample.json +0 -35
  28. package/__mocks__/typedDataSessionExample.json +0 -42
  29. package/__mocks__/typedDataStructArrayExample.json +0 -44
  30. package/__tests__/account.test.ts +0 -345
  31. package/__tests__/contract.test.ts +0 -249
  32. package/__tests__/defaultProvider.test.ts +0 -177
  33. package/__tests__/fixtures.ts +0 -84
  34. package/__tests__/jest.setup.ts +0 -30
  35. package/__tests__/rpcProvider.test.ts +0 -132
  36. package/__tests__/sequencerProvider.test.ts +0 -123
  37. package/__tests__/utils/__snapshots__/ellipticalCurve.test.ts.snap +0 -5
  38. package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +0 -5
  39. package/__tests__/utils/__snapshots__/utils.test.ts.snap +0 -5
  40. package/__tests__/utils/address.test.ts +0 -45
  41. package/__tests__/utils/ellipticalCurve.test.ts +0 -91
  42. package/__tests__/utils/merkle.test.ts +0 -256
  43. package/__tests__/utils/shortString.test.ts +0 -22
  44. package/__tests__/utils/starknetId.test.ts +0 -53
  45. package/__tests__/utils/transactionHash.test.ts +0 -17
  46. package/__tests__/utils/typedData.test.ts +0 -223
  47. package/__tests__/utils/uint256.test.ts +0 -32
  48. package/__tests__/utils/utils.browser.test.ts +0 -29
  49. package/__tests__/utils/utils.test.ts +0 -141
  50. package/img/logo.svg +0 -17
  51. package/index.d.ts +0 -2683
  52. package/index.global.js +0 -23192
  53. package/index.global.js.map +0 -1
  54. package/index.js +0 -4910
  55. package/index.js.map +0 -1
  56. package/index.mjs +0 -4852
  57. package/index.mjs.map +0 -1
  58. package/src/account/default.ts +0 -501
  59. package/src/account/index.ts +0 -2
  60. package/src/account/interface.ts +0 -309
  61. package/src/constants.ts +0 -2065
  62. package/src/contract/contractFactory.ts +0 -88
  63. package/src/contract/default.ts +0 -425
  64. package/src/contract/index.ts +0 -3
  65. package/src/contract/interface.ts +0 -106
  66. package/src/index.ts +0 -26
  67. package/src/provider/default.ts +0 -187
  68. package/src/provider/errors.ts +0 -14
  69. package/src/provider/index.ts +0 -9
  70. package/src/provider/interface.ts +0 -281
  71. package/src/provider/rpc.ts +0 -482
  72. package/src/provider/sequencer.ts +0 -523
  73. package/src/provider/utils.ts +0 -100
  74. package/src/signer/default.ts +0 -99
  75. package/src/signer/index.ts +0 -2
  76. package/src/signer/interface.ts +0 -77
  77. package/src/types/account.ts +0 -43
  78. package/src/types/api/index.ts +0 -10
  79. package/src/types/api/openrpc.ts +0 -607
  80. package/src/types/api/rpc.ts +0 -45
  81. package/src/types/api/sequencer.ts +0 -369
  82. package/src/types/contract.ts +0 -5
  83. package/src/types/index.ts +0 -8
  84. package/src/types/lib.ts +0 -143
  85. package/src/types/provider.ts +0 -134
  86. package/src/types/signer.ts +0 -24
  87. package/src/utils/address.ts +0 -44
  88. package/src/utils/calldata.ts +0 -250
  89. package/src/utils/ellipticCurve.ts +0 -120
  90. package/src/utils/encode.ts +0 -66
  91. package/src/utils/events.ts +0 -32
  92. package/src/utils/fetchPonyfill.ts +0 -5
  93. package/src/utils/hash.ts +0 -235
  94. package/src/utils/json.ts +0 -15
  95. package/src/utils/merkle.ts +0 -69
  96. package/src/utils/number.ts +0 -98
  97. package/src/utils/provider.ts +0 -28
  98. package/src/utils/responseParser/index.ts +0 -28
  99. package/src/utils/responseParser/rpc.ts +0 -70
  100. package/src/utils/responseParser/sequencer.ts +0 -135
  101. package/src/utils/shortString.ts +0 -21
  102. package/src/utils/stark.ts +0 -57
  103. package/src/utils/starknetId.ts +0 -116
  104. package/src/utils/transaction.ts +0 -56
  105. package/src/utils/typedData/index.ts +0 -247
  106. package/src/utils/typedData/types.ts +0 -37
  107. package/src/utils/typedData/utils.ts +0 -16
  108. package/src/utils/uint256.ts +0 -32
  109. package/src/utils/url.ts +0 -53
  110. package/tsconfig.eslint.json +0 -4
  111. package/tsup.config.ts +0 -9
  112. package/www/README.md +0 -41
  113. package/www/babel.config.js +0 -3
  114. package/www/code-examples/account.js +0 -65
  115. package/www/code-examples/amm.js +0 -44
  116. package/www/code-examples/erc20.js +0 -13
  117. package/www/code-examples/package-lock.json +0 -336
  118. package/www/code-examples/package.json +0 -15
  119. package/www/docs/API/_category_.json +0 -5
  120. package/www/docs/API/account.md +0 -463
  121. package/www/docs/API/changelog.md +0 -15
  122. package/www/docs/API/contract.md +0 -135
  123. package/www/docs/API/contractFactory.md +0 -45
  124. package/www/docs/API/index.md +0 -3
  125. package/www/docs/API/provider.md +0 -725
  126. package/www/docs/API/signer.md +0 -105
  127. package/www/docs/API/utils.md +0 -374
  128. package/www/docusaurus.config.js +0 -130
  129. package/www/guides/account.md +0 -140
  130. package/www/guides/cra.md +0 -3
  131. package/www/guides/erc20.md +0 -163
  132. package/www/guides/intro.md +0 -63
  133. package/www/package-lock.json +0 -20405
  134. package/www/package.json +0 -43
  135. package/www/sidebars.js +0 -31
  136. package/www/src/components/HomepageFeatures/index.tsx +0 -67
  137. package/www/src/components/HomepageFeatures/styles.module.css +0 -10
  138. package/www/src/css/custom.css +0 -39
  139. package/www/src/pages/index.module.css +0 -23
  140. package/www/src/pages/index.tsx +0 -40
  141. package/www/src/pages/markdown-page.md +0 -7
  142. package/www/static/.nojekyll +0 -0
  143. package/www/static/img/docusaurus.png +0 -0
  144. package/www/static/img/favicon.ico +0 -0
  145. package/www/static/img/logo.svg +0 -17
  146. package/www/static/img/starknet-1.png +0 -0
  147. package/www/static/img/starknet-2.png +0 -0
  148. package/www/static/img/starknet-3.png +0 -0
  149. package/www/static/img/tutorial/docsVersionDropdown.png +0 -0
  150. package/www/static/img/tutorial/localeDropdown.png +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # [4.18.0](https://github.com/0xs34n/starknet.js/compare/v4.17.1...v4.18.0) (2022-12-23)
2
+
3
+ ### Bug Fixes
4
+
5
+ - merge develop into branch ([21efcb1](https://github.com/0xs34n/starknet.js/commit/21efcb1cefd6ea70a9d49e060ff620e88002e3b6))
6
+
7
+ ### Features
8
+
9
+ - simulate_transaction support on sequencer ([304c3cc](https://github.com/0xs34n/starknet.js/commit/304c3cc1af81bc8810581546f043caca01db173b))
10
+ - update simulate tx ([8f3ea55](https://github.com/0xs34n/starknet.js/commit/8f3ea55eb1e23cefc0419902a2ebbe10ee373ccb))
11
+ - update simulate tx in sequencer ([d79a9fa](https://github.com/0xs34n/starknet.js/commit/d79a9faa307936561504c120f67f3fb2f18423b6))
12
+
13
+ ## [4.17.1](https://github.com/0xs34n/starknet.js/compare/v4.17.0...v4.17.1) (2022-12-14)
14
+
15
+ ### Bug Fixes
16
+
17
+ - estimateAccountDeployFee set nonce to constant 0 ([2110ef0](https://github.com/0xs34n/starknet.js/commit/2110ef09da63765609d60e01259c360a0e8a9ddf))
18
+ - nonce should be fixed for deploy account to 0 ([c8a38e5](https://github.com/0xs34n/starknet.js/commit/c8a38e5349e5c5ebe3bb0665a4fb18cd02811626))
19
+ - rpc deployAccountContract request, rpc nonce hotfix ([9576335](https://github.com/0xs34n/starknet.js/commit/9576335893561603cfd6a8ff4454b69cb49f7484))
20
+
1
21
  # [4.17.0](https://github.com/0xs34n/starknet.js/compare/v4.16.0...v4.17.0) (2022-12-13)
2
22
 
3
23
  ### Bug Fixes
package/README.md CHANGED
@@ -56,14 +56,6 @@ Guides can be found [here](https://www.starknetjs.com/guides/intro)
56
56
 
57
57
  [Click Here](https://www.starknetjs.com/docs/API/)
58
58
 
59
- ## 🚀 Powered by Starknet.js
60
-
61
- - [Argent X - the first StarkNet wallet](https://github.com/argentlabs/argent-x)
62
- - [Braavos - your new wallet on top of StarkNet](https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma)
63
- - [React + Starknet.js boilerplate](https://github.com/fracek/starknet-react-example)
64
- - [AMM Demo](https://www.starknetswap.com/)
65
- - [mySwap - the first DeFi app to launch on StarkNet](https://myswap.xyz)
66
-
67
59
  ## ✏️ Contributing
68
60
 
69
61
  If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/0xs34n/starknet.js/blob/main/CONTRIBUTING.md) first.
@@ -72,9 +64,9 @@ If you consider to contribute to this project please read [CONTRIBUTING.md](http
72
64
 
73
65
  Special thanks to all the [contributors](https://github.com/0xs34n/starknet.js/graphs/contributors), especially to:
74
66
 
75
- Janek ([@janek26](https://github.com/janek26)), Axel ([@delaaxe](https://github.com/delaaxe)) and Dhruv ([@dhruvkelawala](https://github.com/dhruvkelawala)) from [Argent](https://github.com/argentlabs)
67
+ Janek ([@janek26](https://github.com/janek26)) and Dhruv ([@dhruvkelawala](https://github.com/dhruvkelawala)) from [Argent](https://github.com/argentlabs)
76
68
 
77
- Miljan ([@MilGard91](https://github.com/MilGard91)) from [Shard Labs](https://shardlabs.io/)
69
+ Toni ([@tabaktoni](https://github.com/tabaktoni)) and Ivan ([@ivpavici](https://github.com/ivpavici)) from [Shard Labs](https://shardlabs.io/)
78
70
 
79
71
  and of course the [StarkWare](https://starkware.co/) team for their dedicated support!
80
72
 
package/dist/index.d.ts CHANGED
@@ -544,7 +544,9 @@ declare namespace OPENRPC {
544
544
  errors: Errors.INVALID_CONTRACT_CLASS;
545
545
  };
546
546
  starknet_addDeployAccountTransaction: {
547
- params: BROADCASTED_DEPLOY_ACCOUNT_TXN;
547
+ params: {
548
+ deploy_account_transaction: BROADCASTED_DEPLOY_ACCOUNT_TXN;
549
+ };
548
550
  result: {
549
551
  transaction_hash: TXN_HASH;
550
552
  contract_address: FELT;
@@ -1112,7 +1114,7 @@ declare type ExecutionResources = {
1112
1114
  };
1113
1115
  n_memory_holes: number;
1114
1116
  };
1115
- declare type GetTransactionTraceResponse = {
1117
+ declare type TransactionTraceResponse = {
1116
1118
  validate_invocation?: FunctionInvocation;
1117
1119
  function_invocation?: FunctionInvocation;
1118
1120
  fee_transfer_invocation?: FunctionInvocation;
@@ -1254,10 +1256,16 @@ declare namespace Sequencer {
1254
1256
  type DeployAccountEstimateFee = Omit<DeployAccountTransaction, 'max_fee'>;
1255
1257
  type DeployEstimateFee = DeployTransaction;
1256
1258
  type EstimateFeeRequest = InvokeEstimateFee | DeclareEstimateFee | DeployEstimateFee | DeployAccountEstimateFee;
1259
+ type TransactionSimulationResponse = {
1260
+ trace: TransactionTraceResponse;
1261
+ fee_estimation: Sequencer.EstimateFeeResponse;
1262
+ };
1263
+ type SimulateTransaction = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
1257
1264
  type EstimateFeeResponse = {
1258
1265
  overall_fee: number;
1259
1266
  gas_price: number;
1260
1267
  gas_usage: number;
1268
+ uint: string;
1261
1269
  } | {
1262
1270
  amount: BN__default;
1263
1271
  unit: string;
@@ -1292,7 +1300,7 @@ declare namespace Sequencer {
1292
1300
  transactionHash: string;
1293
1301
  };
1294
1302
  REQUEST: never;
1295
- RESPONSE: GetTransactionTraceResponse;
1303
+ RESPONSE: TransactionTraceResponse;
1296
1304
  };
1297
1305
  get_transaction_receipt: {
1298
1306
  QUERY: {
@@ -1382,6 +1390,13 @@ declare namespace Sequencer {
1382
1390
  REQUEST: any;
1383
1391
  RESPONSE: EstimateFeeResponse;
1384
1392
  };
1393
+ simulate_transaction: {
1394
+ QUERY: {
1395
+ blockIdentifier: BlockIdentifier;
1396
+ };
1397
+ REQUEST: SimulateTransaction;
1398
+ RESPONSE: TransactionSimulationResponse;
1399
+ };
1385
1400
  };
1386
1401
  }
1387
1402
 
@@ -1723,8 +1738,9 @@ declare class SequencerProvider implements ProviderInterface {
1723
1738
  * @param txHash
1724
1739
  * @returns the transaction trace
1725
1740
  */
1726
- getTransactionTrace(txHash: BigNumberish): Promise<GetTransactionTraceResponse>;
1741
+ getTransactionTrace(txHash: BigNumberish): Promise<TransactionTraceResponse>;
1727
1742
  estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
1743
+ simulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<Sequencer.TransactionSimulationResponse>;
1728
1744
  }
1729
1745
 
1730
1746
  interface ProviderOptions {
@@ -2008,10 +2024,12 @@ declare abstract class AccountInterface extends ProviderInterface {
2008
2024
  /**
2009
2025
  * Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
2010
2026
  *
2011
- * @param contractPayload the payload object containing:
2027
+ * @param contractPayload -
2012
2028
  * - contract - the compiled contract to be deployed
2013
2029
  * - classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
2014
- *
2030
+ * @param estimateFeeDetails -
2031
+ * - optional blockIdentifier
2032
+ * - constant nonce = 0
2015
2033
  * @returns response from estimate_fee
2016
2034
  */
2017
2035
  abstract estimateAccountDeployFee(contractPayload: DeployAccountContractPayload, estimateFeeDetails?: EstimateFeeDetails): Promise<EstimateFeeResponse>;
@@ -2138,7 +2156,7 @@ declare abstract class AccountInterface extends ProviderInterface {
2138
2156
  - optional address salt
2139
2157
  - optional contractAddress
2140
2158
  * @param transactionsDetail Invocation Details containing:
2141
- - optional nonce
2159
+ - constant nonce = 0
2142
2160
  - optional version
2143
2161
  - optional maxFee
2144
2162
  * @returns a confirmation of sending a transaction on the starknet contract
@@ -2208,7 +2226,7 @@ declare class Account extends Provider implements AccountInterface {
2208
2226
  estimateFee(calls: AllowArray<Call>, estimateFeeDetails?: EstimateFeeDetails | undefined): Promise<EstimateFee>;
2209
2227
  estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
2210
2228
  estimateDeclareFee({ classHash, contract }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce }?: EstimateFeeDetails): Promise<EstimateFee>;
2211
- estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier, nonce: providedNonce }?: EstimateFeeDetails): Promise<EstimateFee>;
2229
+ estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
2212
2230
  estimateDeployFee(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails | undefined): Promise<EstimateFee>;
2213
2231
  execute(calls: AllowArray<Call>, abis?: Abi[] | undefined, transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
2214
2232
  declare({ classHash, contract }: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
@@ -2680,4 +2698,4 @@ declare function validateChecksumAddress(address: string): boolean;
2680
2698
  declare function isUrl(s?: string): boolean;
2681
2699
  declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
2682
2700
 
2683
- export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractFactory, ContractFunction, ContractInterface, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployContractPayload, 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, GetTransactionTraceResponse, HttpError, Invocation, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, KeyPair, 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, TransactionType, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, ellipticCurve as ec, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };
2701
+ export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractFactory, ContractFunction, ContractInterface, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployContractPayload, 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, KeyPair, 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, ellipticCurve as ec, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };
@@ -20773,14 +20773,16 @@ var starknet = (() => {
20773
20773
  }
20774
20774
  async deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }, details) {
20775
20775
  return this.fetchEndpoint("starknet_addDeployAccountTransaction", {
20776
- constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
20777
- class_hash: toHex(toBN(classHash)),
20778
- contract_address_salt: toHex(toBN(addressSalt || 0)),
20779
- type: "DEPLOY",
20780
- max_fee: toHex(toBN(details.maxFee || 0)),
20781
- version: toHex(toBN(details.version || 0)),
20782
- signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
20783
- nonce: toHex(toBN(details.nonce))
20776
+ deploy_account_transaction: {
20777
+ constructor_calldata: bigNumberishArrayToHexadecimalStringArray(constructorCalldata || []),
20778
+ class_hash: toHex(toBN(classHash)),
20779
+ contract_address_salt: toHex(toBN(addressSalt || 0)),
20780
+ type: "DEPLOY_ACCOUNT",
20781
+ max_fee: toHex(toBN(details.maxFee || 0)),
20782
+ version: toHex(toBN(details.version || 0)),
20783
+ signature: bigNumberishArrayToHexadecimalStringArray(signature || []),
20784
+ nonce: toHex(toBN(details.nonce))
20785
+ }
20784
20786
  });
20785
20787
  }
20786
20788
  async invokeFunction(functionInvocation, details) {
@@ -20790,7 +20792,7 @@ var starknet = (() => {
20790
20792
  calldata: parseCalldata(functionInvocation.calldata),
20791
20793
  type: "INVOKE",
20792
20794
  max_fee: toHex(toBN(details.maxFee || 0)),
20793
- version: toHex(toBN(details.version || 0)),
20795
+ version: toHex(toBN(details.version || 1)),
20794
20796
  signature: bigNumberishArrayToHexadecimalStringArray(functionInvocation.signature || []),
20795
20797
  nonce: toHex(toBN(details.nonce))
20796
20798
  }
@@ -21116,7 +21118,8 @@ var starknet = (() => {
21116
21118
  "add_transaction",
21117
21119
  "call_contract",
21118
21120
  "estimate_fee",
21119
- "estimate_message_fee"
21121
+ "estimate_message_fee",
21122
+ "simulate_transaction"
21120
21123
  ];
21121
21124
  return postMethodEndpoints.includes(endpoint) ? "POST" : "GET";
21122
21125
  }
@@ -21361,6 +21364,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
21361
21364
  };
21362
21365
  return this.fetchEndpoint("estimate_message_fee", { blockIdentifier }, validCallL1Handler);
21363
21366
  }
21367
+ async simulateTransaction(invocation, invocationDetails, blockIdentifier = this.blockIdentifier) {
21368
+ return this.fetchEndpoint(
21369
+ "simulate_transaction",
21370
+ { blockIdentifier },
21371
+ {
21372
+ type: "INVOKE_FUNCTION",
21373
+ contract_address: invocation.contractAddress,
21374
+ calldata: invocation.calldata ?? [],
21375
+ signature: bigNumberishArrayToDecimalStringArray(invocation.signature || []),
21376
+ version: toHex(toBN((invocationDetails == null ? void 0 : invocationDetails.version) || 1)),
21377
+ nonce: toHex(toBN(invocationDetails.nonce))
21378
+ }
21379
+ );
21380
+ }
21364
21381
  };
21365
21382
 
21366
21383
  // src/provider/default.ts
@@ -22502,8 +22519,8 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
22502
22519
  addressSalt = 0,
22503
22520
  constructorCalldata = [],
22504
22521
  contractAddress: providedContractAddress
22505
- }, { blockIdentifier, nonce: providedNonce } = {}) {
22506
- const nonce = toBN(providedNonce ?? await this.getNonce());
22522
+ }, { blockIdentifier } = {}) {
22523
+ const nonce = "0x0";
22507
22524
  const version3 = toBN(feeTransactionVersion);
22508
22525
  const chainId = await this.getChainId();
22509
22526
  const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);
@@ -22662,7 +22679,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
22662
22679
  addressSalt = 0,
22663
22680
  contractAddress: providedContractAddress
22664
22681
  }, transactionsDetail = {}) {
22665
- const nonce = toBN(transactionsDetail.nonce ?? await this.getNonce());
22682
+ const nonce = "0x0";
22666
22683
  const version3 = toBN(transactionVersion);
22667
22684
  const chainId = await this.getChainId();
22668
22685
  const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, constructorCalldata, 0);