starknet 3.5.1 → 3.6.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 (76) hide show
  1. package/CHANGELOG.md +18 -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 +2 -0
  8. package/account/default.js +60 -12
  9. package/account/interface.d.ts +14 -0
  10. package/contract/default.d.ts +1 -1
  11. package/contract/default.js +27 -11
  12. package/dist/account/default.d.ts +2 -1
  13. package/dist/account/default.js +47 -9
  14. package/dist/account/interface.d.ts +13 -1
  15. package/dist/contract/default.d.ts +1 -1
  16. package/dist/contract/default.js +22 -10
  17. package/dist/provider/default.d.ts +9 -2
  18. package/dist/provider/default.js +16 -11
  19. package/dist/signer/index.d.ts +1 -0
  20. package/dist/signer/index.js +1 -0
  21. package/dist/signer/ledger.d.ts +12 -0
  22. package/dist/signer/ledger.js +138 -0
  23. package/dist/types/api.d.ts +57 -2
  24. package/package.json +5 -2
  25. package/provider/default.d.ts +9 -1
  26. package/provider/default.js +19 -15
  27. package/signer/index.d.ts +1 -0
  28. package/signer/index.js +1 -0
  29. package/signer/ledger.d.ts +15 -0
  30. package/signer/ledger.js +243 -0
  31. package/src/account/default.ts +25 -4
  32. package/src/account/interface.ts +15 -0
  33. package/src/contract/default.ts +23 -22
  34. package/src/provider/default.ts +13 -11
  35. package/src/signer/index.ts +1 -0
  36. package/src/signer/ledger.ts +81 -0
  37. package/src/types/api.ts +62 -3
  38. package/tsconfig.json +1 -10
  39. package/types/api.d.ts +57 -2
  40. package/www/README.md +41 -0
  41. package/www/babel.config.js +3 -0
  42. package/www/code-examples/account.js +62 -0
  43. package/www/code-examples/amm.js +49 -0
  44. package/www/code-examples/erc20.js +10 -0
  45. package/www/code-examples/package-lock.json +336 -0
  46. package/www/code-examples/package.json +15 -0
  47. package/www/docs/API/_category_.json +5 -0
  48. package/www/docs/API/account.md +11 -0
  49. package/www/docs/API/contract.md +14 -0
  50. package/www/docs/API/index.md +4 -0
  51. package/www/docs/API/provider.md +10 -0
  52. package/www/docs/API/signer.md +8 -0
  53. package/www/docusaurus.config.js +131 -0
  54. package/www/guides/account.md +60 -0
  55. package/www/guides/cra.md +3 -0
  56. package/www/guides/erc20.md +88 -0
  57. package/www/guides/intro.md +20 -0
  58. package/www/package-lock.json +22285 -0
  59. package/www/package.json +43 -0
  60. package/www/sidebars.js +31 -0
  61. package/www/src/components/HomepageFeatures/index.tsx +67 -0
  62. package/www/src/components/HomepageFeatures/styles.module.css +10 -0
  63. package/www/src/css/custom.css +39 -0
  64. package/www/src/pages/index.module.css +23 -0
  65. package/www/src/pages/index.tsx +40 -0
  66. package/www/src/pages/markdown-page.md +7 -0
  67. package/www/static/.nojekyll +0 -0
  68. package/www/static/img/docusaurus.png +0 -0
  69. package/www/static/img/favicon.ico +0 -0
  70. package/www/static/img/logo.svg +17 -0
  71. package/www/static/img/starknet-1.png +0 -0
  72. package/www/static/img/starknet-2.png +0 -0
  73. package/www/static/img/starknet-3.png +0 -0
  74. package/www/static/img/tutorial/docsVersionDropdown.png +0 -0
  75. package/www/static/img/tutorial/localeDropdown.png +0 -0
  76. package/www/tsconfig.json +8 -0
package/types/api.d.ts CHANGED
@@ -35,6 +35,13 @@ export declare type Endpoints = {
35
35
  REQUEST: never;
36
36
  RESPONSE: GetTransactionStatusResponse;
37
37
  };
38
+ get_transaction_trace: {
39
+ QUERY: {
40
+ transactionHash: string;
41
+ };
42
+ REQUEST: never;
43
+ RESPONSE: GetTransactionTraceResponse;
44
+ };
38
45
  get_storage_at: {
39
46
  QUERY: {
40
47
  contractAddress: string;
@@ -68,7 +75,7 @@ export declare type Endpoints = {
68
75
  };
69
76
  estimate_fee: {
70
77
  QUERY: never;
71
- REQUEST: Transaction;
78
+ REQUEST: CallContractTransaction;
72
79
  RESPONSE: EstimateFeeResponse;
73
80
  };
74
81
  };
@@ -91,6 +98,31 @@ export declare type InvokeFunctionTransaction = {
91
98
  entry_point_selector: string;
92
99
  calldata?: RawCalldata;
93
100
  nonce?: BigNumberish;
101
+ max_fee?: BigNumberish;
102
+ };
103
+ export declare type InvokeFunctionTrace = {
104
+ caller_address: string;
105
+ contract_address: string;
106
+ code_address: string;
107
+ selector: string;
108
+ calldata: RawCalldata;
109
+ result: Array<any>;
110
+ execution_resources: ExecutionResources;
111
+ internal_call: Array<InvokeFunctionTrace>;
112
+ events: Array<any>;
113
+ messages: Array<any>;
114
+ };
115
+ export declare type ExecutionResources = {
116
+ n_steps: number;
117
+ builtin_instance_counter: {
118
+ pedersen_builtin: number;
119
+ range_check_builtin: number;
120
+ bitwise_builtin: number;
121
+ output_builtin: number;
122
+ ecdsa_builtin: number;
123
+ ec_op_builtin: number;
124
+ };
125
+ n_memory_holes: number;
94
126
  };
95
127
  export declare type CallContractTransaction = Omit<
96
128
  InvokeFunctionTransaction,
@@ -138,6 +170,21 @@ export declare type GetTransactionStatusResponse = {
138
170
  error_message: string;
139
171
  };
140
172
  };
173
+ export declare type GetTransactionTraceResponse = {
174
+ function_invocation: {
175
+ caller_address: string;
176
+ contract_address: string;
177
+ code_address: string;
178
+ selector: string;
179
+ calldata: RawArgs;
180
+ result: Array<any>;
181
+ execution_resources: any;
182
+ internal_call: Array<any>;
183
+ events: Array<any>;
184
+ messages: Array<any>;
185
+ };
186
+ signature: Signature;
187
+ };
141
188
  export declare type GetTransactionResponse = {
142
189
  status: Status;
143
190
  transaction: Transaction;
@@ -160,7 +207,10 @@ export declare type TransactionReceipt = {
160
207
  l2_to_l1_messages: string[];
161
208
  events: string[];
162
209
  };
163
- export declare type EstimateFeeResponse = {};
210
+ export declare type EstimateFeeResponse = {
211
+ amount: number;
212
+ unit: string;
213
+ };
164
214
  export declare type RawArgs = {
165
215
  [inputName: string]:
166
216
  | string
@@ -171,3 +221,8 @@ export declare type RawArgs = {
171
221
  };
172
222
  };
173
223
  export declare type Calldata = string[];
224
+ export declare type Overrides = {
225
+ maxFee?: BigNumberish;
226
+ nonce?: BigNumberish;
227
+ signature?: Signature;
228
+ };
package/www/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Website
2
+
3
+ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4
+
5
+ ### Installation
6
+
7
+ ```
8
+ $ yarn
9
+ ```
10
+
11
+ ### Local Development
12
+
13
+ ```
14
+ $ yarn start
15
+ ```
16
+
17
+ This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18
+
19
+ ### Build
20
+
21
+ ```
22
+ $ yarn build
23
+ ```
24
+
25
+ This command generates static content into the `build` directory and can be served using any static contents hosting service.
26
+
27
+ ### Deployment
28
+
29
+ Using SSH:
30
+
31
+ ```
32
+ $ USE_SSH=true yarn deploy
33
+ ```
34
+
35
+ Not using SSH:
36
+
37
+ ```
38
+ $ GIT_USER=<Your GitHub username> yarn deploy
39
+ ```
40
+
41
+ If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3
+ };
@@ -0,0 +1,62 @@
1
+
2
+ // Install the latest version of starknet with npm install starknet@next and import starknet
3
+ import * as starknet from "starknet";
4
+
5
+ // Generate public and private key pair.
6
+
7
+ const keyPair = starknet.ec.genKeyPair();
8
+ const starkKey = starknet.ec.getStarkKey(keyPair);
9
+ const starkKeyInt = starknet.number.toBN(starknet.encode.removeHexPrefix(starkKey), 16);
10
+
11
+ const { address: walletAddressLocal } = await provider.deployContract({contract: COMPILED_WALLET_CONTRACT_JSON, constructorCallData: [starkKeyInt], addressSalt: 0});
12
+
13
+ walletAddress = walletAddressLocal;
14
+
15
+ const { code: codeErc20, address: erc20AddressLocal } = await defaultProvider.deployContract({
16
+ contract: compiledErc20,
17
+ });
18
+
19
+ const erc20Address = erc20AddressLocal;
20
+ const erc20 = new Contract(compiledErc20.abi, erc20Address);
21
+
22
+ const { code: codeErc20Mint, transaction_hash: txErc20Mint } = await erc20.invoke('mint', {
23
+ recipient: walletAddress,
24
+ amount: '1000',
25
+ });
26
+
27
+ const balanceBeforeTransfer = await erc20.call('balance_of', {
28
+ user: walletAddress,
29
+ }).res;
30
+
31
+ console.log(number.toBN(res).toString())
32
+
33
+ const { nonce } = await wallet.call('get_nonce');
34
+ const msgHash = encode.addHexPrefix(
35
+ hash.hashMessage(
36
+ wallet.connectedTo,
37
+ erc20Address,
38
+ stark.getSelectorFromName('transfer'),
39
+ [erc20Address, '10'],
40
+ nonce.toString()
41
+ )
42
+ );
43
+
44
+ const signature = ec.sign(starkKeyPair, msgHash);
45
+ const { code, transaction_hash } = await wallet.invoke(
46
+ 'execute',
47
+ {
48
+ to: erc20Address,
49
+ selector: stark.getSelectorFromName('transfer'),
50
+ calldata: [erc20Address, '10'],
51
+ nonce: nonce.toString(),
52
+ },
53
+ signature
54
+ );
55
+
56
+ await defaultProvider.waitForTx(transaction_hash);
57
+
58
+ const balanceAfterTransfer = await erc20.call('balance_of', {
59
+ user: walletAddress,
60
+ }).res;
61
+
62
+ console.log('Balance after transfer', balanceAfterTransfer)
@@ -0,0 +1,49 @@
1
+ import { defaultProvider, stark } from 'starknet';
2
+ const { getSelectorFromName } = stark;
3
+
4
+
5
+ /**
6
+ * !! IMPORTANT NOTE !! When fees are introduced all function invocations will go through the account account contract and this example will be deprecated.
7
+ **/
8
+
9
+ const CONTRACT_ADDRESS =
10
+ "0x03e19baa6cb2078631bcdb34844f3f7879449a544c9ce722681a54af08cff4b9";
11
+
12
+ /**
13
+ * invokeFunction() example
14
+ **/
15
+
16
+ /** Reset the liquidity pool **/
17
+ const addLiquidityResponse = await defaultProvider.LEGACYinvokeFunction(
18
+ {
19
+ contractAddress: CONTRACT_ADDRESS,
20
+ entrypoint: "init_pool",
21
+ calldata: ["1000000", "1000000"],
22
+ }
23
+ );
24
+ console.log(addLiquidityResponse);
25
+
26
+ /**
27
+ * callContract() example
28
+ **/
29
+
30
+ /** Get the balance of the liquidity pool of token A **/
31
+ const poolBalanceTokenA = await defaultProvider.callContract({
32
+ contractAddress: CONTRACT_ADDRESS,
33
+ entrypoint: "get_pool_token_balance",
34
+ calldata: ["1"], // Account 1 (no account implemented)
35
+ });
36
+ const balanceA = poolBalanceTokenA.result[0];
37
+ console.log('token a liquidity pool balance: ', parseInt(balanceA, 16));
38
+
39
+ /** Get the balance of the liquidity pool of token B **/
40
+ const poolBalanceTokenB = await defaultProvider.callContract({
41
+ contractAddress: CONTRACT_ADDRESS,
42
+ entrypoint: "get_pool_token_balance",
43
+ calldata: ["2"],
44
+ });
45
+ const balanceB = poolBalanceTokenB.result[0];
46
+ console.log('token b liquidity pool balance: ', parseInt(balanceB, 16));
47
+
48
+
49
+ /** Make a swap */
@@ -0,0 +1,10 @@
1
+ import * as starknet from "starknet";
2
+
3
+ const keyPair = starknet.ec.genKeyPair();
4
+ const starkKey = starknet.ec.getStarkKey(keyPair);
5
+ const starkKeyInt = starknet.number.toBN(starknet.encode.removeHexPrefix(starkKey), 16);
6
+
7
+ const deployWalletTx = await provider.deployContract({contract: COMPILED_WALLET_CONTRACT_JSON, constructorCallData: [starkKeyInt], addressSalt: 0});
8
+
9
+ await defaultProvider.waitForTx(deployWalletTx.transaction_hash);
10
+
@@ -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
+