starknet 0.1.2 → 1.1.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.
Files changed (49) hide show
  1. package/.babelrc +6 -0
  2. package/.commitlintrc +12 -0
  3. package/.eslintignore +2 -0
  4. package/.eslintrc +20 -0
  5. package/.github/workflows/pr.yml +23 -0
  6. package/.github/workflows/release.yml +40 -0
  7. package/.husky/commit-msg +4 -0
  8. package/.husky/pre-commit +4 -0
  9. package/{.prettierrc.json → .prettierrc} +0 -1
  10. package/.releaserc +28 -0
  11. package/CHANGELOG.md +49 -0
  12. package/CONTRIBUTING.md +52 -0
  13. package/README.md +39 -11
  14. package/__mocks__/ArgentAccount.json +92620 -0
  15. package/__tests__/__snapshots__/utils.browser.test.ts.snap +5 -0
  16. package/__tests__/__snapshots__/utils.test.ts.snap +5 -0
  17. package/__tests__/index.test.ts +49 -4
  18. package/__tests__/utils.browser.test.ts +30 -0
  19. package/__tests__/utils.test.ts +35 -0
  20. package/constants.d.ts +3 -0
  21. package/constants.js +9 -0
  22. package/dist/constants.d.ts +3 -0
  23. package/dist/constants.js +6 -0
  24. package/dist/index.d.ts +23 -9
  25. package/dist/index.js +51 -5
  26. package/dist/types.d.ts +89 -0
  27. package/dist/types.js +2 -0
  28. package/dist/utils.d.ts +21 -0
  29. package/dist/utils.js +44 -0
  30. package/docs/README.md +235 -0
  31. package/index.d.ts +115 -0
  32. package/index.js +261 -0
  33. package/package.json +29 -5
  34. package/src/constants.ts +3 -0
  35. package/src/index.ts +67 -21
  36. package/src/types.ts +95 -0
  37. package/src/utils.ts +44 -0
  38. package/tsconfig.eslint.json +4 -0
  39. package/tsconfig.json +15 -13
  40. package/types.d.ts +94 -0
  41. package/types.js +2 -0
  42. package/utils.d.ts +29 -0
  43. package/utils.js +62 -0
  44. package/.eslintrc.json +0 -26
  45. package/babel.config.js +0 -3
  46. package/dist/__tests__/index.test.d.ts +0 -1
  47. package/dist/__tests__/index.test.js +0 -49
  48. package/docs/Home.md +0 -220
  49. package/docs/_Sidebar.md +0 -3
package/docs/Home.md DELETED
@@ -1,220 +0,0 @@
1
- # Starknet.js Docs
2
-
3
- ## Table of contents
4
-
5
- ### Functions
6
-
7
- - [addTransaction](../wiki/Home#addtransaction)
8
- - [callContract](../wiki/Home#callcontract)
9
- - [getBlock](../wiki/Home#getblock)
10
- - [getCode](../wiki/Home#getcode)
11
- - [getContractAddresses](../wiki/Home#getcontractaddresses)
12
- - [getStorageAt](../wiki/Home#getstorageat)
13
- - [getTransaction](../wiki/Home#gettransaction)
14
- - [getTransactionStatus](../wiki/Home#gettransactionstatus)
15
-
16
- ## Functions
17
-
18
- ### addTransaction
19
-
20
- ▸ **addTransaction**(`tx`): `Promise`<`object`\>
21
-
22
- Invoke a function on the starknet contract
23
-
24
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/gateway/gateway_client.py#L13-L17)
25
-
26
- #### Parameters
27
-
28
- | Name | Type | Description |
29
- | :------ | :------ | :------ |
30
- | `tx` | `object` | transaction to be invoked (WIP) |
31
-
32
- #### Returns
33
-
34
- `Promise`<`object`\>
35
-
36
- a confirmation of invoking a function on the starknet contract
37
-
38
- #### Defined in
39
-
40
- [index.ts:156](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L156)
41
-
42
- ___
43
-
44
- ### callContract
45
-
46
- ▸ **callContract**(`invokeTx`, `blockId`): `Promise`<`object`\>
47
-
48
- Calls a function on the StarkNet contract.
49
-
50
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L17-L25)
51
-
52
- #### Parameters
53
-
54
- | Name | Type | Description |
55
- | :------ | :------ | :------ |
56
- | `invokeTx` | `object` | transaction to be invoked (WIP) |
57
- | `blockId` | `number` | |
58
-
59
- #### Returns
60
-
61
- `Promise`<`object`\>
62
-
63
- the result of the function on the smart contract.
64
-
65
- #### Defined in
66
-
67
- [index.ts:33](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L33)
68
-
69
- ___
70
-
71
- ### getBlock
72
-
73
- ▸ **getBlock**(`blockId`): `Promise`<`object`\>
74
-
75
- Gets the block information from a block ID.
76
-
77
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L27-L31)
78
-
79
- #### Parameters
80
-
81
- | Name | Type |
82
- | :------ | :------ |
83
- | `blockId` | `number` |
84
-
85
- #### Returns
86
-
87
- `Promise`<`object`\>
88
-
89
- the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
90
-
91
- #### Defined in
92
-
93
- [index.ts:52](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L52)
94
-
95
- ___
96
-
97
- ### getCode
98
-
99
- ▸ **getCode**(`contractAddress`, `blockId`): `Promise`<`object`\>
100
-
101
- Gets the code of the deployed contract.
102
-
103
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L33-L36)
104
-
105
- #### Parameters
106
-
107
- | Name | Type |
108
- | :------ | :------ |
109
- | `contractAddress` | `string` |
110
- | `blockId` | `number` |
111
-
112
- #### Returns
113
-
114
- `Promise`<`object`\>
115
-
116
- ABI of compiled contract in JSON
117
-
118
- #### Defined in
119
-
120
- [index.ts:72](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L72)
121
-
122
- ___
123
-
124
- ### getContractAddresses
125
-
126
- ▸ **getContractAddresses**(): `Promise`<`object`\>
127
-
128
- Gets the smart contract address on the goerli testnet.
129
-
130
- https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L13-L15
131
-
132
- #### Returns
133
-
134
- `Promise`<`object`\>
135
-
136
- starknet smart contract address
137
-
138
- #### Defined in
139
-
140
- [index.ts:13](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L13)
141
-
142
- ___
143
-
144
- ### getStorageAt
145
-
146
- ▸ **getStorageAt**(`contractAddress`, `key`, `blockId`): `Promise`<`object`\>
147
-
148
- Gets the contract's storage variable at a specific key.
149
-
150
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L38-L46)
151
-
152
- #### Parameters
153
-
154
- | Name | Type | Description |
155
- | :------ | :------ | :------ |
156
- | `contractAddress` | `string` | |
157
- | `key` | `number` | from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP) |
158
- | `blockId` | `number` | |
159
-
160
- #### Returns
161
-
162
- `Promise`<`object`\>
163
-
164
- the value of the storage variable
165
-
166
- #### Defined in
167
-
168
- [index.ts:93](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L93)
169
-
170
- ___
171
-
172
- ### getTransaction
173
-
174
- ▸ **getTransaction**(`txId`): `Promise`<`object`\>
175
-
176
- Gets the transaction information from a tx id.
177
-
178
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L54-L58)
179
-
180
- #### Parameters
181
-
182
- | Name | Type |
183
- | :------ | :------ |
184
- | `txId` | `number` |
185
-
186
- #### Returns
187
-
188
- `Promise`<`object`\>
189
-
190
- the transacton object { transaction_id, status, transaction, block_id?, block_number?, transaction_index?, transaction_failure_reason? }
191
-
192
- #### Defined in
193
-
194
- [index.ts:137](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L137)
195
-
196
- ___
197
-
198
- ### getTransactionStatus
199
-
200
- ▸ **getTransactionStatus**(`txId`): `Promise`<`object`\>
201
-
202
- Gets the status of a transaction.
203
-
204
- [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L48-L52)
205
-
206
- #### Parameters
207
-
208
- | Name | Type |
209
- | :------ | :------ |
210
- | `txId` | `number` |
211
-
212
- #### Returns
213
-
214
- `Promise`<`object`\>
215
-
216
- the transaction status object { block_id, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
217
-
218
- #### Defined in
219
-
220
- [index.ts:118](https://github.com/seanjameshan/starknet.js/blob/4aa4525/src/index.ts#L118)
package/docs/_Sidebar.md DELETED
@@ -1,3 +0,0 @@
1
- ## Starknet.js Docs
2
-
3
- - [Home](../wiki/Home)