starknet 3.12.2 → 3.13.1

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 (78) hide show
  1. package/.github/workflows/pr.yml +3 -0
  2. package/.github/workflows/release.yml +4 -0
  3. package/CHANGELOG.md +38 -0
  4. package/__mocks__/Account.json +25468 -0
  5. package/__tests__/account.test.ts +102 -65
  6. package/__tests__/contract.test.ts +23 -65
  7. package/__tests__/fixtures.ts +21 -1
  8. package/__tests__/provider.test.ts +20 -1
  9. package/account/default.d.ts +2 -9
  10. package/account/index.js +10 -6
  11. package/account/interface.d.ts +5 -3
  12. package/contract/default.d.ts +1 -1
  13. package/contract/default.js +20 -21
  14. package/contract/index.js +10 -6
  15. package/dist/account/default.d.ts +2 -6
  16. package/dist/account/index.js +5 -1
  17. package/dist/account/interface.d.ts +3 -3
  18. package/dist/contract/default.d.ts +1 -1
  19. package/dist/contract/default.js +18 -18
  20. package/dist/contract/index.js +5 -1
  21. package/dist/index.js +5 -1
  22. package/dist/provider/default.d.ts +3 -3
  23. package/dist/provider/default.js +10 -8
  24. package/dist/provider/index.js +5 -1
  25. package/dist/provider/interface.d.ts +9 -1
  26. package/dist/provider/utils.js +5 -5
  27. package/dist/signer/index.js +5 -1
  28. package/dist/types/account.d.ts +6 -0
  29. package/dist/types/api.d.ts +1 -1
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/index.js +6 -1
  32. package/dist/utils/ellipticCurve.js +1 -1
  33. package/dist/utils/encode.js +1 -1
  34. package/dist/utils/hash.js +1 -1
  35. package/dist/utils/number.js +8 -4
  36. package/dist/utils/shortString.js +2 -2
  37. package/dist/utils/typedData/index.d.ts +2 -36
  38. package/dist/utils/typedData/index.js +8 -4
  39. package/dist/utils/typedData/types.d.ts +15 -70
  40. package/dist/utils/typedData/types.js +0 -45
  41. package/dist/utils/typedData/utils.d.ts +2 -18
  42. package/dist/utils/typedData/utils.js +4 -3
  43. package/index.js +10 -6
  44. package/package.json +30 -29
  45. package/provider/default.d.ts +3 -3
  46. package/provider/default.js +11 -12
  47. package/provider/index.js +10 -6
  48. package/provider/interface.d.ts +9 -1
  49. package/provider/utils.js +5 -5
  50. package/signer/index.js +10 -6
  51. package/src/account/default.ts +2 -6
  52. package/src/account/interface.ts +5 -3
  53. package/src/provider/default.ts +6 -5
  54. package/src/provider/interface.ts +9 -1
  55. package/src/types/account.ts +7 -0
  56. package/src/types/api.ts +1 -1
  57. package/src/types/index.ts +1 -0
  58. package/src/utils/typedData/types.ts +15 -68
  59. package/src/utils/typedData/utils.ts +7 -4
  60. package/types/account.d.ts +6 -0
  61. package/types/api.d.ts +1 -1
  62. package/types/index.d.ts +1 -0
  63. package/types/index.js +11 -6
  64. package/utils/ellipticCurve.js +1 -1
  65. package/utils/encode.js +1 -1
  66. package/utils/hash.js +1 -1
  67. package/utils/number.js +13 -9
  68. package/utils/shortString.js +2 -2
  69. package/utils/typedData/index.d.ts +2 -46
  70. package/utils/typedData/index.js +15 -13
  71. package/utils/typedData/types.d.ts +15 -91
  72. package/utils/typedData/types.js +0 -55
  73. package/utils/typedData/utils.d.ts +2 -21
  74. package/utils/typedData/utils.js +4 -3
  75. package/www/docs/API/provider.md +2 -2
  76. package/www/guides/account.md +21 -7
  77. package/www/guides/erc20.md +15 -27
  78. package/__tests__/accountContract.test.ts +0 -110
@@ -1,49 +1,52 @@
1
1
  import { isBN } from 'bn.js';
2
2
 
3
3
  import typedDataExample from '../__mocks__/typedDataExample.json';
4
- import { Account, Contract, defaultProvider, ec, number, stark } from '../src';
4
+ import { Account, Contract, Provider, ec, number, stark } from '../src';
5
5
  import { toBN } from '../src/utils/number';
6
- import { compiledArgentAccount, compiledErc20, compiledTestDapp } from './fixtures';
6
+ import {
7
+ compiledErc20,
8
+ compiledOpenZeppelinAccount,
9
+ compiledTestDapp,
10
+ getTestAccount,
11
+ getTestProvider,
12
+ } from './fixtures';
7
13
 
8
14
  describe('deploy and test Wallet', () => {
9
- const privateKey = stark.randomAddress();
10
-
11
- const starkKeyPair = ec.getKeyPair(privateKey);
12
- const starkKeyPub = ec.getStarkKey(starkKeyPair);
13
- let account: Account;
15
+ const account: Account = getTestAccount();
16
+ const provider = getTestProvider();
14
17
  let erc20: Contract;
15
18
  let erc20Address: string;
16
19
  let dapp: Contract;
17
20
 
18
21
  beforeAll(async () => {
19
- const accountResponse = await defaultProvider.deployContract({
20
- contract: compiledArgentAccount,
21
- addressSalt: starkKeyPub,
22
- });
23
- const contract = new Contract(compiledArgentAccount.abi, accountResponse.address);
24
- expect(accountResponse.code).toBe('TRANSACTION_RECEIVED');
25
-
26
- const initializeResponse = await contract.initialize(starkKeyPub, '0');
27
- expect(initializeResponse.code).toBe('TRANSACTION_RECEIVED');
28
-
29
- account = new Account(defaultProvider, accountResponse.address, starkKeyPair);
22
+ expect(account).toBeInstanceOf(Account);
30
23
 
31
- const erc20Response = await defaultProvider.deployContract({
24
+ const erc20Response = await provider.deployContract({
32
25
  contract: compiledErc20,
33
26
  });
34
27
  erc20Address = erc20Response.address;
35
28
  erc20 = new Contract(compiledErc20.abi, erc20Address);
36
29
  expect(erc20Response.code).toBe('TRANSACTION_RECEIVED');
37
30
 
38
- const mintResponse = await erc20.mint(account.address, '1000');
31
+ await provider.waitForTransaction(erc20Response.transaction_hash);
32
+
33
+ const mintResponse = await account.execute({
34
+ contractAddress: erc20Address,
35
+ entrypoint: 'mint',
36
+ calldata: [account.address, '1000'],
37
+ });
38
+
39
39
  expect(mintResponse.code).toBe('TRANSACTION_RECEIVED');
40
40
 
41
- const dappResponse = await defaultProvider.deployContract({
41
+ await provider.waitForTransaction(mintResponse.transaction_hash);
42
+
43
+ const dappResponse = await provider.deployContract({
42
44
  contract: compiledTestDapp,
43
45
  });
44
46
  dapp = new Contract(compiledTestDapp.abi, dappResponse.address);
45
47
  expect(dappResponse.code).toBe('TRANSACTION_RECEIVED');
46
- await defaultProvider.waitForTransaction(dappResponse.transaction_hash);
48
+
49
+ await provider.waitForTransaction(dappResponse.transaction_hash);
47
50
  });
48
51
 
49
52
  test('estimate fee', async () => {
@@ -56,20 +59,6 @@ describe('deploy and test Wallet', () => {
56
59
  expect(typeof unit).toBe('string');
57
60
  });
58
61
 
59
- test('same wallet address', () => {
60
- expect(account.address).toBe(account.address);
61
- });
62
-
63
- test('read nonce', async () => {
64
- const { result } = await account.callContract({
65
- contractAddress: account.address,
66
- entrypoint: 'get_nonce',
67
- });
68
- const nonce = result[0];
69
-
70
- expect(number.toBN(nonce).toString()).toStrictEqual(number.toBN(0).toString());
71
- });
72
-
73
62
  test('read balance of wallet', async () => {
74
63
  const { res } = await erc20.balance_of(account.address);
75
64
 
@@ -77,18 +66,14 @@ describe('deploy and test Wallet', () => {
77
66
  });
78
67
 
79
68
  test('execute by wallet owner', async () => {
80
- const { code, transaction_hash } = await account.execute(
81
- {
82
- contractAddress: erc20Address,
83
- entrypoint: 'transfer',
84
- calldata: [erc20.address, '10'],
85
- },
86
- undefined,
87
- { maxFee: '0' }
88
- );
69
+ const { code, transaction_hash } = await account.execute({
70
+ contractAddress: erc20Address,
71
+ entrypoint: 'transfer',
72
+ calldata: [erc20.address, '10'],
73
+ });
89
74
 
90
75
  expect(code).toBe('TRANSACTION_RECEIVED');
91
- await defaultProvider.waitForTransaction(transaction_hash);
76
+ await provider.waitForTransaction(transaction_hash);
92
77
  });
93
78
 
94
79
  test('read balance of wallet after transfer', async () => {
@@ -110,33 +95,29 @@ describe('deploy and test Wallet', () => {
110
95
  calldata: [account.address, '10'],
111
96
  },
112
97
  undefined,
113
- { nonce, maxFee: '0' }
98
+ { nonce }
114
99
  );
115
100
 
116
101
  expect(code).toBe('TRANSACTION_RECEIVED');
117
- await defaultProvider.waitForTransaction(transaction_hash);
102
+ await provider.waitForTransaction(transaction_hash);
118
103
  });
119
104
 
120
105
  test('execute multiple transactions', async () => {
121
- const { code, transaction_hash } = await account.execute(
122
- [
123
- {
124
- contractAddress: dapp.address,
125
- entrypoint: 'set_number',
126
- calldata: ['47'],
127
- },
128
- {
129
- contractAddress: dapp.address,
130
- entrypoint: 'increase_number',
131
- calldata: ['10'],
132
- },
133
- ],
134
- undefined,
135
- { maxFee: '0' }
136
- );
106
+ const { code, transaction_hash } = await account.execute([
107
+ {
108
+ contractAddress: dapp.address,
109
+ entrypoint: 'set_number',
110
+ calldata: ['47'],
111
+ },
112
+ {
113
+ contractAddress: dapp.address,
114
+ entrypoint: 'increase_number',
115
+ calldata: ['10'],
116
+ },
117
+ ]);
137
118
 
138
119
  expect(code).toBe('TRANSACTION_RECEIVED');
139
- await defaultProvider.waitForTransaction(transaction_hash);
120
+ await provider.waitForTransaction(transaction_hash);
140
121
 
141
122
  const response = await dapp.get_number(account.address);
142
123
  expect(toBN(response.number as string).toString()).toStrictEqual('57');
@@ -147,4 +128,60 @@ describe('deploy and test Wallet', () => {
147
128
 
148
129
  expect(await account.verifyMessage(typedDataExample, signature)).toBe(true);
149
130
  });
131
+
132
+ describe('new deployed account', () => {
133
+ let newAccount: Account;
134
+
135
+ beforeAll(async () => {
136
+ const starkKeyPair = ec.genKeyPair();
137
+ const starkKeyPub = ec.getStarkKey(starkKeyPair);
138
+
139
+ const accountResponse = await provider.deployContract({
140
+ contract: compiledOpenZeppelinAccount,
141
+ constructorCalldata: [starkKeyPub],
142
+ });
143
+
144
+ await provider.waitForTransaction(accountResponse.transaction_hash);
145
+
146
+ newAccount = new Account(provider, accountResponse.address, starkKeyPair);
147
+ });
148
+
149
+ test('read nonce', async () => {
150
+ const { result } = await account.callContract({
151
+ contractAddress: newAccount.address,
152
+ entrypoint: 'get_nonce',
153
+ });
154
+ const nonce = result[0];
155
+
156
+ expect(number.toBN(nonce).toString()).toStrictEqual(number.toBN(0).toString());
157
+ });
158
+ });
159
+
160
+ describe('Contract interaction with Account', () => {
161
+ const wallet = stark.randomAddress();
162
+
163
+ beforeAll(async () => {
164
+ const mintResponse = await account.execute({
165
+ contractAddress: erc20Address,
166
+ entrypoint: 'mint',
167
+ calldata: [wallet, '1000'],
168
+ });
169
+
170
+ expect(mintResponse.code).toBe('TRANSACTION_RECEIVED');
171
+
172
+ await provider.waitForTransaction(mintResponse.transaction_hash);
173
+ });
174
+
175
+ test('change from provider to account', async () => {
176
+ expect(erc20.providerOrAccount instanceof Provider);
177
+ erc20.connect(account);
178
+ expect(erc20.providerOrAccount instanceof Account);
179
+ });
180
+
181
+ test('estimate gas fee for `mint`', async () => {
182
+ const res = await erc20.estimateFee.mint(wallet, '10');
183
+ expect(res).toHaveProperty('amount');
184
+ expect(res).toHaveProperty('unit');
185
+ });
186
+ });
150
187
  });
@@ -1,16 +1,19 @@
1
1
  import { isBN } from 'bn.js';
2
2
 
3
- import { Account, Contract, ContractFactory, Provider, defaultProvider, ec, stark } from '../src';
3
+ import { Account, Contract, ContractFactory, Provider, stark } from '../src';
4
4
  import { getSelectorFromName } from '../src/utils/hash';
5
5
  import { BigNumberish, toBN } from '../src/utils/number';
6
6
  import { compileCalldata } from '../src/utils/stark';
7
7
  import {
8
- compiledArgentAccount,
9
8
  compiledErc20,
10
9
  compiledMulticall,
11
10
  compiledTypeTransformation,
11
+ getTestAccount,
12
+ getTestProvider,
12
13
  } from './fixtures';
13
14
 
15
+ const provider = getTestProvider();
16
+
14
17
  describe('class Contract {}', () => {
15
18
  const wallet = stark.randomAddress();
16
19
 
@@ -19,27 +22,27 @@ describe('class Contract {}', () => {
19
22
  let contract: Contract;
20
23
 
21
24
  beforeAll(async () => {
22
- const { code, transaction_hash, address } = await defaultProvider.deployContract({
25
+ const { code, transaction_hash, address } = await provider.deployContract({
23
26
  contract: compiledErc20,
24
27
  });
25
- erc20 = new Contract(compiledErc20.abi, address, defaultProvider);
28
+ erc20 = new Contract(compiledErc20.abi, address!, provider);
26
29
  expect(code).toBe('TRANSACTION_RECEIVED');
27
- await defaultProvider.waitForTransaction(transaction_hash);
30
+ await provider.waitForTransaction(transaction_hash);
28
31
  // Deploy Multicall
29
32
 
30
33
  const {
31
34
  code: m_code,
32
35
  transaction_hash: m_transaction_hash,
33
36
  address: multicallAddress,
34
- } = await defaultProvider.deployContract({
37
+ } = await provider.deployContract({
35
38
  contract: compiledMulticall,
36
39
  });
37
40
 
38
- contract = new Contract(compiledMulticall.abi, multicallAddress);
41
+ contract = new Contract(compiledMulticall.abi, multicallAddress!);
39
42
 
40
43
  expect(m_code).toBe('TRANSACTION_RECEIVED');
41
44
 
42
- await defaultProvider.waitForTransaction(m_transaction_hash);
45
+ await provider.waitForTransaction(m_transaction_hash);
43
46
  });
44
47
 
45
48
  test('populate transaction for initial balance of that account', async () => {
@@ -61,20 +64,6 @@ describe('class Contract {}', () => {
61
64
  expect(res).toStrictEqual(result.res);
62
65
  });
63
66
 
64
- test('add 10 test ERC20 to account', async () => {
65
- const response = await erc20.mint(wallet, '10');
66
- expect(response.code).toBe('TRANSACTION_RECEIVED');
67
-
68
- await defaultProvider.waitForTransaction(response.transaction_hash);
69
- });
70
-
71
- test('read balance after mint of that account', async () => {
72
- const result = await erc20.balance_of(wallet);
73
- const [res] = result;
74
- expect(res).toStrictEqual(toBN(10));
75
- expect(res).toStrictEqual(result.res);
76
- });
77
-
78
67
  test('read balance in a multicall', async () => {
79
68
  const args1 = { user: wallet };
80
69
  const args2 = {};
@@ -103,12 +92,12 @@ describe('class Contract {}', () => {
103
92
  let contract: Contract;
104
93
 
105
94
  beforeAll(async () => {
106
- const { code, transaction_hash, address } = await defaultProvider.deployContract({
95
+ const { code, transaction_hash, address } = await provider.deployContract({
107
96
  contract: compiledTypeTransformation,
108
97
  });
109
- contract = new Contract(compiledTypeTransformation.abi, address, defaultProvider);
98
+ contract = new Contract(compiledTypeTransformation.abi, address!, provider);
110
99
  expect(code).toBe('TRANSACTION_RECEIVED');
111
- await defaultProvider.waitForTransaction(transaction_hash);
100
+ await provider.waitForTransaction(transaction_hash);
112
101
  });
113
102
 
114
103
  describe('Request Type Transformation', () => {
@@ -208,39 +197,24 @@ describe('class Contract {}', () => {
208
197
  });
209
198
 
210
199
  describe('Contract interaction with Account', () => {
211
- let account: Account;
200
+ const account = getTestAccount();
212
201
  let erc20: Contract;
213
202
  let erc20Address: string;
214
203
 
215
204
  beforeAll(async () => {
216
- const starkKeyPair = ec.genKeyPair();
217
- const starkKeyPub = ec.getStarkKey(starkKeyPair);
218
- const { address } = await defaultProvider.deployContract({
219
- contract: compiledArgentAccount,
220
- addressSalt: starkKeyPub,
221
- });
222
- expect(address).toBeDefined();
223
- account = new Account(defaultProvider, address, starkKeyPair);
224
- const accountContract = new Contract(compiledArgentAccount.abi, address);
225
- await accountContract.initialize(starkKeyPub, '0');
226
-
227
- const erc20Response = await defaultProvider.deployContract({
205
+ const erc20Response = await provider.deployContract({
228
206
  contract: compiledErc20,
229
207
  });
230
- erc20Address = erc20Response.address;
231
- erc20 = new Contract(compiledErc20.abi, erc20Address, defaultProvider);
208
+ erc20Address = erc20Response.address!;
209
+ erc20 = new Contract(compiledErc20.abi, erc20Address, provider);
232
210
  expect(erc20Response.code).toBe('TRANSACTION_RECEIVED');
233
- await defaultProvider.waitForTransaction(erc20Response.transaction_hash);
234
-
235
- const mintResponse = await erc20.mint(account.address, '1000');
236
-
237
- await defaultProvider.waitForTransaction(mintResponse.transaction_hash);
211
+ await provider.waitForTransaction(erc20Response.transaction_hash);
238
212
  });
239
213
 
240
214
  test('read balance of wallet', async () => {
241
215
  const result = await erc20.balance_of(account.address);
242
216
  const [res] = result;
243
- expect(res).toStrictEqual(toBN(1000));
217
+ expect(res).toStrictEqual(toBN(0));
244
218
  expect(res).toStrictEqual(result.res);
245
219
  });
246
220
 
@@ -255,34 +229,18 @@ describe('class Contract {}', () => {
255
229
  expect(res).toHaveProperty('amount');
256
230
  expect(res).toHaveProperty('unit');
257
231
  });
258
-
259
- test('read balance of wallet', async () => {
260
- const { res } = await erc20.balance_of(account.address);
261
-
262
- expect(res).toStrictEqual(toBN(1000));
263
- });
264
-
265
- test('invoke contract by wallet owner', async () => {
266
- const { transaction_hash, code } = await erc20.transfer(erc20Address, 10, {
267
- maxFee: 0,
268
- });
269
- expect(code).toBe('TRANSACTION_RECEIVED');
270
- await defaultProvider.waitForTransaction(transaction_hash);
271
- const { res } = await erc20.balance_of(account.address);
272
- expect(res).toStrictEqual(toBN(990));
273
- });
274
232
  });
275
233
  });
276
234
 
277
235
  describe('class ContractFactory {}', () => {
278
236
  let erc20Address: string;
279
237
  beforeAll(async () => {
280
- const { code, transaction_hash, address } = await defaultProvider.deployContract({
238
+ const { code, transaction_hash, address } = await provider.deployContract({
281
239
  contract: compiledErc20,
282
240
  });
283
241
  expect(code).toBe('TRANSACTION_RECEIVED');
284
- await defaultProvider.waitForTransaction(transaction_hash);
285
- erc20Address = address;
242
+ await provider.waitForTransaction(transaction_hash);
243
+ erc20Address = address!;
286
244
  });
287
245
  test('deployment of new contract', async () => {
288
246
  const factory = new ContractFactory(compiledErc20);
@@ -1,13 +1,33 @@
1
1
  import fs from 'fs';
2
2
 
3
- import { json } from '../src';
3
+ import { Account, defaultProvider, ec, json } from '../src';
4
4
  import { CompiledContract } from '../src/types';
5
5
 
6
6
  const readContract = (name: string): CompiledContract =>
7
7
  json.parse(fs.readFileSync(`./__mocks__/${name}.json`).toString('ascii'));
8
8
 
9
+ export const compiledOpenZeppelinAccount = readContract('Account');
9
10
  export const compiledArgentAccount = readContract('ArgentAccount');
10
11
  export const compiledErc20 = readContract('ERC20');
11
12
  export const compiledTypeTransformation = readContract('contract');
12
13
  export const compiledMulticall = readContract('multicall');
13
14
  export const compiledTestDapp = readContract('TestDapp');
15
+
16
+ const DEFAULT_TEST_ACCOUNT_ADDRESS =
17
+ '0x6c0a3ca4f79e978f3b7005898aaa49bef4a24aeaa5f10c6a97887516400197e';
18
+
19
+ export const getTestAccount = () => {
20
+ const testAccountAddress = process.env.TEST_ACCOUNT_ADDRESS || DEFAULT_TEST_ACCOUNT_ADDRESS;
21
+ const testAccountPrivateKey = process.env.TEST_ACCOUNT_PRIVATE_KEY;
22
+
23
+ if (!testAccountPrivateKey) {
24
+ throw new Error('TEST_ACCOUNT_PRIVATE_KEY is not set');
25
+ }
26
+
27
+ return new Account(defaultProvider, testAccountAddress, ec.getKeyPair(testAccountPrivateKey));
28
+ };
29
+
30
+ export const getTestProvider = () => {
31
+ // Will support both local and remote providers in the future
32
+ return defaultProvider;
33
+ };
@@ -1,4 +1,5 @@
1
1
  import { defaultProvider, stark } from '../src';
2
+ import { toBN } from '../src/utils/number';
2
3
  import { compiledArgentAccount } from './fixtures';
3
4
 
4
5
  const { compileCalldata } = stark;
@@ -42,7 +43,7 @@ describe('defaultProvider', () => {
42
43
  )
43
44
  ).resolves.not.toThrow();
44
45
  });
45
- test('getStorageAt()', () => {
46
+ test('getStorageAt() with "key" type of number', () => {
46
47
  return expect(
47
48
  defaultProvider.getStorageAt(
48
49
  '0x01d1f307c073bb786a66e6e042ec2a9bdc385a3373bb3738d95b966d5ce56166',
@@ -51,6 +52,24 @@ describe('defaultProvider', () => {
51
52
  )
52
53
  ).resolves.not.toThrow();
53
54
  });
55
+ test('getStorageAt() with "key" type of string', () => {
56
+ return expect(
57
+ defaultProvider.getStorageAt(
58
+ '0x01d1f307c073bb786a66e6e042ec2a9bdc385a3373bb3738d95b966d5ce56166',
59
+ '0',
60
+ 36663
61
+ )
62
+ ).resolves.not.toThrow();
63
+ });
64
+ test('getStorageAt() with "key" type of BN', () => {
65
+ return expect(
66
+ defaultProvider.getStorageAt(
67
+ '0x01d1f307c073bb786a66e6e042ec2a9bdc385a3373bb3738d95b966d5ce56166',
68
+ toBN('0x0'),
69
+ 36663
70
+ )
71
+ ).resolves.not.toThrow();
72
+ });
54
73
  test('getStorageAt(blockHash=undefined, blockNumber=null)', () => {
55
74
  return expect(
56
75
  defaultProvider.getStorageAt(
@@ -1,5 +1,4 @@
1
1
  import { Provider, ProviderInterface } from '../provider';
2
- import { BlockIdentifier } from '../provider/utils';
3
2
  import { SignerInterface } from '../signer';
4
3
  import {
5
4
  Abi,
@@ -10,7 +9,7 @@ import {
10
9
  Signature,
11
10
  Transaction,
12
11
  } from '../types';
13
- import { EstimateFee } from '../types/account';
12
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
14
13
  import { BigNumberish } from '../utils/number';
15
14
  import { TypedData } from '../utils/typedData';
16
15
  import { AccountInterface } from './interface';
@@ -25,13 +24,7 @@ export declare class Account extends Provider implements AccountInterface {
25
24
  getNonce(): Promise<string>;
26
25
  estimateFee(
27
26
  calls: Call | Call[],
28
- {
29
- nonce: providedNonce,
30
- blockIdentifier,
31
- }?: {
32
- nonce?: BigNumberish;
33
- blockIdentifier?: BlockIdentifier;
34
- }
27
+ { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails
35
28
  ): Promise<EstimateFee>;
36
29
  /**
37
30
  * Invoke execute function in account contract
package/account/index.js CHANGED
@@ -4,12 +4,16 @@ var __createBinding =
4
4
  (Object.create
5
5
  ? function (o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, {
8
- enumerable: true,
9
- get: function () {
10
- return m[k];
11
- },
12
- });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }
14
18
  : function (o, m, k, k2) {
15
19
  if (k2 === undefined) k2 = k;
@@ -5,11 +5,10 @@ import {
5
5
  AddTransactionResponse,
6
6
  Call,
7
7
  DeployContractPayload,
8
- Invocation,
9
8
  InvocationsDetails,
10
9
  Signature,
11
10
  } from '../types';
12
- import { EstimateFee } from '../types/account';
11
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
13
12
  import { BigNumberish } from '../utils/number';
14
13
  import { TypedData } from '../utils/typedData/types';
15
14
  export declare abstract class AccountInterface extends ProviderInterface {
@@ -40,7 +39,10 @@ export declare abstract class AccountInterface extends ProviderInterface {
40
39
  *
41
40
  * @returns response from addTransaction
42
41
  */
43
- abstract estimateFee(invocation: Invocation): Promise<EstimateFee>;
42
+ abstract estimateFee(
43
+ calls: Call | Call[],
44
+ estimateFeeDetails?: EstimateFeeDetails
45
+ ): Promise<EstimateFee>;
44
46
  /**
45
47
  * Invoke execute function in account contract
46
48
  *
@@ -148,6 +148,6 @@ export declare class Contract implements ContractInterface {
148
148
  blockIdentifier?: BlockIdentifier;
149
149
  }
150
150
  ): Promise<Result>;
151
- estimate(method: string, args?: Array<any>): Promise<import('../types/account').EstimateFee>;
151
+ estimate(method: string, args?: Array<any>): Promise<import('../types').EstimateFee>;
152
152
  populate(method: string, args?: Array<any>): Invocation;
153
153
  }