starknet 3.8.0 → 3.10.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.
- package/CHANGELOG.md +35 -0
- package/README.md +18 -53
- package/__mocks__/ArgentAccount.json +32022 -38726
- package/__tests__/accountContract.test.ts +42 -32
- package/__tests__/contract.test.ts +20 -6
- 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 +26 -8
- package/__tests__/utils/transactionHash.test.ts +17 -0
- package/__tests__/utils/utils.test.ts +10 -0
- package/account/default.d.ts +10 -6
- package/account/default.js +32 -39
- package/account/interface.d.ts +2 -0
- package/constants.d.ts +9 -0
- package/constants.js +13 -0
- package/contract/contractFactory.d.ts +5 -5
- package/contract/default.js +14 -2
- package/dist/account/default.d.ts +6 -6
- package/dist/account/default.js +32 -23
- package/dist/account/interface.d.ts +2 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +12 -1
- package/dist/contract/contractFactory.d.ts +5 -5
- package/dist/contract/default.js +14 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/provider/default.d.ts +4 -1
- package/dist/provider/default.js +20 -1
- package/dist/provider/interface.d.ts +2 -0
- package/dist/signer/default.js +4 -2
- package/dist/signer/ledger.js +4 -2
- package/dist/types/api.d.ts +1 -0
- package/dist/types/lib.d.ts +1 -0
- package/dist/types/signer.d.ts +2 -0
- package/dist/utils/hash.d.ts +5 -3
- package/dist/utils/hash.js +25 -23
- package/dist/utils/stark.d.ts +3 -0
- package/dist/utils/stark.js +8 -1
- package/dist/utils/transaction.d.ts +2 -0
- package/dist/utils/transaction.js +5 -1
- package/dist/utils/typedData/index.d.ts +2 -2
- package/dist/utils/typedData/types.d.ts +3 -3
- package/dist/utils/typedData/utils.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/provider/default.d.ts +4 -1
- package/provider/default.js +21 -1
- package/provider/interface.d.ts +2 -0
- package/signer/default.js +12 -5
- package/signer/ledger.js +12 -5
- package/src/account/default.ts +38 -17
- package/src/account/interface.ts +3 -0
- package/src/constants.ts +10 -0
- package/src/contract/contractFactory.ts +5 -5
- package/src/contract/default.ts +13 -2
- package/src/index.ts +1 -0
- package/src/provider/default.ts +23 -2
- package/src/provider/interface.ts +3 -0
- package/src/signer/default.ts +10 -5
- package/src/signer/ledger.ts +10 -5
- package/src/types/api.ts +1 -0
- package/src/types/lib.ts +1 -0
- package/src/types/signer.ts +2 -0
- package/src/utils/hash.ts +70 -26
- package/src/utils/stark.ts +8 -1
- package/src/utils/transaction.ts +7 -0
- package/types/api.d.ts +1 -0
- package/types/lib.d.ts +1 -0
- package/types/signer.d.ts +2 -0
- package/utils/hash.d.ts +25 -7
- package/utils/hash.js +60 -26
- package/utils/stark.d.ts +4 -0
- package/utils/stark.js +13 -1
- package/utils/transaction.d.ts +5 -0
- package/utils/transaction.js +12 -1
- package/utils/typedData/index.d.ts +2 -2
- package/utils/typedData/types.d.ts +3 -3
- package/utils/typedData/utils.d.ts +1 -1
- package/__tests__/constancts.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## [3.10.1](https://github.com/seanjameshan/starknet.js/compare/v3.10.0...v3.10.1) (2022-04-20)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **account:** function documentation fix ([34a9779](https://github.com/seanjameshan/starknet.js/commit/34a977953c2bfea53f9cd1157809919b1dd2ed04))
|
|
6
|
+
- **contractFactory:** wrong prop type ([598bcd0](https://github.com/seanjameshan/starknet.js/commit/598bcd0d589c00e2219522d4a342316598678d4e))
|
|
7
|
+
- **contract:** recursion function name fix ([803b6dc](https://github.com/seanjameshan/starknet.js/commit/803b6dcf5cad5cdfd8258a53e176bcd96300cef3))
|
|
8
|
+
- typings ([1fadf41](https://github.com/seanjameshan/starknet.js/commit/1fadf418b04d96ced8d994b35699f40be9a8c898))
|
|
9
|
+
- **utils:** adding transaction utils to the utils export ([6429179](https://github.com/seanjameshan/starknet.js/commit/642917922a5d5278e8c575a2b4ffd60fff53cf42))
|
|
10
|
+
|
|
11
|
+
# [3.10.0](https://github.com/seanjameshan/starknet.js/compare/v3.9.0...v3.10.0) (2022-04-20)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- new snapshot for browser test ([3394f11](https://github.com/seanjameshan/starknet.js/commit/3394f1110c715826cbc7c3dff1bef1a5b73e80d8))
|
|
16
|
+
- review ([49b04e2](https://github.com/seanjameshan/starknet.js/commit/49b04e231418ca7d26dc78843a905541985aa176))
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **account:** new hash formula ([ea4df2c](https://github.com/seanjameshan/starknet.js/commit/ea4df2c77e6559f9689eaca3c57edbbb9324073a))
|
|
21
|
+
|
|
22
|
+
# [3.9.0](https://github.com/seanjameshan/starknet.js/compare/v3.8.0...v3.9.0) (2022-04-08)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- **account:** adding overhead on estimateFee for maxFee ([ec52f61](https://github.com/seanjameshan/starknet.js/commit/ec52f61aed9a8755491a4b7de73517b075785479))
|
|
27
|
+
- **contract:** override object when invoking a function ([c605151](https://github.com/seanjameshan/starknet.js/commit/c605151c03b544bf62ff9ab2e314e49de3cd562a))
|
|
28
|
+
- estimatedFeeToMaxFee with integers only ([71d19a7](https://github.com/seanjameshan/starknet.js/commit/71d19a7db01630ca0dba55011ff440243d7db992))
|
|
29
|
+
- rename txVersion to version ([2ae36b2](https://github.com/seanjameshan/starknet.js/commit/2ae36b2c075dbee4710abe47770af35478ceba4e))
|
|
30
|
+
- **utils:** remove check for the BN ([50a7951](https://github.com/seanjameshan/starknet.js/commit/50a79514343e303c397358efdba978fec5f93f48))
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
- **account:** adding new transaction version for fee estimation ([2f7cb3f](https://github.com/seanjameshan/starknet.js/commit/2f7cb3fe85c973bcff3e39db333a9ed969c550b1))
|
|
35
|
+
|
|
1
36
|
# [3.8.0](https://github.com/seanjameshan/starknet.js/compare/v3.7.0...v3.8.0) (2022-04-04)
|
|
2
37
|
|
|
3
38
|
### Bug Fixes
|
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/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
85
|
+
Licensed under the [MIT license](https://github.com/0xs34n/starknet.js/blob/main/LICENSE).
|