starknet 1.7.0 → 2.1.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # [2.1.0](https://github.com/seanjameshan/starknet.js/compare/v2.0.1...v2.1.0) (2021-11-30)
2
+
3
+ ### Bug Fixes
4
+
5
+ - deps ([020ba39](https://github.com/seanjameshan/starknet.js/commit/020ba3948f03e41fc96c7c002b613250d73fbda6))
6
+ - transaction status pending ([198d82b](https://github.com/seanjameshan/starknet.js/commit/198d82b30dd8c0c978cfdd2d56cb5a7e5131cb6a))
7
+
8
+ ### Features
9
+
10
+ - support mainnet ([de07149](https://github.com/seanjameshan/starknet.js/commit/de07149ad6521edc9f79e2b0e9c82bf40f32fe02))
11
+
12
+ ## [2.0.1](https://github.com/seanjameshan/starknet.js/compare/v2.0.0...v2.0.1) (2021-11-18)
13
+
14
+ ### Bug Fixes
15
+
16
+ - msgHash length fix in signature verify function ([589b126](https://github.com/seanjameshan/starknet.js/commit/589b126b2b87bf7d0b2730f53a40ee2d9ef9aca0))
17
+
18
+ # [2.0.0](https://github.com/seanjameshan/starknet.js/compare/v1.7.0...v2.0.0) (2021-11-18)
19
+
20
+ ### Features
21
+
22
+ - alpha 4 ([f12db5a](https://github.com/seanjameshan/starknet.js/commit/f12db5a9d3d00902792a292e5258263edb7ac7a2))
23
+
24
+ ### BREAKING CHANGES
25
+
26
+ - implements alpha 4
27
+
1
28
  # [1.7.0](https://github.com/seanjameshan/starknet.js/compare/v1.6.0...v1.7.0) (2021-11-17)
2
29
 
3
30
  ### Features
@@ -13,7 +40,13 @@
13
40
  ### Features
14
41
 
15
42
  - add invokeFunction ([7e04b5e](https://github.com/seanjameshan/starknet.js/commit/7e04b5ec383fa6d466e9e06d9fa02e2d0c36b020))
16
- - add signer and provider v1 ([909fdc0](https://github.com/seanjameshan/starknet.js/commit/909fdc0b2b211755b9124b62f97476d89b655de1))
43
+ - # add signer and provider v1 ([909fdc0](https://github.com/seanjameshan/starknet.js/commit/909fdc0b2b211755b9124b62f97476d89b655de1))
44
+
45
+ ## [1.5.5](https://github.com/seanjameshan/starknet.js/compare/v1.5.4...v1.5.5) (2021-11-13)
46
+
47
+ ### Bug Fixes
48
+
49
+ - msgHash length fix in signature verify function ([589b126](https://github.com/seanjameshan/starknet.js/commit/589b126b2b87bf7d0b2730f53a40ee2d9ef9aca0))
17
50
 
18
51
  ## [1.5.4](https://github.com/seanjameshan/starknet.js/compare/v1.5.3...v1.5.4) (2021-11-05)
19
52
 
package/README.md CHANGED
@@ -44,23 +44,74 @@ $ npm install starknet
44
44
 
45
45
  Import `starknet` and use the [API](https://www.starknetjs.com/modules.html)
46
46
 
47
+ 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)
48
+
47
49
  ```javascript
48
- import { defaultProvider } from 'starknet';
50
+ import { defaultProvider, stark } from 'starknet';
51
+ const { getSelectorFromName } = stark;
52
+
53
+ const CONTRACT_ADDRESS =
54
+ "0x03e19baa6cb2078631bcdb34844f3f7879449a544c9ce722681a54af08cff4b9";
55
+
56
+ /**
57
+ * addTransaction() example
58
+ **/
59
+
60
+ /** Reset the liquidity pool **/
61
+ const addTokenResponse = await provider.addTransaction({
62
+ type: "INVOKE_FUNCTION",
63
+ contract_address: CONTRACT_ADDRESS,
64
+ entry_point_selector: getSelectorFromName("init_pool"),
65
+ calldata: ["1000000", "1000000"],
66
+ });
67
+ console.log(addTokenResponse);
68
+
69
+ /**
70
+ * callContract() example
71
+ **/
72
+
73
+ /** Get the balance of the liquidity pool of token A **/
74
+ const poolBalanceTokenA = await callContract({
75
+ contract_address: CONTRACT_ADDRESS,
76
+ entry_point_selector: getSelectorFromName("get_pool_token_balance"),
77
+ calldata: ["1"],
78
+ });
79
+ const balanceA = poolBalanceTokenA.result[0];
80
+ console.log('token a liquidity pool balance: ', parseInt(balanceA, 16));
49
81
 
50
- defaultProvider.getContractAddresses().then((data) => {
51
- console.log(data);
82
+ /** Get the balance of the liquidity pool of token B **/
83
+ const poolBalanceTokenB = await callContract({
84
+ contract_address: CONTRACT_ADDRESS,
85
+ entry_point_selector: getSelectorFromName("get_pool_token_balance"),
86
+ calldata: ["2"],
52
87
  });
88
+ const balanceB = poolBalanceTokenB.result[0];
89
+ console.log('token b liquidity pool balance: ', parseInt(balanceB, 16));
53
90
  ```
54
91
 
92
+ For more information about **signing transactions**, please take a look at this [pull request](https://github.com/seanjameshan/starknet.js/pull/51)
93
+
55
94
  ## 🌐 API
56
95
 
57
96
  [Click Here](https://www.starknetjs.com/modules.html)
58
97
 
59
- ## Contributing
98
+ ## 🚀 Powered by Starknet.js
99
+
100
+ - [Argent X - the first StarkNet wallet](https://github.com/argentlabs/argent-x)
101
+ - [React + Starknet.js boilerplate](https://github.com/fracek/starknet-react-example)
102
+ - [AMM Demo](https://www.starknetswap.com/)
103
+
104
+ ## ✏️ Contributing
60
105
 
61
106
  If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/seanjameshan/starknet.js/blob/main/CONTRIBUTING.md) first.
62
107
 
63
- ## License
108
+ ## ❤️ Special Thanks
109
+
110
+ 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.
111
+
112
+ This library would not be possible without these rockstars.
113
+
114
+ ## 📜 License
64
115
 
65
116
  Copyright (c) 2021 Sean James Han
66
117