starknet 3.7.0 → 3.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 (79) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +18 -53
  3. package/__mocks__/ArgentAccount.json +32022 -38726
  4. package/__tests__/accountContract.test.ts +42 -32
  5. package/__tests__/contract.test.ts +20 -6
  6. package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +2 -2
  7. package/__tests__/utils/__snapshots__/utils.test.ts.snap +2 -2
  8. package/__tests__/utils/ellipticalCurve.test.ts +26 -8
  9. package/__tests__/utils/transactionHash.test.ts +17 -0
  10. package/__tests__/utils/utils.test.ts +10 -0
  11. package/account/default.d.ts +11 -1
  12. package/account/default.js +58 -50
  13. package/constants.d.ts +9 -0
  14. package/constants.js +13 -0
  15. package/contract/default.d.ts +12 -2
  16. package/contract/default.js +27 -20
  17. package/contract/interface.d.ts +21 -3
  18. package/dist/account/default.d.ts +5 -1
  19. package/dist/account/default.js +46 -30
  20. package/dist/constants.d.ts +9 -0
  21. package/dist/constants.js +12 -1
  22. package/dist/contract/default.d.ts +6 -3
  23. package/dist/contract/default.js +23 -20
  24. package/dist/contract/interface.d.ts +9 -4
  25. package/dist/provider/default.d.ts +5 -2
  26. package/dist/provider/default.js +36 -19
  27. package/dist/provider/interface.d.ts +2 -0
  28. package/dist/provider/utils.d.ts +1 -2
  29. package/dist/provider/utils.js +7 -8
  30. package/dist/signer/default.js +4 -2
  31. package/dist/signer/ledger.js +4 -2
  32. package/dist/types/api.d.ts +4 -1
  33. package/dist/types/lib.d.ts +1 -0
  34. package/dist/types/signer.d.ts +2 -0
  35. package/dist/utils/hash.d.ts +5 -3
  36. package/dist/utils/hash.js +25 -23
  37. package/dist/utils/stark.d.ts +3 -0
  38. package/dist/utils/stark.js +8 -1
  39. package/dist/utils/transaction.d.ts +2 -0
  40. package/dist/utils/transaction.js +5 -1
  41. package/dist/utils/typedData/index.d.ts +2 -2
  42. package/dist/utils/typedData/types.d.ts +3 -3
  43. package/dist/utils/typedData/utils.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/provider/default.d.ts +7 -2
  46. package/provider/default.js +49 -27
  47. package/provider/interface.d.ts +2 -0
  48. package/provider/utils.d.ts +1 -2
  49. package/provider/utils.js +7 -8
  50. package/signer/default.js +12 -5
  51. package/signer/ledger.js +12 -5
  52. package/src/account/default.ts +47 -18
  53. package/src/constants.ts +10 -0
  54. package/src/contract/default.ts +32 -19
  55. package/src/contract/interface.ts +21 -3
  56. package/src/provider/default.ts +37 -12
  57. package/src/provider/interface.ts +3 -0
  58. package/src/provider/utils.ts +7 -8
  59. package/src/signer/default.ts +10 -5
  60. package/src/signer/ledger.ts +10 -5
  61. package/src/types/api.ts +4 -1
  62. package/src/types/lib.ts +1 -0
  63. package/src/types/signer.ts +2 -0
  64. package/src/utils/hash.ts +70 -26
  65. package/src/utils/stark.ts +8 -1
  66. package/src/utils/transaction.ts +7 -0
  67. package/types/api.d.ts +4 -1
  68. package/types/lib.d.ts +1 -0
  69. package/types/signer.d.ts +2 -0
  70. package/utils/hash.d.ts +25 -7
  71. package/utils/hash.js +60 -26
  72. package/utils/stark.d.ts +4 -0
  73. package/utils/stark.js +13 -1
  74. package/utils/transaction.d.ts +5 -0
  75. package/utils/transaction.js +12 -1
  76. package/utils/typedData/index.d.ts +2 -2
  77. package/utils/typedData/types.d.ts +3 -3
  78. package/utils/typedData/utils.d.ts +1 -1
  79. package/__tests__/constancts.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ # [3.10.0](https://github.com/seanjameshan/starknet.js/compare/v3.9.0...v3.10.0) (2022-04-20)
2
+
3
+ ### Bug Fixes
4
+
5
+ - new snapshot for browser test ([3394f11](https://github.com/seanjameshan/starknet.js/commit/3394f1110c715826cbc7c3dff1bef1a5b73e80d8))
6
+ - review ([49b04e2](https://github.com/seanjameshan/starknet.js/commit/49b04e231418ca7d26dc78843a905541985aa176))
7
+
8
+ ### Features
9
+
10
+ - **account:** new hash formula ([ea4df2c](https://github.com/seanjameshan/starknet.js/commit/ea4df2c77e6559f9689eaca3c57edbbb9324073a))
11
+
12
+ # [3.9.0](https://github.com/seanjameshan/starknet.js/compare/v3.8.0...v3.9.0) (2022-04-08)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **account:** adding overhead on estimateFee for maxFee ([ec52f61](https://github.com/seanjameshan/starknet.js/commit/ec52f61aed9a8755491a4b7de73517b075785479))
17
+ - **contract:** override object when invoking a function ([c605151](https://github.com/seanjameshan/starknet.js/commit/c605151c03b544bf62ff9ab2e314e49de3cd562a))
18
+ - estimatedFeeToMaxFee with integers only ([71d19a7](https://github.com/seanjameshan/starknet.js/commit/71d19a7db01630ca0dba55011ff440243d7db992))
19
+ - rename txVersion to version ([2ae36b2](https://github.com/seanjameshan/starknet.js/commit/2ae36b2c075dbee4710abe47770af35478ceba4e))
20
+ - **utils:** remove check for the BN ([50a7951](https://github.com/seanjameshan/starknet.js/commit/50a79514343e303c397358efdba978fec5f93f48))
21
+
22
+ ### Features
23
+
24
+ - **account:** adding new transaction version for fee estimation ([2f7cb3f](https://github.com/seanjameshan/starknet.js/commit/2f7cb3fe85c973bcff3e39db333a9ed969c550b1))
25
+
26
+ # [3.8.0](https://github.com/seanjameshan/starknet.js/compare/v3.7.0...v3.8.0) (2022-04-04)
27
+
28
+ ### Bug Fixes
29
+
30
+ - getBlock should not default to pending block ([7a641b5](https://github.com/seanjameshan/starknet.js/commit/7a641b55c3c762dada70814bf509b147f0cd315e))
31
+
32
+ ### Features
33
+
34
+ - complete interface ([39d2f05](https://github.com/seanjameshan/starknet.js/commit/39d2f0574691e4b37a6050831b4e548b07a8e3e3))
35
+ - default estimateFee to pending block ([719dda5](https://github.com/seanjameshan/starknet.js/commit/719dda5f33a2bed353bd1bf311a2baf3110d1654))
36
+ - default to pending block ([d3c1bdc](https://github.com/seanjameshan/starknet.js/commit/d3c1bdcdca996bce273673cf9c8220156e965863))
37
+ - pending as success ([9e79288](https://github.com/seanjameshan/starknet.js/commit/9e7928845cc1e7088ba9a8dc9ba8fb9311970440))
38
+
1
39
  # [3.7.0](https://github.com/seanjameshan/starknet.js/compare/v3.6.0...v3.7.0) (2022-03-24)
2
40
 
3
41
  ### Features
package/README.md CHANGED
@@ -40,62 +40,19 @@ Install starknet with `npm`
40
40
 
41
41
  ```bash
42
42
  $ npm install starknet
43
- # or
43
+ # or for pre-release features:
44
44
  $ npm install starknet@next
45
45
  ```
46
46
 
47
- Import `starknet` and use the [API](https://www.starknetjs.com/modules.html)
48
-
49
- The following code is used to build a [simple AMM example](https://starkfin.netlify.app/) from the [cairo docs](https://www.cairo-lang.org/docs/hello_starknet/amm.html)
50
-
51
- ```javascript
52
- import { defaultProvider, stark } from 'starknet';
53
- const { getSelectorFromName } = stark;
54
-
55
- const CONTRACT_ADDRESS =
56
- "0x03e19baa6cb2078631bcdb34844f3f7879449a544c9ce722681a54af08cff4b9";
57
-
58
- /**
59
- * invokeFunction() example
60
- **/
61
-
62
- /** Reset the liquidity pool **/
63
- const addTokenResponse = await defaultProvider.invokeFunction(
64
- {
65
- contractAddress: CONTRACT_ADDRESS,
66
- entrypoint: "init_pool",
67
- calldata: ["1000000", "1000000"],
68
- },
69
- abi // for displaying purposes only (default implementation has no display/ui)
70
- );
71
- console.log(addTokenResponse);
72
-
73
- /**
74
- * callContract() example
75
- **/
76
-
77
- /** Get the balance of the liquidity pool of token A **/
78
- const poolBalanceTokenA = await defaultProvider.callContract({
79
- contractAddress: CONTRACT_ADDRESS,
80
- entrypoint: "get_pool_token_balance",
81
- calldata: ["1"],
82
- });
83
- const balanceA = poolBalanceTokenA.result[0];
84
- console.log('token a liquidity pool balance: ', parseInt(balanceA, 16));
85
-
86
- /** Get the balance of the liquidity pool of token B **/
87
- const poolBalanceTokenB = await defaultProvider.callContract({
88
- contractAddress: CONTRACT_ADDRESS,
89
- entrypoint: "get_pool_token_balance",
90
- calldata: ["2"],
91
- });
92
- const balanceB = poolBalanceTokenB.result[0];
93
- console.log('token b liquidity pool balance: ', parseInt(balanceB, 16));
94
- ```
47
+ Import `starknet` and use the [API](https://www.starknetjs.com/docs/API/)
48
+
49
+ Please refer to the following code example [here](https://github.com/0xs34n/starknet.js-workshop/blob/main/index.js)
50
+
51
+ Guides can be found [here](https://www.starknetjs.com/guides/intro)
95
52
 
96
53
  ## 🌐 API
97
54
 
98
- [Click Here](https://www.starknetjs.com/modules.html)
55
+ [Click Here](https://www.starknetjs.com/docs/API/)
99
56
 
100
57
  ## 🚀 Powered by Starknet.js
101
58
 
@@ -105,11 +62,19 @@ console.log('token b liquidity pool balance: ', parseInt(balanceB, 16));
105
62
 
106
63
  ## ✏️ Contributing
107
64
 
108
- If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/seanjameshan/starknet.js/blob/main/CONTRIBUTING.md) first.
65
+ If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/0xs34n/starknet.js/blob/main/CONTRIBUTING.md) first.
109
66
 
110
67
  ## ❤️ Special Thanks
111
68
 
112
- Special thanks to all the [contributors](https://github.com/seanjameshan/starknet.js/graphs/contributors), especially to Janek ([@janek26](https://github.com/janek26)) from [Argent](https://github.com/argentlabs) for driving the development of Starknet.js.
69
+ Special thanks to all the [contributors](https://github.com/0xs34n/starknet.js/graphs/contributors), especially to:
70
+
71
+ Janek ([@janek26](https://github.com/janek26)) and Axel ([@delaaxe](https://github.com/delaaxe)) from [Argent](https://github.com/argentlabs)
72
+
73
+ Miljan ([@MilGard91](https://github.com/MilGard91)) from [Shard Labs](https://shardlabs.io/)
74
+
75
+ Dhruv ([@dhruvkelawala](https://github.com/dhruvkelawala)) from [Jedi Swap](https://twitter.com/jediswap)
76
+
77
+ and of course the [StarkWare](https://starkware.co/) team for their dedicated support!
113
78
 
114
79
  This library would not be possible without these rockstars.
115
80
 
@@ -117,4 +82,4 @@ This library would not be possible without these rockstars.
117
82
 
118
83
  Copyright (c) 2022 0xs34n
119
84
 
120
- Licensed under the [MIT license](https://github.com/seanjameshan/starknet.js/blob/main/LICENSE).
85
+ Licensed under the [MIT license](https://github.com/0xs34n/starknet.js/blob/main/LICENSE).