├── .eslintignore ├── .eslintrc.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── pull_request.yml │ ├── push.yml │ └── tag.yml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc.json ├── CHANGELOG.md ├── README.md ├── docs ├── .nojekyll ├── README.md ├── classes │ ├── AvailabilityGateway.md │ ├── FeederGateway.md │ ├── Gateway.md │ └── StarkExClient.md ├── enums │ ├── GatewayRequestType.md │ ├── OrderTypeObsolete.md │ └── StarkErrorCode.md ├── interfaces │ ├── BatchIdsRequest.md │ ├── CommitteeSignature.md │ ├── ConditionalTransferRequest.md │ ├── FalseFullWithdrawalRequest.md │ ├── FeeInfoExchangeRequest.md │ ├── FeeInfoUserRequest.md │ ├── FullWithdrawalRequest.md │ ├── MultiTransactionRequest.md │ ├── OrderRequest.md │ ├── Request.md │ ├── SettlementInfoRequest.md │ ├── SettlementRequest.md │ ├── Signature.md │ ├── StarkExClientConfig.md │ ├── TransactionRequest.md │ └── TransferRequest.md └── modules.md ├── img └── starkex.svg ├── package.json ├── playground ├── README.md ├── client.html ├── server.js └── server.ts ├── release.config.js ├── scripts ├── docs-publish.bash └── npm-publish.bash ├── src ├── index.ts ├── lib │ ├── availability-gateway │ │ ├── availability-gateway-service-type.ts │ │ ├── availability-gateway-types.ts │ │ ├── availability-gateway.ts │ │ └── index.ts │ ├── common │ │ ├── error-codes.ts │ │ └── index.ts │ ├── feeder-gateway │ │ ├── feeder-gateway-request.ts │ │ ├── feeder-gateway-service-type.ts │ │ ├── feeder-gateway.ts │ │ └── index.ts │ ├── gateway-base.ts │ ├── gateway │ │ ├── gateway-request-type.ts │ │ ├── gateway-request.ts │ │ ├── gateway-service-type.ts │ │ ├── gateway-types.ts │ │ ├── gateway.ts │ │ └── index.ts │ ├── index.ts │ └── starkex-client.ts └── utils │ ├── api-request.ts │ ├── api-versioning.ts │ ├── index.ts │ ├── logger.ts │ ├── messages.ts │ └── utils.ts ├── test ├── gateway.spec.js └── gateway │ └── add-transaction.spec.js ├── tsconfig.json ├── typedoc.json ├── webpack.config.js ├── webpack.dev.js ├── webpack.prod.js └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | docs 4 | playground/*.js 5 | playground/*.ts 6 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "globals": { 4 | "require": true, 5 | "process": true, 6 | "module": true, 7 | "chai": true, 8 | "__dirname": true 9 | }, 10 | "env": { 11 | "browser": true, 12 | "es2021": true, 13 | "mocha": true 14 | }, 15 | "parser": "babel-eslint", 16 | "parserOptions": { 17 | "ecmaVersion": 12, 18 | "sourceType": "module" 19 | }, 20 | "plugins": ["prettier", "mocha-no-only"], 21 | "extends": ["eslint:recommended"], 22 | "rules": { 23 | "prettier/prettier": "error", 24 | "no-console": "warn", 25 | "mocha-no-only/mocha-no-only": "error" 26 | }, 27 | "overrides": [ 28 | { 29 | "files": ["**/*.{ts,tsx}"], 30 | "parser": "@typescript-eslint/parser", 31 | "parserOptions": { 32 | "ecmaVersion": 12, 33 | "sourceType": "module" 34 | }, 35 | "extends": [ 36 | "eslint:recommended", 37 | "plugin:@typescript-eslint/eslint-recommended", 38 | "plugin:@typescript-eslint/recommended", 39 | "prettier" 40 | ], 41 | "plugins": ["@typescript-eslint", "prettier", "mocha-no-only"], 42 | "rules": { 43 | "prettier/prettier": "error", 44 | "@typescript-eslint/no-unused-vars": "error", 45 | "@typescript-eslint/no-explicit-any": ["off"], 46 | "mocha-no-only/mocha-no-only": "error" 47 | } 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: dan-ziv 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | 28 | - OS: [e.g. iOS] 29 | - Browser [e.g. chrome, safari] 30 | - Version [e.g. 22] 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: dan-ziv 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description of the Changes 2 | 3 | Please add a detailed description of the change, whether it's an enhancement or a bugfix. 4 | If the PR is related to an open issue please link to it. 5 | 6 | Solves #[INSERT_MONDAY_ID_HERE](INSERT_MONDAY_URL_HERE) 7 | 8 | --- 9 | 10 | ### Checklist 11 | 12 | - [ ] New unit / functional tests have been added (whenever applicable). 13 | - [ ] Docs have been updated (whenever relevant). 14 | - [ ] PR title is follow the [Conventional Commits](https://www.conventionalcommits.org/) convention: `[optional scope]: `, e.g: `fix: prevent racing of requests` 15 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | name: Pull request workflow 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | lint: 7 | name: Find linting problems in your JavaScript 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - uses: actions/setup-node@v2 13 | with: 14 | node-version: 14 15 | 16 | - name: Install node_modules 17 | run: yarn 18 | 19 | - name: Run ESLint check 20 | run: yarn run lint 21 | 22 | test: 23 | name: Running unit tests 24 | runs-on: ubuntu-latest 25 | needs: lint 26 | steps: 27 | - uses: actions/checkout@v2 28 | 29 | - uses: actions/setup-node@v2 30 | with: 31 | node-version: 14 32 | 33 | - name: Install node_modules 34 | run: yarn 35 | 36 | - name: Run tests 37 | run: | 38 | yarn run build 39 | yarn run test 40 | -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Push workflow 2 | 3 | on: 4 | push: 5 | branches: 6 | - dev 7 | - master 8 | 9 | jobs: 10 | release-version: 11 | name: Releasing a version 12 | runs-on: ubuntu-latest 13 | if: ${{ !startsWith(github.event.head_commit.message, 'release') || (github.ref_name == 'master' && !startsWith(github.event.head_commit.message, 'release')) }} 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | token: ${{ secrets.USER_TOKEN }} 19 | 20 | - uses: actions/setup-node@v2 21 | with: 22 | node-version: 14 23 | 24 | - name: Install node_modules 25 | run: yarn 26 | 27 | - name: Run release script 28 | run: yarn run release 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.USER_TOKEN }} 31 | GH_TOKEN: ${{ secrets.USER_TOKEN }} 32 | -------------------------------------------------------------------------------- /.github/workflows/tag.yml: -------------------------------------------------------------------------------- 1 | name: Tag workflow 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*.*.*' 7 | 8 | jobs: 9 | create-release: 10 | name: Creating a release 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v2 15 | 16 | - name: Setup node 17 | uses: actions/setup-node@v2 18 | with: 19 | node-version: '16.x' 20 | registry-url: 'https://registry.npmjs.org/' 21 | scope: '@starkware-industries' 22 | 23 | - name: Install dependencies 24 | run: yarn 25 | 26 | - name: Build project 🔧 27 | run: yarn run build 28 | 29 | - name: Publish package on NPM 📦 30 | run: yarn npm-publish 31 | env: 32 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /dist 13 | 14 | # misc 15 | .idea 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | *.log 26 | certs 27 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": false, 4 | "embeddedLanguageFormatting": "auto", 5 | "htmlWhitespaceSensitivity": "css", 6 | "insertPragma": false, 7 | "printWidth": 80, 8 | "proseWrap": "preserve", 9 | "quoteProps": "as-needed", 10 | "requirePragma": false, 11 | "semi": true, 12 | "singleQuote": true, 13 | "tabWidth": 2, 14 | "trailingComma": "none", 15 | "useTabs": false 16 | } 17 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.1.0](https://github.com/starkware-libs/starkex-js/compare/v0.0.6...v0.1.0) (2022-09-18) 2 | 3 | 4 | ### 🧩 Features 5 | 6 | * **2847512314:** Add Stark Error Code ([#16](https://github.com/starkware-libs/starkex-js/issues/16)) ([b276cda](https://github.com/starkware-libs/starkex-js/commit/b276cdae756e01461252472e5b5e7cc348e4e1e1)) 7 | * **2847512320:** adjust numeric types ([#20](https://github.com/starkware-libs/starkex-js/issues/20)) ([37550b7](https://github.com/starkware-libs/starkex-js/commit/37550b7d1d1a858e8a3afe93c0ecfe06e8419978)) 8 | * **3075511177:** support multi-transaction ([#21](https://github.com/starkware-libs/starkex-js/issues/21)) ([d788a18](https://github.com/starkware-libs/starkex-js/commit/d788a1823c0d2786250c915c1bf9891683a2478b)) 9 | * **3127780111:** drop support for availability gateway ([#25](https://github.com/starkware-libs/starkex-js/issues/25)) ([bf8bbcf](https://github.com/starkware-libs/starkex-js/commit/bf8bbcf4da9c2d3f528662c0014c91e31f142fcf)) 10 | * **3127791831:** dynamic versioning ([#27](https://github.com/starkware-libs/starkex-js/issues/27)) ([935dd55](https://github.com/starkware-libs/starkex-js/commit/935dd552ffa3a3790d1c107b024d4c8a51c6e337)) 11 | * **3200394536:** gateway - add mark_transaction_for_replacement support ([#29](https://github.com/starkware-libs/starkex-js/issues/29)) ([da402e7](https://github.com/starkware-libs/starkex-js/commit/da402e71d3764a5364f807fadb923c71aba67c29)) 12 | * **3202221738:** feeder gateway - add v4.5 capabilities ([#26](https://github.com/starkware-libs/starkex-js/issues/26)) ([a6b5975](https://github.com/starkware-libs/starkex-js/commit/a6b59755ffb1d46c82495f6cb05275a4ee8a33dc)) 13 | 14 | 15 | ### 📚 Docs 16 | 17 | * generate v4.5 canary docs ([#33](https://github.com/starkware-libs/starkex-js/issues/33)) ([b8c2d71](https://github.com/starkware-libs/starkex-js/commit/b8c2d7120779a835c76ae3ff08c7a5b6edca6422)) 18 | 19 | ## [0.1.0-dev.7](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.6...v0.1.0-dev.7) (2022-09-08) 20 | 21 | 22 | ### 🧩 Features 23 | 24 | * **3200394536:** gateway - add mark_transaction_for_replacement support ([#29](https://github.com/starkware-libs/starkex-js/issues/29)) ([da402e7](https://github.com/starkware-libs/starkex-js/commit/da402e71d3764a5364f807fadb923c71aba67c29)) 25 | 26 | ## [0.1.0-dev.6](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.5...v0.1.0-dev.6) (2022-09-08) 27 | 28 | 29 | ### 🧩 Features 30 | 31 | * **3127791831:** dynamic versioning ([#27](https://github.com/starkware-libs/starkex-js/issues/27)) ([935dd55](https://github.com/starkware-libs/starkex-js/commit/935dd552ffa3a3790d1c107b024d4c8a51c6e337)) 32 | 33 | ## [0.1.0-dev.5](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.4...v0.1.0-dev.5) (2022-09-08) 34 | 35 | 36 | ### 🧩 Features 37 | 38 | * **3202221738:** feeder gateway - add v4.5 capabilities ([#26](https://github.com/starkware-libs/starkex-js/issues/26)) ([a6b5975](https://github.com/starkware-libs/starkex-js/commit/a6b59755ffb1d46c82495f6cb05275a4ee8a33dc)) 39 | 40 | ## [0.1.0-dev.4](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.3...v0.1.0-dev.4) (2022-09-08) 41 | 42 | 43 | ### 🧩 Features 44 | 45 | * **3127780111:** drop support for availability gateway ([#25](https://github.com/starkware-libs/starkex-js/issues/25)) ([bf8bbcf](https://github.com/starkware-libs/starkex-js/commit/bf8bbcf4da9c2d3f528662c0014c91e31f142fcf)) 46 | 47 | ## [0.1.0-dev.3](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.2...v0.1.0-dev.3) (2022-09-06) 48 | 49 | 50 | ### 🧩 Features 51 | 52 | * **3075511177:** support multi-transaction ([#21](https://github.com/starkware-libs/starkex-js/issues/21)) ([d788a18](https://github.com/starkware-libs/starkex-js/commit/d788a1823c0d2786250c915c1bf9891683a2478b)) 53 | 54 | ## [0.1.0-dev.2](https://github.com/starkware-libs/starkex-js/compare/v0.1.0-dev.1...v0.1.0-dev.2) (2022-09-05) 55 | 56 | 57 | ### 🧩 Features 58 | 59 | * **2847512320:** adjust numeric types ([#20](https://github.com/starkware-libs/starkex-js/issues/20)) ([37550b7](https://github.com/starkware-libs/starkex-js/commit/37550b7d1d1a858e8a3afe93c0ecfe06e8419978)) 60 | 61 | ## [0.1.0-dev.1](https://github.com/starkware-libs/starkex-js/compare/v0.0.6...v0.1.0-dev.1) (2022-09-05) 62 | 63 | 64 | ### 🧩 Features 65 | 66 | * **2847512314:** Add Stark Error Code ([#16](https://github.com/starkware-libs/starkex-js/issues/16)) ([b276cda](https://github.com/starkware-libs/starkex-js/commit/b276cdae756e01461252472e5b5e7cc348e4e1e1)) 67 | 68 | # Changelog 69 | 70 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 71 | 72 | ### [0.0.6](https://github.com/starkware-libs/starkex-js/compare/v0.0.6-0...v0.0.6) (2022-01-31) 73 | 74 | ### [0.0.5](https://github.com/starkware-libs/starkex-js/compare/v0.0.4...v0.0.5) (2021-12-05) 75 | 76 | ### [0.0.4](https://github.com/starkware-libs/starkex-js/compare/v0.0.3...v0.0.4) (2021-11-24) 77 | 78 | ### Bug Fixes 79 | 80 | - **gateway:** caller is not aware of the sent txId ([#10](https://github.com/starkware-libs/starkex-js/issues/10)) ([cb9862d](https://github.com/starkware-libs/starkex-js/commit/cb9862d687998deec928b8068bd8d1e69c0a90f4)) 81 | 82 | ### [0.0.3](https://github.com/starkware-libs/starkex-js/compare/v0.0.2...v0.0.3) (2021-10-20) 83 | 84 | ### [0.0.2](https://github.com/starkware-libs/starkex-js/compare/v0.0.1...v0.0.2) (2021-10-20) 85 | 86 | ### Bug Fixes 87 | 88 | - README.md ([#5](https://github.com/starkware-libs/starkex-js/issues/5)) ([89a0901](https://github.com/starkware-libs/starkex-js/commit/89a0901fd0f9bef8a810413d3b8cc292e5706e48)) 89 | 90 | ### 0.0.1 (2021-10-11) 91 | 92 | ### Features 93 | 94 | - add jenkins support ([#3](https://github.com/starkware-libs/starkex-js/issues/3)) ([8a56bd4](https://github.com/starkware-libs/starkex-js/commit/8a56bd46aa39163fd618c1935fe487cec1c90504)) 95 | - starkex sdk ([#2](https://github.com/starkware-libs/starkex-js/issues/2)) ([faaa213](https://github.com/starkware-libs/starkex-js/commit/faaa2138feae74599a344c60bd49df6fef122017)) 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 | 7 |

JavaScript SDK for StarkEx

8 | 9 | 10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | `starkex-js` is a JavaScript wrapper around the [StarkEx API](https://starkware.co/starkex/api/) 23 | that can be used in both NodeJS and Browser environments. 24 | 25 | `starkex-js` is written in [ECMAScript6] and strongly typed and transpiled to ECMAScript5 using [TypeScript]. 26 | 27 | [typescript]: https://www.typescriptlang.org/ 28 | [ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials 29 | 30 | ## Installation 31 | 32 | _This package is Typescript ready_ 33 | 34 | ```bash 35 | // using npm 36 | npm i @starkware-industries/starkex-js 37 | 38 | // using yarn 39 | yarn add @starkware-industries/starkex-js 40 | ``` 41 | 42 | ## How to use it 43 | 44 | The library is a default export. 45 | 46 | ### Browser 47 | 48 | To use it browser, you need to use the code from `browser.js` file. 49 | 50 | ```html 51 | 52 | ``` 53 | 54 | or via CDN 55 | 56 | ```html 57 | 58 | ``` 59 | 60 | In this scenario, the library will be bound to the global window object with the property StarkExAPI. 61 | 62 | `window.StarkExAPI` or simple `StarkExAPI` can be used to access the library. 63 | 64 | If you have a toolchain available you can use an `import` statement. 65 | 66 | ```ts 67 | import StarkExAPI from '@starkware-industries/starkex-js/browser'; 68 | ``` 69 | 70 | ```js 71 | const StarkExAPI = require('@starkware-industries/starkex-js/browser'); 72 | ``` 73 | 74 | _Because is a default export, here you can import it with what name you want_ 75 | 76 | ### Node 77 | 78 | For `NodeJS` environment, just replace `browser` with `node` 79 | 80 | ```ts 81 | import StarkExAPI from 'starkex-js/node'; 82 | ``` 83 | 84 | ```js 85 | const StarkExAPI = require('@starkware-industries/starkex-js/node'); 86 | ``` 87 | 88 | ## Usage 89 | 90 | The object imported is a class that first needs to be instantiated: 91 | 92 | ```ts 93 | new StarkExAPI(config: StarkExClientConfig): StarkExClient; 94 | ``` 95 | 96 | Where `config` is a configuration object of form: 97 | 98 | ```ts 99 | interface StarkExClientConfig { 100 | endpoint: string; 101 | // optional - relevant only for node environment 102 | certs?: { 103 | cert: string; 104 | key: string; 105 | ca?: string; 106 | }; 107 | } 108 | ``` 109 | 110 | _Example_ 111 | 112 | ```ts 113 | const starkExAPI = new StarkExAPI({ 114 | endpoint: 'https://gw.playground-v2.starkex.co' 115 | }); 116 | ``` 117 | 118 | _Example with certs (NodeJS environment)_ 119 | 120 | ```ts 121 | const starkExAPI = new StarkExAPI({ 122 | endpoint: 'https://playground.starkex.co', 123 | certs: { 124 | cert: 'USER_CERT', 125 | key: 'USER_KEY' 126 | } 127 | }); 128 | ``` 129 | 130 | The `StarkExClient` object returned from the constructor exposing the different gateways existing on this API: 131 | 132 | #### `public gateway: Gateway` 133 | 134 | This is the StarkEx Services HTTP gateway version2 for all external trading interactions. 135 | 136 | _Example for is_alive_ 137 | 138 | ```ts 139 | const isAlive = await starkExAPI.gateway.isAlive(); 140 | console.log(isAlive); // gateway is alive! 141 | ``` 142 | 143 | _Example for get_first_unused_tx_id_ 144 | 145 | ```ts 146 | const txId = await starkExAPI.gateway.getFirstUnusedTxId(); 147 | console.log(txId); // 69 148 | ``` 149 | 150 | _Example for a DepositRequest_ 151 | 152 | ```ts 153 | const request = { 154 | txId: 10234993, 155 | amount: "4029557120079369747", 156 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 157 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 158 | vaultId: 1654615998 159 | }; 160 | const response = await starkExAPI.gateway.deposit(request); 161 | console.log(response); // {txId: 10234993, code: "TRANSACTION_PENDING"} 162 | ``` 163 | 164 | _Example for a MultiTransactionRequest_ 165 | 166 | ```ts 167 | const response = await starkExClient.gateway.multiTransaction({ 168 | txId: 10234994, 169 | txs: [ 170 | { 171 | type: StarkExClient.GatewayRequestType.DEPOSIT_REQUEST, 172 | amount: "4029557120079369747", 173 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 174 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 175 | vaultId: 1654615998 176 | }, 177 | { 178 | type: StarkExClient.GatewayRequestType.WITHDRAWAL_REQUEST, 179 | amount: "4029557120079369747", 180 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 181 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 182 | vaultId: 1654615998 183 | }, 184 | ], 185 | }); 186 | console.log(response); // {txId: 10234994, code: "TRANSACTION_PENDING"} 187 | ``` 188 | 189 | Full API docs for `gateway` can be found [here](docs/classes/Gateway.md). 190 | 191 | #### `public feederGateway: FeederGateway` 192 | 193 | This is the StarkEx Services HTTP gateway for feeder interactions. The Feeder is a gateway to the StarkEx system for 194 | retrieving transaction batch information by external parties 195 | 196 | _Example for get_batch_ids_ 197 | 198 | ```ts 199 | const batchIdsRequest = { 200 | vaultRoot: '0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1', 201 | orderRoot: '0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8', 202 | sequenceNumber: 5678 203 | }; 204 | const batchIds = await starkExAPI.feederGateway.getBatchIds(batchIdsRequest); 205 | console.log(batchIds); // [123, 456] 206 | ``` 207 | 208 | Full API docs for `feederGateway` can be found [here](docs/classes/FeederGateway.md). 209 | 210 | _Deprecated functionality_ 211 | 212 | Since StarkEx v4.5, `gateway` and `feeder gateway` apis expect to receive http requests for version 2 (`v2` prefix inside the request url). 213 | 214 | Deprecated functions, that still uses the old version of the StarkEx api (no url prefix), are marked with a `DEPRECATED` prefix by the SDK. This was done in order to inform the user that even though those methods are still supported by the api, they will be deleted in the next version. 215 | 216 | For example, a request to `/v2/feeder_gateway/get_batch_info` will be made by: 217 | 218 | ```ts 219 | await starkExAPI.feederGateway.getBatchInfo(1); 220 | ``` 221 | 222 | While: 223 | 224 | ```ts 225 | await starkExAPI.feederGateway.DEPRECATED_getBatchInfo(1); 226 | ``` 227 | 228 | will make a request to `/feeder_gateway/get_batch_info`. 229 | 230 | --- 231 | 232 | Note: All results will be exactly the **raw** response from the API. 233 | 234 | ## API Docs 235 | 236 | [Click here](docs/modules.md) for full API documentation. 237 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | StarkEx JavaScript Client Library - v0.1.0-dev.7 / [Exports](modules.md) 2 | 3 | 4 |

5 | 6 |

7 | 8 | 9 |

JavaScript SDK for StarkEx

10 | 11 | 12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

23 | 24 | `starkex-js` is a JavaScript wrapper around the [StarkEx API](https://starkware.co/starkex/api/) 25 | that can be used in both NodeJS and Browser environments. 26 | 27 | `starkex-js` is written in [ECMAScript6] and strongly typed and transpiled to ECMAScript5 using [TypeScript]. 28 | 29 | [typescript]: https://www.typescriptlang.org/ 30 | [ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials 31 | 32 | ## Installation 33 | 34 | _This package is Typescript ready_ 35 | 36 | ```bash 37 | // using npm 38 | npm i @starkware-industries/starkex-js 39 | 40 | // using yarn 41 | yarn add @starkware-industries/starkex-js 42 | ``` 43 | 44 | ## How to use it 45 | 46 | The library is a default export. 47 | 48 | ### Browser 49 | 50 | To use it browser, you need to use the code from `browser.js` file. 51 | 52 | ```html 53 | 54 | ``` 55 | 56 | or via CDN 57 | 58 | ```html 59 | 60 | ``` 61 | 62 | In this scenario, the library will be bound to the global window object with the property StarkExAPI. 63 | 64 | `window.StarkExAPI` or simple `StarkExAPI` can be used to access the library. 65 | 66 | If you have a toolchain available you can use an `import` statement. 67 | 68 | ```ts 69 | import StarkExAPI from '@starkware-industries/starkex-js/browser'; 70 | ``` 71 | 72 | ```js 73 | const StarkExAPI = require('@starkware-industries/starkex-js/browser'); 74 | ``` 75 | 76 | _Because is a default export, here you can import it with what name you want_ 77 | 78 | ### Node 79 | 80 | For `NodeJS` environment, just replace `browser` with `node` 81 | 82 | ```ts 83 | import StarkExAPI from 'starkex-js/node'; 84 | ``` 85 | 86 | ```js 87 | const StarkExAPI = require('@starkware-industries/starkex-js/node'); 88 | ``` 89 | 90 | ## Usage 91 | 92 | The object imported is a class that first needs to be instantiated: 93 | 94 | ```ts 95 | new StarkExAPI(config: StarkExClientConfig): StarkExClient; 96 | ``` 97 | 98 | Where `config` is a configuration object of form: 99 | 100 | ```ts 101 | interface StarkExClientConfig { 102 | endpoint: string; 103 | // optional - relevant only for node environment 104 | certs?: { 105 | cert: string; 106 | key: string; 107 | ca?: string; 108 | }; 109 | } 110 | ``` 111 | 112 | _Example_ 113 | 114 | ```ts 115 | const starkExAPI = new StarkExAPI({ 116 | endpoint: 'https://gw.playground-v2.starkex.co' 117 | }); 118 | ``` 119 | 120 | _Example with certs (NodeJS environment)_ 121 | 122 | ```ts 123 | const starkExAPI = new StarkExAPI({ 124 | endpoint: 'https://playground.starkex.co', 125 | certs: { 126 | cert: 'USER_CERT', 127 | key: 'USER_KEY' 128 | } 129 | }); 130 | ``` 131 | 132 | The `StarkExClient` object returned from the constructor exposing the different gateways existing on this API: 133 | 134 | #### `public gateway: Gateway` 135 | 136 | This is the StarkEx Services HTTP gateway version2 for all external trading interactions. 137 | 138 | _Example for is_alive_ 139 | 140 | ```ts 141 | const isAlive = await starkExAPI.gateway.isAlive(); 142 | console.log(isAlive); // gateway is alive! 143 | ``` 144 | 145 | _Example for get_first_unused_tx_id_ 146 | 147 | ```ts 148 | const txId = await starkExAPI.gateway.getFirstUnusedTxId(); 149 | console.log(txId); // 69 150 | ``` 151 | 152 | _Example for a DepositRequest_ 153 | 154 | ```ts 155 | const request = { 156 | txId: 10234993, 157 | amount: "4029557120079369747", 158 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 159 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 160 | vaultId: 1654615998 161 | }; 162 | const response = await starkExAPI.gateway.deposit(request); 163 | console.log(response); // {txId: 10234993, code: "TRANSACTION_PENDING"} 164 | ``` 165 | 166 | _Example for a MultiTransactionRequest_ 167 | 168 | ```ts 169 | const response = await starkExClient.gateway.multiTransaction({ 170 | txId: 10234994, 171 | txs: [ 172 | { 173 | type: StarkExClient.GatewayRequestType.DEPOSIT_REQUEST, 174 | amount: "4029557120079369747", 175 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 176 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 177 | vaultId: 1654615998 178 | }, 179 | { 180 | type: StarkExClient.GatewayRequestType.WITHDRAWAL_REQUEST, 181 | amount: "4029557120079369747", 182 | starkKey: "0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac", 183 | tokenId: "0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378", 184 | vaultId: 1654615998 185 | }, 186 | ], 187 | }); 188 | console.log(response); // {txId: 10234994, code: "TRANSACTION_PENDING"} 189 | ``` 190 | 191 | Full API docs for `gateway` can be found [here](docs/classes/Gateway.md). 192 | 193 | #### `public feederGateway: FeederGateway` 194 | 195 | This is the StarkEx Services HTTP gateway for feeder interactions. The Feeder is a gateway to the StarkEx system for 196 | retrieving transaction batch information by external parties 197 | 198 | _Example for get_batch_ids_ 199 | 200 | ```ts 201 | const batchIdsRequest = { 202 | vaultRoot: '0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1', 203 | orderRoot: '0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8', 204 | sequenceNumber: 5678 205 | }; 206 | const batchIds = await starkExAPI.feederGateway.getBatchIds(batchIdsRequest); 207 | console.log(batchIds); // [123, 456] 208 | ``` 209 | 210 | Full API docs for `feederGateway` can be found [here](docs/classes/FeederGateway.md). 211 | 212 | _Deprecated functionality_ 213 | 214 | Since StarkEx v4.5, `gateway` and `feeder gateway` apis expect to receive http requests for version 2 (`v2` prefix inside the request url). 215 | 216 | Deprecated functions, that still uses the old version of the StarkEx api (no url prefix), are marked with a `DEPRECATED` prefix by the SDK. This was done in order to inform the user that even though those methods are still supported by the api, they will be deleted in the next version. 217 | 218 | For example, a request to `/v2/feeder_gateway/get_batch_info` will be made by: 219 | 220 | ```ts 221 | await starkExAPI.feederGateway.getBatchInfo(1); 222 | ``` 223 | 224 | While: 225 | 226 | ```ts 227 | await starkExAPI.feederGateway.DEPRECATED_getBatchInfo(1); 228 | ``` 229 | 230 | will make a request to `/feeder_gateway/get_batch_info`. 231 | 232 | --- 233 | 234 | Note: All results will be exactly the **raw** response from the API. 235 | 236 | ## API Docs 237 | 238 | [Click here](docs/modules.md) for full API documentation. 239 | -------------------------------------------------------------------------------- /docs/classes/AvailabilityGateway.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / AvailabilityGateway 2 | 3 | # Class: AvailabilityGateway 4 | 5 | ## Hierarchy 6 | 7 | - `GatewayBase` 8 | 9 | ↳ **`AvailabilityGateway`** 10 | 11 | ## Table of contents 12 | 13 | ### Constructors 14 | 15 | - [constructor](AvailabilityGateway.md#constructor) 16 | 17 | ### Methods 18 | 19 | - [approveNewRoots](AvailabilityGateway.md#approvenewroots) 20 | - [getBatchData](AvailabilityGateway.md#getbatchdata) 21 | 22 | ## Constructors 23 | 24 | ### constructor 25 | 26 | • **new AvailabilityGateway**(`config`) 27 | 28 | #### Parameters 29 | 30 | | Name | Type | 31 | | :------- | :------------------------------------------------------------ | 32 | | `config` | [`StarkExClientConfig`](../interfaces/StarkExClientConfig.md) | 33 | 34 | #### Overrides 35 | 36 | GatewayBase.constructor 37 | 38 | #### Defined in 39 | 40 | [availability-gateway/availability-gateway.ts:8](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway.ts#L8) 41 | 42 | ## Methods 43 | 44 | ### approveNewRoots 45 | 46 | ▸ **approveNewRoots**(`data`): `Promise`<`string`\> 47 | 48 | #### Parameters 49 | 50 | | Name | Type | 51 | | :----- | :---------------------------------------------------------- | 52 | | `data` | [`CommitteeSignature`](../interfaces/CommitteeSignature.md) | 53 | 54 | #### Returns 55 | 56 | `Promise`<`string`\> 57 | 58 | #### Defined in 59 | 60 | [availability-gateway/availability-gateway.ts:15](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway.ts#L15) 61 | 62 | --- 63 | 64 | ### getBatchData 65 | 66 | ▸ **getBatchData**(`batchId`): `Promise`<`Record`<`string`, `any`\>\> 67 | 68 | #### Parameters 69 | 70 | | Name | Type | 71 | | :-------- | :------- | 72 | | `batchId` | `number` | 73 | 74 | #### Returns 75 | 76 | `Promise`<`Record`<`string`, `any`\>\> 77 | 78 | #### Defined in 79 | 80 | [availability-gateway/availability-gateway.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway.ts#L24) 81 | -------------------------------------------------------------------------------- /docs/classes/FeederGateway.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / FeederGateway 2 | 3 | # Class: FeederGateway 4 | 5 | ## Hierarchy 6 | 7 | - `GatewayBase` 8 | 9 | ↳ **`FeederGateway`** 10 | 11 | ## Table of contents 12 | 13 | ### Constructors 14 | 15 | - [constructor](FeederGateway.md#constructor) 16 | 17 | ### Methods 18 | 19 | - [DEPRECATED_getBatchIds](FeederGateway.md#deprecated_getbatchids) 20 | - [DEPRECATED_getBatchInfo](FeederGateway.md#deprecated_getbatchinfo) 21 | - [getBatchEnclosingIds](FeederGateway.md#getbatchenclosingids) 22 | - [getBatchInfo](FeederGateway.md#getbatchinfo) 23 | - [getLastBatchId](FeederGateway.md#getlastbatchid) 24 | - [getPrevBatchId](FeederGateway.md#getprevbatchid) 25 | - [isAlive](FeederGateway.md#isalive) 26 | - [isReady](FeederGateway.md#isready) 27 | 28 | ## Constructors 29 | 30 | ### constructor 31 | 32 | • **new FeederGateway**(`config`) 33 | 34 | #### Parameters 35 | 36 | | Name | Type | 37 | | :------- | :------------------------------------------------------------ | 38 | | `config` | [`StarkExClientConfig`](../interfaces/StarkExClientConfig.md) | 39 | 40 | #### Overrides 41 | 42 | GatewayBase.constructor 43 | 44 | #### Defined in 45 | 46 | [feeder-gateway/feeder-gateway.ts:8](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L8) 47 | 48 | ## Methods 49 | 50 | ### DEPRECATED_getBatchIds 51 | 52 | ▸ **DEPRECATED_getBatchIds**(`request`): `Promise`<`number`[]\> 53 | 54 | #### Parameters 55 | 56 | | Name | Type | 57 | | :-------- | :---------------------------------------------------- | 58 | | `request` | [`BatchIdsRequest`](../interfaces/BatchIdsRequest.md) | 59 | 60 | #### Returns 61 | 62 | `Promise`<`number`[]\> 63 | 64 | #### Defined in 65 | 66 | [feeder-gateway/feeder-gateway.ts:29](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L29) 67 | 68 | --- 69 | 70 | ### DEPRECATED_getBatchInfo 71 | 72 | ▸ **DEPRECATED_getBatchInfo**(`batchId`): `Promise`<`Record`<`string`, `any`\>\> 73 | 74 | #### Parameters 75 | 76 | | Name | Type | 77 | | :-------- | :------- | 78 | | `batchId` | `number` | 79 | 80 | #### Returns 81 | 82 | `Promise`<`Record`<`string`, `any`\>\> 83 | 84 | #### Defined in 85 | 86 | [feeder-gateway/feeder-gateway.ts:40](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L40) 87 | 88 | --- 89 | 90 | ### getBatchEnclosingIds 91 | 92 | ▸ **getBatchEnclosingIds**(`batchId`): `Promise`<`number`[]\> 93 | 94 | #### Parameters 95 | 96 | | Name | Type | 97 | | :-------- | :------- | 98 | | `batchId` | `number` | 99 | 100 | #### Returns 101 | 102 | `Promise`<`number`[]\> 103 | 104 | #### Defined in 105 | 106 | [feeder-gateway/feeder-gateway.ts:23](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L23) 107 | 108 | --- 109 | 110 | ### getBatchInfo 111 | 112 | ▸ **getBatchInfo**(`batchId`): `Promise`<`Record`<`string`, `any`\>\> 113 | 114 | #### Parameters 115 | 116 | | Name | Type | 117 | | :-------- | :------- | 118 | | `batchId` | `number` | 119 | 120 | #### Returns 121 | 122 | `Promise`<`Record`<`string`, `any`\>\> 123 | 124 | #### Defined in 125 | 126 | [feeder-gateway/feeder-gateway.ts:52](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L52) 127 | 128 | --- 129 | 130 | ### getLastBatchId 131 | 132 | ▸ **getLastBatchId**(): `Promise`<`number`\> 133 | 134 | #### Returns 135 | 136 | `Promise`<`number`\> 137 | 138 | #### Defined in 139 | 140 | [feeder-gateway/feeder-gateway.ts:58](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L58) 141 | 142 | --- 143 | 144 | ### getPrevBatchId 145 | 146 | ▸ **getPrevBatchId**(`batchId`): `Promise`<`number`\> 147 | 148 | #### Parameters 149 | 150 | | Name | Type | 151 | | :-------- | :------- | 152 | | `batchId` | `number` | 153 | 154 | #### Returns 155 | 156 | `Promise`<`number`\> 157 | 158 | #### Defined in 159 | 160 | [feeder-gateway/feeder-gateway.ts:62](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L62) 161 | 162 | --- 163 | 164 | ### isAlive 165 | 166 | ▸ **isAlive**(): `Promise`<`string`\> 167 | 168 | #### Returns 169 | 170 | `Promise`<`string`\> 171 | 172 | #### Defined in 173 | 174 | [feeder-gateway/feeder-gateway.ts:15](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L15) 175 | 176 | --- 177 | 178 | ### isReady 179 | 180 | ▸ **isReady**(): `Promise`<`string`\> 181 | 182 | #### Returns 183 | 184 | `Promise`<`string`\> 185 | 186 | #### Defined in 187 | 188 | [feeder-gateway/feeder-gateway.ts:19](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway.ts#L19) 189 | -------------------------------------------------------------------------------- /docs/classes/Gateway.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / Gateway 2 | 3 | # Class: Gateway 4 | 5 | ## Hierarchy 6 | 7 | - `GatewayBase` 8 | 9 | ↳ **`Gateway`** 10 | 11 | ## Table of contents 12 | 13 | ### Constructors 14 | 15 | - [constructor](Gateway.md#constructor) 16 | 17 | ### Methods 18 | 19 | - [conditionalTransfer](Gateway.md#conditionaltransfer) 20 | - [deposit](Gateway.md#deposit) 21 | - [falseFullWithdrawal](Gateway.md#falsefullwithdrawal) 22 | - [fullWithdrawal](Gateway.md#fullwithdrawal) 23 | - [getFirstUnusedTxId](Gateway.md#getfirstunusedtxid) 24 | - [getStarkDexAddress](Gateway.md#getstarkdexaddress) 25 | - [getTransaction](Gateway.md#gettransaction) 26 | - [isAlive](Gateway.md#isalive) 27 | - [markTransactionForReplacement](Gateway.md#marktransactionforreplacement) 28 | - [mint](Gateway.md#mint) 29 | - [multiTransaction](Gateway.md#multitransaction) 30 | - [settlement](Gateway.md#settlement) 31 | - [transfer](Gateway.md#transfer) 32 | - [withdrawal](Gateway.md#withdrawal) 33 | 34 | ## Constructors 35 | 36 | ### constructor 37 | 38 | • **new Gateway**(`config`) 39 | 40 | #### Parameters 41 | 42 | | Name | Type | 43 | | :------- | :------------------------------------------------------------ | 44 | | `config` | [`StarkExClientConfig`](../interfaces/StarkExClientConfig.md) | 45 | 46 | #### Overrides 47 | 48 | GatewayBase.constructor 49 | 50 | #### Defined in 51 | 52 | [gateway/gateway.ts:19](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L19) 53 | 54 | ## Methods 55 | 56 | ### conditionalTransfer 57 | 58 | ▸ **conditionalTransfer**(`request`): `Promise`<`Record`<`string`, `string`\>\> 59 | 60 | #### Parameters 61 | 62 | | Name | Type | 63 | | :-------- | :-------------------------------------------------------------------------- | 64 | | `request` | [`ConditionalTransferRequest`](../interfaces/ConditionalTransferRequest.md) | 65 | 66 | #### Returns 67 | 68 | `Promise`<`Record`<`string`, `string`\>\> 69 | 70 | #### Defined in 71 | 72 | [gateway/gateway.ts:72](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L72) 73 | 74 | --- 75 | 76 | ### deposit 77 | 78 | ▸ **deposit**(`request`): `Promise`<`Record`<`string`, `string`\>\> 79 | 80 | #### Parameters 81 | 82 | | Name | Type | 83 | | :-------- | :---------------------------------------------------------- | 84 | | `request` | [`TransactionRequest`](../interfaces/TransactionRequest.md) | 85 | 86 | #### Returns 87 | 88 | `Promise`<`Record`<`string`, `string`\>\> 89 | 90 | #### Defined in 91 | 92 | [gateway/gateway.ts:54](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L54) 93 | 94 | --- 95 | 96 | ### falseFullWithdrawal 97 | 98 | ▸ **falseFullWithdrawal**(`request`): `Promise`<`Record`<`string`, `string`\>\> 99 | 100 | #### Parameters 101 | 102 | | Name | Type | 103 | | :-------- | :-------------------------------------------------------------------------- | 104 | | `request` | [`FalseFullWithdrawalRequest`](../interfaces/FalseFullWithdrawalRequest.md) | 105 | 106 | #### Returns 107 | 108 | `Promise`<`Record`<`string`, `string`\>\> 109 | 110 | #### Defined in 111 | 112 | [gateway/gateway.ts:90](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L90) 113 | 114 | --- 115 | 116 | ### fullWithdrawal 117 | 118 | ▸ **fullWithdrawal**(`request`): `Promise`<`Record`<`string`, `string`\>\> 119 | 120 | #### Parameters 121 | 122 | | Name | Type | 123 | | :-------- | :---------------------------------------------------------------- | 124 | | `request` | [`FullWithdrawalRequest`](../interfaces/FullWithdrawalRequest.md) | 125 | 126 | #### Returns 127 | 128 | `Promise`<`Record`<`string`, `string`\>\> 129 | 130 | #### Defined in 131 | 132 | [gateway/gateway.ts:81](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L81) 133 | 134 | --- 135 | 136 | ### getFirstUnusedTxId 137 | 138 | ▸ **getFirstUnusedTxId**(): `Promise`<`number`\> 139 | 140 | #### Returns 141 | 142 | `Promise`<`number`\> 143 | 144 | #### Defined in 145 | 146 | [gateway/gateway.ts:33](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L33) 147 | 148 | --- 149 | 150 | ### getStarkDexAddress 151 | 152 | ▸ **getStarkDexAddress**(): `Promise`<`string`\> 153 | 154 | #### Returns 155 | 156 | `Promise`<`string`\> 157 | 158 | #### Defined in 159 | 160 | [gateway/gateway.ts:29](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L29) 161 | 162 | --- 163 | 164 | ### getTransaction 165 | 166 | ▸ **getTransaction**(`txId`): `Promise`<`Record`<`string`, `any`\>\> 167 | 168 | #### Parameters 169 | 170 | | Name | Type | 171 | | :----- | :------- | 172 | | `txId` | `number` | 173 | 174 | #### Returns 175 | 176 | `Promise`<`Record`<`string`, `any`\>\> 177 | 178 | #### Defined in 179 | 180 | [gateway/gateway.ts:23](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L23) 181 | 182 | --- 183 | 184 | ### isAlive 185 | 186 | ▸ **isAlive**(): `Promise`<`string`\> 187 | 188 | #### Returns 189 | 190 | `Promise`<`string`\> 191 | 192 | #### Defined in 193 | 194 | [gateway/gateway.ts:44](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L44) 195 | 196 | --- 197 | 198 | ### markTransactionForReplacement 199 | 200 | ▸ **markTransactionForReplacement**(`txId`): `Promise`<`string`\> 201 | 202 | #### Parameters 203 | 204 | | Name | Type | 205 | | :----- | :------------------------------------------------- | 206 | | `txId` | [`NumericSequence`](../modules.md#numericsequence) | 207 | 208 | #### Returns 209 | 210 | `Promise`<`string`\> 211 | 212 | #### Defined in 213 | 214 | [gateway/gateway.ts:37](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L37) 215 | 216 | --- 217 | 218 | ### mint 219 | 220 | ▸ **mint**(`request`): `Promise`<`Record`<`string`, `string`\>\> 221 | 222 | #### Parameters 223 | 224 | | Name | Type | 225 | | :-------- | :---------------------------------------------------------- | 226 | | `request` | [`TransactionRequest`](../interfaces/TransactionRequest.md) | 227 | 228 | #### Returns 229 | 230 | `Promise`<`Record`<`string`, `string`\>\> 231 | 232 | #### Defined in 233 | 234 | [gateway/gateway.ts:58](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L58) 235 | 236 | --- 237 | 238 | ### multiTransaction 239 | 240 | ▸ **multiTransaction**(`request`): `Promise`<`Record`<`string`, `string`\>\> 241 | 242 | #### Parameters 243 | 244 | | Name | Type | 245 | | :-------- | :-------------------------------------------------------------------- | 246 | | `request` | [`MultiTransactionRequest`](../interfaces/MultiTransactionRequest.md) | 247 | 248 | #### Returns 249 | 250 | `Promise`<`Record`<`string`, `string`\>\> 251 | 252 | #### Defined in 253 | 254 | [gateway/gateway.ts:99](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L99) 255 | 256 | --- 257 | 258 | ### settlement 259 | 260 | ▸ **settlement**(`request`): `Promise`<`Record`<`string`, `string`\>\> 261 | 262 | #### Parameters 263 | 264 | | Name | Type | 265 | | :-------- | :-------------------------------------------------------- | 266 | | `request` | [`SettlementRequest`](../interfaces/SettlementRequest.md) | 267 | 268 | #### Returns 269 | 270 | `Promise`<`Record`<`string`, `string`\>\> 271 | 272 | #### Defined in 273 | 274 | [gateway/gateway.ts:62](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L62) 275 | 276 | --- 277 | 278 | ### transfer 279 | 280 | ▸ **transfer**(`request`): `Promise`<`Record`<`string`, `string`\>\> 281 | 282 | #### Parameters 283 | 284 | | Name | Type | 285 | | :-------- | :---------------------------------------------------- | 286 | | `request` | [`TransferRequest`](../interfaces/TransferRequest.md) | 287 | 288 | #### Returns 289 | 290 | `Promise`<`Record`<`string`, `string`\>\> 291 | 292 | #### Defined in 293 | 294 | [gateway/gateway.ts:68](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L68) 295 | 296 | --- 297 | 298 | ### withdrawal 299 | 300 | ▸ **withdrawal**(`request`): `Promise`<`Record`<`string`, `string`\>\> 301 | 302 | #### Parameters 303 | 304 | | Name | Type | 305 | | :-------- | :---------------------------------------------------------- | 306 | | `request` | [`TransactionRequest`](../interfaces/TransactionRequest.md) | 307 | 308 | #### Returns 309 | 310 | `Promise`<`Record`<`string`, `string`\>\> 311 | 312 | #### Defined in 313 | 314 | [gateway/gateway.ts:48](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway.ts#L48) 315 | -------------------------------------------------------------------------------- /docs/classes/StarkExClient.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / StarkExClient 2 | 3 | # Class: StarkExClient 4 | 5 | ## Table of contents 6 | 7 | ### Constructors 8 | 9 | - [constructor](StarkExClient.md#constructor) 10 | 11 | ### Properties 12 | 13 | - [feederGateway](StarkExClient.md#feedergateway) 14 | - [gateway](StarkExClient.md#gateway) 15 | - [GatewayRequestType](StarkExClient.md#gatewayrequesttype) 16 | - [StarkErrorCode](StarkExClient.md#starkerrorcode) 17 | 18 | ## Constructors 19 | 20 | ### constructor 21 | 22 | • **new StarkExClient**(`config`) 23 | 24 | #### Parameters 25 | 26 | | Name | Type | 27 | | :------- | :------------------------------------------------------------ | 28 | | `config` | [`StarkExClientConfig`](../interfaces/StarkExClientConfig.md) | 29 | 30 | #### Defined in 31 | 32 | [starkex-client.ts:12](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L12) 33 | 34 | ## Properties 35 | 36 | ### feederGateway 37 | 38 | • **feederGateway**: [`FeederGateway`](FeederGateway.md) 39 | 40 | #### Defined in 41 | 42 | [starkex-client.ts:10](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L10) 43 | 44 | --- 45 | 46 | ### gateway 47 | 48 | • **gateway**: [`Gateway`](Gateway.md) 49 | 50 | #### Defined in 51 | 52 | [starkex-client.ts:9](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L9) 53 | 54 | --- 55 | 56 | ### GatewayRequestType 57 | 58 | ▪ `Static` `Readonly` **GatewayRequestType**: typeof [`GatewayRequestType`](../enums/GatewayRequestType.md) = `GatewayRequestType` 59 | 60 | #### Defined in 61 | 62 | [starkex-client.ts:7](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L7) 63 | 64 | --- 65 | 66 | ### StarkErrorCode 67 | 68 | ▪ `Static` `Readonly` **StarkErrorCode**: typeof [`StarkErrorCode`](../enums/StarkErrorCode.md) = `StarkErrorCode` 69 | 70 | #### Defined in 71 | 72 | [starkex-client.ts:6](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L6) 73 | -------------------------------------------------------------------------------- /docs/enums/GatewayRequestType.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / GatewayRequestType 2 | 3 | # Enumeration: GatewayRequestType 4 | 5 | ## Table of contents 6 | 7 | ### Enumeration members 8 | 9 | - [CONDITIONAL_TRANSFER_REQUEST](GatewayRequestType.md#conditional_transfer_request) 10 | - [DEPOSIT_REQUEST](GatewayRequestType.md#deposit_request) 11 | - [FALSE_FULL_WITHDRAWAL_REQUEST](GatewayRequestType.md#false_full_withdrawal_request) 12 | - [FULL_WITHDRAWAL_REQUEST](GatewayRequestType.md#full_withdrawal_request) 13 | - [MINT_REQUEST](GatewayRequestType.md#mint_request) 14 | - [MULTI_TRANSACTION_REQUEST](GatewayRequestType.md#multi_transaction_request) 15 | - [SETTLEMENT_REQUEST](GatewayRequestType.md#settlement_request) 16 | - [TRANSFER_REQUEST](GatewayRequestType.md#transfer_request) 17 | - [WITHDRAWAL_REQUEST](GatewayRequestType.md#withdrawal_request) 18 | 19 | ## Enumeration members 20 | 21 | ### CONDITIONAL_TRANSFER_REQUEST 22 | 23 | • **CONDITIONAL_TRANSFER_REQUEST** = `"ConditionalTransferRequest"` 24 | 25 | #### Defined in 26 | 27 | [gateway/gateway-request-type.ts:4](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L4) 28 | 29 | --- 30 | 31 | ### DEPOSIT_REQUEST 32 | 33 | • **DEPOSIT_REQUEST** = `"DepositRequest"` 34 | 35 | #### Defined in 36 | 37 | [gateway/gateway-request-type.ts:5](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L5) 38 | 39 | --- 40 | 41 | ### FALSE_FULL_WITHDRAWAL_REQUEST 42 | 43 | • **FALSE_FULL_WITHDRAWAL_REQUEST** = `"FalseFullWithdrawalRequest"` 44 | 45 | #### Defined in 46 | 47 | [gateway/gateway-request-type.ts:9](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L9) 48 | 49 | --- 50 | 51 | ### FULL_WITHDRAWAL_REQUEST 52 | 53 | • **FULL_WITHDRAWAL_REQUEST** = `"FullWithdrawalRequest"` 54 | 55 | #### Defined in 56 | 57 | [gateway/gateway-request-type.ts:8](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L8) 58 | 59 | --- 60 | 61 | ### MINT_REQUEST 62 | 63 | • **MINT_REQUEST** = `"MintRequest"` 64 | 65 | #### Defined in 66 | 67 | [gateway/gateway-request-type.ts:6](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L6) 68 | 69 | --- 70 | 71 | ### MULTI_TRANSACTION_REQUEST 72 | 73 | • **MULTI_TRANSACTION_REQUEST** = `"MultiTransactionRequest"` 74 | 75 | #### Defined in 76 | 77 | [gateway/gateway-request-type.ts:10](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L10) 78 | 79 | --- 80 | 81 | ### SETTLEMENT_REQUEST 82 | 83 | • **SETTLEMENT_REQUEST** = `"SettlementRequest"` 84 | 85 | #### Defined in 86 | 87 | [gateway/gateway-request-type.ts:2](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L2) 88 | 89 | --- 90 | 91 | ### TRANSFER_REQUEST 92 | 93 | • **TRANSFER_REQUEST** = `"TransferRequest"` 94 | 95 | #### Defined in 96 | 97 | [gateway/gateway-request-type.ts:3](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L3) 98 | 99 | --- 100 | 101 | ### WITHDRAWAL_REQUEST 102 | 103 | • **WITHDRAWAL_REQUEST** = `"WithdrawalRequest"` 104 | 105 | #### Defined in 106 | 107 | [gateway/gateway-request-type.ts:7](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request-type.ts#L7) 108 | -------------------------------------------------------------------------------- /docs/enums/OrderTypeObsolete.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / OrderTypeObsolete 2 | 3 | # Enumeration: OrderTypeObsolete 4 | 5 | ## Table of contents 6 | 7 | ### Enumeration members 8 | 9 | - [SETTLEMENT](OrderTypeObsolete.md#settlement) 10 | - [TRANSFER](OrderTypeObsolete.md#transfer) 11 | 12 | ## Enumeration members 13 | 14 | ### SETTLEMENT 15 | 16 | • **SETTLEMENT** = `0` 17 | 18 | #### Defined in 19 | 20 | [gateway/gateway-types.ts:36](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L36) 21 | 22 | --- 23 | 24 | ### TRANSFER 25 | 26 | • **TRANSFER** = `1` 27 | 28 | #### Defined in 29 | 30 | [gateway/gateway-types.ts:37](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L37) 31 | -------------------------------------------------------------------------------- /docs/enums/StarkErrorCode.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / StarkErrorCode 2 | 3 | # Enumeration: StarkErrorCode 4 | 5 | ## Table of contents 6 | 7 | ### Enumeration members 8 | 9 | - [API_FUNCTION_TEMPORARILY_DISABLED](StarkErrorCode.md#api_function_temporarily_disabled) 10 | - [BATCH_CREATION_FAILURE](StarkErrorCode.md#batch_creation_failure) 11 | - [BATCH_FULL](StarkErrorCode.md#batch_full) 12 | - [BATCH_NOT_READY](StarkErrorCode.md#batch_not_ready) 13 | - [CONFLICTING_ORDER_AMOUNTS](StarkErrorCode.md#conflicting_order_amounts) 14 | - [FACT_NOT_REGISTERED](StarkErrorCode.md#fact_not_registered) 15 | - [INSUFFICIENT_ONCHAIN_BALANCE](StarkErrorCode.md#insufficient_onchain_balance) 16 | - [INVALID_BATCH_ID](StarkErrorCode.md#invalid_batch_id) 17 | - [INVALID_CLAIM_HASH](StarkErrorCode.md#invalid_claim_hash) 18 | - [INVALID_COMMITTEE_MEMBER](StarkErrorCode.md#invalid_committee_member) 19 | - [INVALID_CONTRACT_ADDRESS](StarkErrorCode.md#invalid_contract_address) 20 | - [INVALID_CONTRACT_RESPONSE](StarkErrorCode.md#invalid_contract_response) 21 | - [INVALID_DEPLOYMENT_INFO](StarkErrorCode.md#invalid_deployment_info) 22 | - [INVALID_ETH_ADDRESS](StarkErrorCode.md#invalid_eth_address) 23 | - [INVALID_FACT](StarkErrorCode.md#invalid_fact) 24 | - [INVALID_FEE_TAKEN](StarkErrorCode.md#invalid_fee_taken) 25 | - [INVALID_ORDER_ID](StarkErrorCode.md#invalid_order_id) 26 | - [INVALID_ORDER_TYPE](StarkErrorCode.md#invalid_order_type) 27 | - [INVALID_REQUEST](StarkErrorCode.md#invalid_request) 28 | - [INVALID_REQUEST_PARAMETERS](StarkErrorCode.md#invalid_request_parameters) 29 | - [INVALID_SETTLEMENT_INFO](StarkErrorCode.md#invalid_settlement_info) 30 | - [INVALID_SETTLEMENT_RATIO](StarkErrorCode.md#invalid_settlement_ratio) 31 | - [INVALID_SETTLEMENT_TOKENS](StarkErrorCode.md#invalid_settlement_tokens) 32 | - [INVALID_SIGNATURE](StarkErrorCode.md#invalid_signature) 33 | - [INVALID_TRANSACTION](StarkErrorCode.md#invalid_transaction) 34 | - [INVALID_TRANSACTION_ID](StarkErrorCode.md#invalid_transaction_id) 35 | - [INVALID_VAULT](StarkErrorCode.md#invalid_vault) 36 | - [MALFORMED_REQUEST](StarkErrorCode.md#malformed_request) 37 | - [MIGRATED_PIPELINE_OBJECT_MISSING](StarkErrorCode.md#migrated_pipeline_object_missing) 38 | - [MISSING_FEE_OBJECT](StarkErrorCode.md#missing_fee_object) 39 | - [ORDER_OVERDUE](StarkErrorCode.md#order_overdue) 40 | - [OUT_OF_RANGE_AMOUNT](StarkErrorCode.md#out_of_range_amount) 41 | - [OUT_OF_RANGE_BALANCE](StarkErrorCode.md#out_of_range_balance) 42 | - [OUT_OF_RANGE_BATCH_ID](StarkErrorCode.md#out_of_range_batch_id) 43 | - [OUT_OF_RANGE_ETH_ADDRESS](StarkErrorCode.md#out_of_range_eth_address) 44 | - [OUT_OF_RANGE_EXPIRATION_TIMESTAMP](StarkErrorCode.md#out_of_range_expiration_timestamp) 45 | - [OUT_OF_RANGE_NONCE](StarkErrorCode.md#out_of_range_nonce) 46 | - [OUT_OF_RANGE_ORACLE_PRICE_QUORUM](StarkErrorCode.md#out_of_range_oracle_price_quorum) 47 | - [OUT_OF_RANGE_ORDER_ID](StarkErrorCode.md#out_of_range_order_id) 48 | - [OUT_OF_RANGE_POSITIVE_AMOUNT](StarkErrorCode.md#out_of_range_positive_amount) 49 | - [OUT_OF_RANGE_PUBLIC_KEY](StarkErrorCode.md#out_of_range_public_key) 50 | - [OUT_OF_RANGE_SIGNATURE_SUBFIELD](StarkErrorCode.md#out_of_range_signature_subfield) 51 | - [OUT_OF_RANGE_TOKEN_ID](StarkErrorCode.md#out_of_range_token_id) 52 | - [OUT_OF_RANGE_VAULT_ID](StarkErrorCode.md#out_of_range_vault_id) 53 | - [REPLACED_BEFORE](StarkErrorCode.md#replaced_before) 54 | - [REQUEST_FAILED](StarkErrorCode.md#request_failed) 55 | - [SCHEMA_VALIDATION_ERROR](StarkErrorCode.md#schema_validation_error) 56 | - [TRANSACTION_CANCELLED](StarkErrorCode.md#transaction_cancelled) 57 | - [TRANSACTION_PENDING](StarkErrorCode.md#transaction_pending) 58 | 59 | ## Enumeration members 60 | 61 | ### API_FUNCTION_TEMPORARILY_DISABLED 62 | 63 | • **API_FUNCTION_TEMPORARILY_DISABLED** = `0` 64 | 65 | #### Defined in 66 | 67 | [common/error-codes.ts:4](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L4) 68 | 69 | --- 70 | 71 | ### BATCH_CREATION_FAILURE 72 | 73 | • **BATCH_CREATION_FAILURE** = `1` 74 | 75 | #### Defined in 76 | 77 | [common/error-codes.ts:5](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L5) 78 | 79 | --- 80 | 81 | ### BATCH_FULL 82 | 83 | • **BATCH_FULL** = `2` 84 | 85 | #### Defined in 86 | 87 | [common/error-codes.ts:6](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L6) 88 | 89 | --- 90 | 91 | ### BATCH_NOT_READY 92 | 93 | • **BATCH_NOT_READY** = `3` 94 | 95 | #### Defined in 96 | 97 | [common/error-codes.ts:7](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L7) 98 | 99 | --- 100 | 101 | ### CONFLICTING_ORDER_AMOUNTS 102 | 103 | • **CONFLICTING_ORDER_AMOUNTS** = `4` 104 | 105 | #### Defined in 106 | 107 | [common/error-codes.ts:8](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L8) 108 | 109 | --- 110 | 111 | ### FACT_NOT_REGISTERED 112 | 113 | • **FACT_NOT_REGISTERED** = `5` 114 | 115 | #### Defined in 116 | 117 | [common/error-codes.ts:9](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L9) 118 | 119 | --- 120 | 121 | ### INSUFFICIENT_ONCHAIN_BALANCE 122 | 123 | • **INSUFFICIENT_ONCHAIN_BALANCE** = `6` 124 | 125 | #### Defined in 126 | 127 | [common/error-codes.ts:10](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L10) 128 | 129 | --- 130 | 131 | ### INVALID_BATCH_ID 132 | 133 | • **INVALID_BATCH_ID** = `7` 134 | 135 | #### Defined in 136 | 137 | [common/error-codes.ts:11](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L11) 138 | 139 | --- 140 | 141 | ### INVALID_CLAIM_HASH 142 | 143 | • **INVALID_CLAIM_HASH** = `8` 144 | 145 | #### Defined in 146 | 147 | [common/error-codes.ts:12](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L12) 148 | 149 | --- 150 | 151 | ### INVALID_COMMITTEE_MEMBER 152 | 153 | • **INVALID_COMMITTEE_MEMBER** = `9` 154 | 155 | #### Defined in 156 | 157 | [common/error-codes.ts:13](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L13) 158 | 159 | --- 160 | 161 | ### INVALID_CONTRACT_ADDRESS 162 | 163 | • **INVALID_CONTRACT_ADDRESS** = `10` 164 | 165 | #### Defined in 166 | 167 | [common/error-codes.ts:14](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L14) 168 | 169 | --- 170 | 171 | ### INVALID_CONTRACT_RESPONSE 172 | 173 | • **INVALID_CONTRACT_RESPONSE** = `11` 174 | 175 | #### Defined in 176 | 177 | [common/error-codes.ts:15](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L15) 178 | 179 | --- 180 | 181 | ### INVALID_DEPLOYMENT_INFO 182 | 183 | • **INVALID_DEPLOYMENT_INFO** = `12` 184 | 185 | #### Defined in 186 | 187 | [common/error-codes.ts:16](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L16) 188 | 189 | --- 190 | 191 | ### INVALID_ETH_ADDRESS 192 | 193 | • **INVALID_ETH_ADDRESS** = `13` 194 | 195 | #### Defined in 196 | 197 | [common/error-codes.ts:17](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L17) 198 | 199 | --- 200 | 201 | ### INVALID_FACT 202 | 203 | • **INVALID_FACT** = `14` 204 | 205 | #### Defined in 206 | 207 | [common/error-codes.ts:18](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L18) 208 | 209 | --- 210 | 211 | ### INVALID_FEE_TAKEN 212 | 213 | • **INVALID_FEE_TAKEN** = `15` 214 | 215 | #### Defined in 216 | 217 | [common/error-codes.ts:19](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L19) 218 | 219 | --- 220 | 221 | ### INVALID_ORDER_ID 222 | 223 | • **INVALID_ORDER_ID** = `16` 224 | 225 | #### Defined in 226 | 227 | [common/error-codes.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L20) 228 | 229 | --- 230 | 231 | ### INVALID_ORDER_TYPE 232 | 233 | • **INVALID_ORDER_TYPE** = `17` 234 | 235 | #### Defined in 236 | 237 | [common/error-codes.ts:21](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L21) 238 | 239 | --- 240 | 241 | ### INVALID_REQUEST 242 | 243 | • **INVALID_REQUEST** = `18` 244 | 245 | #### Defined in 246 | 247 | [common/error-codes.ts:22](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L22) 248 | 249 | --- 250 | 251 | ### INVALID_REQUEST_PARAMETERS 252 | 253 | • **INVALID_REQUEST_PARAMETERS** = `19` 254 | 255 | #### Defined in 256 | 257 | [common/error-codes.ts:23](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L23) 258 | 259 | --- 260 | 261 | ### INVALID_SETTLEMENT_INFO 262 | 263 | • **INVALID_SETTLEMENT_INFO** = `20` 264 | 265 | #### Defined in 266 | 267 | [common/error-codes.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L24) 268 | 269 | --- 270 | 271 | ### INVALID_SETTLEMENT_RATIO 272 | 273 | • **INVALID_SETTLEMENT_RATIO** = `21` 274 | 275 | #### Defined in 276 | 277 | [common/error-codes.ts:25](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L25) 278 | 279 | --- 280 | 281 | ### INVALID_SETTLEMENT_TOKENS 282 | 283 | • **INVALID_SETTLEMENT_TOKENS** = `22` 284 | 285 | #### Defined in 286 | 287 | [common/error-codes.ts:26](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L26) 288 | 289 | --- 290 | 291 | ### INVALID_SIGNATURE 292 | 293 | • **INVALID_SIGNATURE** = `23` 294 | 295 | #### Defined in 296 | 297 | [common/error-codes.ts:27](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L27) 298 | 299 | --- 300 | 301 | ### INVALID_TRANSACTION 302 | 303 | • **INVALID_TRANSACTION** = `24` 304 | 305 | #### Defined in 306 | 307 | [common/error-codes.ts:28](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L28) 308 | 309 | --- 310 | 311 | ### INVALID_TRANSACTION_ID 312 | 313 | • **INVALID_TRANSACTION_ID** = `25` 314 | 315 | #### Defined in 316 | 317 | [common/error-codes.ts:29](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L29) 318 | 319 | --- 320 | 321 | ### INVALID_VAULT 322 | 323 | • **INVALID_VAULT** = `26` 324 | 325 | #### Defined in 326 | 327 | [common/error-codes.ts:30](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L30) 328 | 329 | --- 330 | 331 | ### MALFORMED_REQUEST 332 | 333 | • **MALFORMED_REQUEST** = `27` 334 | 335 | #### Defined in 336 | 337 | [common/error-codes.ts:31](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L31) 338 | 339 | --- 340 | 341 | ### MIGRATED_PIPELINE_OBJECT_MISSING 342 | 343 | • **MIGRATED_PIPELINE_OBJECT_MISSING** = `28` 344 | 345 | #### Defined in 346 | 347 | [common/error-codes.ts:32](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L32) 348 | 349 | --- 350 | 351 | ### MISSING_FEE_OBJECT 352 | 353 | • **MISSING_FEE_OBJECT** = `29` 354 | 355 | #### Defined in 356 | 357 | [common/error-codes.ts:33](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L33) 358 | 359 | --- 360 | 361 | ### ORDER_OVERDUE 362 | 363 | • **ORDER_OVERDUE** = `30` 364 | 365 | #### Defined in 366 | 367 | [common/error-codes.ts:34](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L34) 368 | 369 | --- 370 | 371 | ### OUT_OF_RANGE_AMOUNT 372 | 373 | • **OUT_OF_RANGE_AMOUNT** = `32` 374 | 375 | #### Defined in 376 | 377 | [common/error-codes.ts:35](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L35) 378 | 379 | --- 380 | 381 | ### OUT_OF_RANGE_BALANCE 382 | 383 | • **OUT_OF_RANGE_BALANCE** = `33` 384 | 385 | #### Defined in 386 | 387 | [common/error-codes.ts:36](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L36) 388 | 389 | --- 390 | 391 | ### OUT_OF_RANGE_BATCH_ID 392 | 393 | • **OUT_OF_RANGE_BATCH_ID** = `34` 394 | 395 | #### Defined in 396 | 397 | [common/error-codes.ts:37](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L37) 398 | 399 | --- 400 | 401 | ### OUT_OF_RANGE_ETH_ADDRESS 402 | 403 | • **OUT_OF_RANGE_ETH_ADDRESS** = `35` 404 | 405 | #### Defined in 406 | 407 | [common/error-codes.ts:38](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L38) 408 | 409 | --- 410 | 411 | ### OUT_OF_RANGE_EXPIRATION_TIMESTAMP 412 | 413 | • **OUT_OF_RANGE_EXPIRATION_TIMESTAMP** = `36` 414 | 415 | #### Defined in 416 | 417 | [common/error-codes.ts:39](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L39) 418 | 419 | --- 420 | 421 | ### OUT_OF_RANGE_NONCE 422 | 423 | • **OUT_OF_RANGE_NONCE** = `37` 424 | 425 | #### Defined in 426 | 427 | [common/error-codes.ts:40](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L40) 428 | 429 | --- 430 | 431 | ### OUT_OF_RANGE_ORACLE_PRICE_QUORUM 432 | 433 | • **OUT_OF_RANGE_ORACLE_PRICE_QUORUM** = `38` 434 | 435 | #### Defined in 436 | 437 | [common/error-codes.ts:41](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L41) 438 | 439 | --- 440 | 441 | ### OUT_OF_RANGE_ORDER_ID 442 | 443 | • **OUT_OF_RANGE_ORDER_ID** = `39` 444 | 445 | #### Defined in 446 | 447 | [common/error-codes.ts:42](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L42) 448 | 449 | --- 450 | 451 | ### OUT_OF_RANGE_POSITIVE_AMOUNT 452 | 453 | • **OUT_OF_RANGE_POSITIVE_AMOUNT** = `31` 454 | 455 | #### Defined in 456 | 457 | [common/error-codes.ts:43](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L43) 458 | 459 | --- 460 | 461 | ### OUT_OF_RANGE_PUBLIC_KEY 462 | 463 | • **OUT_OF_RANGE_PUBLIC_KEY** = `40` 464 | 465 | #### Defined in 466 | 467 | [common/error-codes.ts:44](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L44) 468 | 469 | --- 470 | 471 | ### OUT_OF_RANGE_SIGNATURE_SUBFIELD 472 | 473 | • **OUT_OF_RANGE_SIGNATURE_SUBFIELD** = `41` 474 | 475 | #### Defined in 476 | 477 | [common/error-codes.ts:45](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L45) 478 | 479 | --- 480 | 481 | ### OUT_OF_RANGE_TOKEN_ID 482 | 483 | • **OUT_OF_RANGE_TOKEN_ID** = `42` 484 | 485 | #### Defined in 486 | 487 | [common/error-codes.ts:46](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L46) 488 | 489 | --- 490 | 491 | ### OUT_OF_RANGE_VAULT_ID 492 | 493 | • **OUT_OF_RANGE_VAULT_ID** = `43` 494 | 495 | #### Defined in 496 | 497 | [common/error-codes.ts:47](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L47) 498 | 499 | --- 500 | 501 | ### REPLACED_BEFORE 502 | 503 | • **REPLACED_BEFORE** = `44` 504 | 505 | #### Defined in 506 | 507 | [common/error-codes.ts:48](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L48) 508 | 509 | --- 510 | 511 | ### REQUEST_FAILED 512 | 513 | • **REQUEST_FAILED** = `45` 514 | 515 | #### Defined in 516 | 517 | [common/error-codes.ts:49](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L49) 518 | 519 | --- 520 | 521 | ### SCHEMA_VALIDATION_ERROR 522 | 523 | • **SCHEMA_VALIDATION_ERROR** = `46` 524 | 525 | #### Defined in 526 | 527 | [common/error-codes.ts:50](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L50) 528 | 529 | --- 530 | 531 | ### TRANSACTION_CANCELLED 532 | 533 | • **TRANSACTION_CANCELLED** = `47` 534 | 535 | #### Defined in 536 | 537 | [common/error-codes.ts:51](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L51) 538 | 539 | --- 540 | 541 | ### TRANSACTION_PENDING 542 | 543 | • **TRANSACTION_PENDING** = `48` 544 | 545 | #### Defined in 546 | 547 | [common/error-codes.ts:52](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/common/error-codes.ts#L52) 548 | -------------------------------------------------------------------------------- /docs/interfaces/BatchIdsRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / BatchIdsRequest 2 | 3 | # Interface: BatchIdsRequest 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [orderRoot](BatchIdsRequest.md#orderroot) 10 | - [sequenceNumber](BatchIdsRequest.md#sequencenumber) 11 | - [vaultRoot](BatchIdsRequest.md#vaultroot) 12 | 13 | ## Properties 14 | 15 | ### orderRoot 16 | 17 | • **orderRoot**: `string` 18 | 19 | #### Defined in 20 | 21 | [feeder-gateway/feeder-gateway-request.ts:3](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway-request.ts#L3) 22 | 23 | --- 24 | 25 | ### sequenceNumber 26 | 27 | • **sequenceNumber**: `number` 28 | 29 | #### Defined in 30 | 31 | [feeder-gateway/feeder-gateway-request.ts:4](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway-request.ts#L4) 32 | 33 | --- 34 | 35 | ### vaultRoot 36 | 37 | • **vaultRoot**: `string` 38 | 39 | #### Defined in 40 | 41 | [feeder-gateway/feeder-gateway-request.ts:2](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/feeder-gateway/feeder-gateway-request.ts#L2) 42 | -------------------------------------------------------------------------------- /docs/interfaces/CommitteeSignature.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / CommitteeSignature 2 | 3 | # Interface: CommitteeSignature 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [batchId](CommitteeSignature.md#batchid) 10 | - [claimHash](CommitteeSignature.md#claimhash) 11 | - [memberKey](CommitteeSignature.md#memberkey) 12 | - [signature](CommitteeSignature.md#signature) 13 | 14 | ## Properties 15 | 16 | ### batchId 17 | 18 | • **batchId**: `number` 19 | 20 | #### Defined in 21 | 22 | [availability-gateway/availability-gateway-types.ts:2](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway-types.ts#L2) 23 | 24 | --- 25 | 26 | ### claimHash 27 | 28 | • **claimHash**: `string` 29 | 30 | #### Defined in 31 | 32 | [availability-gateway/availability-gateway-types.ts:5](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway-types.ts#L5) 33 | 34 | --- 35 | 36 | ### memberKey 37 | 38 | • **memberKey**: `string` 39 | 40 | #### Defined in 41 | 42 | [availability-gateway/availability-gateway-types.ts:4](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway-types.ts#L4) 43 | 44 | --- 45 | 46 | ### signature 47 | 48 | • **signature**: `string` 49 | 50 | #### Defined in 51 | 52 | [availability-gateway/availability-gateway-types.ts:3](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/availability-gateway/availability-gateway-types.ts#L3) 53 | -------------------------------------------------------------------------------- /docs/interfaces/ConditionalTransferRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / ConditionalTransferRequest 2 | 3 | # Interface: ConditionalTransferRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`TransferRequest`](TransferRequest.md) 8 | 9 | ↳ **`ConditionalTransferRequest`** 10 | 11 | ## Table of contents 12 | 13 | ### Properties 14 | 15 | - [amount](ConditionalTransferRequest.md#amount) 16 | - [expirationTimestamp](ConditionalTransferRequest.md#expirationtimestamp) 17 | - [fact](ConditionalTransferRequest.md#fact) 18 | - [factRegistryAddress](ConditionalTransferRequest.md#factregistryaddress) 19 | - [feeInfoExchange](ConditionalTransferRequest.md#feeinfoexchange) 20 | - [feeInfoUser](ConditionalTransferRequest.md#feeinfouser) 21 | - [nonce](ConditionalTransferRequest.md#nonce) 22 | - [receiverPublicKey](ConditionalTransferRequest.md#receiverpublickey) 23 | - [receiverVaultId](ConditionalTransferRequest.md#receivervaultid) 24 | - [senderPublicKey](ConditionalTransferRequest.md#senderpublickey) 25 | - [senderVaultId](ConditionalTransferRequest.md#sendervaultid) 26 | - [signature](ConditionalTransferRequest.md#signature) 27 | - [token](ConditionalTransferRequest.md#token) 28 | - [txId](ConditionalTransferRequest.md#txid) 29 | 30 | ## Properties 31 | 32 | ### amount 33 | 34 | • **amount**: `string` 35 | 36 | #### Inherited from 37 | 38 | [TransferRequest](TransferRequest.md).[amount](TransferRequest.md#amount) 39 | 40 | #### Defined in 41 | 42 | [gateway/gateway-request.ts:49](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L49) 43 | 44 | --- 45 | 46 | ### expirationTimestamp 47 | 48 | • **expirationTimestamp**: `number` 49 | 50 | #### Inherited from 51 | 52 | [TransferRequest](TransferRequest.md).[expirationTimestamp](TransferRequest.md#expirationtimestamp) 53 | 54 | #### Defined in 55 | 56 | [gateway/gateway-request.ts:56](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L56) 57 | 58 | --- 59 | 60 | ### fact 61 | 62 | • **fact**: `string` 63 | 64 | #### Defined in 65 | 66 | [gateway/gateway-request.ts:64](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L64) 67 | 68 | --- 69 | 70 | ### factRegistryAddress 71 | 72 | • **factRegistryAddress**: `string` 73 | 74 | #### Defined in 75 | 76 | [gateway/gateway-request.ts:63](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L63) 77 | 78 | --- 79 | 80 | ### feeInfoExchange 81 | 82 | • `Optional` **feeInfoExchange**: [`FeeInfoExchangeRequest`](FeeInfoExchangeRequest.md) 83 | 84 | #### Inherited from 85 | 86 | [TransferRequest](TransferRequest.md).[feeInfoExchange](TransferRequest.md#feeinfoexchange) 87 | 88 | #### Defined in 89 | 90 | [gateway/gateway-request.ts:59](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L59) 91 | 92 | --- 93 | 94 | ### feeInfoUser 95 | 96 | • `Optional` **feeInfoUser**: [`FeeInfoUserRequest`](FeeInfoUserRequest.md) 97 | 98 | #### Inherited from 99 | 100 | [TransferRequest](TransferRequest.md).[feeInfoUser](TransferRequest.md#feeinfouser) 101 | 102 | #### Defined in 103 | 104 | [gateway/gateway-request.ts:58](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L58) 105 | 106 | --- 107 | 108 | ### nonce 109 | 110 | • **nonce**: [`NumericSequence`](../modules.md#numericsequence) 111 | 112 | #### Inherited from 113 | 114 | [TransferRequest](TransferRequest.md).[nonce](TransferRequest.md#nonce) 115 | 116 | #### Defined in 117 | 118 | [gateway/gateway-request.ts:50](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L50) 119 | 120 | --- 121 | 122 | ### receiverPublicKey 123 | 124 | • **receiverPublicKey**: `string` 125 | 126 | #### Inherited from 127 | 128 | [TransferRequest](TransferRequest.md).[receiverPublicKey](TransferRequest.md#receiverpublickey) 129 | 130 | #### Defined in 131 | 132 | [gateway/gateway-request.ts:54](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L54) 133 | 134 | --- 135 | 136 | ### receiverVaultId 137 | 138 | • **receiverVaultId**: [`NumericSequence`](../modules.md#numericsequence) 139 | 140 | #### Inherited from 141 | 142 | [TransferRequest](TransferRequest.md).[receiverVaultId](TransferRequest.md#receivervaultid) 143 | 144 | #### Defined in 145 | 146 | [gateway/gateway-request.ts:55](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L55) 147 | 148 | --- 149 | 150 | ### senderPublicKey 151 | 152 | • **senderPublicKey**: `string` 153 | 154 | #### Inherited from 155 | 156 | [TransferRequest](TransferRequest.md).[senderPublicKey](TransferRequest.md#senderpublickey) 157 | 158 | #### Defined in 159 | 160 | [gateway/gateway-request.ts:51](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L51) 161 | 162 | --- 163 | 164 | ### senderVaultId 165 | 166 | • **senderVaultId**: [`NumericSequence`](../modules.md#numericsequence) 167 | 168 | #### Inherited from 169 | 170 | [TransferRequest](TransferRequest.md).[senderVaultId](TransferRequest.md#sendervaultid) 171 | 172 | #### Defined in 173 | 174 | [gateway/gateway-request.ts:52](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L52) 175 | 176 | --- 177 | 178 | ### signature 179 | 180 | • **signature**: [`Signature`](Signature.md) 181 | 182 | #### Inherited from 183 | 184 | [TransferRequest](TransferRequest.md).[signature](TransferRequest.md#signature) 185 | 186 | #### Defined in 187 | 188 | [gateway/gateway-request.ts:57](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L57) 189 | 190 | --- 191 | 192 | ### token 193 | 194 | • **token**: `string` 195 | 196 | #### Inherited from 197 | 198 | [TransferRequest](TransferRequest.md).[token](TransferRequest.md#token) 199 | 200 | #### Defined in 201 | 202 | [gateway/gateway-request.ts:53](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L53) 203 | 204 | --- 205 | 206 | ### txId 207 | 208 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 209 | 210 | #### Inherited from 211 | 212 | [TransferRequest](TransferRequest.md).[txId](TransferRequest.md#txid) 213 | 214 | #### Defined in 215 | 216 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 217 | -------------------------------------------------------------------------------- /docs/interfaces/FalseFullWithdrawalRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / FalseFullWithdrawalRequest 2 | 3 | # Interface: FalseFullWithdrawalRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | - `WithVault` 10 | 11 | ↳ **`FalseFullWithdrawalRequest`** 12 | 13 | ## Table of contents 14 | 15 | ### Properties 16 | 17 | - [requesterStarkKey](FalseFullWithdrawalRequest.md#requesterstarkkey) 18 | - [txId](FalseFullWithdrawalRequest.md#txid) 19 | - [vaultId](FalseFullWithdrawalRequest.md#vaultid) 20 | 21 | ## Properties 22 | 23 | ### requesterStarkKey 24 | 25 | • **requesterStarkKey**: `string` 26 | 27 | #### Defined in 28 | 29 | [gateway/gateway-request.ts:45](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L45) 30 | 31 | --- 32 | 33 | ### txId 34 | 35 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 36 | 37 | #### Inherited from 38 | 39 | [Request](Request.md).[txId](Request.md#txid) 40 | 41 | #### Defined in 42 | 43 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 44 | 45 | --- 46 | 47 | ### vaultId 48 | 49 | • **vaultId**: [`NumericSequence`](../modules.md#numericsequence) 50 | 51 | #### Inherited from 52 | 53 | WithVault.vaultId 54 | 55 | #### Defined in 56 | 57 | [gateway/gateway-request.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L24) 58 | -------------------------------------------------------------------------------- /docs/interfaces/FeeInfoExchangeRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / FeeInfoExchangeRequest 2 | 3 | # Interface: FeeInfoExchangeRequest 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [destinationStarkKey](FeeInfoExchangeRequest.md#destinationstarkkey) 10 | - [destinationVaultId](FeeInfoExchangeRequest.md#destinationvaultid) 11 | - [feeTaken](FeeInfoExchangeRequest.md#feetaken) 12 | 13 | ## Properties 14 | 15 | ### destinationStarkKey 16 | 17 | • **destinationStarkKey**: `string` 18 | 19 | #### Defined in 20 | 21 | [gateway/gateway-types.ts:30](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L30) 22 | 23 | --- 24 | 25 | ### destinationVaultId 26 | 27 | • **destinationVaultId**: [`NumericSequence`](../modules.md#numericsequence) 28 | 29 | #### Defined in 30 | 31 | [gateway/gateway-types.ts:31](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L31) 32 | 33 | --- 34 | 35 | ### feeTaken 36 | 37 | • **feeTaken**: `number` 38 | 39 | #### Defined in 40 | 41 | [gateway/gateway-types.ts:32](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L32) 42 | -------------------------------------------------------------------------------- /docs/interfaces/FeeInfoUserRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / FeeInfoUserRequest 2 | 3 | # Interface: FeeInfoUserRequest 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [feeLimit](FeeInfoUserRequest.md#feelimit) 10 | - [sourceVaultId](FeeInfoUserRequest.md#sourcevaultid) 11 | - [tokenId](FeeInfoUserRequest.md#tokenid) 12 | 13 | ## Properties 14 | 15 | ### feeLimit 16 | 17 | • **feeLimit**: `number` 18 | 19 | #### Defined in 20 | 21 | [gateway/gateway-types.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L24) 22 | 23 | --- 24 | 25 | ### sourceVaultId 26 | 27 | • **sourceVaultId**: [`NumericSequence`](../modules.md#numericsequence) 28 | 29 | #### Defined in 30 | 31 | [gateway/gateway-types.ts:25](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L25) 32 | 33 | --- 34 | 35 | ### tokenId 36 | 37 | • **tokenId**: `string` 38 | 39 | #### Defined in 40 | 41 | [gateway/gateway-types.ts:26](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L26) 42 | -------------------------------------------------------------------------------- /docs/interfaces/FullWithdrawalRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / FullWithdrawalRequest 2 | 3 | # Interface: FullWithdrawalRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | - `WithVault` 10 | 11 | - `WithStarkKey` 12 | 13 | ↳ **`FullWithdrawalRequest`** 14 | 15 | ## Table of contents 16 | 17 | ### Properties 18 | 19 | - [starkKey](FullWithdrawalRequest.md#starkkey) 20 | - [txId](FullWithdrawalRequest.md#txid) 21 | - [vaultId](FullWithdrawalRequest.md#vaultid) 22 | 23 | ## Properties 24 | 25 | ### starkKey 26 | 27 | • **starkKey**: `string` 28 | 29 | #### Inherited from 30 | 31 | WithStarkKey.starkKey 32 | 33 | #### Defined in 34 | 35 | [gateway/gateway-request.ts:28](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L28) 36 | 37 | --- 38 | 39 | ### txId 40 | 41 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 42 | 43 | #### Inherited from 44 | 45 | [Request](Request.md).[txId](Request.md#txid) 46 | 47 | #### Defined in 48 | 49 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 50 | 51 | --- 52 | 53 | ### vaultId 54 | 55 | • **vaultId**: [`NumericSequence`](../modules.md#numericsequence) 56 | 57 | #### Inherited from 58 | 59 | WithVault.vaultId 60 | 61 | #### Defined in 62 | 63 | [gateway/gateway-request.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L24) 64 | -------------------------------------------------------------------------------- /docs/interfaces/MultiTransactionRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / MultiTransactionRequest 2 | 3 | # Interface: MultiTransactionRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | ↳ **`MultiTransactionRequest`** 10 | 11 | ## Table of contents 12 | 13 | ### Properties 14 | 15 | - [txId](MultiTransactionRequest.md#txid) 16 | - [txs](MultiTransactionRequest.md#txs) 17 | 18 | ## Properties 19 | 20 | ### txId 21 | 22 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 23 | 24 | #### Inherited from 25 | 26 | [Request](Request.md).[txId](Request.md#txid) 27 | 28 | #### Defined in 29 | 30 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 31 | 32 | --- 33 | 34 | ### txs 35 | 36 | • **txs**: [`MultiTransactionTransaction`](../modules.md#multitransactiontransaction)[] 37 | 38 | #### Defined in 39 | 40 | [gateway/gateway-request.ts:131](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L131) 41 | -------------------------------------------------------------------------------- /docs/interfaces/OrderRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / OrderRequest 2 | 3 | # Interface: OrderRequest 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [amountBuy](OrderRequest.md#amountbuy) 10 | - [amountSell](OrderRequest.md#amountsell) 11 | - [expirationTimestamp](OrderRequest.md#expirationtimestamp) 12 | - [feeInfo](OrderRequest.md#feeinfo) 13 | - [nonce](OrderRequest.md#nonce) 14 | - [orderType](OrderRequest.md#ordertype) 15 | - [tokenBuy](OrderRequest.md#tokenbuy) 16 | - [tokenSell](OrderRequest.md#tokensell) 17 | - [vaultIdBuy](OrderRequest.md#vaultidbuy) 18 | - [vaultIdSell](OrderRequest.md#vaultidsell) 19 | 20 | ## Properties 21 | 22 | ### amountBuy 23 | 24 | • **amountBuy**: `string` 25 | 26 | #### Defined in 27 | 28 | [gateway/gateway-types.ts:9](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L9) 29 | 30 | --- 31 | 32 | ### amountSell 33 | 34 | • **amountSell**: `string` 35 | 36 | #### Defined in 37 | 38 | [gateway/gateway-types.ts:8](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L8) 39 | 40 | --- 41 | 42 | ### expirationTimestamp 43 | 44 | • **expirationTimestamp**: `number` 45 | 46 | #### Defined in 47 | 48 | [gateway/gateway-types.ts:14](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L14) 49 | 50 | --- 51 | 52 | ### feeInfo 53 | 54 | • `Optional` **feeInfo**: [`FeeInfoUserRequest`](FeeInfoUserRequest.md) 55 | 56 | #### Defined in 57 | 58 | [gateway/gateway-types.ts:15](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L15) 59 | 60 | --- 61 | 62 | ### nonce 63 | 64 | • **nonce**: [`NumericSequence`](../modules.md#numericsequence) 65 | 66 | #### Defined in 67 | 68 | [gateway/gateway-types.ts:7](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L7) 69 | 70 | --- 71 | 72 | ### orderType 73 | 74 | • **orderType**: [`OrderTypeObsolete`](../enums/OrderTypeObsolete.md) 75 | 76 | #### Defined in 77 | 78 | [gateway/gateway-types.ts:6](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L6) 79 | 80 | --- 81 | 82 | ### tokenBuy 83 | 84 | • **tokenBuy**: `string` 85 | 86 | #### Defined in 87 | 88 | [gateway/gateway-types.ts:11](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L11) 89 | 90 | --- 91 | 92 | ### tokenSell 93 | 94 | • **tokenSell**: `string` 95 | 96 | #### Defined in 97 | 98 | [gateway/gateway-types.ts:10](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L10) 99 | 100 | --- 101 | 102 | ### vaultIdBuy 103 | 104 | • **vaultIdBuy**: [`NumericSequence`](../modules.md#numericsequence) 105 | 106 | #### Defined in 107 | 108 | [gateway/gateway-types.ts:13](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L13) 109 | 110 | --- 111 | 112 | ### vaultIdSell 113 | 114 | • **vaultIdSell**: [`NumericSequence`](../modules.md#numericsequence) 115 | 116 | #### Defined in 117 | 118 | [gateway/gateway-types.ts:12](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L12) 119 | -------------------------------------------------------------------------------- /docs/interfaces/Request.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / Request 2 | 3 | # Interface: Request 4 | 5 | ## Hierarchy 6 | 7 | - **`Request`** 8 | 9 | ↳ [`FalseFullWithdrawalRequest`](FalseFullWithdrawalRequest.md) 10 | 11 | ↳ [`FullWithdrawalRequest`](FullWithdrawalRequest.md) 12 | 13 | ↳ [`TransactionRequest`](TransactionRequest.md) 14 | 15 | ↳ [`TransferRequest`](TransferRequest.md) 16 | 17 | ↳ [`SettlementRequest`](SettlementRequest.md) 18 | 19 | ↳ [`MultiTransactionRequest`](MultiTransactionRequest.md) 20 | 21 | ## Table of contents 22 | 23 | ### Properties 24 | 25 | - [txId](Request.md#txid) 26 | 27 | ## Properties 28 | 29 | ### txId 30 | 31 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 32 | 33 | #### Defined in 34 | 35 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 36 | -------------------------------------------------------------------------------- /docs/interfaces/SettlementInfoRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / SettlementInfoRequest 2 | 3 | # Interface: SettlementInfoRequest 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [partyAFeeInfo](SettlementInfoRequest.md#partyafeeinfo) 10 | - [partyASold](SettlementInfoRequest.md#partyasold) 11 | - [partyBFeeInfo](SettlementInfoRequest.md#partybfeeinfo) 12 | - [partyBSold](SettlementInfoRequest.md#partybsold) 13 | 14 | ## Properties 15 | 16 | ### partyAFeeInfo 17 | 18 | • `Optional` **partyAFeeInfo**: [`FeeInfoExchangeRequest`](FeeInfoExchangeRequest.md) 19 | 20 | #### Defined in 21 | 22 | [gateway/gateway-request.ts:76](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L76) 23 | 24 | --- 25 | 26 | ### partyASold 27 | 28 | • **partyASold**: `number` 29 | 30 | #### Defined in 31 | 32 | [gateway/gateway-request.ts:74](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L74) 33 | 34 | --- 35 | 36 | ### partyBFeeInfo 37 | 38 | • `Optional` **partyBFeeInfo**: [`FeeInfoExchangeRequest`](FeeInfoExchangeRequest.md) 39 | 40 | #### Defined in 41 | 42 | [gateway/gateway-request.ts:77](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L77) 43 | 44 | --- 45 | 46 | ### partyBSold 47 | 48 | • **partyBSold**: `number` 49 | 50 | #### Defined in 51 | 52 | [gateway/gateway-request.ts:75](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L75) 53 | -------------------------------------------------------------------------------- /docs/interfaces/SettlementRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / SettlementRequest 2 | 3 | # Interface: SettlementRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | ↳ **`SettlementRequest`** 10 | 11 | ## Table of contents 12 | 13 | ### Properties 14 | 15 | - [partyAOrder](SettlementRequest.md#partyaorder) 16 | - [partyBOrder](SettlementRequest.md#partyborder) 17 | - [settlementInfo](SettlementRequest.md#settlementinfo) 18 | - [txId](SettlementRequest.md#txid) 19 | 20 | ## Properties 21 | 22 | ### partyAOrder 23 | 24 | • **partyAOrder**: [`OrderRequest`](OrderRequest.md) 25 | 26 | #### Defined in 27 | 28 | [gateway/gateway-request.ts:69](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L69) 29 | 30 | --- 31 | 32 | ### partyBOrder 33 | 34 | • **partyBOrder**: [`OrderRequest`](OrderRequest.md) 35 | 36 | #### Defined in 37 | 38 | [gateway/gateway-request.ts:70](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L70) 39 | 40 | --- 41 | 42 | ### settlementInfo 43 | 44 | • **settlementInfo**: [`SettlementInfoRequest`](SettlementInfoRequest.md) 45 | 46 | #### Defined in 47 | 48 | [gateway/gateway-request.ts:68](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L68) 49 | 50 | --- 51 | 52 | ### txId 53 | 54 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 55 | 56 | #### Inherited from 57 | 58 | [Request](Request.md).[txId](Request.md#txid) 59 | 60 | #### Defined in 61 | 62 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 63 | -------------------------------------------------------------------------------- /docs/interfaces/Signature.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / Signature 2 | 3 | # Interface: Signature 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [r](Signature.md#r) 10 | - [s](Signature.md#s) 11 | 12 | ## Properties 13 | 14 | ### r 15 | 16 | • **r**: `string` 17 | 18 | #### Defined in 19 | 20 | [gateway/gateway-types.ts:19](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L19) 21 | 22 | --- 23 | 24 | ### s 25 | 26 | • `Optional` **s**: `string` 27 | 28 | #### Defined in 29 | 30 | [gateway/gateway-types.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L20) 31 | -------------------------------------------------------------------------------- /docs/interfaces/StarkExClientConfig.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / StarkExClientConfig 2 | 3 | # Interface: StarkExClientConfig 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [certs](StarkExClientConfig.md#certs) 10 | - [endpoint](StarkExClientConfig.md#endpoint) 11 | 12 | ## Properties 13 | 14 | ### certs 15 | 16 | • `Optional` **certs**: [`StarkExCertsConfig`](../modules.md#starkexcertsconfig) 17 | 18 | #### Defined in 19 | 20 | [starkex-client.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L20) 21 | 22 | --- 23 | 24 | ### endpoint 25 | 26 | • **endpoint**: `string` 27 | 28 | #### Defined in 29 | 30 | [starkex-client.ts:19](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L19) 31 | -------------------------------------------------------------------------------- /docs/interfaces/TransactionRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / TransactionRequest 2 | 3 | # Interface: TransactionRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | - `WithAmount` 10 | 11 | - `WithVault` 12 | 13 | - `WithStarkKey` 14 | 15 | ↳ **`TransactionRequest`** 16 | 17 | ## Table of contents 18 | 19 | ### Properties 20 | 21 | - [amount](TransactionRequest.md#amount) 22 | - [starkKey](TransactionRequest.md#starkkey) 23 | - [tokenId](TransactionRequest.md#tokenid) 24 | - [txId](TransactionRequest.md#txid) 25 | - [vaultId](TransactionRequest.md#vaultid) 26 | 27 | ## Properties 28 | 29 | ### amount 30 | 31 | • **amount**: `string` 32 | 33 | #### Inherited from 34 | 35 | WithAmount.amount 36 | 37 | #### Defined in 38 | 39 | [gateway/gateway-request.ts:33](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L33) 40 | 41 | --- 42 | 43 | ### starkKey 44 | 45 | • **starkKey**: `string` 46 | 47 | #### Inherited from 48 | 49 | WithStarkKey.starkKey 50 | 51 | #### Defined in 52 | 53 | [gateway/gateway-request.ts:28](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L28) 54 | 55 | --- 56 | 57 | ### tokenId 58 | 59 | • **tokenId**: `string` 60 | 61 | #### Inherited from 62 | 63 | WithAmount.tokenId 64 | 65 | #### Defined in 66 | 67 | [gateway/gateway-request.ts:32](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L32) 68 | 69 | --- 70 | 71 | ### txId 72 | 73 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 74 | 75 | #### Inherited from 76 | 77 | [Request](Request.md).[txId](Request.md#txid) 78 | 79 | #### Defined in 80 | 81 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 82 | 83 | --- 84 | 85 | ### vaultId 86 | 87 | • **vaultId**: [`NumericSequence`](../modules.md#numericsequence) 88 | 89 | #### Inherited from 90 | 91 | WithVault.vaultId 92 | 93 | #### Defined in 94 | 95 | [gateway/gateway-request.ts:24](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L24) 96 | -------------------------------------------------------------------------------- /docs/interfaces/TransferRequest.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](../README.md) / [Exports](../modules.md) / TransferRequest 2 | 3 | # Interface: TransferRequest 4 | 5 | ## Hierarchy 6 | 7 | - [`Request`](Request.md) 8 | 9 | ↳ **`TransferRequest`** 10 | 11 | ↳↳ [`ConditionalTransferRequest`](ConditionalTransferRequest.md) 12 | 13 | ## Table of contents 14 | 15 | ### Properties 16 | 17 | - [amount](TransferRequest.md#amount) 18 | - [expirationTimestamp](TransferRequest.md#expirationtimestamp) 19 | - [feeInfoExchange](TransferRequest.md#feeinfoexchange) 20 | - [feeInfoUser](TransferRequest.md#feeinfouser) 21 | - [nonce](TransferRequest.md#nonce) 22 | - [receiverPublicKey](TransferRequest.md#receiverpublickey) 23 | - [receiverVaultId](TransferRequest.md#receivervaultid) 24 | - [senderPublicKey](TransferRequest.md#senderpublickey) 25 | - [senderVaultId](TransferRequest.md#sendervaultid) 26 | - [signature](TransferRequest.md#signature) 27 | - [token](TransferRequest.md#token) 28 | - [txId](TransferRequest.md#txid) 29 | 30 | ## Properties 31 | 32 | ### amount 33 | 34 | • **amount**: `string` 35 | 36 | #### Defined in 37 | 38 | [gateway/gateway-request.ts:49](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L49) 39 | 40 | --- 41 | 42 | ### expirationTimestamp 43 | 44 | • **expirationTimestamp**: `number` 45 | 46 | #### Defined in 47 | 48 | [gateway/gateway-request.ts:56](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L56) 49 | 50 | --- 51 | 52 | ### feeInfoExchange 53 | 54 | • `Optional` **feeInfoExchange**: [`FeeInfoExchangeRequest`](FeeInfoExchangeRequest.md) 55 | 56 | #### Defined in 57 | 58 | [gateway/gateway-request.ts:59](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L59) 59 | 60 | --- 61 | 62 | ### feeInfoUser 63 | 64 | • `Optional` **feeInfoUser**: [`FeeInfoUserRequest`](FeeInfoUserRequest.md) 65 | 66 | #### Defined in 67 | 68 | [gateway/gateway-request.ts:58](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L58) 69 | 70 | --- 71 | 72 | ### nonce 73 | 74 | • **nonce**: [`NumericSequence`](../modules.md#numericsequence) 75 | 76 | #### Defined in 77 | 78 | [gateway/gateway-request.ts:50](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L50) 79 | 80 | --- 81 | 82 | ### receiverPublicKey 83 | 84 | • **receiverPublicKey**: `string` 85 | 86 | #### Defined in 87 | 88 | [gateway/gateway-request.ts:54](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L54) 89 | 90 | --- 91 | 92 | ### receiverVaultId 93 | 94 | • **receiverVaultId**: [`NumericSequence`](../modules.md#numericsequence) 95 | 96 | #### Defined in 97 | 98 | [gateway/gateway-request.ts:55](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L55) 99 | 100 | --- 101 | 102 | ### senderPublicKey 103 | 104 | • **senderPublicKey**: `string` 105 | 106 | #### Defined in 107 | 108 | [gateway/gateway-request.ts:51](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L51) 109 | 110 | --- 111 | 112 | ### senderVaultId 113 | 114 | • **senderVaultId**: [`NumericSequence`](../modules.md#numericsequence) 115 | 116 | #### Defined in 117 | 118 | [gateway/gateway-request.ts:52](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L52) 119 | 120 | --- 121 | 122 | ### signature 123 | 124 | • **signature**: [`Signature`](Signature.md) 125 | 126 | #### Defined in 127 | 128 | [gateway/gateway-request.ts:57](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L57) 129 | 130 | --- 131 | 132 | ### token 133 | 134 | • **token**: `string` 135 | 136 | #### Defined in 137 | 138 | [gateway/gateway-request.ts:53](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L53) 139 | 140 | --- 141 | 142 | ### txId 143 | 144 | • **txId**: [`NumericSequence`](../modules.md#numericsequence) 145 | 146 | #### Inherited from 147 | 148 | [Request](Request.md).[txId](Request.md#txid) 149 | 150 | #### Defined in 151 | 152 | [gateway/gateway-request.ts:20](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L20) 153 | -------------------------------------------------------------------------------- /docs/modules.md: -------------------------------------------------------------------------------- 1 | [StarkEx JavaScript Client Library - v0.1.0-dev.7](README.md) / Exports 2 | 3 | # StarkEx JavaScript Client Library - v0.1.0-dev.7 4 | 5 | ## Table of contents 6 | 7 | ### Enumerations 8 | 9 | - [GatewayRequestType](enums/GatewayRequestType.md) 10 | - [OrderTypeObsolete](enums/OrderTypeObsolete.md) 11 | - [StarkErrorCode](enums/StarkErrorCode.md) 12 | 13 | ### Classes 14 | 15 | - [AvailabilityGateway](classes/AvailabilityGateway.md) 16 | - [FeederGateway](classes/FeederGateway.md) 17 | - [Gateway](classes/Gateway.md) 18 | - [StarkExClient](classes/StarkExClient.md) 19 | 20 | ### Interfaces 21 | 22 | - [BatchIdsRequest](interfaces/BatchIdsRequest.md) 23 | - [CommitteeSignature](interfaces/CommitteeSignature.md) 24 | - [ConditionalTransferRequest](interfaces/ConditionalTransferRequest.md) 25 | - [FalseFullWithdrawalRequest](interfaces/FalseFullWithdrawalRequest.md) 26 | - [FeeInfoExchangeRequest](interfaces/FeeInfoExchangeRequest.md) 27 | - [FeeInfoUserRequest](interfaces/FeeInfoUserRequest.md) 28 | - [FullWithdrawalRequest](interfaces/FullWithdrawalRequest.md) 29 | - [MultiTransactionRequest](interfaces/MultiTransactionRequest.md) 30 | - [OrderRequest](interfaces/OrderRequest.md) 31 | - [Request](interfaces/Request.md) 32 | - [SettlementInfoRequest](interfaces/SettlementInfoRequest.md) 33 | - [SettlementRequest](interfaces/SettlementRequest.md) 34 | - [Signature](interfaces/Signature.md) 35 | - [StarkExClientConfig](interfaces/StarkExClientConfig.md) 36 | - [TransactionRequest](interfaces/TransactionRequest.md) 37 | - [TransferRequest](interfaces/TransferRequest.md) 38 | 39 | ### Type aliases 40 | 41 | - [ConditionalTransferTransaction](modules.md#conditionaltransfertransaction) 42 | - [DepositTransaction](modules.md#deposittransaction) 43 | - [ExcludeRequest](modules.md#excluderequest) 44 | - [FalseFullWithdrawalTransaction](modules.md#falsefullwithdrawaltransaction) 45 | - [FullWithdrawalTransaction](modules.md#fullwithdrawaltransaction) 46 | - [GatewayRequest](modules.md#gatewayrequest) 47 | - [MintTransaction](modules.md#minttransaction) 48 | - [MultiTransactionTransaction](modules.md#multitransactiontransaction) 49 | - [NumericSequence](modules.md#numericsequence) 50 | - [SettlementTransaction](modules.md#settlementtransaction) 51 | - [StarkExCertsConfig](modules.md#starkexcertsconfig) 52 | - [TransferTransaction](modules.md#transfertransaction) 53 | - [WithdrawalTransaction](modules.md#withdrawaltransaction) 54 | 55 | ## Type aliases 56 | 57 | ### ConditionalTransferTransaction 58 | 59 | Ƭ **ConditionalTransferTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`ConditionalTransferRequest`](interfaces/ConditionalTransferRequest.md)\> & { `type`: [`CONDITIONAL_TRANSFER_REQUEST`](enums/GatewayRequestType.md#conditional_transfer_request) } 60 | 61 | #### Defined in 62 | 63 | [gateway/gateway-request.ts:104](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L104) 64 | 65 | --- 66 | 67 | ### DepositTransaction 68 | 69 | Ƭ **DepositTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`TransactionRequest`](interfaces/TransactionRequest.md)\> & { `type`: [`DEPOSIT_REQUEST`](enums/GatewayRequestType.md#deposit_request) } 70 | 71 | #### Defined in 72 | 73 | [gateway/gateway-request.ts:88](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L88) 74 | 75 | --- 76 | 77 | ### ExcludeRequest 78 | 79 | Ƭ **ExcludeRequest**<`T`\>: `Pick`<`T`, `Exclude`\> 80 | 81 | #### Type parameters 82 | 83 | | Name | 84 | | :--- | 85 | | `T` | 86 | 87 | #### Defined in 88 | 89 | [gateway/gateway-request.ts:82](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L82) 90 | 91 | --- 92 | 93 | ### FalseFullWithdrawalTransaction 94 | 95 | Ƭ **FalseFullWithdrawalTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`FalseFullWithdrawalRequest`](interfaces/FalseFullWithdrawalRequest.md)\> & { `type`: [`FALSE_FULL_WITHDRAWAL_REQUEST`](enums/GatewayRequestType.md#false_full_withdrawal_request) } 96 | 97 | #### Defined in 98 | 99 | [gateway/gateway-request.ts:113](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L113) 100 | 101 | --- 102 | 103 | ### FullWithdrawalTransaction 104 | 105 | Ƭ **FullWithdrawalTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`FullWithdrawalRequest`](interfaces/FullWithdrawalRequest.md)\> & { `type`: [`FULL_WITHDRAWAL_REQUEST`](enums/GatewayRequestType.md#full_withdrawal_request) } 106 | 107 | #### Defined in 108 | 109 | [gateway/gateway-request.ts:109](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L109) 110 | 111 | --- 112 | 113 | ### GatewayRequest 114 | 115 | Ƭ **GatewayRequest**: [`TransactionRequest`](interfaces/TransactionRequest.md) \| [`TransferRequest`](interfaces/TransferRequest.md) \| [`SettlementRequest`](interfaces/SettlementRequest.md) \| [`FullWithdrawalRequest`](interfaces/FullWithdrawalRequest.md) \| [`FalseFullWithdrawalRequest`](interfaces/FalseFullWithdrawalRequest.md) \| [`ConditionalTransferRequest`](interfaces/ConditionalTransferRequest.md) \| [`MultiTransactionRequest`](interfaces/MultiTransactionRequest.md) 116 | 117 | #### Defined in 118 | 119 | [gateway/gateway-request.ts:10](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L10) 120 | 121 | --- 122 | 123 | ### MintTransaction 124 | 125 | Ƭ **MintTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`TransactionRequest`](interfaces/TransactionRequest.md)\> & { `type`: [`MINT_REQUEST`](enums/GatewayRequestType.md#mint_request) } 126 | 127 | #### Defined in 128 | 129 | [gateway/gateway-request.ts:92](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L92) 130 | 131 | --- 132 | 133 | ### MultiTransactionTransaction 134 | 135 | Ƭ **MultiTransactionTransaction**: [`DepositTransaction`](modules.md#deposittransaction) \| [`WithdrawalTransaction`](modules.md#withdrawaltransaction) \| [`MintTransaction`](modules.md#minttransaction) \| [`SettlementTransaction`](modules.md#settlementtransaction) \| [`TransferTransaction`](modules.md#transfertransaction) \| [`ConditionalTransferTransaction`](modules.md#conditionaltransfertransaction) \| [`FullWithdrawalTransaction`](modules.md#fullwithdrawaltransaction) \| [`FalseFullWithdrawalTransaction`](modules.md#falsefullwithdrawaltransaction) 136 | 137 | #### Defined in 138 | 139 | [gateway/gateway-request.ts:120](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L120) 140 | 141 | --- 142 | 143 | ### NumericSequence 144 | 145 | Ƭ **NumericSequence**: `number` \| `string` 146 | 147 | #### Defined in 148 | 149 | [gateway/gateway-types.ts:3](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-types.ts#L3) 150 | 151 | --- 152 | 153 | ### SettlementTransaction 154 | 155 | Ƭ **SettlementTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`SettlementRequest`](interfaces/SettlementRequest.md)\> & { `type`: [`SETTLEMENT_REQUEST`](enums/GatewayRequestType.md#settlement_request) } 156 | 157 | #### Defined in 158 | 159 | [gateway/gateway-request.ts:96](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L96) 160 | 161 | --- 162 | 163 | ### StarkExCertsConfig 164 | 165 | Ƭ **StarkExCertsConfig**: `Object` 166 | 167 | #### Type declaration 168 | 169 | | Name | Type | 170 | | :----- | :------- | 171 | | `ca?` | `string` | 172 | | `cert` | `string` | 173 | | `key` | `string` | 174 | 175 | #### Defined in 176 | 177 | [starkex-client.ts:23](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/starkex-client.ts#L23) 178 | 179 | --- 180 | 181 | ### TransferTransaction 182 | 183 | Ƭ **TransferTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`TransferRequest`](interfaces/TransferRequest.md)\> & { `type`: [`TRANSFER_REQUEST`](enums/GatewayRequestType.md#transfer_request) } 184 | 185 | #### Defined in 186 | 187 | [gateway/gateway-request.ts:100](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L100) 188 | 189 | --- 190 | 191 | ### WithdrawalTransaction 192 | 193 | Ƭ **WithdrawalTransaction**: [`ExcludeRequest`](modules.md#excluderequest)<[`TransactionRequest`](interfaces/TransactionRequest.md)\> & { `type`: [`WITHDRAWAL_REQUEST`](enums/GatewayRequestType.md#withdrawal_request) } 194 | 195 | #### Defined in 196 | 197 | [gateway/gateway-request.ts:84](https://github.com/starkware-libs/starkex-js/blob/d7a28bb/src/lib/gateway/gateway-request.ts#L84) 198 | -------------------------------------------------------------------------------- /img/starkex.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@starkware-industries/starkex-js", 3 | "version": "0.1.0", 4 | "description": "`starkex-js` is a JavaScript wrapper around the [StarkEx API](https://starkware.co/starkex/api/) that can be used in both NodeJS and Browser environments.", 5 | "keywords": [ 6 | "starkware", 7 | "starkex", 8 | "javascript", 9 | "typescript", 10 | "node", 11 | "browser", 12 | "sdk", 13 | "api", 14 | "blockchain", 15 | "etherium" 16 | ], 17 | "homepage": "https://github.com/starkware-libs/starkex-js#readme", 18 | "bugs": { 19 | "url": "https://github.com/starkware-libs/starkex-js/issues" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/starkware-libs/starkex-js.git" 24 | }, 25 | "license": "ISC", 26 | "author": "Dan Ziv", 27 | "main": "browser.js", 28 | "module": "node.js", 29 | "types": "types/index.d.ts", 30 | "directories": { 31 | "doc": "docs" 32 | }, 33 | "files": [ 34 | "node.js", 35 | "browser.js", 36 | "types", 37 | "package.json", 38 | "lib", 39 | "README.md", 40 | "CHANGELOG.md" 41 | ], 42 | "scripts": { 43 | "clean": "rm -rf ./dist", 44 | "prebuild": "npm run clean", 45 | "build": "cross-env NODE_ENV=production webpack --mode=production", 46 | "precommit": "lint-staged", 47 | "start": "webpack --watch --mode development --env development", 48 | "typecheck": "tsc --noemit", 49 | "eslint": "eslint .", 50 | "eslint:fix": "eslint --fix .", 51 | "lint": "yarn run eslint && yarn run typecheck && yarn run format:check", 52 | "format:check": "prettier --check \"**/*.+(ts|js|json|md|html|yml)\"", 53 | "format": "prettier --write \"**/*.+(ts|js|json|md|html|yml)\"", 54 | "docs:generate": "typedoc", 55 | "docs:watch": "typedoc --watch", 56 | "release": "semantic-release", 57 | "release:dry": "semantic-release --no-ci --dry-run", 58 | "npm-publish": "bash ./scripts/npm-publish.bash", 59 | "test": "mocha --recursive", 60 | "playground:js": "node playground/server.js", 61 | "playground:ts": "ts-node -O '{\"module\": \"commonjs\"}' -T playground/server.ts" 62 | }, 63 | "husky": { 64 | "hooks": { 65 | "pre-commit": "lint-staged" 66 | } 67 | }, 68 | "lint-staged": { 69 | "*.+(ts|js|jsx)": [ 70 | "eslint --fix", 71 | "prettier --write --ignore-unknown" 72 | ], 73 | "*.+(json|scss|css|md)": [ 74 | "prettier --write" 75 | ] 76 | }, 77 | "dependencies": { 78 | "axios": "^0.21.1", 79 | "https": "^1.0.0", 80 | "js-logger": "^1.6.1" 81 | }, 82 | "devDependencies": { 83 | "@semantic-release/changelog": "^6.0.0", 84 | "@semantic-release/commit-analyzer": "^9.0.1", 85 | "@semantic-release/git": "^10.0.0", 86 | "@semantic-release/npm": "^9.0.1", 87 | "@semantic-release/release-notes-generator": "^10.0.2", 88 | "@trivago/prettier-plugin-sort-imports": "^2.0.4", 89 | "@types/axios": "^0.14.0", 90 | "@typescript-eslint/eslint-plugin": "^4.29.0", 91 | "@typescript-eslint/parser": "^4.29.0", 92 | "babel-eslint": "^10.1.0", 93 | "chai": "^4.3.6", 94 | "clean-webpack-plugin": "^4.0.0-alpha.0", 95 | "conventional-changelog-conventionalcommits": "^4.6.3", 96 | "copy-webpack-plugin": "^9.0.1", 97 | "cross-env": "^7.0.3", 98 | "eslint": "^7.32.0", 99 | "eslint-config-prettier": "^8.3.0", 100 | "eslint-plugin-mocha-no-only": "^1.1.1", 101 | "eslint-plugin-prettier": "^3.4.0", 102 | "husky": "^7.0.1", 103 | "lint-staged": "^11.1.1", 104 | "mocha": "^9.2.0", 105 | "prettier": "^2.3.2", 106 | "semantic-release": "^19.0.2", 107 | "terser-webpack-plugin": "^5.1.4", 108 | "ts-loader": "^9.2.5", 109 | "ts-node": "^10.9.1", 110 | "typedoc": "^0.22.6", 111 | "typedoc-plugin-markdown": "^3.11.3", 112 | "typescript": "^4.3.5", 113 | "webpack": "^5.48.0", 114 | "webpack-cli": "^4.7.2", 115 | "webpack-dev-server": "^4.0.0-beta.0", 116 | "webpack-merge": "^5.8.0", 117 | "webpack-node-externals": "^3.0.0" 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /playground/README.md: -------------------------------------------------------------------------------- 1 | ### Playground 2 | 3 | In order to run webpack in 'watch' mode: 4 | 5 | `npm run start` 6 | 7 | Run node package from a JS file: 8 | 9 | `npm run playground:js` 10 | 11 | Run node package from a TS file (assuming ts-node installed globally): 12 | 13 | `npm run playground:ts` 14 | 15 | Run browser package from a HTML page: Open client.html with your browser. 16 | -------------------------------------------------------------------------------- /playground/client.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | StarkEX JavaScript Client Lib 12 | 13 | 14 |

Is Alive:

15 |

16 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /playground/server.js: -------------------------------------------------------------------------------- 1 | const StarkExAPI = require('../dist/node'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | 5 | const readCert = certType => 6 | fs.readFileSync(path.resolve(`certs/user.${certType}`)); 7 | 8 | const starkExAPI = new StarkExAPI({ 9 | endpoint: 'https://gw.playground-v2.starkex.co' 10 | }); 11 | 12 | // const starkExAPIWithCerts = new StarkExAPI({ 13 | // endpoint: 'https://playground.starkex.co', 14 | // certs: { 15 | // cert: readCert('crt'), 16 | // key: readCert('key') 17 | // } 18 | // }); 19 | 20 | (async function () { 21 | console.log('Server running'); 22 | console.log(await starkExAPI.gateway.isAlive()); 23 | // console.log(await starkExAPIWithCerts.gateway.isAlive()); 24 | })(); 25 | -------------------------------------------------------------------------------- /playground/server.ts: -------------------------------------------------------------------------------- 1 | import StarkExAPI from '../dist/node'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | const readCert = (certType: string) => 6 | fs.readFileSync(path.resolve(`certs/user.${certType}`)); 7 | 8 | const starkExAPI = new StarkExAPI({ 9 | endpoint: 'https://gw.playground-v2.starkex.co' 10 | }); 11 | 12 | // const starkExAPIWithCerts = new StarkExAPI({ 13 | // endpoint: 'https://playground.starkex.co', 14 | // certs: { 15 | // cert: readCert('crt'), 16 | // key: readCert('key') 17 | // } 18 | // }); 19 | 20 | (async function () { 21 | console.log('Server running'); 22 | console.log(await starkExAPI.gateway.isAlive()); 23 | // console.log(await starkExAPIWithCerts.gateway.isAlive()); 24 | })(); 25 | -------------------------------------------------------------------------------- /release.config.js: -------------------------------------------------------------------------------- 1 | const {execSync} = require('child_process'); 2 | 3 | module.exports = { 4 | branches: [ 5 | 'master', 6 | { 7 | name: 'dev', 8 | prerelease: true 9 | } 10 | ], 11 | plugins: [ 12 | [ 13 | '@semantic-release/commit-analyzer', 14 | { 15 | preset: 'conventionalcommits', 16 | releaseRules: [ 17 | {breaking: true, release: 'major'}, 18 | {revert: true, release: 'patch'}, 19 | // MINOR 20 | {type: 'feat', release: 'minor'}, 21 | {type: 'feature', release: 'minor'}, 22 | // PATCH 23 | {type: 'fix', release: 'patch'}, 24 | {type: 'bugfix', release: 'patch'}, 25 | {type: 'hotfix', release: 'patch'}, 26 | {type: 'perf', release: 'patch'}, 27 | {type: 'refactor', release: 'patch'}, 28 | {type: 'improvement', release: 'patch'}, 29 | {type: 'revert', release: 'patch'}, 30 | {type: 'style', release: 'patch'}, 31 | // NO RELEASE 32 | {type: 'docs', release: false}, 33 | {type: 'test', release: false}, 34 | {type: 'chore', release: false}, 35 | {type: 'ci', release: false}, 36 | {type: 'build', release: false}, 37 | {type: 'prerelease', release: false}, 38 | {type: 'release', release: false}, 39 | {scope: 'no-release', release: false} 40 | ] 41 | } 42 | ], 43 | [ 44 | '@semantic-release/release-notes-generator', 45 | { 46 | // Using conventionalcommits here since the angular preset does not allow custom 47 | // types for release notes generation. 48 | preset: 'conventionalcommits', 49 | presetConfig: { 50 | types: [ 51 | {type: 'breaking', section: 'Breaking'}, 52 | {type: 'feat', section: '🧩 Features'}, 53 | {type: 'feature', section: '🧩 Features'}, 54 | {type: 'fix', section: '🔧 Fixes'}, 55 | {type: 'bugfix', section: '🔧 Fixes'}, 56 | {type: 'hotfix', section: '🔧 Fixes'}, 57 | {type: 'perf', section: '💉 Improvements'}, 58 | {type: 'refactor', section: '💉 Improvements'}, 59 | {type: 'improvement', section: '💉 Improvements'}, 60 | {type: 'style', section: '💉 Improvements'}, 61 | {type: 'docs', section: '📚 Docs'}, 62 | 63 | {type: 'chore', section: '⚙ Internals', hidden: true}, 64 | {type: 'ci', section: '⚙ Internals', hidden: true}, 65 | {type: 'build', section: '⚙ Internals', hidden: true}, 66 | { 67 | type: 'release', 68 | section: '⚙ Internals', 69 | hidden: true 70 | }, 71 | { 72 | type: 'prerelease', 73 | section: '⚙ Internals', 74 | hidden: true 75 | } 76 | ] 77 | } 78 | } 79 | ], 80 | { 81 | prepare: () => { 82 | execSync('yarn run docs:generate'); 83 | execSync('yarn run format'); 84 | } 85 | }, 86 | '@semantic-release/changelog', 87 | [ 88 | '@semantic-release/npm', 89 | { 90 | npmPublish: false 91 | } 92 | ], 93 | [ 94 | '@semantic-release/git', 95 | { 96 | assets: ['package.json', 'yarn.lock', 'CHANGELOG.md', 'docs'], 97 | message: 98 | "<%= branch === 'dev' ? 'prerelease' : 'release' %>: <%= nextRelease.gitTag %>\n\n <%= nextRelease.notes %>" 99 | } 100 | ], 101 | '@semantic-release/github' 102 | ], 103 | repositoryUrl: 'https://github.com/starkware-libs/starkex-js' 104 | }; 105 | -------------------------------------------------------------------------------- /scripts/docs-publish.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yarn run docs:generate 4 | yarn run format 5 | git add . 6 | git commit --amend --no-edit 7 | -------------------------------------------------------------------------------- /scripts/npm-publish.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mv dist/* . 4 | npm publish --access public 5 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import {StarkExClient} from './lib'; 2 | import {getLogger, printPackageInfo, setLogLevel} from './utils'; 3 | 4 | declare const __VERSION__: string; 5 | declare const __NAME__: string; 6 | declare const __NODE_ENV__: string; 7 | 8 | printPackageInfo(__NAME__, __VERSION__, '#734d7e'); 9 | 10 | export default StarkExClient; 11 | 12 | if (__NODE_ENV__ === 'development') { 13 | setLogLevel(getLogger().DEBUG); 14 | } 15 | -------------------------------------------------------------------------------- /src/lib/availability-gateway/availability-gateway-service-type.ts: -------------------------------------------------------------------------------- 1 | enum AvailabilityGatewayServiceType { 2 | APPROVE_NEW_ROOTS = 'approve_new_roots', 3 | GET_BATCH_DATA = 'get_batch_data' 4 | } 5 | 6 | export {AvailabilityGatewayServiceType}; 7 | -------------------------------------------------------------------------------- /src/lib/availability-gateway/availability-gateway-types.ts: -------------------------------------------------------------------------------- 1 | interface CommitteeSignature { 2 | batchId: number; 3 | signature: string; 4 | memberKey: string; 5 | claimHash: string; 6 | } 7 | 8 | export {CommitteeSignature}; 9 | -------------------------------------------------------------------------------- /src/lib/availability-gateway/availability-gateway.ts: -------------------------------------------------------------------------------- 1 | import {camelToUnderscore, ApiVersion} from '../../utils'; 2 | import {GatewayBase} from '../gateway-base'; 3 | import {StarkExClientConfig} from '../starkex-client'; 4 | import {AvailabilityGatewayServiceType} from './availability-gateway-service-type'; 5 | import {CommitteeSignature} from './availability-gateway-types'; 6 | 7 | class AvailabilityGateway extends GatewayBase { 8 | constructor(config: StarkExClientConfig) { 9 | super(config, { 10 | gatewayRoute: 'availability_gateway', 11 | defaultVersion: ApiVersion.V1 12 | }); 13 | } 14 | 15 | public approveNewRoots(data: CommitteeSignature): Promise { 16 | const formattedData = camelToUnderscore(data); 17 | return this.makeRequest( 18 | AvailabilityGatewayServiceType.APPROVE_NEW_ROOTS, 19 | 'POST', 20 | formattedData 21 | ); 22 | } 23 | 24 | public getBatchData(batchId: number): Promise> { 25 | return this.makeRequest( 26 | `${AvailabilityGatewayServiceType.GET_BATCH_DATA}?batch_id=${batchId}` 27 | ); 28 | } 29 | } 30 | 31 | export {AvailabilityGateway}; 32 | -------------------------------------------------------------------------------- /src/lib/availability-gateway/index.ts: -------------------------------------------------------------------------------- 1 | export * from './availability-gateway'; 2 | export * from './availability-gateway-types'; 3 | -------------------------------------------------------------------------------- /src/lib/common/error-codes.ts: -------------------------------------------------------------------------------- 1 | // https://starkware.co/StarkExRESTAPI/error_codes.html 2 | 3 | export enum StarkErrorCode { 4 | API_FUNCTION_TEMPORARILY_DISABLED = 0, 5 | BATCH_CREATION_FAILURE = 1, 6 | BATCH_FULL = 2, 7 | BATCH_NOT_READY = 3, 8 | CONFLICTING_ORDER_AMOUNTS = 4, 9 | FACT_NOT_REGISTERED = 5, 10 | INSUFFICIENT_ONCHAIN_BALANCE = 6, 11 | INVALID_BATCH_ID = 7, 12 | INVALID_CLAIM_HASH = 8, 13 | INVALID_COMMITTEE_MEMBER = 9, 14 | INVALID_CONTRACT_ADDRESS = 10, 15 | INVALID_CONTRACT_RESPONSE = 11, 16 | INVALID_DEPLOYMENT_INFO = 12, 17 | INVALID_ETH_ADDRESS = 13, 18 | INVALID_FACT = 14, 19 | INVALID_FEE_TAKEN = 15, 20 | INVALID_ORDER_ID = 16, 21 | INVALID_ORDER_TYPE = 17, 22 | INVALID_REQUEST = 18, 23 | INVALID_REQUEST_PARAMETERS = 19, 24 | INVALID_SETTLEMENT_INFO = 20, 25 | INVALID_SETTLEMENT_RATIO = 21, 26 | INVALID_SETTLEMENT_TOKENS = 22, 27 | INVALID_SIGNATURE = 23, 28 | INVALID_TRANSACTION = 24, 29 | INVALID_TRANSACTION_ID = 25, 30 | INVALID_VAULT = 26, 31 | MALFORMED_REQUEST = 27, 32 | MIGRATED_PIPELINE_OBJECT_MISSING = 28, 33 | MISSING_FEE_OBJECT = 29, 34 | ORDER_OVERDUE = 30, 35 | OUT_OF_RANGE_AMOUNT = 32, 36 | OUT_OF_RANGE_BALANCE = 33, 37 | OUT_OF_RANGE_BATCH_ID = 34, 38 | OUT_OF_RANGE_ETH_ADDRESS = 35, 39 | OUT_OF_RANGE_EXPIRATION_TIMESTAMP = 36, 40 | OUT_OF_RANGE_NONCE = 37, 41 | OUT_OF_RANGE_ORACLE_PRICE_QUORUM = 38, 42 | OUT_OF_RANGE_ORDER_ID = 39, 43 | OUT_OF_RANGE_POSITIVE_AMOUNT = 31, 44 | OUT_OF_RANGE_PUBLIC_KEY = 40, 45 | OUT_OF_RANGE_SIGNATURE_SUBFIELD = 41, 46 | OUT_OF_RANGE_TOKEN_ID = 42, 47 | OUT_OF_RANGE_VAULT_ID = 43, 48 | REPLACED_BEFORE = 44, 49 | REQUEST_FAILED = 45, 50 | SCHEMA_VALIDATION_ERROR = 46, 51 | TRANSACTION_CANCELLED = 47, 52 | TRANSACTION_PENDING = 48 53 | } 54 | -------------------------------------------------------------------------------- /src/lib/common/index.ts: -------------------------------------------------------------------------------- 1 | export * from './error-codes'; 2 | -------------------------------------------------------------------------------- /src/lib/feeder-gateway/feeder-gateway-request.ts: -------------------------------------------------------------------------------- 1 | interface BatchIdsRequest { 2 | vaultRoot: string; 3 | orderRoot: string; 4 | sequenceNumber: number; 5 | } 6 | 7 | export {BatchIdsRequest}; 8 | -------------------------------------------------------------------------------- /src/lib/feeder-gateway/feeder-gateway-service-type.ts: -------------------------------------------------------------------------------- 1 | enum FeederGatewayServiceType { 2 | IS_READY = 'is_ready', 3 | IS_ALIVE = 'is_alive', 4 | GET_BATCH_ENCLOSING_IDS = 'get_batch_enclosing_ids', 5 | GET_BATCH_IDS = 'get_batch_ids', 6 | GET_BATCH_INFO = 'get_batch_info', 7 | GET_LAST_BATCH_ID = 'get_last_batch_id', 8 | GET_PREV_BATCH_ID = 'get_prev_batch_id' 9 | } 10 | 11 | export {FeederGatewayServiceType}; 12 | -------------------------------------------------------------------------------- /src/lib/feeder-gateway/feeder-gateway.ts: -------------------------------------------------------------------------------- 1 | import {ApiVersion, Messages} from '../../utils'; 2 | import {GatewayBase} from '../gateway-base'; 3 | import {StarkExClientConfig} from '../starkex-client'; 4 | import {BatchIdsRequest} from './feeder-gateway-request'; 5 | import {FeederGatewayServiceType} from './feeder-gateway-service-type'; 6 | 7 | class FeederGateway extends GatewayBase { 8 | constructor(config: StarkExClientConfig) { 9 | super(config, { 10 | gatewayRoute: 'feeder_gateway', 11 | defaultVersion: ApiVersion.V2 12 | }); 13 | } 14 | 15 | public isAlive(): Promise { 16 | return this.makeRequest(`${FeederGatewayServiceType.IS_ALIVE}`); 17 | } 18 | 19 | public isReady(): Promise { 20 | return this.makeRequest(`${FeederGatewayServiceType.IS_READY}`); 21 | } 22 | 23 | public getBatchEnclosingIds(batchId: number): Promise { 24 | return this.makeRequest( 25 | `${FeederGatewayServiceType.GET_BATCH_ENCLOSING_IDS}?batch_id=${batchId}` 26 | ); 27 | } 28 | 29 | public DEPRECATED_getBatchIds(request: BatchIdsRequest): Promise { 30 | this.logger.error(`DEPRECATED_getBatchIds: ${Messages.DEPRECATION}`); 31 | const {vaultRoot, orderRoot, sequenceNumber} = request; 32 | return this.makeRequest( 33 | `${FeederGatewayServiceType.GET_BATCH_IDS}?vault_root=${vaultRoot}&order_root=${orderRoot}&sequence_number=${sequenceNumber}`, 34 | 'GET', 35 | undefined, 36 | ApiVersion.V1 37 | ); 38 | } 39 | 40 | public DEPRECATED_getBatchInfo( 41 | batchId: number 42 | ): Promise> { 43 | this.logger.error(`DEPRECATED_getBatchInfo: ${Messages.DEPRECATION}`); 44 | return this.makeRequest( 45 | `${FeederGatewayServiceType.GET_BATCH_INFO}?batch_id=${batchId}`, 46 | 'GET', 47 | undefined, 48 | ApiVersion.V1 49 | ); 50 | } 51 | 52 | public getBatchInfo(batchId: number): Promise> { 53 | return this.makeRequest( 54 | `${FeederGatewayServiceType.GET_BATCH_INFO}?batch_id=${batchId}` 55 | ); 56 | } 57 | 58 | public getLastBatchId(): Promise { 59 | return this.makeRequest(`${FeederGatewayServiceType.GET_LAST_BATCH_ID}`); 60 | } 61 | 62 | public getPrevBatchId(batchId: number): Promise { 63 | return this.makeRequest( 64 | `${FeederGatewayServiceType.GET_PREV_BATCH_ID}?batch_id=${batchId}` 65 | ); 66 | } 67 | } 68 | 69 | export {FeederGateway}; 70 | -------------------------------------------------------------------------------- /src/lib/feeder-gateway/index.ts: -------------------------------------------------------------------------------- 1 | export * from './feeder-gateway'; 2 | export * from './feeder-gateway-request'; 3 | -------------------------------------------------------------------------------- /src/lib/gateway-base.ts: -------------------------------------------------------------------------------- 1 | import { 2 | apiRequest, 3 | capitalize, 4 | getLogger, 5 | ILogger, 6 | ApiGatewayPath, 7 | ApiVersion, 8 | mapApiVersionToUrlPrefix 9 | } from '../utils'; 10 | import {StarkExCertsConfig, StarkExClientConfig} from './starkex-client'; 11 | import {Method} from 'axios'; 12 | 13 | class GatewayBase { 14 | protected logger: ILogger; 15 | private readonly endpoint: string; 16 | private readonly certs: StarkExCertsConfig; 17 | 18 | constructor( 19 | config: StarkExClientConfig, 20 | private readonly path: ApiGatewayPath 21 | ) { 22 | const {endpoint, certs} = config; 23 | this.endpoint = endpoint; 24 | this.certs = certs; 25 | 26 | this.initLogger(this.getEndpoint()); 27 | } 28 | 29 | private getEndpoint(version?: ApiVersion) { 30 | return [ 31 | this.endpoint, 32 | mapApiVersionToUrlPrefix[version || this.path.defaultVersion], 33 | this.path.gatewayRoute 34 | ] 35 | .filter(a => !!a) 36 | .join('/'); 37 | } 38 | 39 | private initLogger(path: string): void { 40 | const pathSlices = path.split('/'); 41 | const rawName = pathSlices[pathSlices.length - 1]; 42 | const name = rawName 43 | .split('_') 44 | .map(s => capitalize(s)) 45 | .join(' '); 46 | this.logger = getLogger(name); 47 | this.logger.debug('Initialized'); 48 | } 49 | 50 | protected async makeRequest( 51 | path: string, 52 | method?: Method, 53 | data?: Record, 54 | version?: ApiVersion 55 | ): Promise { 56 | try { 57 | this.logger.debug(`Sending request to ${path}`, data); 58 | const response = await apiRequest({ 59 | path: `${this.getEndpoint(version)}/${path}`, 60 | method, 61 | data, 62 | certs: this.certs 63 | }); 64 | this.logger.debug('Response success:', response.data); 65 | return response.data; 66 | } catch (err) { 67 | this.logger.error('Error in response:', err.response?.data?.message); 68 | return Promise.reject(err.response?.data); 69 | } 70 | } 71 | } 72 | 73 | export {GatewayBase}; 74 | -------------------------------------------------------------------------------- /src/lib/gateway/gateway-request-type.ts: -------------------------------------------------------------------------------- 1 | enum GatewayRequestType { 2 | SETTLEMENT_REQUEST = 'SettlementRequest', 3 | TRANSFER_REQUEST = 'TransferRequest', 4 | CONDITIONAL_TRANSFER_REQUEST = 'ConditionalTransferRequest', 5 | DEPOSIT_REQUEST = 'DepositRequest', 6 | MINT_REQUEST = 'MintRequest', 7 | WITHDRAWAL_REQUEST = 'WithdrawalRequest', 8 | FULL_WITHDRAWAL_REQUEST = 'FullWithdrawalRequest', 9 | FALSE_FULL_WITHDRAWAL_REQUEST = 'FalseFullWithdrawalRequest', 10 | MULTI_TRANSACTION_REQUEST = 'MultiTransactionRequest' 11 | } 12 | 13 | export {GatewayRequestType}; 14 | -------------------------------------------------------------------------------- /src/lib/gateway/gateway-request.ts: -------------------------------------------------------------------------------- 1 | import {GatewayRequestType} from './gateway-request-type'; 2 | import { 3 | FeeInfoExchangeRequest, 4 | FeeInfoUserRequest, 5 | NumericSequence, 6 | OrderRequest, 7 | Signature 8 | } from './gateway-types'; 9 | 10 | type GatewayRequest = 11 | | TransactionRequest 12 | | TransferRequest 13 | | SettlementRequest 14 | | FullWithdrawalRequest 15 | | FalseFullWithdrawalRequest 16 | | ConditionalTransferRequest 17 | | MultiTransactionRequest; 18 | 19 | interface Request { 20 | txId: NumericSequence; 21 | } 22 | 23 | interface WithVault { 24 | vaultId: NumericSequence; 25 | } 26 | 27 | interface WithStarkKey { 28 | starkKey: string; 29 | } 30 | 31 | interface WithAmount { 32 | tokenId: string; 33 | amount: string; 34 | } 35 | 36 | interface TransactionRequest 37 | extends Request, 38 | WithAmount, 39 | WithVault, 40 | WithStarkKey {} 41 | 42 | interface FullWithdrawalRequest extends Request, WithVault, WithStarkKey {} 43 | 44 | interface FalseFullWithdrawalRequest extends Request, WithVault { 45 | requesterStarkKey: string; 46 | } 47 | 48 | interface TransferRequest extends Request { 49 | amount: string; 50 | nonce: NumericSequence; 51 | senderPublicKey: string; 52 | senderVaultId: NumericSequence; 53 | token: string; 54 | receiverPublicKey: string; 55 | receiverVaultId: NumericSequence; 56 | expirationTimestamp: number; 57 | signature: Signature; 58 | feeInfoUser?: FeeInfoUserRequest; 59 | feeInfoExchange?: FeeInfoExchangeRequest; 60 | } 61 | 62 | interface ConditionalTransferRequest extends TransferRequest { 63 | factRegistryAddress: string; 64 | fact: string; 65 | } 66 | 67 | interface SettlementRequest extends Request { 68 | settlementInfo: SettlementInfoRequest; 69 | partyAOrder: OrderRequest; 70 | partyBOrder: OrderRequest; 71 | } 72 | 73 | interface SettlementInfoRequest { 74 | partyASold: number; 75 | partyBSold: number; 76 | partyAFeeInfo?: FeeInfoExchangeRequest; 77 | partyBFeeInfo?: FeeInfoExchangeRequest; 78 | } 79 | 80 | // Transactions' type and request-body tuples 81 | // Use a base request type but exclude Request interface 82 | type ExcludeRequest = Pick>; 83 | 84 | type WithdrawalTransaction = ExcludeRequest & { 85 | type: GatewayRequestType.WITHDRAWAL_REQUEST; 86 | }; 87 | 88 | type DepositTransaction = ExcludeRequest & { 89 | type: GatewayRequestType.DEPOSIT_REQUEST; 90 | }; 91 | 92 | type MintTransaction = ExcludeRequest & { 93 | type: GatewayRequestType.MINT_REQUEST; 94 | }; 95 | 96 | type SettlementTransaction = ExcludeRequest & { 97 | type: GatewayRequestType.SETTLEMENT_REQUEST; 98 | }; 99 | 100 | type TransferTransaction = ExcludeRequest & { 101 | type: GatewayRequestType.TRANSFER_REQUEST; 102 | }; 103 | 104 | type ConditionalTransferTransaction = 105 | ExcludeRequest & { 106 | type: GatewayRequestType.CONDITIONAL_TRANSFER_REQUEST; 107 | }; 108 | 109 | type FullWithdrawalTransaction = ExcludeRequest & { 110 | type: GatewayRequestType.FULL_WITHDRAWAL_REQUEST; 111 | }; 112 | 113 | type FalseFullWithdrawalTransaction = 114 | ExcludeRequest & { 115 | type: GatewayRequestType.FALSE_FULL_WITHDRAWAL_REQUEST; 116 | }; 117 | 118 | // Each Tx of a MultiTransaction Transaction should be of a following type - 119 | 120 | type MultiTransactionTransaction = 121 | | DepositTransaction 122 | | WithdrawalTransaction 123 | | MintTransaction 124 | | SettlementTransaction 125 | | TransferTransaction 126 | | ConditionalTransferTransaction 127 | | FullWithdrawalTransaction 128 | | FalseFullWithdrawalTransaction; 129 | 130 | interface MultiTransactionRequest extends Request { 131 | txs: Array; 132 | } 133 | 134 | export { 135 | GatewayRequest, 136 | FalseFullWithdrawalRequest, 137 | FullWithdrawalRequest, 138 | TransactionRequest, 139 | TransferRequest, 140 | SettlementRequest, 141 | ConditionalTransferRequest, 142 | SettlementInfoRequest, 143 | MultiTransactionRequest, 144 | MultiTransactionTransaction, 145 | DepositTransaction, 146 | WithdrawalTransaction, 147 | MintTransaction, 148 | SettlementTransaction, 149 | TransferTransaction, 150 | ConditionalTransferTransaction, 151 | FullWithdrawalTransaction, 152 | FalseFullWithdrawalTransaction, 153 | ExcludeRequest, 154 | Request 155 | }; 156 | -------------------------------------------------------------------------------- /src/lib/gateway/gateway-service-type.ts: -------------------------------------------------------------------------------- 1 | enum GatewayServiceType { 2 | ADD_TRANSACTION = 'add_transaction', 3 | GET_TRANSACTION = 'get_transaction', 4 | IS_ALIVE = 'is_alive', 5 | GET_FIRST_UNUSED_TX_ID = 'testing/get_first_unused_tx_id', 6 | GET_STARK_DEX_ADDRESS = 'testing/get_stark_dex_address', 7 | MARK_TRANSACTION_FOR_REPLACEMENT = 'mark_transaction_for_replacement' 8 | } 9 | 10 | export {GatewayServiceType}; 11 | -------------------------------------------------------------------------------- /src/lib/gateway/gateway-types.ts: -------------------------------------------------------------------------------- 1 | // Represents a numeric (only) sequence to hold numbers 2 | // that cannot fit into the built-in JS number type 3 | type NumericSequence = number | string; 4 | 5 | interface OrderRequest { 6 | orderType: OrderTypeObsolete; 7 | nonce: NumericSequence; 8 | amountSell: string; 9 | amountBuy: string; 10 | tokenSell: string; 11 | tokenBuy: string; 12 | vaultIdSell: NumericSequence; 13 | vaultIdBuy: NumericSequence; 14 | expirationTimestamp: number; 15 | feeInfo?: FeeInfoUserRequest; 16 | } 17 | 18 | interface Signature { 19 | r: string; 20 | s?: string; 21 | } 22 | 23 | interface FeeInfoUserRequest { 24 | feeLimit: number; 25 | sourceVaultId: NumericSequence; 26 | tokenId: string; 27 | } 28 | 29 | interface FeeInfoExchangeRequest { 30 | destinationStarkKey: string; 31 | destinationVaultId: NumericSequence; 32 | feeTaken: number; 33 | } 34 | 35 | enum OrderTypeObsolete { 36 | SETTLEMENT, 37 | TRANSFER 38 | } 39 | 40 | export { 41 | OrderRequest, 42 | Signature, 43 | FeeInfoUserRequest, 44 | FeeInfoExchangeRequest, 45 | NumericSequence, 46 | OrderTypeObsolete 47 | }; 48 | -------------------------------------------------------------------------------- /src/lib/gateway/gateway.ts: -------------------------------------------------------------------------------- 1 | import {camelToUnderscore, ApiVersion} from '../../utils'; 2 | import {GatewayBase} from '../gateway-base'; 3 | import {StarkExClientConfig} from '../starkex-client'; 4 | import { 5 | FalseFullWithdrawalRequest, 6 | FullWithdrawalRequest, 7 | ConditionalTransferRequest, 8 | GatewayRequest, 9 | SettlementRequest, 10 | TransactionRequest, 11 | TransferRequest, 12 | MultiTransactionRequest 13 | } from './gateway-request'; 14 | import {GatewayRequestType} from './gateway-request-type'; 15 | import {GatewayServiceType} from './gateway-service-type'; 16 | import {NumericSequence} from './gateway-types'; 17 | 18 | class Gateway extends GatewayBase { 19 | constructor(config: StarkExClientConfig) { 20 | super(config, {gatewayRoute: 'gateway', defaultVersion: ApiVersion.V2}); 21 | } 22 | 23 | public getTransaction(txId: number): Promise> { 24 | return this.makeRequest( 25 | `${GatewayServiceType.GET_TRANSACTION}?tx_id=${txId}` 26 | ); 27 | } 28 | 29 | public getStarkDexAddress(): Promise { 30 | return this.makeRequest(GatewayServiceType.GET_STARK_DEX_ADDRESS); 31 | } 32 | 33 | public getFirstUnusedTxId(): Promise { 34 | return this.makeRequest(GatewayServiceType.GET_FIRST_UNUSED_TX_ID); 35 | } 36 | 37 | public markTransactionForReplacement(txId: NumericSequence): Promise { 38 | return this.makeRequest( 39 | `${GatewayServiceType.MARK_TRANSACTION_FOR_REPLACEMENT}?tx_id=${txId}`, 40 | 'POST' 41 | ); 42 | } 43 | 44 | public isAlive(): Promise { 45 | return this.makeRequest(GatewayServiceType.IS_ALIVE); 46 | } 47 | 48 | public withdrawal( 49 | request: TransactionRequest 50 | ): Promise> { 51 | return this.addTransaction(GatewayRequestType.WITHDRAWAL_REQUEST, request); 52 | } 53 | 54 | public deposit(request: TransactionRequest): Promise> { 55 | return this.addTransaction(GatewayRequestType.DEPOSIT_REQUEST, request); 56 | } 57 | 58 | public mint(request: TransactionRequest): Promise> { 59 | return this.addTransaction(GatewayRequestType.MINT_REQUEST, request); 60 | } 61 | 62 | public settlement( 63 | request: SettlementRequest 64 | ): Promise> { 65 | return this.addTransaction(GatewayRequestType.SETTLEMENT_REQUEST, request); 66 | } 67 | 68 | public transfer(request: TransferRequest): Promise> { 69 | return this.addTransaction(GatewayRequestType.TRANSFER_REQUEST, request); 70 | } 71 | 72 | public conditionalTransfer( 73 | request: ConditionalTransferRequest 74 | ): Promise> { 75 | return this.addTransaction( 76 | GatewayRequestType.CONDITIONAL_TRANSFER_REQUEST, 77 | request 78 | ); 79 | } 80 | 81 | public fullWithdrawal( 82 | request: FullWithdrawalRequest 83 | ): Promise> { 84 | return this.addTransaction( 85 | GatewayRequestType.FULL_WITHDRAWAL_REQUEST, 86 | request 87 | ); 88 | } 89 | 90 | public falseFullWithdrawal( 91 | request: FalseFullWithdrawalRequest 92 | ): Promise> { 93 | return this.addTransaction( 94 | GatewayRequestType.FALSE_FULL_WITHDRAWAL_REQUEST, 95 | request 96 | ); 97 | } 98 | 99 | public multiTransaction( 100 | request: MultiTransactionRequest 101 | ): Promise> { 102 | return this.addTransaction( 103 | GatewayRequestType.MULTI_TRANSACTION_REQUEST, 104 | request 105 | ); 106 | } 107 | 108 | private async addTransaction( 109 | type: GatewayRequestType, 110 | request: GatewayRequest 111 | ) { 112 | const {txId, ...nativeRequest} = request; 113 | const formattedRequest = camelToUnderscore(nativeRequest); 114 | try { 115 | const response = await this.makeRequest( 116 | GatewayServiceType.ADD_TRANSACTION, 117 | 'POST', 118 | { 119 | tx: { 120 | type, 121 | ...formattedRequest 122 | }, 123 | tx_id: txId 124 | } 125 | ); 126 | return { 127 | txId, 128 | ...response 129 | }; 130 | } catch (err) { 131 | //TODO: error handling 132 | return Promise.reject({...err, txId}); 133 | } 134 | } 135 | } 136 | 137 | export {Gateway}; 138 | -------------------------------------------------------------------------------- /src/lib/gateway/index.ts: -------------------------------------------------------------------------------- 1 | export * from './gateway'; 2 | export * from './gateway-request'; 3 | export * from './gateway-request-type'; 4 | export * from './gateway-types'; 5 | -------------------------------------------------------------------------------- /src/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './gateway'; 2 | export * from './feeder-gateway'; 3 | export * from './availability-gateway'; 4 | export * from './starkex-client'; 5 | export * from './common/error-codes'; 6 | -------------------------------------------------------------------------------- /src/lib/starkex-client.ts: -------------------------------------------------------------------------------- 1 | import {StarkErrorCode} from './common'; 2 | import {GatewayRequestType} from './gateway/gateway-request-type'; 3 | import {FeederGateway, Gateway} from './index'; 4 | 5 | class StarkExClient { 6 | public static readonly StarkErrorCode = StarkErrorCode; 7 | public static readonly GatewayRequestType = GatewayRequestType; 8 | 9 | public gateway: Gateway; 10 | public feederGateway: FeederGateway; 11 | 12 | constructor(config: StarkExClientConfig) { 13 | this.gateway = new Gateway(config); 14 | this.feederGateway = new FeederGateway(config); 15 | } 16 | } 17 | 18 | interface StarkExClientConfig { 19 | endpoint: string; 20 | certs?: StarkExCertsConfig; 21 | } 22 | 23 | type StarkExCertsConfig = { 24 | cert: string; 25 | key: string; 26 | ca?: string; 27 | }; 28 | 29 | export {StarkExClient, StarkExClientConfig, StarkExCertsConfig}; 30 | -------------------------------------------------------------------------------- /src/utils/api-request.ts: -------------------------------------------------------------------------------- 1 | import {StarkExCertsConfig} from '../lib'; 2 | import axios, { 3 | AxiosError, 4 | AxiosRequestConfig, 5 | AxiosResponse, 6 | Method 7 | } from 'axios'; 8 | 9 | // // we communicate with JSON 10 | const DEFAULT_HEADERS: Record = { 11 | 'Content-Type': 'application/json' 12 | }; 13 | 14 | // on each request we need to send auth headers 15 | axios.interceptors.request.use( 16 | (config: AxiosRequestConfig) => { 17 | const customHeaders: any = {}; 18 | Object.assign(config.headers, customHeaders); 19 | return config; 20 | }, 21 | (error: AxiosError) => Promise.reject(error) 22 | ); 23 | 24 | /** 25 | * on each response we need to grab the auth headers 26 | * and persist it to a local storage 27 | */ 28 | axios.interceptors.response.use( 29 | (response: AxiosResponse) => response, 30 | (error: AxiosError) => Promise.reject(error) 31 | ); 32 | 33 | /** 34 | * helper method to perform an api requests 35 | */ 36 | export const apiRequest = async ({ 37 | path, 38 | method = 'GET', 39 | data, 40 | headers = {}, 41 | certs 42 | }: { 43 | path: string; 44 | method?: Method; 45 | data?: any; 46 | headers?: Record; 47 | certs?: StarkExCertsConfig; 48 | }): Promise => { 49 | let httpsAgent; 50 | if (certs) { 51 | /* eslint-disable-next-line @typescript-eslint/no-var-requires */ 52 | const https = require('https'); 53 | httpsAgent = new https.Agent({rejectUnauthorized: false, ...certs}); 54 | } 55 | return axios({ 56 | url: path, 57 | method, 58 | data: data || {}, 59 | headers: Object.assign({}, DEFAULT_HEADERS, headers), 60 | httpsAgent 61 | }); 62 | }; 63 | -------------------------------------------------------------------------------- /src/utils/api-versioning.ts: -------------------------------------------------------------------------------- 1 | enum ApiVersion { 2 | V1 = 'v1', 3 | V2 = 'v2' 4 | } 5 | 6 | const mapApiVersionToUrlPrefix = { 7 | [ApiVersion.V1]: '', 8 | [ApiVersion.V2]: 'v2' 9 | }; 10 | 11 | interface ApiGatewayPath { 12 | gatewayRoute: string; 13 | defaultVersion: ApiVersion; 14 | } 15 | 16 | export {ApiVersion, mapApiVersionToUrlPrefix, ApiGatewayPath}; 17 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils'; 2 | export * from './logger'; 3 | export * from './api-request'; 4 | export * from './api-versioning'; 5 | export * from './messages'; 6 | -------------------------------------------------------------------------------- /src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import jsLogger, {ILogger, ILogLevel} from 'js-logger'; 2 | 3 | jsLogger.useDefaults({defaultLevel: jsLogger.ERROR}); 4 | 5 | const getLogger = (name?: string): ILogger => { 6 | if (!name) { 7 | return jsLogger; 8 | } 9 | return jsLogger.get(name); 10 | }; 11 | 12 | const getLogLevel = (name?: string): ILogLevel => { 13 | return getLogger(name).getLevel(); 14 | }; 15 | 16 | const setLogLevel = (level: ILogLevel, name?: string): void => { 17 | getLogger(name).setLevel(level); 18 | }; 19 | 20 | export {getLogger, getLogLevel, setLogLevel, ILogger}; 21 | -------------------------------------------------------------------------------- /src/utils/messages.ts: -------------------------------------------------------------------------------- 1 | const Messages = { 2 | DEPRECATION: 3 | 'This function is deprecated and will be deleted in the next version.' 4 | }; 5 | 6 | export {Messages}; 7 | -------------------------------------------------------------------------------- /src/utils/utils.ts: -------------------------------------------------------------------------------- 1 | import {getLogger, getLogLevel, setLogLevel} from './logger'; 2 | 3 | const toUnderscore = (s: string): string => 4 | s.replace(/([A-Z])/g, '_$1').toLowerCase(); 5 | 6 | const camelToUnderscore = (obj: Record): Record => { 7 | const res: Record = {}; 8 | 9 | Object.keys(obj).forEach(key => { 10 | let val = obj[key]; 11 | 12 | if (Array.isArray(val)) { 13 | val = val.map(v => camelToUnderscore(v)); 14 | } else if (typeof val === 'object') { 15 | val = camelToUnderscore(val); 16 | } 17 | 18 | res[toUnderscore(key)] = val; 19 | }); 20 | return res; 21 | }; 22 | 23 | const capitalize = (s: string): string => { 24 | if (typeof s !== 'string') return ''; 25 | return s.charAt(0).toUpperCase() + s.slice(1); 26 | }; 27 | 28 | const printPackageInfo = ( 29 | name: string, 30 | version: string, 31 | color?: string 32 | ): void => { 33 | const currentLogLevel = getLogLevel(); 34 | setLogLevel(getLogger().INFO); 35 | getLogger().log( 36 | `%c ${name} v${version}`, 37 | `color: ${color || '#ff98f9'}; font-size: large` 38 | ); 39 | setLogLevel(currentLogLevel); 40 | }; 41 | 42 | export {camelToUnderscore, capitalize, printPackageInfo}; 43 | -------------------------------------------------------------------------------- /test/gateway.spec.js: -------------------------------------------------------------------------------- 1 | const StarkExAPI = require('../dist/node'); 2 | const chai = require('chai'); 3 | const assert = chai.assert; 4 | 5 | const SchemaValidationError = { 6 | code: 'StarkErrorCode.SCHEMA_VALIDATION_ERROR', 7 | message: 'Schema validation failed' 8 | }; 9 | 10 | describe('Gateway', () => { 11 | let starkExAPI, error; 12 | const vaultId = 1; 13 | const txId = 1; 14 | const amount = '1'; 15 | const starkKey = '0x2'; 16 | const tokenId = '0x1'; 17 | const nonce = 2; 18 | const receiverPublicKey = '0x4'; 19 | const receiverVaultId = 4; 20 | const expirationTimestamp = new Date().getTime(); 21 | const signature = {r: '0x1', s: '0x2'}; 22 | const factRegistryAddress = '0x5'; 23 | 24 | before(() => { 25 | starkExAPI = new StarkExAPI({ 26 | endpoint: 'https://gw.playground-v2.starkex.co' 27 | }); 28 | }); 29 | 30 | beforeEach(() => { 31 | error = null; 32 | }); 33 | 34 | it('should be alive', async () => { 35 | await starkExAPI.gateway.isAlive(); 36 | }); 37 | 38 | describe('requests validation', () => { 39 | const objectShouldFailSchema = async (request, field, method, done) => { 40 | const errorValue = ['Missing data for required field.']; 41 | let expectedError; 42 | 43 | if (field === 'tx_id') { 44 | expectedError = { 45 | ...SchemaValidationError, 46 | txId: undefined, 47 | problems: { 48 | tx_id: errorValue 49 | } 50 | }; 51 | } else { 52 | expectedError = { 53 | ...SchemaValidationError, 54 | txId, 55 | problems: { 56 | tx: { 57 | [field]: errorValue 58 | } 59 | } 60 | }; 61 | } 62 | 63 | try { 64 | await starkExAPI.gateway[method](request); 65 | } catch (ex) { 66 | error = ex; 67 | } 68 | assert.deepEqual(error, expectedError); 69 | done(); 70 | }; 71 | 72 | it('should throw error for tx when missing txId', done => { 73 | const request = { 74 | amount, 75 | starkKey, 76 | tokenId, 77 | vaultId 78 | }; 79 | objectShouldFailSchema(request, 'tx_id', 'deposit', done); 80 | }); 81 | 82 | it('should throw error for tx when missing starkKey', done => { 83 | const request = { 84 | amount, 85 | tokenId, 86 | vaultId, 87 | txId 88 | }; 89 | objectShouldFailSchema(request, 'stark_key', 'deposit', done); 90 | }); 91 | 92 | it('should throw error for tx when missing vaultId', done => { 93 | const request = { 94 | amount, 95 | tokenId, 96 | starkKey, 97 | txId 98 | }; 99 | objectShouldFailSchema(request, 'vault_id', 'deposit', done); 100 | }); 101 | 102 | it('should throw error for transfer when missing nonce', done => { 103 | const request = { 104 | txId, 105 | amount, 106 | senderPublicKey: starkKey, 107 | senderVaultId: vaultId, 108 | token: tokenId, 109 | receiverPublicKey, 110 | receiverVaultId, 111 | expirationTimestamp, 112 | signature 113 | }; 114 | objectShouldFailSchema(request, 'nonce', 'transfer', done); 115 | }); 116 | 117 | it('should throw error for conditional transfer when missing fact', done => { 118 | const request = { 119 | txId, 120 | amount, 121 | nonce, 122 | senderPublicKey: starkKey, 123 | senderVaultId: vaultId, 124 | token: tokenId, 125 | receiverPublicKey, 126 | receiverVaultId, 127 | expirationTimestamp, 128 | signature, 129 | factRegistryAddress 130 | }; 131 | objectShouldFailSchema(request, 'fact', 'conditionalTransfer', done); 132 | }); 133 | }); 134 | 135 | it('should succeed markTransactionForReplacement', async () => { 136 | const response = await starkExAPI.gateway.markTransactionForReplacement( 137 | txId 138 | ); 139 | 140 | chai 141 | .expect(response) 142 | .to.equal(`transaction ${txId} marked for replacement`); 143 | }); 144 | }); 145 | -------------------------------------------------------------------------------- /test/gateway/add-transaction.spec.js: -------------------------------------------------------------------------------- 1 | const StarkExAPI = require('../../dist/node'); 2 | const chai = require('chai'); 3 | 4 | describe('Gateway', () => { 5 | let starkExAPI; 6 | const vaultId = 1654615998, 7 | tokenId = 8 | '0x2dd48fd7a024204f7c1bd874da5e709d4713d60c8a70639eb1167b367a9c378', 9 | starkKey = 10 | '0x7c65c1e82e2e662f728b4fa42485e3a0a5d2f346baa9455e3e70682c2094cac', 11 | amount = '4029557120079369747'; 12 | 13 | before(() => { 14 | starkExAPI = new StarkExAPI({ 15 | endpoint: 'https://gw.playground-v2.starkex.co' 16 | }); 17 | }); 18 | 19 | describe('multitranaction', () => { 20 | it('should success with a valid input', async () => { 21 | const request = {vaultId, tokenId, starkKey, amount}; 22 | const txId = await starkExAPI.gateway.getFirstUnusedTxId(); 23 | 24 | const response = await starkExAPI.gateway.multiTransaction({ 25 | txId, 26 | txs: [ 27 | {type: StarkExAPI.GatewayRequestType.DEPOSIT_REQUEST, ...request}, 28 | {type: StarkExAPI.GatewayRequestType.WITHDRAWAL_REQUEST, ...request} 29 | ] 30 | }); 31 | 32 | chai.expect(response.txId).to.equal(txId); 33 | chai.expect(response.code).to.equal('TRANSACTION_PENDING'); 34 | }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist/types/", 4 | "sourceMap": true, 5 | "noImplicitAny": true, 6 | "module": "es6", 7 | "target": "es5", 8 | "declaration": true, 9 | "allowSyntheticDefaultImports": true, 10 | "esModuleInterop": true, 11 | "moduleResolution": "node", 12 | "resolveJsonModule": true, 13 | "allowJs": true 14 | }, 15 | "include": ["src/**/*"], 16 | "exclude": ["playground/**/*"] 17 | } 18 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["./src/lib/index.ts"], 3 | "excludePrivate": true, 4 | "excludeProtected": true, 5 | "name": "StarkEx JavaScript Client Library", 6 | "includeVersion": true 7 | } 8 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpack = require('webpack'); 3 | const {CleanWebpackPlugin} = require('clean-webpack-plugin'); 4 | const nodeExternals = require('webpack-node-externals'); 5 | const {merge} = require('webpack-merge'); 6 | const packageData = require('./package.json'); 7 | 8 | const prodConfig = require('./webpack.prod'); 9 | const devConfig = require('./webpack.dev'); 10 | 11 | const {ProgressPlugin, DefinePlugin} = webpack; 12 | 13 | const distPath = path.resolve(__dirname, 'dist'); 14 | const srcPath = path.resolve(__dirname, 'src'); 15 | 16 | module.exports = () => { 17 | const isProductionEnv = process.env.NODE_ENV === 'production'; 18 | 19 | let nodeConfig = { 20 | target: 'node', 21 | externals: [nodeExternals()], 22 | output: { 23 | filename: 'node.js', 24 | libraryTarget: 'commonjs2', 25 | libraryExport: 'default' 26 | } 27 | }; 28 | 29 | let browserConfig = { 30 | target: 'web', 31 | output: { 32 | filename: 'browser.js', 33 | libraryTarget: 'umd', 34 | umdNamedDefine: true, 35 | libraryExport: 'default', 36 | globalObject: 'this', 37 | library: 'StarkExAPI' 38 | }, 39 | resolve: { 40 | fallback: { 41 | http: false, 42 | https: false 43 | } 44 | } 45 | }; 46 | 47 | const commonConfig = { 48 | context: srcPath, 49 | entry: './index.ts', 50 | output: { 51 | path: distPath 52 | }, 53 | module: { 54 | rules: [ 55 | { 56 | test: /\.(ts|tsx)$/, 57 | loader: 'ts-loader', 58 | include: [srcPath], 59 | exclude: [/node_modules/] 60 | } 61 | ] 62 | }, 63 | resolve: { 64 | extensions: ['.tsx', '.ts', '.js'] 65 | }, 66 | watchOptions: { 67 | aggregateTimeout: 600, 68 | ignored: /node_modules/ 69 | }, 70 | plugins: [ 71 | new ProgressPlugin(), 72 | new CleanWebpackPlugin({ 73 | cleanStaleWebpackAssets: false, 74 | cleanOnceBeforeBuildPatterns: [distPath] 75 | }), 76 | new DefinePlugin({ 77 | __VERSION__: JSON.stringify(packageData.version), 78 | __NAME__: JSON.stringify(packageData.name), 79 | __NODE_ENV__: JSON.stringify(process.env.NODE_ENV) 80 | }) 81 | ] 82 | }; 83 | 84 | nodeConfig = merge(nodeConfig, commonConfig); 85 | browserConfig = merge(browserConfig, commonConfig); 86 | 87 | if (isProductionEnv) { 88 | return [merge(nodeConfig, prodConfig), merge(browserConfig, prodConfig)]; 89 | } 90 | return [merge(nodeConfig, devConfig), merge(browserConfig, devConfig)]; 91 | }; 92 | -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | devtool: 'inline-source-map', 6 | devServer: { 7 | static: path.resolve(__dirname, 'src'), 8 | host: '0.0.0.0', 9 | port: 4200 10 | }, 11 | optimization: { 12 | minimize: false 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /webpack.prod.js: -------------------------------------------------------------------------------- 1 | const TerserPlugin = require('terser-webpack-plugin'); 2 | 3 | module.exports = { 4 | mode: 'production', 5 | optimization: { 6 | minimizer: [ 7 | new TerserPlugin({ 8 | extractComments: false 9 | }) 10 | ], 11 | splitChunks: { 12 | cacheGroups: { 13 | vendors: { 14 | priority: -10, 15 | test: /[\\/]node_modules[\\/]/ 16 | } 17 | }, 18 | chunks: 'async', 19 | minChunks: 1, 20 | minSize: 30000, 21 | name: false 22 | } 23 | } 24 | }; 25 | --------------------------------------------------------------------------------