This commit is contained in:
Aleksandr Kraiz
2023-08-21 17:42:08 +04:00
parent 4259c04caf
commit cd1f34bbae
5 changed files with 3193 additions and 1635 deletions

4721
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.19.53",
"version": "0.19.54",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
@@ -10,6 +10,9 @@
"require": "./lib/index.cjs",
"import": "./lib/index.js",
"types": "./lib/index.d.ts"
},
"./browser": {
"browser": "./lib/index.global.js"
}
},
"engines": {
@@ -27,6 +30,7 @@
"coverage": "jest --coverage",
"lint:eslint": "eslint ./src --ext .ts,.js,.tsx,.jsx",
"lint:eslint:fix": "eslint ./src --ext .ts,.js,.tsx,.jsx --fix",
"postinstall": "patch-package",
"postpublish": "npm run publish-npm",
"publish-npm": "npm publish --access public --ignore-scripts --@orionprotocol:registry='https://registry.npmjs.org'",
"test": "dotenv jest",
@@ -51,23 +55,23 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@tsconfig/esm": "^1.0.3",
"@tsconfig/esm": "^1.0.4",
"@tsconfig/strictest": "^2.0.1",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.1",
"@types/node": "^20.2.3",
"@types/node": "^20.5.1",
"@types/uuid": "^9.0.1",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"babel-loader": "^9.1.2",
"concurrently": "^8.1.0",
"eslint": "^8.41.0",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-config-standard-with-typescript": "^38.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-promise": "^6.1.1",
"http-terminator": "^3.2.0",
"husky": "^8.0.3",
@@ -76,14 +80,14 @@
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "github:TypeStrong/ts-node#main",
"tsup": "^6.7.0",
"typescript": "^5.1.3"
"tsup": "^7.2.0",
"typescript": "^5.1.6"
},
"dependencies": {
"@babel/runtime": "^7.21.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@orionprotocol/contracts": "1.9.0",
"@orionprotocol/contracts": "1.16.2",
"bignumber.js": "^9.1.1",
"bson-objectid": "^2.0.4",
"buffer": "^6.0.3",
@@ -93,7 +97,8 @@
"just-clone": "^6.2.0",
"merge-anything": "^5.1.7",
"neverthrow": "^6.0.0",
"simple-typed-fetch": "0.2.1",
"patch-package": "^8.0.0",
"simple-typed-fetch": "0.2.2",
"stream-browserify": "^3.0.0",
"tiny-invariant": "^1.3.1",
"ts-is-present": "^1.2.2",
@@ -108,4 +113,4 @@
"overrides": {
"tsconfig-paths": "^4.0.0"
}
}
}

View File

@@ -0,0 +1,15 @@
diff --git a/node_modules/unfetch/package.json b/node_modules/unfetch/package.json
index ec47dc2..33954f7 100644
--- a/node_modules/unfetch/package.json
+++ b/node_modules/unfetch/package.json
@@ -15,8 +15,8 @@
},
"exports": {
".": {
- "import": "./index.mjs",
- "default": "./index.js"
+ "import": "./dist/unfetch.mjs",
+ "default": "./dist/unfetch.js"
},
"./polyfill": {
"default": "./polyfill/index.js"

View File

@@ -229,7 +229,7 @@ class AggregatorWS {
this.logger?.(`Sent: ${jsonData}`);
}
private hearbeatIntervalId: NodeJS.Timer | undefined;
private hearbeatIntervalId: ReturnType<typeof setInterval> | undefined;
private setupHeartbeat() {
const heartbeat = () => {
if (this.isAlive) {
@@ -552,7 +552,7 @@ class AggregatorWS {
break;
case MessageType.AGGREGATED_ORDER_BOOK_UPDATE: {
const { ob, S } = json;
const mapOrderbookItems = (rawItems: typeof ob.a | typeof ob.b) => rawItems.reduce<OrderbookItem[]>((acc, item) => {
const mapOrderbookItems = (rawItems: typeof ob.a) => rawItems.reduce<OrderbookItem[]>((acc, item) => {
const [
price,
amount,

View File

@@ -1,12 +1,47 @@
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/index.ts'],
sourcemap: true,
platform: 'neutral',
outDir: 'lib',
format: ['esm', 'cjs'],
dts: true,
clean: true,
shims: true,
})
export default defineConfig([
{
entry: ['src/index.ts'],
sourcemap: true,
platform: 'neutral',
minify: true,
outDir: 'lib',
format: ['esm', 'cjs'],
dts: true,
clean: true,
shims: true,
},
{
entry: ['src/index.ts'],
globalName: 'orion',
sourcemap: true,
platform: 'browser',
minify: true,
outDir: 'lib',
format: 'iife',
dts: true,
clean: true,
shims: true,
// Suppress all 'node:' imports
esbuildPlugins: [
{
name: 'resolve-node-polyfill',
setup(build) {
build.onResolve({ filter: /^node:/ }, (args) => {
return {
path: args.path,
namespace: 'node-polyfill',
}
})
build.onLoad({ filter: /.*/, namespace: 'node-polyfill' }, (args) => {
return {
contents: 'undefined',
}
})
},
},
],
}
])