starknet 0.1.4 → 1.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.
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/docs-bot.yml +25 -0
  6. package/.github/workflows/pr.yml +23 -0
  7. package/.github/workflows/release.yml +39 -0
  8. package/.husky/commit-msg +4 -0
  9. package/.husky/pre-commit +4 -0
  10. package/{.prettierrc.json → .prettierrc} +0 -1
  11. package/.releaserc +28 -0
  12. package/CHANGELOG.md +36 -0
  13. package/CONTRIBUTING.md +52 -0
  14. package/README.md +35 -11
  15. package/__mocks__/ArgentAccount.json +92620 -0
  16. package/__tests__/__snapshots__/utils.browser.test.ts.snap +5 -0
  17. package/__tests__/__snapshots__/utils.test.ts.snap +5 -0
  18. package/__tests__/index.test.ts +49 -4
  19. package/__tests__/utils.browser.test.ts +30 -0
  20. package/__tests__/utils.test.ts +35 -0
  21. package/constants.d.ts +3 -0
  22. package/constants.js +9 -0
  23. package/dist/constants.d.ts +3 -0
  24. package/dist/constants.js +6 -0
  25. package/dist/index.d.ts +22 -8
  26. package/dist/index.js +50 -4
  27. package/dist/types.d.ts +89 -0
  28. package/dist/types.js +2 -0
  29. package/dist/utils.d.ts +21 -0
  30. package/dist/utils.js +44 -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 +66 -20
  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/tsconfig.json CHANGED
@@ -11,8 +11,13 @@
11
11
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
13
  /* Language and Environment */
14
- "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": ["es2017", "es7", "es6", "dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
+ "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ "lib": [
16
+ "es2017",
17
+ "es7",
18
+ "es6",
19
+ "dom"
20
+ ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
16
21
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
22
  // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
23
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
@@ -24,7 +29,7 @@
24
29
  // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
30
 
26
31
  /* Modules */
27
- "module": "commonjs", /* Specify what module code is generated. */
32
+ "module": "commonjs" /* Specify what module code is generated. */,
28
33
  // "rootDir": "./", /* Specify the root folder within your source files. */
29
34
  // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
35
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -42,12 +47,12 @@
42
47
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43
48
 
44
49
  /* Emit */
45
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
50
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
46
51
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
52
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
53
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
54
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
- "outDir": "dist", /* Specify an output folder for all emitted files. */
55
+ "outDir": "dist" /* Specify an output folder for all emitted files. */,
51
56
  // "removeComments": true, /* Disable emitting comments. */
52
57
  // "noEmit": true, /* Disable emitting files from a compilation. */
53
58
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -68,12 +73,12 @@
68
73
  /* Interop Constraints */
69
74
  // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
70
75
  // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
71
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
76
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
72
77
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
73
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
78
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
74
79
 
75
80
  /* Type Checking */
76
- "strict": true, /* Enable all strict type-checking options. */
81
+ "strict": true /* Enable all strict type-checking options. */,
77
82
  // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
78
83
  // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
79
84
  // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -95,13 +100,10 @@
95
100
 
96
101
  /* Completeness */
97
102
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
98
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
103
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
99
104
  },
100
105
  "include": ["src/**/*"],
101
- "exclude": [
102
- "node_modules",
103
- "**/*.test.ts"
104
- ],
106
+ "exclude": ["node_modules"],
105
107
  "typedocOptions": {
106
108
  "entryPoints": ["src/index.ts"],
107
109
  "out": "docs"
package/types.d.ts ADDED
@@ -0,0 +1,94 @@
1
+ export interface GetContractAddressesResponse {
2
+ Starknet: string;
3
+ GpsStatementVerifier: string;
4
+ }
5
+ export declare type Status =
6
+ | 'NOT_RECEIVED'
7
+ | 'RECEIVED'
8
+ | 'PENDING'
9
+ | 'REJECTED'
10
+ | 'ACCEPTED_ONCHAIN';
11
+ export declare type TxStatus = 'TRANSACTION_RECEIVED';
12
+ export declare type Type = 'DEPLOY' | 'INVOKE_FUNCTION';
13
+ export declare type EntryPointType = 'EXTERNAL';
14
+ export declare type CompressedProgram = string;
15
+ export interface Abi {
16
+ inputs: {
17
+ name: string;
18
+ type: string;
19
+ }[];
20
+ name: string;
21
+ outputs: {
22
+ name: string;
23
+ type: string;
24
+ }[];
25
+ type: string;
26
+ }
27
+ export declare type EntryPointsByType = object;
28
+ export declare type Program = object;
29
+ export interface CompiledContract {
30
+ abi: Abi;
31
+ entry_points_by_type: EntryPointsByType;
32
+ program: Program;
33
+ }
34
+ export interface CompressedCompiledContract extends Omit<CompiledContract, 'program'> {
35
+ program: CompressedProgram;
36
+ }
37
+ export interface DeployTransaction {
38
+ type: 'DEPLOY';
39
+ contract_definition: CompressedCompiledContract;
40
+ contract_address: string;
41
+ }
42
+ export interface InvokeFunctionTransaction {
43
+ type: 'INVOKE_FUNCTION';
44
+ contract_address: string;
45
+ entry_point_type?: EntryPointType;
46
+ entry_point_selector?: string;
47
+ calldata?: string[];
48
+ }
49
+ export declare type Transaction = DeployTransaction | InvokeFunctionTransaction;
50
+ export interface GetBlockResponse {
51
+ sequence_number: number;
52
+ state_root: string;
53
+ block_id: number;
54
+ transactions: {
55
+ [txid: string]: Transaction;
56
+ };
57
+ timestamp: number;
58
+ transaction_receipts: {
59
+ [txid: string]: {
60
+ block_id: number;
61
+ transaction_id: number;
62
+ l2_to_l1_messages: {
63
+ to_address: string;
64
+ payload: string[];
65
+ from_address: string;
66
+ }[];
67
+ block_number: number;
68
+ status: Status;
69
+ transaction_index: number;
70
+ };
71
+ };
72
+ previous_block_id: number;
73
+ status: Status;
74
+ }
75
+ export interface GetCode {
76
+ bytecode: string[];
77
+ abi: Abi[];
78
+ }
79
+ export interface GetTransactionStatusResponse {
80
+ tx_status: Status;
81
+ block_id: number;
82
+ }
83
+ export interface GetTransactionResponse {
84
+ transaction_index: number;
85
+ transaction: Transaction;
86
+ block_id: number;
87
+ block_number: number;
88
+ status: Status;
89
+ transaction_id: number;
90
+ }
91
+ export interface AddTransactionResponse {
92
+ code: TxStatus;
93
+ tx_id: number;
94
+ }
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
package/utils.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { CompressedProgram, Program } from './types';
2
+ export declare const isBrowser: boolean;
3
+ export declare const btoaUniversal: (b: ArrayBuffer) => string;
4
+ export declare function randomIntFromInterval(min: number, max: number): number;
5
+ export declare function randomAddress(): string;
6
+ export declare function makeAddress(input: string): string;
7
+ export declare const JsonParser: {
8
+ parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
9
+ stringify: {
10
+ (
11
+ value: any,
12
+ replacer?: ((this: any, key: string, value: any) => any) | undefined,
13
+ space?: string | number | undefined
14
+ ): string;
15
+ (
16
+ value: any,
17
+ replacer?: (string | number)[] | null | undefined,
18
+ space?: string | number | undefined
19
+ ): string;
20
+ };
21
+ };
22
+ /**
23
+ * Function to compress compiled cairo program
24
+ *
25
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/gateway/transaction.py#L54-L58)
26
+ * @param jsonProgram - json file representing the compiled cairo program
27
+ * @returns Compressed cairo program
28
+ */
29
+ export declare function compressProgram(jsonProgram: Program | string): CompressedProgram;
package/utils.js ADDED
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ Object.defineProperty(exports, '__esModule', { value: true });
8
+ exports.compressProgram =
9
+ exports.JsonParser =
10
+ exports.makeAddress =
11
+ exports.randomAddress =
12
+ exports.randomIntFromInterval =
13
+ exports.btoaUniversal =
14
+ exports.isBrowser =
15
+ void 0;
16
+ var pako_1 = require('pako');
17
+ var json_bigint_1 = __importDefault(require('json-bigint'));
18
+ var constants_1 = require('./constants');
19
+ exports.isBrowser = typeof window !== 'undefined';
20
+ var btoaUniversal = function (b) {
21
+ return exports.isBrowser
22
+ ? btoa(String.fromCharCode.apply(null, b))
23
+ : Buffer.from(b).toString('base64');
24
+ };
25
+ exports.btoaUniversal = btoaUniversal;
26
+ function randomIntFromInterval(min, max) {
27
+ return Math.floor(Math.random() * (max - min + 1) + min);
28
+ }
29
+ exports.randomIntFromInterval = randomIntFromInterval;
30
+ function randomAddress() {
31
+ return (
32
+ '0x' +
33
+ randomIntFromInterval(
34
+ constants_1.CONTRACT_ADDRESS_LOWER_BOUND,
35
+ constants_1.CONTRACT_ADDRESS_UPPER_BOUND
36
+ ).toString(16)
37
+ );
38
+ }
39
+ exports.randomAddress = randomAddress;
40
+ function makeAddress(input) {
41
+ return '0x' + input.replace(/^0x/, '').toLowerCase();
42
+ }
43
+ exports.makeAddress = makeAddress;
44
+ exports.JsonParser = (0, json_bigint_1.default)({
45
+ alwaysParseAsBig: true,
46
+ useNativeBigInt: true,
47
+ });
48
+ /**
49
+ * Function to compress compiled cairo program
50
+ *
51
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/gateway/transaction.py#L54-L58)
52
+ * @param jsonProgram - json file representing the compiled cairo program
53
+ * @returns Compressed cairo program
54
+ */
55
+ function compressProgram(jsonProgram) {
56
+ var stringified =
57
+ typeof jsonProgram === 'string' ? jsonProgram : exports.JsonParser.stringify(jsonProgram);
58
+ var compressedProgram = (0, pako_1.gzip)(stringified);
59
+ var base64 = (0, exports.btoaUniversal)(compressedProgram);
60
+ return base64;
61
+ }
62
+ exports.compressProgram = compressProgram;
package/.eslintrc.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true,
5
- "node": true,
6
- "jest": true
7
- },
8
- "extends": [
9
- "airbnb-base",
10
- "prettier",
11
- "plugin:prettier/recommended",
12
- ],
13
- "globals": {
14
- "Atomics": "readonly",
15
- "SharedArrayBuffer": "readonly"
16
- },
17
- "parser": "@typescript-eslint/parser",
18
- "parserOptions": {
19
- "ecmaVersion": 12,
20
- "sourceType": "module"
21
- },
22
- "plugins": [
23
- "@typescript-eslint"
24
- ],
25
- "rules": {}
26
- }
package/babel.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
3
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var starknet = __importStar(require("../index"));
23
- describe('starknet endpoints', function () {
24
- describe('feeder gateway endpoints', function () {
25
- test('getContractAddresses()', function () {
26
- return expect(starknet.getContractAddresses()).resolves.not.toThrow();
27
- });
28
- xtest('callContract()', function () { });
29
- test('getBlock()', function () {
30
- return expect(starknet.getBlock(46500)).resolves.not.toThrow();
31
- });
32
- test('getCode()', function () {
33
- return expect(starknet.getCode('0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d', 46500)).resolves.not.toThrow();
34
- });
35
- test('getStorageAt()', function () {
36
- return expect(starknet.getStorageAt('0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d', 0, 46500)).resolves.not.toThrow();
37
- });
38
- test('getTransactionStatus()', function () {
39
- return expect(starknet.getTransactionStatus(286136)).resolves.not.toThrow();
40
- });
41
- test('getTransaction()', function () {
42
- return expect(starknet.getTransaction(286136)).resolves.not.toThrow();
43
- });
44
- xtest('addTransaction()', function () { });
45
- });
46
- describe('gateway endpoints', function () {
47
- xtest('addTransaction()', function () { });
48
- });
49
- });
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/8e7389f/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/8e7389f/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/8e7389f/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/8e7389f/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
- [Reference](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/8e7389f/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/8e7389f/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/8e7389f/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/8e7389f/src/index.ts#L118)
package/docs/_Sidebar.md DELETED
@@ -1,3 +0,0 @@
1
- ## StarkNet.js Docs
2
-
3
- - [Home](../wiki/Home)