starknet 4.8.0 → 4.10.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 (107) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -3
  3. package/__mocks__/ERC20.json +32561 -29055
  4. package/__tests__/account.test.ts +32 -24
  5. package/__tests__/contract.test.ts +25 -14
  6. package/__tests__/defaultProvider.test.ts +91 -240
  7. package/__tests__/fixtures.ts +10 -2
  8. package/__tests__/rpcProvider.test.ts +8 -16
  9. package/__tests__/sequencerProvider.test.ts +17 -10
  10. package/__tests__/udc.test.ts +41 -0
  11. package/__tests__/utils/merkle.test.ts +98 -3
  12. package/__tests__/utils/typedData.test.ts +3 -3
  13. package/account/default.d.ts +12 -44
  14. package/account/default.js +305 -61
  15. package/account/interface.d.ts +96 -8
  16. package/constants.d.ts +8 -1
  17. package/constants.js +8 -1
  18. package/contract/default.d.ts +11 -27
  19. package/contract/default.js +105 -121
  20. package/contract/interface.d.ts +5 -2
  21. package/dist/account/default.d.ts +12 -44
  22. package/dist/account/default.js +305 -61
  23. package/dist/account/interface.d.ts +96 -8
  24. package/dist/constants.d.ts +8 -1
  25. package/dist/constants.js +8 -1
  26. package/dist/contract/default.d.ts +11 -27
  27. package/dist/contract/default.js +105 -121
  28. package/dist/contract/interface.d.ts +5 -2
  29. package/dist/provider/default.d.ts +8 -3
  30. package/dist/provider/default.js +31 -4
  31. package/dist/provider/interface.d.ts +67 -5
  32. package/dist/provider/rpc.d.ts +10 -3
  33. package/dist/provider/rpc.js +98 -10
  34. package/dist/provider/sequencer.d.ts +11 -4
  35. package/dist/provider/sequencer.js +89 -18
  36. package/dist/signer/default.d.ts +5 -2
  37. package/dist/signer/default.js +25 -3
  38. package/dist/signer/interface.d.ts +29 -2
  39. package/dist/types/api/index.d.ts +0 -6
  40. package/dist/types/api/openrpc.d.ts +24 -2
  41. package/dist/types/api/sequencer.d.ts +22 -7
  42. package/dist/types/index.d.ts +1 -1
  43. package/dist/types/lib.d.ts +36 -2
  44. package/dist/types/provider.d.ts +15 -10
  45. package/dist/types/signer.d.ts +14 -1
  46. package/dist/utils/hash.d.ts +2 -0
  47. package/dist/utils/hash.js +13 -2
  48. package/dist/utils/merkle.js +2 -4
  49. package/dist/utils/number.d.ts +1 -0
  50. package/dist/utils/number.js +3 -1
  51. package/dist/utils/responseParser/rpc.d.ts +2 -6
  52. package/dist/utils/responseParser/rpc.js +0 -11
  53. package/dist/utils/responseParser/sequencer.js +4 -14
  54. package/package.json +1 -1
  55. package/provider/default.d.ts +8 -3
  56. package/provider/default.js +31 -4
  57. package/provider/interface.d.ts +67 -5
  58. package/provider/rpc.d.ts +10 -3
  59. package/provider/rpc.js +98 -10
  60. package/provider/sequencer.d.ts +11 -4
  61. package/provider/sequencer.js +89 -18
  62. package/signer/default.d.ts +5 -2
  63. package/signer/default.js +25 -3
  64. package/signer/interface.d.ts +29 -2
  65. package/src/account/default.ts +243 -55
  66. package/src/account/interface.ts +132 -7
  67. package/src/constants.ts +8 -0
  68. package/src/contract/default.ts +124 -141
  69. package/src/contract/interface.ts +5 -2
  70. package/src/provider/default.ts +43 -5
  71. package/src/provider/interface.ts +92 -7
  72. package/src/provider/rpc.ts +93 -15
  73. package/src/provider/sequencer.ts +87 -14
  74. package/src/signer/default.ts +56 -4
  75. package/src/signer/interface.ts +33 -2
  76. package/src/types/api/index.ts +0 -4
  77. package/src/types/api/openrpc.ts +28 -2
  78. package/src/types/api/sequencer.ts +32 -9
  79. package/src/types/index.ts +1 -1
  80. package/src/types/lib.ts +43 -2
  81. package/src/types/provider.ts +27 -11
  82. package/src/types/signer.ts +18 -1
  83. package/src/utils/hash.ts +46 -1
  84. package/src/utils/merkle.ts +2 -4
  85. package/src/utils/number.ts +2 -0
  86. package/src/utils/responseParser/rpc.ts +4 -20
  87. package/src/utils/responseParser/sequencer.ts +2 -0
  88. package/types/api/index.d.ts +0 -6
  89. package/types/api/openrpc.d.ts +24 -2
  90. package/types/api/sequencer.d.ts +22 -7
  91. package/types/index.d.ts +1 -1
  92. package/types/lib.d.ts +36 -2
  93. package/types/provider.d.ts +15 -10
  94. package/types/signer.d.ts +14 -1
  95. package/utils/hash.d.ts +2 -0
  96. package/utils/hash.js +13 -2
  97. package/utils/merkle.js +2 -4
  98. package/utils/number.d.ts +1 -0
  99. package/utils/number.js +3 -1
  100. package/utils/responseParser/rpc.d.ts +2 -6
  101. package/utils/responseParser/rpc.js +0 -11
  102. package/utils/responseParser/sequencer.js +4 -14
  103. package/www/docs/API/account.md +170 -11
  104. package/www/docs/API/contract.md +39 -3
  105. package/www/docs/API/provider.md +310 -17
  106. package/www/docs/API/signer.md +56 -2
  107. package/www/guides/erc20.md +13 -7
@@ -125,7 +125,7 @@ export class Contract implements ContractInterface {
125
125
  address: string,
126
126
  providerOrAccount: ProviderInterface | AccountInterface = defaultProvider
127
127
  ) {
128
- this.address = address.toLowerCase();
128
+ this.address = address && address.toLowerCase();
129
129
  this.providerOrAccount = providerOrAccount;
130
130
  this.abi = abi;
131
131
  this.structs = abi
@@ -204,30 +204,14 @@ export class Contract implements ContractInterface {
204
204
  });
205
205
  }
206
206
 
207
- /**
208
- * Saves the address of the contract deployed on network that will be used for interaction
209
- *
210
- * @param address - address of the contract
211
- */
212
207
  public attach(address: string): void {
213
208
  this.address = address;
214
209
  }
215
210
 
216
- /**
217
- * Attaches to new Provider or Account
218
- *
219
- * @param providerOrAccount - new Provider or Account to attach to
220
- */
221
211
  public connect(providerOrAccount: ProviderInterface | AccountInterface) {
222
212
  this.providerOrAccount = providerOrAccount;
223
213
  }
224
214
 
225
- /**
226
- * Resolves when contract is deployed on the network or when no deployment transaction is found
227
- *
228
- * @returns Promise that resolves when contract is deployed on the network or when no deployment transaction is found
229
- * @throws When deployment fails
230
- */
231
215
  public async deployed(): Promise<Contract> {
232
216
  if (this.deployTransactionHash) {
233
217
  await this.providerOrAccount.waitForTransaction(this.deployTransactionHash);
@@ -236,6 +220,129 @@ export class Contract implements ContractInterface {
236
220
  return this;
237
221
  }
238
222
 
223
+ public async call(
224
+ method: string,
225
+ args: Array<any> = [],
226
+ {
227
+ blockIdentifier = 'pending',
228
+ }: {
229
+ blockIdentifier?: BlockIdentifier;
230
+ } = {}
231
+ ): Promise<Result> {
232
+ // ensure contract is connected
233
+ assert(this.address !== null, 'contract is not connected to an address');
234
+
235
+ // validate method and args
236
+ this.validateMethodAndArgs('CALL', method, args);
237
+ const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
238
+
239
+ // compile calldata
240
+ const calldata = this.compileCalldata(args, inputs);
241
+ return this.providerOrAccount
242
+ .callContract(
243
+ {
244
+ contractAddress: this.address,
245
+ calldata,
246
+ entrypoint: method,
247
+ },
248
+ blockIdentifier
249
+ )
250
+ .then((x) => this.parseResponse(method, x.result));
251
+ }
252
+
253
+ public invoke(
254
+ method: string,
255
+ args: Array<any> = [],
256
+ options: Overrides = {}
257
+ ): Promise<InvokeFunctionResponse> {
258
+ // ensure contract is connected
259
+ assert(this.address !== null, 'contract is not connected to an address');
260
+ // validate method and args
261
+ this.validateMethodAndArgs('INVOKE', method, args);
262
+
263
+ const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
264
+ const inputsLength = inputs.reduce((acc, input) => {
265
+ if (!/_len$/.test(input.name)) {
266
+ return acc + 1;
267
+ }
268
+ return acc;
269
+ }, 0);
270
+
271
+ if (args.length !== inputsLength) {
272
+ throw Error(
273
+ `Invalid number of arguments, expected ${inputsLength} arguments, but got ${args.length}`
274
+ );
275
+ }
276
+ // compile calldata
277
+ const calldata = this.compileCalldata(args, inputs);
278
+
279
+ const invocation = {
280
+ contractAddress: this.address,
281
+ calldata,
282
+ entrypoint: method,
283
+ };
284
+ if ('execute' in this.providerOrAccount) {
285
+ return this.providerOrAccount.execute(invocation, undefined, {
286
+ maxFee: options.maxFee,
287
+ nonce: options.nonce,
288
+ });
289
+ }
290
+
291
+ if (!options.nonce) {
292
+ throw new Error(`Nonce is required when invoking a function without an account`);
293
+ }
294
+
295
+ // eslint-disable-next-line no-console
296
+ console.warn(`Invoking ${method} without an account. This will not work on a public node.`);
297
+
298
+ return this.providerOrAccount.invokeFunction(
299
+ {
300
+ ...invocation,
301
+ signature: options.signature || [],
302
+ },
303
+ {
304
+ nonce: options.nonce,
305
+ }
306
+ );
307
+ }
308
+
309
+ public async estimate(method: string, args: Array<any> = []) {
310
+ // ensure contract is connected
311
+ assert(this.address !== null, 'contract is not connected to an address');
312
+
313
+ // validate method and args
314
+ this.validateMethodAndArgs('INVOKE', method, args);
315
+ const invocation = this.populateTransaction[method](...args);
316
+ if ('estimateInvokeFee' in this.providerOrAccount) {
317
+ return this.providerOrAccount.estimateInvokeFee(invocation);
318
+ }
319
+ throw Error('Contract must be connected to the account contract to estimate');
320
+ }
321
+
322
+ public populate(method: string, args: Array<any> = []): Call {
323
+ const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
324
+ return {
325
+ contractAddress: this.address,
326
+ entrypoint: method,
327
+ calldata: this.compileCalldata(args, inputs),
328
+ };
329
+ }
330
+
331
+ /**
332
+ * Deep parse of the object that has been passed to the method
333
+ *
334
+ * @param struct - struct that needs to be calculated
335
+ * @return {number} - number of members for the given struct
336
+ */
337
+ private calculateStructMembers(struct: string): number {
338
+ return this.structs[struct].members.reduce((acc, member) => {
339
+ if (member.type === 'felt') {
340
+ return acc + 1;
341
+ }
342
+ return acc + this.calculateStructMembers(member.type);
343
+ }, 0);
344
+ }
345
+
239
346
  /**
240
347
  * Validates if all arguments that are passed to the method are corresponding to the ones in the abi
241
348
  *
@@ -337,22 +444,6 @@ export class Contract implements ContractInterface {
337
444
  });
338
445
  }
339
446
 
340
- /**
341
- * Deep parse of the object that has been passed to the method
342
- *
343
- * @param struct - struct that needs to be calculated
344
- * @return {number} - number of members for the given struct
345
- */
346
-
347
- private calculateStructMembers(struct: string): number {
348
- return this.structs[struct].members.reduce((acc, member) => {
349
- if (member.type === 'felt') {
350
- return acc + 1;
351
- }
352
- return acc + this.calculateStructMembers(member.type);
353
- }, 0);
354
- }
355
-
356
447
  /**
357
448
  * Deep parse of the object that has been passed to the method
358
449
  *
@@ -539,112 +630,4 @@ export class Contract implements ContractInterface {
539
630
  return acc;
540
631
  }, [] as Result);
541
632
  }
542
-
543
- public invoke(
544
- method: string,
545
- args: Array<any> = [],
546
- options: Overrides = {}
547
- ): Promise<InvokeFunctionResponse> {
548
- // ensure contract is connected
549
- assert(this.address !== null, 'contract isnt connected to an address');
550
- // validate method and args
551
- this.validateMethodAndArgs('INVOKE', method, args);
552
-
553
- const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
554
- const inputsLength = inputs.reduce((acc, input) => {
555
- if (!/_len$/.test(input.name)) {
556
- return acc + 1;
557
- }
558
- return acc;
559
- }, 0);
560
-
561
- if (args.length !== inputsLength) {
562
- throw Error(
563
- `Invalid number of arguments, expected ${inputsLength} arguments, but got ${args.length}`
564
- );
565
- }
566
- // compile calldata
567
- const calldata = this.compileCalldata(args, inputs);
568
-
569
- const invocation = {
570
- contractAddress: this.address,
571
- calldata,
572
- entrypoint: method,
573
- };
574
- if ('execute' in this.providerOrAccount) {
575
- return this.providerOrAccount.execute(invocation, undefined, {
576
- maxFee: options.maxFee,
577
- nonce: options.nonce,
578
- });
579
- }
580
-
581
- if (!options.nonce) {
582
- throw new Error(`Nonce is required when invoking a function without an account`);
583
- }
584
-
585
- // eslint-disable-next-line no-console
586
- console.warn(`Invoking ${method} without an account. This will not work on a public node.`);
587
-
588
- return this.providerOrAccount.invokeFunction(
589
- {
590
- ...invocation,
591
- signature: options.signature || [],
592
- },
593
- {
594
- nonce: options.nonce,
595
- }
596
- );
597
- }
598
-
599
- public async call(
600
- method: string,
601
- args: Array<any> = [],
602
- {
603
- blockIdentifier = 'pending',
604
- }: {
605
- blockIdentifier?: BlockIdentifier;
606
- } = {}
607
- ): Promise<Result> {
608
- // ensure contract is connected
609
- assert(this.address !== null, 'contract isnt connected to an address');
610
-
611
- // validate method and args
612
- this.validateMethodAndArgs('CALL', method, args);
613
- const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
614
-
615
- // compile calldata
616
- const calldata = this.compileCalldata(args, inputs);
617
- return this.providerOrAccount
618
- .callContract(
619
- {
620
- contractAddress: this.address,
621
- calldata,
622
- entrypoint: method,
623
- },
624
- blockIdentifier
625
- )
626
- .then((x) => this.parseResponse(method, x.result));
627
- }
628
-
629
- public async estimate(method: string, args: Array<any> = []) {
630
- // ensure contract is connected
631
- assert(this.address !== null, 'contract isnt connected to an address');
632
-
633
- // validate method and args
634
- this.validateMethodAndArgs('INVOKE', method, args);
635
- const invocation = this.populateTransaction[method](...args);
636
- if ('estimateFee' in this.providerOrAccount) {
637
- return this.providerOrAccount.estimateFee(invocation);
638
- }
639
- throw Error('Contract must be connected to the account contract to estimate');
640
- }
641
-
642
- public populate(method: string, args: Array<any> = []): Call {
643
- const { inputs } = this.abi.find((abi) => abi.name === method) as FunctionAbi;
644
- return {
645
- contractAddress: this.address,
646
- entrypoint: method,
647
- calldata: this.compileCalldata(args, inputs),
648
- };
649
- }
650
633
  }
@@ -57,6 +57,7 @@ export abstract class ContractInterface {
57
57
  *
58
58
  * @param method name of the method
59
59
  * @param args Array of the arguments for the call
60
+ * @param options optional blockIdentifier
60
61
  * @returns Result of the call as an array with key value pars
61
62
  */
62
63
  public abstract call(
@@ -72,6 +73,7 @@ export abstract class ContractInterface {
72
73
  *
73
74
  * @param method name of the method
74
75
  * @param args Array of the arguments for the invoke
76
+ * @param options
75
77
  * @returns Add Transaction Response
76
78
  */
77
79
  public abstract invoke(
@@ -81,10 +83,11 @@ export abstract class ContractInterface {
81
83
  ): Promise<InvokeFunctionResponse>;
82
84
 
83
85
  /**
84
- * Calls a method on a contract
86
+ * Estimates a method on a contract
85
87
  *
86
88
  * @param method name of the method
87
89
  * @param args Array of the arguments for the call
90
+ * @param options optional blockIdentifier
88
91
  */
89
92
  public abstract estimate(
90
93
  method: string,
@@ -99,7 +102,7 @@ export abstract class ContractInterface {
99
102
  *
100
103
  * @param method name of the method
101
104
  * @param args Array of the arguments for the call
102
- * @returns Invocation objet
105
+ * @returns Invocation object
103
106
  */
104
107
  public abstract populate(method: string, args?: Array<any>): Invocation;
105
108
  }
@@ -3,7 +3,6 @@ import {
3
3
  Call,
4
4
  CallContractResponse,
5
5
  ContractClass,
6
- DeclareContractPayload,
7
6
  DeclareContractResponse,
8
7
  DeployContractPayload,
9
8
  DeployContractResponse,
@@ -16,6 +15,7 @@ import {
16
15
  InvocationsDetailsWithNonce,
17
16
  InvokeFunctionResponse,
18
17
  } from '../types';
18
+ import { DeclareContractTransaction, DeployAccountContractTransaction } from '../types/lib';
19
19
  import { BigNumberish } from '../utils/number';
20
20
  import { ProviderInterface } from './interface';
21
21
  import { RpcProvider, RpcProviderOptions } from './rpc';
@@ -62,11 +62,23 @@ export class Provider implements ProviderInterface {
62
62
  }
63
63
 
64
64
  public async getEstimateFee(
65
- invocation: Invocation,
65
+ invocationWithTxType: Invocation,
66
66
  invocationDetails: InvocationsDetailsWithNonce,
67
67
  blockIdentifier: BlockIdentifier = 'pending'
68
68
  ): Promise<EstimateFeeResponse> {
69
- return this.provider.getEstimateFee(invocation, invocationDetails, blockIdentifier);
69
+ return this.provider.getEstimateFee(invocationWithTxType, invocationDetails, blockIdentifier);
70
+ }
71
+
72
+ public async getInvokeEstimateFee(
73
+ invocationWithTxType: Invocation,
74
+ invocationDetails: InvocationsDetailsWithNonce,
75
+ blockIdentifier: BlockIdentifier = 'pending'
76
+ ): Promise<EstimateFeeResponse> {
77
+ return this.provider.getInvokeEstimateFee(
78
+ invocationWithTxType,
79
+ invocationDetails,
80
+ blockIdentifier
81
+ );
70
82
  }
71
83
 
72
84
  public async getNonce(
@@ -110,8 +122,34 @@ export class Provider implements ProviderInterface {
110
122
  return this.provider.deployContract(payload);
111
123
  }
112
124
 
113
- public async declareContract(payload: DeclareContractPayload): Promise<DeclareContractResponse> {
114
- return this.provider.declareContract(payload);
125
+ public async deployAccountContract(
126
+ payload: DeployAccountContractTransaction,
127
+ details: InvocationsDetailsWithNonce
128
+ ): Promise<DeployContractResponse> {
129
+ return this.provider.deployAccountContract(payload, details);
130
+ }
131
+
132
+ public async declareContract(
133
+ transaction: DeclareContractTransaction,
134
+ details: InvocationsDetailsWithNonce
135
+ ): Promise<DeclareContractResponse> {
136
+ return this.provider.declareContract(transaction, details);
137
+ }
138
+
139
+ public async getDeclareEstimateFee(
140
+ transaction: DeclareContractTransaction,
141
+ details: InvocationsDetailsWithNonce,
142
+ blockIdentifier: BlockIdentifier = 'pending'
143
+ ): Promise<EstimateFeeResponse> {
144
+ return this.provider.getDeclareEstimateFee(transaction, details, blockIdentifier);
145
+ }
146
+
147
+ public getDeployAccountEstimateFee(
148
+ transaction: DeployAccountContractTransaction,
149
+ details: InvocationsDetailsWithNonce,
150
+ blockIdentifier: BlockIdentifier = 'pending'
151
+ ): Promise<EstimateFeeResponse> {
152
+ return this.provider.getDeployAccountEstimateFee(transaction, details, blockIdentifier);
115
153
  }
116
154
 
117
155
  public async getCode(
@@ -3,7 +3,6 @@ import type {
3
3
  Call,
4
4
  CallContractResponse,
5
5
  ContractClass,
6
- DeclareContractPayload,
7
6
  DeclareContractResponse,
8
7
  DeployContractPayload,
9
8
  DeployContractResponse,
@@ -16,6 +15,11 @@ import type {
16
15
  InvocationsDetailsWithNonce,
17
16
  InvokeFunctionResponse,
18
17
  } from '../types';
18
+ import {
19
+ DeclareContractTransaction,
20
+ DeployAccountContractPayload,
21
+ DeployAccountContractTransaction,
22
+ } from '../types/lib';
19
23
  import type { BigNumberish } from '../utils/number';
20
24
  import { BlockIdentifier } from './utils';
21
25
 
@@ -124,16 +128,18 @@ export abstract class ProviderInterface {
124
128
  public abstract deployContract(payload: DeployContractPayload): Promise<DeployContractResponse>;
125
129
 
126
130
  /**
127
- * Declares a given compiled contract (json) to starknet
131
+ * Deploys a given compiled Account contract (json) to starknet
128
132
  *
129
133
  * @param payload payload to be deployed containing:
130
134
  * - compiled contract code
131
- * - optional version
135
+ * - constructor calldata
136
+ * - address salt
132
137
  * @returns a confirmation of sending a transaction on the starknet contract
133
138
  */
134
- public abstract declareContract(
135
- payload: DeclareContractPayload
136
- ): Promise<DeclareContractResponse>;
139
+ public abstract deployAccountContract(
140
+ payload: DeployAccountContractPayload,
141
+ details: InvocationsDetailsWithNonce
142
+ ): Promise<DeployContractResponse>;
137
143
 
138
144
  /**
139
145
  * Invokes a function on starknet
@@ -156,7 +162,25 @@ export abstract class ProviderInterface {
156
162
  ): Promise<InvokeFunctionResponse>;
157
163
 
158
164
  /**
159
- * Estimates the fee for a given transaction
165
+ * Declares a given compiled contract (json) to starknet
166
+ * @param transaction transaction payload to be deployed containing:
167
+ * - compiled contract code
168
+ * - sender address
169
+ * - signature
170
+ * @param details Invocation Details containing:
171
+ * - nonce
172
+ * - optional version
173
+ * - optional maxFee
174
+ * @returns a confirmation of sending a transaction on the starknet contract
175
+ */
176
+ public abstract declareContract(
177
+ transaction: DeclareContractTransaction,
178
+ details: InvocationsDetailsWithNonce
179
+ ): Promise<DeclareContractResponse>;
180
+
181
+ /**
182
+ * Estimates the fee for a given INVOKE transaction
183
+ * @deprecated Please use getInvokeEstimateFee or getDeclareEstimateFee instead
160
184
  *
161
185
  * @param invocation the invocation object containing:
162
186
  * - contractAddress - the address of the contract
@@ -175,6 +199,67 @@ export abstract class ProviderInterface {
175
199
  blockIdentifier: BlockIdentifier
176
200
  ): Promise<EstimateFeeResponse>;
177
201
 
202
+ /**
203
+ * Estimates the fee for a given INVOKE transaction
204
+ *
205
+ * @param invocation the invocation object containing:
206
+ * - contractAddress - the address of the contract
207
+ * - entrypoint - the entrypoint of the contract
208
+ * - calldata - (defaults to []) the calldata
209
+ * - signature - (defaults to []) the signature
210
+ * @param blockIdentifier - block identifier
211
+ * @param details - optional details containing:
212
+ * - nonce - optional nonce
213
+ * - version - optional version
214
+ * @returns the estimated fee
215
+ */
216
+ public abstract getInvokeEstimateFee(
217
+ invocation: Invocation,
218
+ details: InvocationsDetailsWithNonce,
219
+ blockIdentifier: BlockIdentifier
220
+ ): Promise<EstimateFeeResponse>;
221
+
222
+ /**
223
+ * Estimates the fee for a given DECLARE transaction
224
+ *
225
+ * @param transaction transaction payload to be declared containing:
226
+ * - compiled contract code
227
+ * - sender address
228
+ * - signature - (defaults to []) the signature
229
+ * @param details - optional details containing:
230
+ * - nonce
231
+ * - version - optional version
232
+ * - optional maxFee
233
+ * @param blockIdentifier - block identifier
234
+ * @returns the estimated fee
235
+ */
236
+ public abstract getDeclareEstimateFee(
237
+ transaction: DeclareContractTransaction,
238
+ details: InvocationsDetailsWithNonce,
239
+ blockIdentifier: BlockIdentifier
240
+ ): Promise<EstimateFeeResponse>;
241
+
242
+ /**
243
+ * Estimates the fee for a given DEPLOY_ACCOUNT transaction
244
+ *
245
+ * @param transaction transaction payload to be deployed containing:
246
+ * - classHash
247
+ * - constructorCalldata
248
+ * - addressSalt
249
+ * - signature - (defaults to []) the signature
250
+ * @param details - optional details containing:
251
+ * - nonce
252
+ * - version - optional version
253
+ * - optional maxFee
254
+ * @param blockIdentifier - block identifier
255
+ * @returns the estimated fee
256
+ */
257
+ public abstract getDeployAccountEstimateFee(
258
+ transaction: DeployAccountContractTransaction,
259
+ details: InvocationsDetailsWithNonce,
260
+ blockIdentifier: BlockIdentifier
261
+ ): Promise<EstimateFeeResponse>;
262
+
178
263
  /**
179
264
  * Wait for the transaction to be accepted
180
265
  * @param txHash - transaction hash