starknet 3.5.0 → 3.7.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 +33 -0
  2. package/__tests__/account.test.ts +38 -20
  3. package/__tests__/accountContract.test.ts +0 -31
  4. package/__tests__/constancts.ts +2 -0
  5. package/__tests__/contract.test.ts +14 -21
  6. package/__tests__/provider.test.ts +8 -0
  7. package/account/default.d.ts +4 -1
  8. package/account/default.js +63 -14
  9. package/account/interface.d.ts +14 -0
  10. package/contract/default.d.ts +6 -6
  11. package/contract/default.js +28 -13
  12. package/contract/interface.d.ts +4 -4
  13. package/dist/account/default.d.ts +4 -2
  14. package/dist/account/default.js +50 -11
  15. package/dist/account/interface.d.ts +13 -1
  16. package/dist/contract/default.d.ts +6 -6
  17. package/dist/contract/default.js +23 -12
  18. package/dist/contract/interface.d.ts +4 -4
  19. package/dist/provider/default.d.ts +9 -2
  20. package/dist/provider/default.js +16 -11
  21. package/dist/signer/index.d.ts +1 -0
  22. package/dist/signer/index.js +1 -0
  23. package/dist/signer/ledger.d.ts +12 -0
  24. package/dist/signer/ledger.js +138 -0
  25. package/dist/types/api.d.ts +57 -2
  26. package/package.json +5 -2
  27. package/provider/default.d.ts +9 -1
  28. package/provider/default.js +19 -15
  29. package/signer/index.d.ts +1 -0
  30. package/signer/index.js +1 -0
  31. package/signer/ledger.d.ts +15 -0
  32. package/signer/ledger.js +243 -0
  33. package/src/account/default.ts +28 -6
  34. package/src/account/interface.ts +15 -0
  35. package/src/contract/default.ts +33 -28
  36. package/src/contract/interface.ts +4 -4
  37. package/src/provider/default.ts +13 -11
  38. package/src/signer/index.ts +1 -0
  39. package/src/signer/ledger.ts +81 -0
  40. package/src/types/api.ts +62 -3
  41. package/tsconfig.json +1 -10
  42. package/types/api.d.ts +57 -2
  43. package/www/README.md +41 -0
  44. package/www/babel.config.js +3 -0
  45. package/www/code-examples/account.js +62 -0
  46. package/www/code-examples/amm.js +49 -0
  47. package/www/code-examples/erc20.js +10 -0
  48. package/www/code-examples/package-lock.json +336 -0
  49. package/www/code-examples/package.json +15 -0
  50. package/www/docs/API/_category_.json +5 -0
  51. package/www/docs/API/account.md +11 -0
  52. package/www/docs/API/contract.md +14 -0
  53. package/www/docs/API/index.md +4 -0
  54. package/www/docs/API/provider.md +10 -0
  55. package/www/docs/API/signer.md +8 -0
  56. package/www/docusaurus.config.js +131 -0
  57. package/www/guides/account.md +60 -0
  58. package/www/guides/cra.md +3 -0
  59. package/www/guides/erc20.md +88 -0
  60. package/www/guides/intro.md +20 -0
  61. package/www/package-lock.json +22285 -0
  62. package/www/package.json +43 -0
  63. package/www/sidebars.js +31 -0
  64. package/www/src/components/HomepageFeatures/index.tsx +67 -0
  65. package/www/src/components/HomepageFeatures/styles.module.css +10 -0
  66. package/www/src/css/custom.css +39 -0
  67. package/www/src/pages/index.module.css +23 -0
  68. package/www/src/pages/index.tsx +40 -0
  69. package/www/src/pages/markdown-page.md +7 -0
  70. package/www/static/.nojekyll +0 -0
  71. package/www/static/img/docusaurus.png +0 -0
  72. package/www/static/img/favicon.ico +0 -0
  73. package/www/static/img/logo.svg +17 -0
  74. package/www/static/img/starknet-1.png +0 -0
  75. package/www/static/img/starknet-2.png +0 -0
  76. package/www/static/img/starknet-3.png +0 -0
  77. package/www/static/img/tutorial/docsVersionDropdown.png +0 -0
  78. package/www/static/img/tutorial/localeDropdown.png +0 -0
  79. package/www/tsconfig.json +8 -0
@@ -0,0 +1,336 @@
1
+ {
2
+ "name": "code-examples",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 2,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "code-examples",
9
+ "version": "1.0.0",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "starknet": "^3.3.0"
13
+ }
14
+ },
15
+ "node_modules/@noble/hashes": {
16
+ "version": "0.5.9",
17
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-0.5.9.tgz",
18
+ "integrity": "sha512-7lN1Qh6d8DUGmfN36XRsbN/WcGIPNtTGhkw26vWId/DlCIGsYJJootTtPGghTLcn/AaXPx2Q0b3cacrwXa7OVw=="
19
+ },
20
+ "node_modules/@noble/secp256k1": {
21
+ "version": "1.5.5",
22
+ "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.5.5.tgz",
23
+ "integrity": "sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ==",
24
+ "funding": [
25
+ {
26
+ "type": "individual",
27
+ "url": "https://paulmillr.com/funding/"
28
+ }
29
+ ]
30
+ },
31
+ "node_modules/axios": {
32
+ "version": "0.23.0",
33
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.23.0.tgz",
34
+ "integrity": "sha512-NmvAE4i0YAv5cKq8zlDoPd1VLKAqX5oLuZKs8xkJa4qi6RGn0uhCYFjWtHHC9EM/MwOwYWOs53W+V0aqEXq1sg==",
35
+ "dependencies": {
36
+ "follow-redirects": "^1.14.4"
37
+ }
38
+ },
39
+ "node_modules/bignumber.js": {
40
+ "version": "9.0.2",
41
+ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz",
42
+ "integrity": "sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==",
43
+ "engines": {
44
+ "node": "*"
45
+ }
46
+ },
47
+ "node_modules/bn.js": {
48
+ "version": "5.2.0",
49
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
50
+ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw=="
51
+ },
52
+ "node_modules/brorand": {
53
+ "version": "1.1.0",
54
+ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
55
+ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
56
+ },
57
+ "node_modules/elliptic": {
58
+ "version": "6.5.4",
59
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
60
+ "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
61
+ "dependencies": {
62
+ "bn.js": "^4.11.9",
63
+ "brorand": "^1.1.0",
64
+ "hash.js": "^1.0.0",
65
+ "hmac-drbg": "^1.0.1",
66
+ "inherits": "^2.0.4",
67
+ "minimalistic-assert": "^1.0.1",
68
+ "minimalistic-crypto-utils": "^1.0.1"
69
+ }
70
+ },
71
+ "node_modules/elliptic/node_modules/bn.js": {
72
+ "version": "4.12.0",
73
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
74
+ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
75
+ },
76
+ "node_modules/ethereum-cryptography": {
77
+ "version": "0.2.5",
78
+ "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.2.5.tgz",
79
+ "integrity": "sha512-aWvqiegXgSTwbuDE1DDnM7taLteLcHVHh5nMZnnD2dwlvH6w5bOxcdXW20oS+1aLDorDlrK1c82stB8jsLDN5Q==",
80
+ "dependencies": {
81
+ "@noble/hashes": "^0.5.7",
82
+ "@noble/secp256k1": "^1.4.0",
83
+ "micro-base": "^0.10.1"
84
+ }
85
+ },
86
+ "node_modules/follow-redirects": {
87
+ "version": "1.14.9",
88
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
89
+ "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
90
+ "funding": [
91
+ {
92
+ "type": "individual",
93
+ "url": "https://github.com/sponsors/RubenVerborgh"
94
+ }
95
+ ],
96
+ "engines": {
97
+ "node": ">=4.0"
98
+ },
99
+ "peerDependenciesMeta": {
100
+ "debug": {
101
+ "optional": true
102
+ }
103
+ }
104
+ },
105
+ "node_modules/hash.js": {
106
+ "version": "1.1.7",
107
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
108
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
109
+ "dependencies": {
110
+ "inherits": "^2.0.3",
111
+ "minimalistic-assert": "^1.0.1"
112
+ }
113
+ },
114
+ "node_modules/hmac-drbg": {
115
+ "version": "1.0.1",
116
+ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
117
+ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
118
+ "dependencies": {
119
+ "hash.js": "^1.0.3",
120
+ "minimalistic-assert": "^1.0.0",
121
+ "minimalistic-crypto-utils": "^1.0.1"
122
+ }
123
+ },
124
+ "node_modules/inherits": {
125
+ "version": "2.0.4",
126
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
127
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
128
+ },
129
+ "node_modules/json-bigint": {
130
+ "version": "1.0.0",
131
+ "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
132
+ "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
133
+ "dependencies": {
134
+ "bignumber.js": "^9.0.0"
135
+ }
136
+ },
137
+ "node_modules/micro-base": {
138
+ "version": "0.10.2",
139
+ "resolved": "https://registry.npmjs.org/micro-base/-/micro-base-0.10.2.tgz",
140
+ "integrity": "sha512-lqqJrT7lfJtDmmiQ4zRLZuIJBk96t0RAc5pCrrWpL9zDeH5i/SUL85mku9HqzTI/OCZ8EQ3aicbMW+eK5Nyu5w==",
141
+ "deprecated": "Switch to @scure/base for audited version of the lib & updates"
142
+ },
143
+ "node_modules/minimalistic-assert": {
144
+ "version": "1.0.1",
145
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
146
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
147
+ },
148
+ "node_modules/minimalistic-crypto-utils": {
149
+ "version": "1.0.1",
150
+ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
151
+ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
152
+ },
153
+ "node_modules/pako": {
154
+ "version": "2.0.4",
155
+ "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz",
156
+ "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg=="
157
+ },
158
+ "node_modules/starknet": {
159
+ "version": "3.3.0",
160
+ "resolved": "https://registry.npmjs.org/starknet/-/starknet-3.3.0.tgz",
161
+ "integrity": "sha512-PsdrnD1dNIbMAePRU3yeDsY1d9m7CaZI6VYKxpgZX+tlb45Zntz4F98bMFo/vvoLCfuubkLmHbNZfc76bcgcRQ==",
162
+ "dependencies": {
163
+ "axios": "^0.23.0",
164
+ "bn.js": "^5.2.0",
165
+ "elliptic": "^6.5.4",
166
+ "ethereum-cryptography": "^0.2.0",
167
+ "hash.js": "^1.1.7",
168
+ "json-bigint": "^1.0.0",
169
+ "minimalistic-assert": "^1.0.1",
170
+ "pako": "^2.0.4",
171
+ "superstruct": "^0.15.3",
172
+ "url-join": "^4.0.1"
173
+ }
174
+ },
175
+ "node_modules/superstruct": {
176
+ "version": "0.15.4",
177
+ "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.4.tgz",
178
+ "integrity": "sha512-eOoMeSbP9ZJChNOm/9RYjE+F36rYR966AAqeG3xhQB02j2sfAUXDp4EQ/7bAOqnlJnuFDB8yvOu50SocvKpUEw=="
179
+ },
180
+ "node_modules/url-join": {
181
+ "version": "4.0.1",
182
+ "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
183
+ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
184
+ }
185
+ },
186
+ "dependencies": {
187
+ "@noble/hashes": {
188
+ "version": "0.5.9",
189
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-0.5.9.tgz",
190
+ "integrity": "sha512-7lN1Qh6d8DUGmfN36XRsbN/WcGIPNtTGhkw26vWId/DlCIGsYJJootTtPGghTLcn/AaXPx2Q0b3cacrwXa7OVw=="
191
+ },
192
+ "@noble/secp256k1": {
193
+ "version": "1.5.5",
194
+ "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.5.5.tgz",
195
+ "integrity": "sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ=="
196
+ },
197
+ "axios": {
198
+ "version": "0.23.0",
199
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.23.0.tgz",
200
+ "integrity": "sha512-NmvAE4i0YAv5cKq8zlDoPd1VLKAqX5oLuZKs8xkJa4qi6RGn0uhCYFjWtHHC9EM/MwOwYWOs53W+V0aqEXq1sg==",
201
+ "requires": {
202
+ "follow-redirects": "^1.14.4"
203
+ }
204
+ },
205
+ "bignumber.js": {
206
+ "version": "9.0.2",
207
+ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz",
208
+ "integrity": "sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw=="
209
+ },
210
+ "bn.js": {
211
+ "version": "5.2.0",
212
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
213
+ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw=="
214
+ },
215
+ "brorand": {
216
+ "version": "1.1.0",
217
+ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
218
+ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
219
+ },
220
+ "elliptic": {
221
+ "version": "6.5.4",
222
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
223
+ "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
224
+ "requires": {
225
+ "bn.js": "^4.11.9",
226
+ "brorand": "^1.1.0",
227
+ "hash.js": "^1.0.0",
228
+ "hmac-drbg": "^1.0.1",
229
+ "inherits": "^2.0.4",
230
+ "minimalistic-assert": "^1.0.1",
231
+ "minimalistic-crypto-utils": "^1.0.1"
232
+ },
233
+ "dependencies": {
234
+ "bn.js": {
235
+ "version": "4.12.0",
236
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
237
+ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
238
+ }
239
+ }
240
+ },
241
+ "ethereum-cryptography": {
242
+ "version": "0.2.5",
243
+ "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.2.5.tgz",
244
+ "integrity": "sha512-aWvqiegXgSTwbuDE1DDnM7taLteLcHVHh5nMZnnD2dwlvH6w5bOxcdXW20oS+1aLDorDlrK1c82stB8jsLDN5Q==",
245
+ "requires": {
246
+ "@noble/hashes": "^0.5.7",
247
+ "@noble/secp256k1": "^1.4.0",
248
+ "micro-base": "^0.10.1"
249
+ }
250
+ },
251
+ "follow-redirects": {
252
+ "version": "1.14.9",
253
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
254
+ "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
255
+ },
256
+ "hash.js": {
257
+ "version": "1.1.7",
258
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
259
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
260
+ "requires": {
261
+ "inherits": "^2.0.3",
262
+ "minimalistic-assert": "^1.0.1"
263
+ }
264
+ },
265
+ "hmac-drbg": {
266
+ "version": "1.0.1",
267
+ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
268
+ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
269
+ "requires": {
270
+ "hash.js": "^1.0.3",
271
+ "minimalistic-assert": "^1.0.0",
272
+ "minimalistic-crypto-utils": "^1.0.1"
273
+ }
274
+ },
275
+ "inherits": {
276
+ "version": "2.0.4",
277
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
278
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
279
+ },
280
+ "json-bigint": {
281
+ "version": "1.0.0",
282
+ "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
283
+ "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
284
+ "requires": {
285
+ "bignumber.js": "^9.0.0"
286
+ }
287
+ },
288
+ "micro-base": {
289
+ "version": "0.10.2",
290
+ "resolved": "https://registry.npmjs.org/micro-base/-/micro-base-0.10.2.tgz",
291
+ "integrity": "sha512-lqqJrT7lfJtDmmiQ4zRLZuIJBk96t0RAc5pCrrWpL9zDeH5i/SUL85mku9HqzTI/OCZ8EQ3aicbMW+eK5Nyu5w=="
292
+ },
293
+ "minimalistic-assert": {
294
+ "version": "1.0.1",
295
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
296
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
297
+ },
298
+ "minimalistic-crypto-utils": {
299
+ "version": "1.0.1",
300
+ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
301
+ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
302
+ },
303
+ "pako": {
304
+ "version": "2.0.4",
305
+ "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz",
306
+ "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg=="
307
+ },
308
+ "starknet": {
309
+ "version": "3.3.0",
310
+ "resolved": "https://registry.npmjs.org/starknet/-/starknet-3.3.0.tgz",
311
+ "integrity": "sha512-PsdrnD1dNIbMAePRU3yeDsY1d9m7CaZI6VYKxpgZX+tlb45Zntz4F98bMFo/vvoLCfuubkLmHbNZfc76bcgcRQ==",
312
+ "requires": {
313
+ "axios": "^0.23.0",
314
+ "bn.js": "^5.2.0",
315
+ "elliptic": "^6.5.4",
316
+ "ethereum-cryptography": "^0.2.0",
317
+ "hash.js": "^1.1.7",
318
+ "json-bigint": "^1.0.0",
319
+ "minimalistic-assert": "^1.0.1",
320
+ "pako": "^2.0.4",
321
+ "superstruct": "^0.15.3",
322
+ "url-join": "^4.0.1"
323
+ }
324
+ },
325
+ "superstruct": {
326
+ "version": "0.15.4",
327
+ "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.4.tgz",
328
+ "integrity": "sha512-eOoMeSbP9ZJChNOm/9RYjE+F36rYR966AAqeG3xhQB02j2sfAUXDp4EQ/7bAOqnlJnuFDB8yvOu50SocvKpUEw=="
329
+ },
330
+ "url-join": {
331
+ "version": "4.0.1",
332
+ "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
333
+ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
334
+ }
335
+ }
336
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "code-examples",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "starknet": "^3.3.0"
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "label": "StarkNet.js API",
3
+ "position": 1,
4
+ "collapsed": false
5
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # Account
6
+
7
+ An Account extends <ins>[`Provider`](/docs/API/provider)</ins> and inherits all of its methods.
8
+
9
+ It also introduces new methods that allow Accounts to create and verify signatures with a custom <ins>[`Signer`](/docs/API/signer)</ins>.
10
+
11
+ This API is the primary way to interact with an account contract on StarkNet.
@@ -0,0 +1,14 @@
1
+ ---
2
+ sidebar_position: 4
3
+ ---
4
+
5
+ # Contract
6
+
7
+ Contracts can do data transformations in JavaScript based on an ABI. They can also call and invoke to StarkNet through a provided Signer.
8
+
9
+ Contracts allow you to transform Cairo values, like `Uint256` to `BigNumber`. It could also allow users to pass their own transformers, similar to `JSON.parse`.
10
+
11
+ ## Contract Factory
12
+
13
+ Contract Factory allow you to deploy contracts onto StarkNet
14
+
@@ -0,0 +1,4 @@
1
+ # StarkNet.js API
2
+
3
+ This API is based on the <ins>[Starknet.js V3](https://github.com/0xs34n/starknet.js/discussions/102)</ins> Interface write up by <ins>[Janek](https://twitter.com/0xjanek)</ins> of <ins>[Argent](https://www.argent.xyz/)</ins>
4
+
@@ -0,0 +1,10 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Provider
6
+
7
+ The **Provider** API allows you to interface with the StarkNet network, without signing transactions or messages.
8
+
9
+ Typically, these are *read* calls on the blockchain.
10
+
@@ -0,0 +1,8 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # Signer
6
+
7
+ The **Signer** API allows you to sign transactions and messages, and also allows you to get the public key.
8
+
@@ -0,0 +1,131 @@
1
+ // @ts-check
2
+ // Note: type annotations allow type checking and IDEs autocompletion
3
+
4
+ const lightCodeTheme = require('prism-react-renderer/themes/github');
5
+ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
6
+
7
+ /** @type {import('@docusaurus/types').Config} */
8
+ const config = {
9
+ title: 'Starknet.js',
10
+ tagline: 'JavaScript libray for StarkNet',
11
+ url: 'https://starknetjs.com',
12
+ baseUrl: '/',
13
+ onBrokenLinks: 'throw',
14
+ onBrokenMarkdownLinks: 'warn',
15
+ favicon: 'img/favicon.ico',
16
+ organizationName: '0xs34n', // Usually your GitHub org/user name.
17
+ projectName: 'starknet.js', // Usually your repo name.
18
+
19
+ plugins: [
20
+ [
21
+ '@docusaurus/plugin-content-docs',
22
+ {
23
+ id: 'guides',
24
+ path: 'guides',
25
+ routeBasePath: 'guides',
26
+ sidebarPath: require.resolve('./sidebars.js'),
27
+ },
28
+ ],
29
+ ],
30
+
31
+ presets: [
32
+ [
33
+ 'classic',
34
+ /** @type {import('@docusaurus/preset-classic').Options} */
35
+ ({
36
+ docs: {
37
+ sidebarPath: require.resolve('./sidebars.js'),
38
+ // Please change this to your repo.
39
+ editUrl: 'https://github.com/0xs34n/starknet.js',
40
+ },
41
+ blog: {
42
+ showReadingTime: true,
43
+ // Please change this to your repo.
44
+ editUrl:
45
+ 'https://github.com/0xs34n/starknet.js',
46
+ },
47
+ theme: {
48
+ customCss: require.resolve('./src/css/custom.css'),
49
+ },
50
+ }),
51
+ ],
52
+ ],
53
+
54
+ themeConfig:
55
+ /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
56
+ ({
57
+ navbar: {
58
+ title: 'Home',
59
+ logo: {
60
+ alt: 'Starknet.js Logo',
61
+ src: 'img/logo.svg',
62
+ },
63
+ items: [
64
+ {
65
+ type: 'doc',
66
+ docId: 'API/index',
67
+ position: 'left',
68
+ label: 'API',
69
+ },
70
+ {
71
+ position: 'left',
72
+ label: 'Guides',
73
+ to: '/guides/intro'
74
+ },
75
+ // {to: '/blog', label: 'Blog', position: 'left'},
76
+ {
77
+ href: 'https://github.com/facebook/docusaurus',
78
+ label: 'GitHub',
79
+ position: 'right',
80
+ },
81
+ ],
82
+ },
83
+ footer: {
84
+ style: 'dark',
85
+ links: [
86
+ {
87
+ title: 'Docs',
88
+ items: [
89
+ {
90
+ label: 'API',
91
+ to: '/docs/API/',
92
+ },
93
+ {
94
+ label: 'Guides',
95
+ to: '/guides/intro',
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ title: 'Community',
101
+ items: [
102
+ {
103
+ label: 'Twitter',
104
+ href: 'https://twitter.com/0xs34n',
105
+ },
106
+ ],
107
+ },
108
+ {
109
+ title: 'More',
110
+ items: [
111
+ // {
112
+ // label: 'Blog',
113
+ // to: '/blog',
114
+ // },
115
+ {
116
+ label: 'GitHub',
117
+ href: 'https://github.com/0xs34n/starknet.js',
118
+ },
119
+ ],
120
+ },
121
+ ],
122
+ copyright: `Copyright © ${new Date().getFullYear()} 0xs34n`,
123
+ },
124
+ prism: {
125
+ theme: lightCodeTheme,
126
+ darkTheme: darkCodeTheme,
127
+ },
128
+ }),
129
+ };
130
+
131
+ module.exports = config;
@@ -0,0 +1,60 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # Creating an Account
6
+
7
+ Since there are no Externally Owned Accounts (EOA) in StarkNet, all Accounts in StarkNet are contracts.
8
+
9
+ Unlike in Ethereum where a wallet is created with a public and private key pair, StarkNet Accounts are the only way to sign transactions and messages, and verify signatures. Therefore a Account - Contract interface is needed.
10
+
11
+ ## Install and import StarkNet
12
+
13
+ Install the latest version of starknet with `npm install starknet@next`
14
+
15
+ ```javascript
16
+ import fs from "fs";
17
+ import * as starknet from "starknet";
18
+ ```
19
+
20
+ ## Generate random key pair.
21
+
22
+ You can also get a key pair from a private key using `getKeyPair(pk: BigNumberish)`
23
+
24
+ ```javascript
25
+ const starkKeyPair = ec.genKeyPair();
26
+ const starkKeyPub = ec.getStarkKey(starkKeyPair);;
27
+ ```
28
+
29
+ ## Deploy Account Contract
30
+
31
+ Deploy the Account contract and wait for it to be verified on StarkNet.
32
+
33
+ ```javascript
34
+ const compiledArgentAccount = json.parse(
35
+ fs.readFileSync("./ArgentAccount.json").toString("ascii")
36
+ );
37
+ const accountResponse = await defaultProvider.deployContract({
38
+ contract: compiledArgentAccount,
39
+ addressSalt: starkKeyPub,
40
+ });
41
+ ```
42
+
43
+ ## Use your new account
44
+
45
+ Wait for the deployment transaction to be accepted and assign the address of the deployed account to the Account object.
46
+
47
+ Use your new account object to sign transactions, messages or verify signatures!
48
+
49
+ ```javascript
50
+ await defaultProvider.waitForTransaction(accountResponse.transaction_hash);
51
+ const accountContract = new Contract(
52
+ compiledArgentAccount.abi,
53
+ accountResponse.address
54
+ );
55
+ const { transaction_hash: initializeTxHash } = await accountContract.initialize(
56
+ starkKeyPub,
57
+ "0"
58
+ );
59
+ await defaultProvider.waitForTransaction(initializeTxHash);
60
+ ```
@@ -0,0 +1,3 @@
1
+ # Usage with Create React App
2
+
3
+ Please refer to this <ins>[GitHub issue](https://github.com/0xs34n/starknet.js/issues/37)</ins>