├── .c8rc.json ├── .commitlintrc.json ├── .eslintignore ├── .eslintrc.json ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── pgp │ └── key.asc.gpg ├── scripts │ ├── cleanup.sh │ ├── decrypt.sh │ ├── encrypt.sh │ ├── git.sh │ └── gpg.sh └── workflows │ └── ci.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg └── pre-commit ├── .lintstagedrc.json ├── .npmignore ├── .prettierignore ├── .prettierignore_docs ├── .releaserc.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── docs ├── .nojekyll ├── assets │ ├── highlight.css │ ├── icons.css │ ├── icons.png │ ├── icons@2x.png │ ├── main.js │ ├── search.js │ ├── style.css │ ├── widgets.png │ └── widgets@2x.png ├── classes │ ├── AuthenticatedClient.html │ ├── PublicClient.html │ └── WebsocketClient.html ├── index.html ├── interfaces │ ├── AcceptedOrder.html │ ├── Account.html │ ├── AccountDetails.html │ ├── AccountInfo.html │ ├── AccountName.html │ ├── ActiveOrder.html │ ├── AddBankOptions.html │ ├── AddBankResponse.html │ ├── AuctionHistory.html │ ├── AuctionHistoryFilter.html │ ├── AuctionIndicativeEvent.html │ ├── AuctionInfo.html │ ├── AuctionOpenEvent.html │ ├── AuctionResultEvent.html │ ├── AuthHeaders.html │ ├── AuthenticatedClientOptions.html │ ├── Balance.html │ ├── BaseClearingOrder.html │ ├── BaseOrder.html │ ├── BaseWSOrder.html │ ├── BlockTradeEvent.html │ ├── BookEntry.html │ ├── BookFilter.html │ ├── BookedOrder.html │ ├── BrokerOrderOptions.html │ ├── CancelClearingOrderResponse.html │ ├── CancelOrdersResponse.html │ ├── CancelRejectedOrder.html │ ├── CancelledOrder.html │ ├── CandlesFilter.html │ ├── CandlesUpdate.html │ ├── ChangeEvent.html │ ├── ClearingOrderID.html │ ├── ClearingOrderOptions.html │ ├── ClearingOrderStatus.html │ ├── ClosedOrder.html │ ├── ConfirmClearingOptions.html │ ├── ConfirmClearingOptionsResponse.html │ ├── DepositAddress.html │ ├── DepositAddressesFilter.html │ ├── FilledOrder.html │ ├── GUSDWithdrawal.html │ ├── Heartbeat.html │ ├── HeartbeatMarketMessage.html │ ├── HeartbeatMarketV2.html │ ├── HeartbeatOrdersMessage.html │ ├── ISymbol.html │ ├── InitialUpdate.html │ ├── InternalTransferFilter.html │ ├── InternalTransferResponse.html │ ├── L2Auction.html │ ├── L2InitialResponse.html │ ├── L2Trade.html │ ├── L2Update.html │ ├── MessageV2.html │ ├── NewAddress.html │ ├── NewAddressFilter.html │ ├── NewClearingOrderResponse.html │ ├── NotionalBalance.html │ ├── NotionalBalancesOptions.html │ ├── NotionalVolume.html │ ├── OrderBook.html │ ├── OrderID.html │ ├── OrderOptions.html │ ├── OrderStatus.html │ ├── PastTrade.html │ ├── PaymentBalance.html │ ├── PaymentBank.html │ ├── PaymentMethods.html │ ├── PriceFeedItem.html │ ├── PublicClientOptions.html │ ├── RejectedOrder.html │ ├── SENWithdrawOptions.html │ ├── SENWithdrawal.html │ ├── SignerOptions.html │ ├── SubscriptionAck.html │ ├── SymbolFilter.html │ ├── TickerFilter.html │ ├── TickerV1.html │ ├── TickerV2.html │ ├── Trade.html │ ├── TradeEvent.html │ ├── TradeHistoryFilter.html │ ├── TradeVolume.html │ ├── Transfer.html │ ├── TransferFilter.html │ ├── Update.html │ ├── WSMarketQS.html │ ├── WSOrderQS.html │ ├── WSSignerOptions.html │ ├── WebsocketClientOptions.html │ ├── WithdrawCryptoFilter.html │ ├── WithdrawGUSDFilter.html │ └── Withdrawal.html └── modules.html ├── index.ts ├── package-lock.json ├── package.json ├── src ├── auth.ts ├── public.ts ├── signer.ts └── websocket.ts ├── test ├── auth.spec.ts ├── public.spec.ts ├── signer.spec.ts └── websocket.spec.ts ├── tsconfig.json └── typedoc.json /.c8rc.json: -------------------------------------------------------------------------------- 1 | { "exclude": ["build/test/*"] } 2 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { "extends": "b2broker" } 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # Typescript compiled files 2 | build/ 3 | 4 | # Documentation 5 | docs/ 6 | 7 | # nyc test coverage 8 | .nyc_output/ 9 | 10 | # Coverage directory used by nyc 11 | coverage/ 12 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { "extends": ["b2broker-ts"], "parserOptions": { "project": "tsconfig.json" } } 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://commerce.coinbase.com/checkout/04a40393-21f0-44aa-b11b-726b67f08c5a 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: vansergen 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 (add some code): 14 | 15 | ```typescript 16 | import * as Gemini from "gemini-node-api"; 17 | // more code 18 | ``` 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Please complete the following information:** 24 | 25 | - Node.js version: [e.g. 8.1.0] 26 | - NPM version: [e.g. 5.1.2] 27 | - Version [e.g. 0.4.0] 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE-REQUEST]" 5 | labels: enhancement 6 | assignees: vansergen 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/pgp/key.asc.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vansergen/gemini-node-api/a6ea812302b9a05d4ed6ca0b42d20a443529bdb8/.github/pgp/key.asc.gpg -------------------------------------------------------------------------------- /.github/scripts/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Delete the private key 5 | rm -f .github/pgp/key.asc 6 | -------------------------------------------------------------------------------- /.github/scripts/decrypt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Descrypt the private key 5 | gpg --quiet --batch --yes --decrypt --passphrase=${PRIVATE_KEY_PASSPHRASE} \ 6 | --output ./.github/pgp/key.asc ./.github/pgp/key.asc.gpg 7 | 8 | # Set the access permissions 9 | chmod 600 ./.github/pgp/key.asc 10 | 11 | # Import the private key 12 | gpg --batch --yes --import ./.github/pgp/key.asc 13 | -------------------------------------------------------------------------------- /.github/scripts/encrypt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Encrypt PGP key 5 | gpg --batch --symmetric --cipher-algo AES256 \ 6 | --output ./.github/pgp/key.asc.gpg --passphrase=${PRIVATE_KEY_PASSPHRASE} \ 7 | ./.github/pgp/key.asc 8 | -------------------------------------------------------------------------------- /.github/scripts/git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Set pgp siging key 5 | git config user.signingkey ${PGP_KEY_ID} 6 | 7 | # Set the custom gpg program (that passes the passphrase to `gpg`) 8 | git config gpg.program ./.github/scripts/gpg.sh 9 | 10 | # Sign commits with PGP key 11 | git config commit.gpgsign true 12 | -------------------------------------------------------------------------------- /.github/scripts/gpg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Pass the passphrase to gpg 5 | gpg --batch --pinentry-mode=loopback --passphrase ${PGP_PASSPHRASE} -v $@ 6 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: push 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@main 11 | with: 12 | fetch-depth: 0 13 | 14 | - uses: actions/setup-node@main 15 | with: 16 | node-version: 16 17 | check-latest: true 18 | 19 | - name: Node.js version 20 | run: node --version 21 | 22 | - name: npm version 23 | run: npm --version 24 | 25 | - name: Install dependencies 26 | run: npm ci 27 | 28 | - name: Commitlint 29 | run: npm run commitlint:all 30 | 31 | - name: Prettier 32 | run: npm run prettier 33 | 34 | - name: ESLint 35 | run: npm run lint 36 | 37 | - name: Tests 38 | run: npm run test:ci 39 | 40 | - name: Publish (test) 41 | run: npm run publish:test 42 | 43 | - name: Coverage 44 | run: npm run coverage:ci 45 | 46 | - name: Coveralls 47 | uses: coverallsapp/github-action@master 48 | with: 49 | github-token: ${{ secrets.GITHUB_TOKEN }} 50 | 51 | docs: 52 | runs-on: ubuntu-latest 53 | 54 | steps: 55 | - uses: actions/checkout@main 56 | 57 | - uses: actions/setup-node@main 58 | with: 59 | node-version: 16 60 | check-latest: true 61 | 62 | - name: Install dependencies 63 | run: npm ci 64 | 65 | - name: Docs 66 | run: npm run docs:build 67 | 68 | release: 69 | needs: [test, docs] 70 | 71 | runs-on: ubuntu-latest 72 | 73 | steps: 74 | - uses: actions/checkout@main 75 | with: 76 | fetch-depth: 0 77 | 78 | - uses: actions/setup-node@main 79 | with: 80 | node-version: 16 81 | check-latest: true 82 | 83 | - name: Install dependencies 84 | run: npm ci 85 | 86 | - name: Decrypt PGP key 87 | run: ./.github/scripts/decrypt.sh 88 | env: 89 | PRIVATE_KEY_PASSPHRASE: ${{ secrets.PRIVATE_KEY_PASSPHRASE }} 90 | 91 | - name: Setup git 92 | run: ./.github/scripts/git.sh 93 | env: 94 | PGP_KEY_ID: ${{ secrets.PGP_KEY_ID }} 95 | 96 | - name: Release 97 | run: npm run release 98 | env: 99 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 100 | GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} 101 | GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} 102 | PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} 103 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 104 | 105 | - name: Cleanup 106 | run: ./.github/scripts/cleanup.sh 107 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | # Build 107 | build/ 108 | 109 | # PGP key 110 | .github/pgp/key.asc 111 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { "*": "npm run prettier:write", "*.ts": "npm run lint:fix" } 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # nyc test coverage 2 | .nyc_output 3 | 4 | # Coverage directory used by nyc 5 | coverage 6 | 7 | # c8 config - https://github.com/bcoe/c8 8 | .c8rc.json 9 | 10 | # GitHub folder 11 | .github/ 12 | 13 | # Tests 14 | test/ 15 | build/test/ 16 | 17 | # Documentation 18 | docs/ 19 | 20 | # Commitlint config - https://commitlint.js.org/ 21 | .commitlintrc.json 22 | 23 | # ESLint config - https://eslint.org/ 24 | .eslintrc.json 25 | 26 | # ESLint ignore - https://eslint.org/docs/user-guide/configuring#eslintignore 27 | .eslintignore 28 | 29 | # husky config - https://github.com/typicode/husky 30 | .husky 31 | 32 | # lint-staged config - https://github.com/okonet/lint-staged 33 | .lintstagedrc.json 34 | 35 | # Prettier ignore 36 | .prettierignore 37 | .prettierignore_docs 38 | 39 | # semantic-release config - https://semantic-release.gitbook.io/semantic-release/ 40 | .releaserc.json 41 | 42 | # TypeScript config - https://www.typescriptlang.org/tsconfig 43 | tsconfig.json 44 | 45 | # TypeDoc config - https://typedoc.org/ 46 | typedoc.json 47 | 48 | # Code of Conduct 49 | CODE_OF_CONDUCT.md 50 | 51 | # Source files 52 | src/ 53 | index.ts 54 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Coverage directory used by nyc 2 | coverage 3 | 4 | # nyc test coverage 5 | .nyc_output 6 | 7 | # Documentation 8 | docs 9 | -------------------------------------------------------------------------------- /.prettierignore_docs: -------------------------------------------------------------------------------- 1 | # Coverage directory used by nyc 2 | coverage 3 | 4 | # nyc test coverage 5 | .nyc_output 6 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": "main", 3 | "preset": "conventionalcommits", 4 | "presetConfig": { 5 | "types": [ 6 | { "type": "feat", "section": "Features" }, 7 | { "type": "fix", "section": "Bug Fixes" }, 8 | { "type": "perf", "section": "Performance Improvements" }, 9 | { "type": "revert", "section": "Reverts" }, 10 | { "type": "build", "section": "Build System" }, 11 | { "type": "initial", "section": "Initial" }, 12 | { "type": "dependencies", "section": "Dependencies" }, 13 | { "type": "peerDependencies", "section": "Peer dependencies" }, 14 | { "type": "devDependencies", "section": "Dev dependencies" }, 15 | { "type": "metadata", "section": "Metadata" }, 16 | { "type": "docs", "section": "Documentation", "hidden": true }, 17 | { "type": "style", "section": "Styles", "hidden": true }, 18 | { "type": "chore", "section": "Miscellaneous Chores", "hidden": true }, 19 | { "type": "refactor", "section": "Code Refactoring", "hidden": true }, 20 | { "type": "test", "section": "Tests", "hidden": true }, 21 | { "type": "ci", "section": "Continuous Integration", "hidden": true } 22 | ] 23 | }, 24 | "releaseRules": [ 25 | { "breaking": true, "release": "major" }, 26 | { "type": "feat", "release": "minor" }, 27 | { "type": "fix", "release": "patch" }, 28 | { "type": "perf", "release": "patch" }, 29 | { "type": "build", "release": "patch" }, 30 | { "type": "initial", "release": "minor" }, 31 | { "type": "dependencies", "release": "patch" }, 32 | { "type": "peerDependencies", "release": "patch" }, 33 | { "type": "metadata", "release": "patch" } 34 | ], 35 | "plugins": [ 36 | "@semantic-release/commit-analyzer", 37 | "@semantic-release/release-notes-generator", 38 | ["@semantic-release/changelog", { "changelogTitle": "# Changelog" }], 39 | "@semantic-release/npm", 40 | ["@semantic-release/exec", { "prepareCmd": "npm run docs:build" }], 41 | "@semantic-release/github", 42 | [ 43 | "@semantic-release/git", 44 | { 45 | "assets": ["CHANGELOG.md", "package.json", "package-lock.json", "docs"], 46 | "message": "chore(release): ${nextRelease.version} [skip ci]" 47 | } 48 | ] 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [4.3.0](https://github.com/vansergen/gemini-node-api/compare/v4.2.1...v4.3.0) (2022-06-26) 4 | 5 | ### Features 6 | 7 | - add the `.withdrawSEN()` method ([edc71fd](https://github.com/vansergen/gemini-node-api/commit/edc71fda0f7a54fa07690e4297a654c03a3af02d)) 8 | 9 | ### Dependencies 10 | 11 | - upgrade `rpc-request` to `v6.0.2` ([c4096b2](https://github.com/vansergen/gemini-node-api/commit/c4096b274941df4cc8e380266f53b1a1f0c40ca0)) 12 | - upgrade `ws` to `v8.8.0` ([4d0d108](https://github.com/vansergen/gemini-node-api/commit/4d0d108eccbab2b5a32fe544df02b63b9988c2df)) 13 | 14 | ### [4.2.1](https://github.com/vansergen/gemini-node-api/compare/v4.2.0...v4.2.1) (2022-05-15) 15 | 16 | ### Dependencies 17 | 18 | - upgrade `rpc-request` to `v6.0.1` ([1252b8d](https://github.com/vansergen/gemini-node-api/commit/1252b8d850c0218970163f24bf534a2f2ecaef3b)) 19 | 20 | ## [4.2.0](https://github.com/vansergen/gemini-node-api/compare/v4.1.0...v4.2.0) (2022-05-15) 21 | 22 | ### Features 23 | 24 | - add the `getPaymentMethods` method ([7a2ffa9](https://github.com/vansergen/gemini-node-api/commit/7a2ffa90d888df5c991c12666cb70c407d71df13)) 25 | 26 | ## [4.1.0](https://github.com/vansergen/gemini-node-api/compare/v4.0.2...v4.1.0) (2022-05-15) 27 | 28 | ### Features 29 | 30 | - add the `addBank` method to the `AuthenticatedClient` class ([8e93bdc](https://github.com/vansergen/gemini-node-api/commit/8e93bdca6594a2e0d0e2a3270ff72ab68cd5689b)) 31 | 32 | ### Bug Fixes 33 | 34 | - update order interfaces ([70c0cf3](https://github.com/vansergen/gemini-node-api/commit/70c0cf3375a34faec4bd05ab5da638fbf7469735)) 35 | 36 | ### [4.0.2](https://github.com/vansergen/gemini-node-api/compare/v4.0.1...v4.0.2) (2022-05-13) 37 | 38 | ### Performance Improvements 39 | 40 | - allow to get notional balances in different currencies ([5892f5f](https://github.com/vansergen/gemini-node-api/commit/5892f5f64709ea1d68b90077c1a2d783c37b9284)) 41 | - set `usd` as the default currency ([ebdbc80](https://github.com/vansergen/gemini-node-api/commit/ebdbc805eee06eb5c3129f994d1e0626594a22d4)) 42 | 43 | ### [4.0.1](https://github.com/vansergen/gemini-node-api/compare/v4.0.0...v4.0.1) (2022-05-13) 44 | 45 | ### Dependencies 46 | 47 | - upgrdate `ws` to `v8.6.0` ([a0cd563](https://github.com/vansergen/gemini-node-api/commit/a0cd5634ed617609b3bfc5f92d953ae4d47421b6)) 48 | 49 | ## [4.0.0](https://github.com/vansergen/gemini-node-api/compare/v3.1.2...v4.0.0) (2021-10-30) 50 | 51 | ### ⚠ BREAKING CHANGES 52 | 53 | - drop Node `<16.13.0` support 54 | - change package type from `commonjs` to `module` 55 | - async methods return native promises instead of `Bluebird` 56 | - drop Node `<16.3.0` 57 | 58 | ### Features 59 | 60 | - add the `.getAccountDetails()` method ([3f0d010](https://github.com/vansergen/gemini-node-api/commit/3f0d010dcca2f1a679229236da888d7781b90b1d)) 61 | 62 | ### Performance Improvements 63 | 64 | - change package type from `commonjs` to `module` ([c580cce](https://github.com/vansergen/gemini-node-api/commit/c580cce6f60c8933319172b8026dc6a7f17456e6)) 65 | - drop Node `<16.13.0` support ([47fb9a9](https://github.com/vansergen/gemini-node-api/commit/47fb9a99c85b1df9a09a608d7e5ad5da2a04aac5)) 66 | 67 | ### Miscellaneous Chores 68 | 69 | - drop Node `<16.3.0` ([905f35b](https://github.com/vansergen/gemini-node-api/commit/905f35b6dc50f6a9eb732329e4450cca7c8a640c)) 70 | 71 | ### Dependencies 72 | 73 | - upgrade `@types/ws` to `v7.4.4` ([ed1f456](https://github.com/vansergen/gemini-node-api/commit/ed1f4560cf2f765c1bee6ebbef9cbb342d925add)) 74 | - upgrade `@types/ws` to `v8.2.0` ([b163895](https://github.com/vansergen/gemini-node-api/commit/b16389521e5e9305d5923c848838372976f8d962)) 75 | - upgrade `ws` to `v7.4.6` ([7094eee](https://github.com/vansergen/gemini-node-api/commit/7094eeef30a4debf00845f3258f3618fa535fb8b)) 76 | - upgrade `ws` to `v8.2.3` ([8f4c588](https://github.com/vansergen/gemini-node-api/commit/8f4c588350cad21c1742040b8dfb98989aeeff07)) 77 | - use `rpc-request` instead of `rpc-bluebird` ([a9d729a](https://github.com/vansergen/gemini-node-api/commit/a9d729a6a7a4182d1f4b45fcbb7a0113eb296772)) 78 | 79 | ### Code Refactoring 80 | 81 | - async methods return native promises instead of `Bluebird` ([65cec82](https://github.com/vansergen/gemini-node-api/commit/65cec8221f22c41fa6dab324385e6da6e9889640)) 82 | 83 | ### [3.1.2](https://github.com/vansergen/gemini-node-api/compare/v3.1.1...v3.1.2) (2021-03-07) 84 | 85 | ### Dependencies 86 | 87 | - upgrade `rpc-bluebird` to `v3.0.3` ([c221ff1](https://github.com/vansergen/gemini-node-api/commit/c221ff157fec0288c24e4a5c2de908e754d57756)) 88 | - upgrade `ws` to `v7.4.4` ([8287e32](https://github.com/vansergen/gemini-node-api/commit/8287e32451790ca50ac18d7ac05d5a03add62355)) 89 | 90 | ### [3.1.1](https://github.com/vansergen/gemini-node-api/compare/v3.1.0...v3.1.1) (2021-02-14) 91 | 92 | ### Dependencies 93 | 94 | - upgrade `rpc-bluebird` to `v3.0.2` ([df8ceda](https://github.com/vansergen/gemini-node-api/commit/df8ceda00ec70a249100ecf0a2adf1f07920e004)) 95 | 96 | ## [3.1.0](https://github.com/vansergen/gemini-node-api/compare/v3.0.1...v3.1.0) (2021-02-05) 97 | 98 | ### Features 99 | 100 | - add the `getSymbol` method ([d98ec03](https://github.com/vansergen/gemini-node-api/commit/d98ec03d48fcff7d58cd5b2dc928db4eb990d08b)) 101 | 102 | ### Dependencies 103 | 104 | - update `ws` to `v7.4.3` ([5e2fc35](https://github.com/vansergen/gemini-node-api/commit/5e2fc355a77bf040ed6475562e54d4137ae19261)) 105 | 106 | ### [3.0.1](https://github.com/vansergen/gemini-node-api/compare/v3.0.0...v3.0.1) (2020-12-21) 107 | 108 | ### Dependencies 109 | 110 | - update `rpc-bluebird` to `v3.0.1` ([1a61f64](https://github.com/vansergen/gemini-node-api/commit/1a61f646bf2980a508fbf8980f9eb99a62242ffa)) 111 | 112 | ## [3.0.0](https://github.com/vansergen/gemini-node-api/compare/v2.1.0...v3.0.0) (2020-12-20) 113 | 114 | ### ⚠ BREAKING CHANGES 115 | 116 | - drop Node `<14.15.3` support 117 | - the main methods of the `WebsocketClient` class return promises 118 | - update AuthenticatedClient 119 | - pass `payload` as string 120 | - the class `PublicClient` extends `FetchClient` 121 | - drop Node `<12.20.0` support 122 | 123 | ### Bug Fixes 124 | 125 | - package.json, package-lock.json & .snyk to reduce vulnerabilities ([3b5bc40](https://github.com/vansergen/gemini-node-api/commit/3b5bc4029e39154286d4828922898c5fd3e1f572)) 126 | - package.json, package-lock.json & .snyk to reduce vulnerabilities ([7a560e2](https://github.com/vansergen/gemini-node-api/commit/7a560e2147f84fd1775b6a8f5282c4a65aca3a0e)) 127 | - package.json, package-lock.json & .snyk to reduce vulnerabilities ([50c45e9](https://github.com/vansergen/gemini-node-api/commit/50c45e9325913a8f3dfa26941390dac7d44d40a5)) 128 | - update AuthenticatedClient ([d7336fd](https://github.com/vansergen/gemini-node-api/commit/d7336fdb4989ffa7b220715d54acd8af94fcae6d)) 129 | - upgrade @types/ws from 7.2.1 to 7.2.2 ([870a9b0](https://github.com/vansergen/gemini-node-api/commit/870a9b0a0f36433893f7f6e2fb227cb759787542)) 130 | - upgrade @types/ws from 7.2.3 to 7.2.6 ([783c1d3](https://github.com/vansergen/gemini-node-api/commit/783c1d3c23973466ed76001c927b39faac33d87b)) 131 | - upgrade rpc-bluebird from 2.0.2 to 2.0.3 ([700ca1f](https://github.com/vansergen/gemini-node-api/commit/700ca1f6bb904f01f94155fcf87c2e9f7ebab004)) 132 | - upgrade snyk from 1.316.1 to 1.352.1 ([757dfa9](https://github.com/vansergen/gemini-node-api/commit/757dfa955bb2fb9452694916812f9321a92d15cb)) 133 | - upgrade snyk from 1.352.1 to 1.388.0 ([295aaee](https://github.com/vansergen/gemini-node-api/commit/295aaee5adb358092d87c7accc0cb5a0a0c4d335)) 134 | - upgrade ws from 7.2.3 to 7.2.5 ([9a66b91](https://github.com/vansergen/gemini-node-api/commit/9a66b917527cb11a422418854abe6e9a4f4a2a7f)) 135 | - upgrade ws from 7.2.3 to 7.2.5 ([ae29355](https://github.com/vansergen/gemini-node-api/commit/ae29355c533cdace98398e5914cc97cdbf47183a)) 136 | - upgrade ws from 7.2.5 to 7.3.1 ([b5d2f4a](https://github.com/vansergen/gemini-node-api/commit/b5d2f4a5236c1aa5567be9469da98390bff0ba8c)) 137 | 138 | ### Performance Improvements 139 | 140 | - drop Node `<14.15.3` support ([bf0c9d5](https://github.com/vansergen/gemini-node-api/commit/bf0c9d5b6bee4155237b6e7060893774b7d5ad9c)) 141 | - pass `payload` as string ([e20a99c](https://github.com/vansergen/gemini-node-api/commit/e20a99c8e1a92c2f46ef4d36ad788d658bbbc276)) 142 | - the class `PublicClient` extends `FetchClient` ([e6c1c67](https://github.com/vansergen/gemini-node-api/commit/e6c1c67b900f4daa8aee276868e772f7fb34f6a7)) 143 | - the main methods of the `WebsocketClient` class return promises ([f4d0091](https://github.com/vansergen/gemini-node-api/commit/f4d009179eff15e50303c5eae9271f515015b9b6)) 144 | 145 | ### Dependencies 146 | 147 | - remove snyk ([62a896a](https://github.com/vansergen/gemini-node-api/commit/62a896a23899360a31585fb831a9e60ee86dba44)) 148 | - update `@types/ws` to `v7.4.0` ([4f16162](https://github.com/vansergen/gemini-node-api/commit/4f161629749edee51f942875e1a795e924fcf35c)) 149 | - update `rpc-bluebird` to `v3.0.0` ([44d5b4d](https://github.com/vansergen/gemini-node-api/commit/44d5b4d35cec2217c7244e43601dadea2b44cd2b)) 150 | - update `ws` to `v7.4.1` ([54f901e](https://github.com/vansergen/gemini-node-api/commit/54f901efa3218be1e10c097b6b320547d422c6a8)) 151 | 152 | ### Miscellaneous Chores 153 | 154 | - drop Node `<12.20.0` support ([c190963](https://github.com/vansergen/gemini-node-api/commit/c190963227124d8c90e5e875e9efb6a41f03b25d)) 155 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | - Demonstrating empathy and kindness toward other people 21 | - Being respectful of differing opinions, viewpoints, and experiences 22 | - Giving and gracefully accepting constructive feedback 23 | - Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | - Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | - The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | - Trolling, insulting or derogatory comments, and personal or political attacks 33 | - Public or private harassment 34 | - Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | - Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | sergey.bakulin.github@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Sergey Bakulin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /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/assets/highlight.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-hl-0: #000000; 3 | --dark-hl-0: #d4d4d4; 4 | --light-hl-1: #af00db; 5 | --dark-hl-1: #c586c0; 6 | --light-hl-2: #001080; 7 | --dark-hl-2: #9cdcfe; 8 | --light-hl-3: #a31515; 9 | --dark-hl-3: #ce9178; 10 | --light-hl-4: #0000ff; 11 | --dark-hl-4: #569cd6; 12 | --light-hl-5: #0070c1; 13 | --dark-hl-5: #4fc1ff; 14 | --light-hl-6: #795e26; 15 | --dark-hl-6: #dcdcaa; 16 | --light-hl-7: #008000; 17 | --dark-hl-7: #6a9955; 18 | --light-hl-8: #098658; 19 | --dark-hl-8: #b5cea8; 20 | --light-hl-9: #267f99; 21 | --dark-hl-9: #4ec9b0; 22 | --light-hl-10: #000000; 23 | --dark-hl-10: #c8c8c8; 24 | --light-code-background: #f5f5f5; 25 | --dark-code-background: #1e1e1e; 26 | } 27 | 28 | @media (prefers-color-scheme: light) { 29 | :root { 30 | --hl-0: var(--light-hl-0); 31 | --hl-1: var(--light-hl-1); 32 | --hl-2: var(--light-hl-2); 33 | --hl-3: var(--light-hl-3); 34 | --hl-4: var(--light-hl-4); 35 | --hl-5: var(--light-hl-5); 36 | --hl-6: var(--light-hl-6); 37 | --hl-7: var(--light-hl-7); 38 | --hl-8: var(--light-hl-8); 39 | --hl-9: var(--light-hl-9); 40 | --hl-10: var(--light-hl-10); 41 | --code-background: var(--light-code-background); 42 | } 43 | } 44 | 45 | @media (prefers-color-scheme: dark) { 46 | :root { 47 | --hl-0: var(--dark-hl-0); 48 | --hl-1: var(--dark-hl-1); 49 | --hl-2: var(--dark-hl-2); 50 | --hl-3: var(--dark-hl-3); 51 | --hl-4: var(--dark-hl-4); 52 | --hl-5: var(--dark-hl-5); 53 | --hl-6: var(--dark-hl-6); 54 | --hl-7: var(--dark-hl-7); 55 | --hl-8: var(--dark-hl-8); 56 | --hl-9: var(--dark-hl-9); 57 | --hl-10: var(--dark-hl-10); 58 | --code-background: var(--dark-code-background); 59 | } 60 | } 61 | 62 | body.light { 63 | --hl-0: var(--light-hl-0); 64 | --hl-1: var(--light-hl-1); 65 | --hl-2: var(--light-hl-2); 66 | --hl-3: var(--light-hl-3); 67 | --hl-4: var(--light-hl-4); 68 | --hl-5: var(--light-hl-5); 69 | --hl-6: var(--light-hl-6); 70 | --hl-7: var(--light-hl-7); 71 | --hl-8: var(--light-hl-8); 72 | --hl-9: var(--light-hl-9); 73 | --hl-10: var(--light-hl-10); 74 | --code-background: var(--light-code-background); 75 | } 76 | 77 | body.dark { 78 | --hl-0: var(--dark-hl-0); 79 | --hl-1: var(--dark-hl-1); 80 | --hl-2: var(--dark-hl-2); 81 | --hl-3: var(--dark-hl-3); 82 | --hl-4: var(--dark-hl-4); 83 | --hl-5: var(--dark-hl-5); 84 | --hl-6: var(--dark-hl-6); 85 | --hl-7: var(--dark-hl-7); 86 | --hl-8: var(--dark-hl-8); 87 | --hl-9: var(--dark-hl-9); 88 | --hl-10: var(--dark-hl-10); 89 | --code-background: var(--dark-code-background); 90 | } 91 | 92 | .hl-0 { 93 | color: var(--hl-0); 94 | } 95 | .hl-1 { 96 | color: var(--hl-1); 97 | } 98 | .hl-2 { 99 | color: var(--hl-2); 100 | } 101 | .hl-3 { 102 | color: var(--hl-3); 103 | } 104 | .hl-4 { 105 | color: var(--hl-4); 106 | } 107 | .hl-5 { 108 | color: var(--hl-5); 109 | } 110 | .hl-6 { 111 | color: var(--hl-6); 112 | } 113 | .hl-7 { 114 | color: var(--hl-7); 115 | } 116 | .hl-8 { 117 | color: var(--hl-8); 118 | } 119 | .hl-9 { 120 | color: var(--hl-9); 121 | } 122 | .hl-10 { 123 | color: var(--hl-10); 124 | } 125 | pre, 126 | code { 127 | background: var(--code-background); 128 | } 129 | -------------------------------------------------------------------------------- /docs/assets/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vansergen/gemini-node-api/a6ea812302b9a05d4ed6ca0b42d20a443529bdb8/docs/assets/icons.png -------------------------------------------------------------------------------- /docs/assets/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vansergen/gemini-node-api/a6ea812302b9a05d4ed6ca0b42d20a443529bdb8/docs/assets/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vansergen/gemini-node-api/a6ea812302b9a05d4ed6ca0b42d20a443529bdb8/docs/assets/widgets.png -------------------------------------------------------------------------------- /docs/assets/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vansergen/gemini-node-api/a6ea812302b9a05d4ed6ca0b42d20a443529bdb8/docs/assets/widgets@2x.png -------------------------------------------------------------------------------- /docs/interfaces/Account.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Account | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface Account

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • Account
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 |
    100 |
  • 101 | name 102 |
  • 103 |
  • 104 | type 105 |
  • 106 |
107 |
108 |
109 |
110 |
111 |
112 |

Properties

113 |
116 | 117 | 141 |
142 | name: 143 | string 144 |
145 | 156 |
157 |
160 | 161 | 185 |
186 | type?: 187 | "exchange" | "custody" 190 |
191 | 202 |
203 |
204 |
205 | 227 |
228 |
229 | 282 |
283 | 284 | 285 | 286 | -------------------------------------------------------------------------------- /docs/interfaces/AccountName.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AccountName | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface AccountName

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 | 168 |
169 |
170 |

Index

171 |
172 |
173 |
174 |

Properties

175 | 182 |
183 |
184 |
185 |
186 |
187 |

Properties

188 |
191 | 192 | 216 |
217 | account?: 218 | string 219 |
220 | 231 |
232 |
233 |
234 | 257 |
258 |
259 | 312 |
313 | 314 | 315 | 316 | -------------------------------------------------------------------------------- /docs/interfaces/AddBankResponse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AddBankResponse | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface AddBankResponse

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • AddBankResponse
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 108 |
109 |
110 |
111 |
112 |
113 |

Properties

114 |
117 | 118 | 142 |
143 | referenceId: 144 | string 145 |
146 | 157 |
158 |
159 |

160 | Reference ID for the new bank addition request. Once 161 | received, send in a wire from the requested bank account to 162 | verify it and enable withdrawals to that account. 163 |

164 |
165 |
166 |
167 |
168 |
169 | 194 |
195 |
196 | 249 |
250 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /docs/interfaces/CancelClearingOrderResponse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CancelClearingOrderResponse | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 84 |

Interface CancelClearingOrderResponse

85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |

Hierarchy

93 |
    94 |
  • CancelClearingOrderResponse
  • 95 |
96 |
97 |
98 |

Index

99 |
100 |
101 |
102 |

Properties

103 | 119 |
120 |
121 |
122 |
123 |
124 |

Properties

125 |
128 | 129 | 153 |
154 | details: 155 | string 156 |
157 | 168 |
169 |
172 | 173 | 197 |
198 | result: 199 | "failed" | "ok" 202 |
203 | 214 |
215 |
216 |
217 | 249 |
250 |
251 | 304 |
305 | 306 | 307 | 308 | -------------------------------------------------------------------------------- /docs/interfaces/ClearingOrderID.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ClearingOrderID | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface ClearingOrderID

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • ClearingOrderID
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 108 |
109 |
110 |
111 |
112 |
113 |

Properties

114 |
117 | 118 | 142 |
143 | clearing_id: 144 | string 145 |
146 | 157 |
158 |
159 |
160 | 185 |
186 |
187 | 240 |
241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /docs/interfaces/Heartbeat.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Heartbeat | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface Heartbeat

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • Heartbeat
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 |
    100 |
  • 101 | result 104 |
  • 105 |
106 |
107 |
108 |
109 |
110 |
111 |

Properties

112 |
115 | 116 | 140 |
141 | result: 142 | "ok" 143 |
144 | 155 |
156 |
157 |
158 | 179 |
180 |
181 | 234 |
235 | 236 | 237 | 238 | -------------------------------------------------------------------------------- /docs/interfaces/HeartbeatMarketMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HeartbeatMarketMessage | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 82 |

Interface HeartbeatMarketMessage

83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |

Hierarchy

91 |
    92 |
  • HeartbeatMarketMessage
  • 93 |
94 |
95 |
96 |

Index

97 |
98 |
99 |
100 |

Properties

101 | 117 |
118 |
119 |
120 |
121 |
122 |

Properties

123 |
126 | 127 | 151 |
152 | socket_sequence: 155 | number 156 |
157 | 168 |
169 |
172 | 173 | 197 |
198 | type: 199 | "heartbeat" 200 |
201 | 212 |
213 |
214 |
215 | 247 |
248 |
249 | 302 |
303 | 304 | 305 | 306 | -------------------------------------------------------------------------------- /docs/interfaces/HeartbeatMarketV2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HeartbeatMarketV2 | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface HeartbeatMarketV2

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • HeartbeatMarketV2
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 115 |
116 |
117 |
118 |
119 |
120 |

Properties

121 |
124 | 125 | 149 |
150 | timestamp: 151 | number 152 |
153 | 164 |
165 |
168 | 169 | 193 |
194 | type: 195 | "heartbeat" 196 |
197 | 208 |
209 |
210 |
211 | 241 |
242 |
243 | 296 |
297 | 298 | 299 | 300 | -------------------------------------------------------------------------------- /docs/interfaces/InternalTransferResponse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | InternalTransferResponse | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 84 |

Interface InternalTransferResponse

85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |

Hierarchy

93 |
    94 |
  • InternalTransferResponse
  • 95 |
96 |
97 |
98 |

Index

99 |
100 |
101 |
102 |

Properties

103 |
    104 |
  • 105 | uuid 110 |
  • 111 |
112 |
113 |
114 |
115 |
116 |
117 |

Properties

118 |
121 | 122 | 146 |
147 | uuid: 148 | string 149 |
150 | 161 |
162 |
163 |
164 | 189 |
190 |
191 | 244 |
245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /docs/interfaces/MessageV2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | MessageV2 | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface MessageV2

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • MessageV2
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 113 |
114 |
115 |
116 |
117 |
118 |

Properties

119 |
122 | 123 | 147 |
148 | subscriptions: 149 | Subscriptions 155 |
156 | 167 |
168 |
171 | 172 | 196 |
197 | type: 198 | "subscribe" | "unsubscribe" 201 |
202 | 213 |
214 |
215 |
216 | 242 |
243 |
244 | 297 |
298 | 299 | 300 | 301 | -------------------------------------------------------------------------------- /docs/interfaces/NewClearingOrderResponse.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | NewClearingOrderResponse | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 84 |

Interface NewClearingOrderResponse

85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |

Hierarchy

93 |
    94 |
  • NewClearingOrderResponse
  • 95 |
96 |
97 |
98 |

Index

99 |
100 |
101 |
102 |

Properties

103 | 119 |
120 |
121 |
122 |
123 |
124 |

Properties

125 |
128 | 129 | 153 |
154 | clearing_id: 155 | string 156 |
157 | 168 |
169 |
172 | 173 | 197 |
198 | result: 199 | string 200 |
201 | 212 |
213 |
214 |
215 | 247 |
248 |
249 | 302 |
303 | 304 | 305 | 306 | -------------------------------------------------------------------------------- /docs/interfaces/OrderBook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | OrderBook | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface OrderBook

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • OrderBook
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 |
    100 |
  • 101 | asks 104 |
  • 105 |
  • 106 | bids 109 |
  • 110 |
111 |
112 |
113 |
114 |
115 |
116 |

Properties

117 |
120 | 121 | 145 |
146 | asks: 147 | BookEntry[] 153 |
154 | 165 |
166 |
169 | 170 | 194 |
195 | bids: 196 | BookEntry[] 202 |
203 | 214 |
215 |
216 |
217 | 241 |
242 |
243 | 296 |
297 | 298 | 299 | 300 | -------------------------------------------------------------------------------- /docs/interfaces/PaymentBank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PaymentBank | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface PaymentBank

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • PaymentBank
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 |
    100 |
  • 101 | bank 104 |
  • 105 |
  • 106 | bankId 109 |
  • 110 |
111 |
112 |
113 |
114 |
115 |
116 |

Properties

117 |
120 | 121 | 145 |
146 | bank: 147 | string 148 |
149 | 160 |
161 |
162 |

Name of bank account

163 |
164 |
165 |
166 |
169 | 170 | 194 |
195 | bankId: 196 | string 197 |
198 | 209 |
210 |
211 |

Unique identifier for bank account

212 |
213 |
214 |
215 |
216 |
217 | 245 |
246 |
247 | 300 |
301 | 302 | 303 | 304 | -------------------------------------------------------------------------------- /docs/interfaces/PaymentMethods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PaymentMethods | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface PaymentMethods

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 |
    90 |
  • PaymentMethods
  • 91 |
92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 113 |
114 |
115 |
116 |
117 |
118 |

Properties

119 |
122 | 123 | 147 |
148 | balances: 149 | PaymentBalance[] 155 |
156 | 167 |
168 |
171 | 172 | 196 |
197 | banks: 198 | PaymentBank[] 204 |
205 | 216 |
217 |
218 |
219 | 247 |
248 |
249 | 302 |
303 | 304 | 305 | 306 | -------------------------------------------------------------------------------- /docs/interfaces/SymbolFilter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SymbolFilter | gemini-node-api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | 35 |
36 |
37 | Options 43 |
44 |
45 | All 46 |
    47 |
  • Public
  • 48 |
  • Public/Protected
  • 49 |
  • All
  • 50 |
51 |
52 | 65 |
66 |
67 | Menu 70 |
71 |
72 |
73 |
74 |
75 |
76 | 80 |

Interface SymbolFilter

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |

Hierarchy

89 | 152 |
153 |
154 |

Index

155 |
156 |
157 |
158 |

Properties

159 |
    160 |
  • 161 | symbol 164 |
  • 165 |
166 |
167 |
168 |
169 |
170 |
171 |

Properties

172 |
175 | 176 | 200 |
201 | symbol?: 202 | string 203 |
204 | 215 |
216 |
217 |
218 | 241 |
242 |
243 | 296 |
297 | 298 | 299 | 300 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from "./src/public.js"; 2 | export * from "./src/signer.js"; 3 | export * from "./src/auth.js"; 4 | export * from "./src/websocket.js"; 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gemini-node-api", 3 | "version": "4.3.0", 4 | "description": "Gemini Node.js API", 5 | "main": "build/index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "type": "module", 10 | "types": "build/index.d.ts", 11 | "engines": { 12 | "node": ">=16.13.0", 13 | "npm": ">=8.1.0" 14 | }, 15 | "dependencies": { 16 | "rpc-request": "^6.0.2", 17 | "ws": "^8.8.0" 18 | }, 19 | "peerDependencies": { 20 | "@types/ws": "^8.5.3" 21 | }, 22 | "devDependencies": { 23 | "@b2broker/tsconfig": "^1.0.3", 24 | "@semantic-release/changelog": "^6.0.1", 25 | "@semantic-release/exec": "^6.0.3", 26 | "@semantic-release/git": "^10.0.1", 27 | "@types/mocha": "^9.1.1", 28 | "c8": "^7.11.3", 29 | "commitlint-config-b2broker": "^1.0.7", 30 | "eslint-config-b2broker-ts": "^2.0.1", 31 | "husky": "^8.0.1", 32 | "lint-staged": "^13.0.3", 33 | "mocha": "^10.0.0", 34 | "nock": "^13.2.7", 35 | "prettier": "^2.7.1", 36 | "semantic-release": "^19.0.3", 37 | "ts-node": "^10.8.1", 38 | "typedoc": "^0.22.18" 39 | }, 40 | "scripts": { 41 | "build": "npm run postpublish && tsc", 42 | "ci:all": "npm ci && npm run commitlint:all && npm run prettier && npm run lint && npm run test:ci && npm run publish:test && npm run coverage:ci", 43 | "commitlint": "commitlint --verbose", 44 | "commitlint:all": "npm run commitlint -- --from=fe44f0a9370553a77f73fbe4383697956c91c65f", 45 | "coverage": "c8 npm test && c8 report --reporter=lcov", 46 | "coverage:ci": "npm run prepublishOnly && npm run coverage", 47 | "docs:build": "rm -rf ./docs && typedoc && npm run prettier:write -- --ignore-path .prettierignore_docs", 48 | "install:clean": "rm -fr node_modules && rm -f package-lock.json && npm install", 49 | "lint": "eslint --ext .ts ./", 50 | "lint:fix": "npm run lint -- --fix", 51 | "postpublish": "rm -rf ./build", 52 | "prepare": "husky install", 53 | "prepublishOnly": "npm run build && npm run prettier:write", 54 | "prettier": "prettier -c .", 55 | "prettier:write": "npm run prettier -- --write", 56 | "publish:test": "npm publish --dry-run", 57 | "release": "semantic-release", 58 | "test": "mocha 'build/test/**/*.spec.js' --ui=tdd --full-trace --bail", 59 | "test:ci": "npm run prepublishOnly && npm test && npm run postpublish", 60 | "ts-node": "node --loader ts-node/esm" 61 | }, 62 | "repository": { 63 | "type": "git", 64 | "url": "git+https://github.com/vansergen/gemini-node-api.git" 65 | }, 66 | "keywords": [ 67 | "Gemini", 68 | "crypto", 69 | "exchange", 70 | "API" 71 | ], 72 | "author": "Sergey Bakulin ", 73 | "license": "MIT", 74 | "bugs": { 75 | "url": "https://github.com/vansergen/gemini-node-api/issues" 76 | }, 77 | "homepage": "https://github.com/vansergen/gemini-node-api#readme", 78 | "funding": { 79 | "type": "Coinbase Commerce", 80 | "url": "https://commerce.coinbase.com/checkout/04a40393-21f0-44aa-b11b-726b67f08c5a" 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/public.ts: -------------------------------------------------------------------------------- 1 | import { FetchClient, UnsuccessfulFetch } from "rpc-request"; 2 | 3 | export const ApiLimit = 500; 4 | export const DefaultSymbol = "btcusd"; 5 | export const DefaultCurrency = "usd"; 6 | export const ApiUri = "https://api.gemini.com"; 7 | export const SandboxApiUri = "https://api.sandbox.gemini.com"; 8 | export const Headers = { 9 | "User-Agent": "gemini-node-api", 10 | "Content-Type": "text/plain", 11 | Accept: "application/json", 12 | "Content-Length": "0", 13 | "Cache-Control": "no-cache", 14 | }; 15 | 16 | export interface SymbolFilter { 17 | symbol?: string; 18 | } 19 | 20 | export interface TickerFilter extends SymbolFilter { 21 | v?: "v1" | "v2"; 22 | } 23 | 24 | export interface CandlesFilter extends SymbolFilter { 25 | time_frame?: "1m" | "5m" | "15m" | "30m" | "1hr" | "6hr" | "1day"; 26 | } 27 | 28 | export interface BookFilter extends SymbolFilter { 29 | limit_bids?: number; 30 | limit_asks?: number; 31 | } 32 | 33 | export interface TradeHistoryFilter extends SymbolFilter { 34 | timestamp?: number; 35 | limit_trades?: number; 36 | include_breaks?: boolean; 37 | } 38 | 39 | export interface AuctionHistoryFilter extends SymbolFilter { 40 | timestamp?: number; 41 | limit_auction_results?: number; 42 | include_indicative?: boolean; 43 | } 44 | 45 | export interface ISymbol { 46 | symbol: string; 47 | base_currency: string; 48 | quote_currency: string; 49 | tick_size: number; 50 | quote_increment: number; 51 | min_order_size: string; 52 | status: "open" | "closed" | "cancel_only" | "post_only" | "limit_only"; 53 | } 54 | 55 | export interface TickerV1 { 56 | bid: string; 57 | ask: string; 58 | last: string; 59 | volume: { [key: string]: string | number }; 60 | } 61 | 62 | export interface TickerV2 { 63 | symbol: string; 64 | open: string; 65 | high: string; 66 | low: string; 67 | close: string; 68 | changes: string[]; 69 | bid: string; 70 | ask: string; 71 | } 72 | 73 | export type Ticker = TickerV1 | TickerV2; 74 | 75 | export type Candle = [number, number, number, number, number, number]; 76 | 77 | export interface BookEntry { 78 | price: string; 79 | amount: string; 80 | timestamp: string; 81 | } 82 | 83 | export interface OrderBook { 84 | bids: BookEntry[]; 85 | asks: BookEntry[]; 86 | } 87 | 88 | export interface Trade { 89 | timestamp: number; 90 | timestampms: number; 91 | tid: number; 92 | price: string; 93 | amount: string; 94 | exchange: "gemini"; 95 | type: "buy" | "sell" | "auction" | "block"; 96 | broken?: boolean; 97 | } 98 | 99 | export interface AuctionInfo { 100 | closed_until_ms?: number; 101 | last_auction_eid?: number; 102 | last_auction_price?: string; 103 | last_auction_quantity?: string; 104 | last_highest_bid_price?: string; 105 | last_lowest_ask_price?: string; 106 | last_collar_price?: string; 107 | most_recent_indicative_price?: string; 108 | most_recent_indicative_quantity?: string; 109 | most_recent_highest_bid_price?: string; 110 | most_recent_lowest_ask_price?: string; 111 | most_recent_collar_price?: string; 112 | next_update_ms?: number; 113 | next_auction_ms?: number; 114 | } 115 | 116 | export interface AuctionHistory { 117 | timestamp: number; 118 | timestampms: number; 119 | auction_id: number; 120 | eid: number; 121 | event_type: "indicative" | "auction"; 122 | auction_result: "success" | "failure"; 123 | auction_price?: string; 124 | auction_quantity?: string; 125 | highest_bid_price?: string; 126 | lowest_ask_price?: string; 127 | collar_price?: string; 128 | unmatched_collar_quantity?: string; 129 | } 130 | 131 | export interface PriceFeedItem { 132 | pair: string; 133 | price: string; 134 | percentChange24h: string; 135 | } 136 | 137 | export interface PublicClientOptions { 138 | symbol?: string; 139 | sandbox?: boolean; 140 | apiUri?: string; 141 | } 142 | 143 | export class PublicClient extends FetchClient { 144 | public readonly symbol: string; 145 | public readonly apiUri: string; 146 | 147 | public constructor({ 148 | symbol = DefaultSymbol, 149 | sandbox = false, 150 | apiUri = sandbox ? SandboxApiUri : ApiUri, 151 | }: PublicClientOptions = {}) { 152 | super({ headers: { ...Headers } }, { transform: "json", baseUrl: apiUri }); 153 | this.apiUri = apiUri; 154 | this.symbol = symbol; 155 | } 156 | 157 | public get(path: string): Promise { 158 | return new Promise((resolve, reject) => { 159 | super 160 | .get(path) 161 | .then((data) => { 162 | resolve(data as T); 163 | }) 164 | .catch((error) => { 165 | if (error instanceof UnsuccessfulFetch) { 166 | error.response 167 | .json() 168 | .then((data) => { 169 | const { reason, message } = data as { 170 | reason: string; 171 | message?: string; 172 | }; 173 | reject(new Error(message ?? reason)); 174 | }) 175 | .catch(reject); 176 | } else { 177 | reject(error); 178 | } 179 | }); 180 | }); 181 | } 182 | 183 | /** Get all available symbols for trading. */ 184 | public getSymbols(): Promise { 185 | return this.get("v1/symbols"); 186 | } 187 | 188 | /** Get extra details about the symbol. */ 189 | public getSymbol({ symbol }: { symbol: string }): Promise { 190 | return this.get(`v1/symbols/details/${symbol}`); 191 | } 192 | 193 | /** Get information about recent trading activity for the symbol. */ 194 | public getTicker(options: { symbol?: string; v: "v2" }): Promise; 195 | public getTicker(options?: { symbol?: string; v?: "v1" }): Promise; 196 | public getTicker({ 197 | symbol = this.symbol, 198 | v = "v1", 199 | }: TickerFilter = {}): Promise { 200 | if (v === "v2") { 201 | return this.get(`/${v}/ticker/${symbol}`); 202 | } 203 | return this.get(`/${v}/pubticker/${symbol}`); 204 | } 205 | 206 | /** Get time-intervaled data for the provided symbol. */ 207 | public getCandles({ 208 | symbol = this.symbol, 209 | time_frame = "1day", 210 | }: CandlesFilter = {}): Promise { 211 | return this.get(`/v2/candles/${symbol}/${time_frame}`); 212 | } 213 | 214 | /** Get the current order book. */ 215 | public getOrderBook({ 216 | symbol = this.symbol, 217 | ...qs 218 | }: BookFilter = {}): Promise { 219 | const url = new URL(`/v1/book/${symbol}`, this.apiUri); 220 | PublicClient.#addOptions(url, { ...qs }); 221 | return this.get(url.toString()); 222 | } 223 | 224 | /** Get the trades that have executed since the specified timestamp. */ 225 | public getTradeHistory({ 226 | symbol = this.symbol, 227 | limit_trades = ApiLimit, 228 | ...qs 229 | }: TradeHistoryFilter = {}): Promise { 230 | const url = new URL(`/v1/trades/${symbol}`, this.apiUri); 231 | PublicClient.#addOptions(url, { limit_trades, ...qs }); 232 | return this.get(url.toString()); 233 | } 234 | 235 | /** Get current auction information. */ 236 | public getCurrentAuction({ 237 | symbol = this.symbol, 238 | }: SymbolFilter = {}): Promise { 239 | return this.get(`v1/auction/${symbol}`); 240 | } 241 | 242 | /** Get the auction events. */ 243 | public getAuctionHistory({ 244 | symbol = this.symbol, 245 | limit_auction_results = ApiLimit, 246 | ...qs 247 | }: AuctionHistoryFilter = {}): Promise { 248 | const url = new URL(`/v1/auction/${symbol}/history`, this.apiUri); 249 | PublicClient.#addOptions(url, { limit_auction_results, ...qs }); 250 | return this.get(url.toString()); 251 | } 252 | 253 | /** Get the price feed. */ 254 | public getPriceFeed(): Promise { 255 | return this.get("v1/pricefeed"); 256 | } 257 | 258 | static #addOptions( 259 | target: URL, 260 | data: Record 261 | ): void { 262 | for (const key in data) { 263 | const value = data[key]; 264 | if (typeof value !== "undefined") { 265 | target.searchParams.append(key, value.toString()); 266 | } 267 | } 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /src/signer.ts: -------------------------------------------------------------------------------- 1 | import { createHmac } from "node:crypto"; 2 | 3 | export interface SignerOptions { 4 | key: string; 5 | secret: string; 6 | payload: string; 7 | } 8 | 9 | export interface AuthHeaders { 10 | "X-GEMINI-PAYLOAD": string; 11 | "X-GEMINI-SIGNATURE": string; 12 | "X-GEMINI-APIKEY": string; 13 | } 14 | 15 | export function SignRequest({ 16 | key, 17 | secret, 18 | payload, 19 | }: SignerOptions): AuthHeaders { 20 | const signature = createHmac("sha384", secret).update(payload).digest("hex"); 21 | return { 22 | "X-GEMINI-PAYLOAD": payload, 23 | "X-GEMINI-SIGNATURE": signature, 24 | "X-GEMINI-APIKEY": key, 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /test/signer.spec.ts: -------------------------------------------------------------------------------- 1 | import { deepStrictEqual } from "node:assert"; 2 | import { SignRequest, AuthHeaders } from "../index.js"; 3 | 4 | suite("SignRequest", () => { 5 | test("correct signature", () => { 6 | const key = "mykey"; 7 | const secret = "1234abcd"; 8 | const payload = 9 | "eyJyZXF1ZXN0IjoiL3YxL29yZGVyL3N0YXR1cyIsIm5vbmNlIjoxMjM0NTYsIm9yZGVyX2lkIjoxODgzNH0="; 10 | 11 | const expectedSignature: AuthHeaders = { 12 | "X-GEMINI-APIKEY": key, 13 | "X-GEMINI-PAYLOAD": payload, 14 | "X-GEMINI-SIGNATURE": 15 | "51f2d46b8d13add5414bb73d72c1e1e1d3e1f6f8ed411960d860510df3219d0ed3514578d14f18cd1340109bf0c0385b", 16 | }; 17 | const signtature = SignRequest({ key, secret, payload }); 18 | deepStrictEqual(signtature, expectedSignature); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@b2broker/tsconfig", 3 | "compilerOptions": { "module": "esnext", "outDir": "./build" } 4 | } 5 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "out": "docs", 3 | "entryPoints": ["./index.ts"], 4 | "name": "gemini-node-api", 5 | "exclude": "test/**/*", 6 | "hideGenerator": true, 7 | "gitRevision": "main" 8 | } 9 | --------------------------------------------------------------------------------