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 +34 -1
- package/README.md +56 -5
- package/__mocks__/ArgentAccount.json +42401 -49045
- package/__mocks__/ERC20.json +3721 -3274
- package/__mocks__/Readme.md +2 -0
- package/__tests__/account.test.ts +6 -6
- package/__tests__/provider.test.ts +5 -5
- package/__tests__/signer.test.ts +1 -1
- package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +2 -2
- package/__tests__/utils/__snapshots__/utils.test.ts.snap +2 -2
- package/__tests__/utils/ellipticalCurve.test.ts +18 -6
- package/__tests__/utils/utils.test.ts +3 -3
- package/dist/provider/default.d.ts +7 -5
- package/dist/provider/default.js +12 -6
- package/dist/signer/default.js +2 -3
- package/dist/types.d.ts +6 -6
- package/dist/utils/ellipticCurve.js +1 -1
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +7 -15
- package/dist/utils/stark.d.ts +0 -1
- package/dist/utils/stark.js +1 -30
- package/package.json +1 -1
- package/provider/default.d.ts +11 -5
- package/provider/default.js +16 -7
- package/signer/default.js +2 -2
- package/src/provider/default.ts +22 -11
- package/src/signer/default.ts +2 -2
- package/src/types.ts +6 -6
- package/src/utils/ellipticCurve.ts +1 -1
- package/src/utils/hash.ts +6 -14
- package/src/utils/stark.ts +1 -5
- package/tsconfig.json +3 -2
- package/types.d.ts +6 -6
- package/utils/ellipticCurve.js +1 -1
- package/utils/hash.d.ts +1 -0
- package/utils/hash.js +16 -15
- package/utils/stark.d.ts +0 -1
- package/utils/stark.js +1 -45
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
|
-
|
|
51
|
-
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
|