Skip to content

Commit

Permalink
Isomorphic WebSocket so that cent-js works on server side (#2509)
Browse files Browse the repository at this point in the history
* Add isomorphic websocket so that cent-js works on server side

* Fix package manager version
  • Loading branch information
sophialittlejohn authored Oct 21, 2024
1 parent b8a971d commit 87066d4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
5 changes: 4 additions & 1 deletion centrifuge-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@styled-system/css": "^5.1.5",
"bn.js": "^5.2.1",
"formik": "^2.4.5",
"isomorphic-ws": "^5.0.0",
"merkletreejs": "^0.3.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -47,7 +48,8 @@
"styled-components": "^5.3.5",
"styled-system": "^5.1.5",
"typescript": "~5.3.3",
"vitest": "^1.2.1"
"vitest": "^1.2.1",
"ws": "^8.18.0"
},
"devDependencies": {
"@synthetixio/synpress": "^3.7.3",
Expand All @@ -61,6 +63,7 @@
"@types/styled-system": "^5",
"@types/styled-system__css": "^5.0.16",
"@types/styled-system__should-forward-prop": "^5",
"@types/ws": "^8",
"@typescript-eslint/eslint-plugin": "5.30.5",
"@typescript-eslint/parser": "5.30.5",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
1 change: 1 addition & 0 deletions centrifuge-js/src/CentrifugeBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { hexToBn } from '@polkadot/util'
import { sortAddresses } from '@polkadot/util-crypto'
import type { JsonRpcSigner, TransactionRequest } from 'ethers'
import 'isomorphic-fetch'
import WebSocket from 'isomorphic-ws'
import {
Observable,
Subject,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
"@types/react": "^18.0.27",
"@types/eslint": "7.28.0",
"@babel/traverse": "^7.23.9"
}
},
"packageManager": "[email protected]"
}
36 changes: 36 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@ __metadata:
"@types/styled-system": ^5
"@types/styled-system__css": ^5.0.16
"@types/styled-system__should-forward-prop": ^5
"@types/ws": ^8
"@typescript-eslint/eslint-plugin": 5.30.5
"@typescript-eslint/parser": 5.30.5
"@vitejs/plugin-react": ^4.2.1
Expand All @@ -1760,6 +1761,7 @@ __metadata:
eslint-config-react-app: ^7.0.1
eslint-plugin-react: 7.30.1
formik: ^2.4.5
isomorphic-ws: ^5.0.0
merkletreejs: ^0.3.11
nodemon: ^2.0.20
npm-run-all: ^4.1.5
Expand All @@ -1778,6 +1780,7 @@ __metadata:
vite: ^5
vite-plugin-node-polyfills: ^0.19.0
vitest: ^1.2.1
ws: ^8.18.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -9544,6 +9547,15 @@ __metadata:
languageName: node
linkType: hard

"@types/ws@npm:^8":
version: 8.5.12
resolution: "@types/ws@npm:8.5.12"
dependencies:
"@types/node": "*"
checksum: ddefb6ad1671f70ce73b38a5f47f471d4d493864fca7c51f002a86e5993d031294201c5dced6d5018fb8905ad46888d65c7f20dd54fc165910b69f42fba9a6d0
languageName: node
linkType: hard

"@types/ws@npm:^8.5.5":
version: 8.5.10
resolution: "@types/ws@npm:8.5.10"
Expand Down Expand Up @@ -19166,6 +19178,15 @@ __metadata:
languageName: node
linkType: hard

"isomorphic-ws@npm:^5.0.0":
version: 5.0.0
resolution: "isomorphic-ws@npm:5.0.0"
peerDependencies:
ws: "*"
checksum: e20eb2aee09ba96247465fda40c6d22c1153394c0144fa34fe6609f341af4c8c564f60ea3ba762335a7a9c306809349f9b863c8beedf2beea09b299834ad5398
languageName: node
linkType: hard

"isows@npm:1.0.3":
version: 1.0.3
resolution: "isows@npm:1.0.3"
Expand Down Expand Up @@ -28262,6 +28283,21 @@ __metadata:
languageName: node
linkType: hard

"ws@npm:^8.18.0":
version: 8.18.0
resolution: "ws@npm:8.18.0"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ">=5.0.2"
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
checksum: 91d4d35bc99ff6df483bdf029b9ea4bfd7af1f16fc91231a96777a63d263e1eabf486e13a2353970efc534f9faa43bdbf9ee76525af22f4752cbc5ebda333975
languageName: node
linkType: hard

"xml-name-validator@npm:^3.0.0":
version: 3.0.0
resolution: "xml-name-validator@npm:3.0.0"
Expand Down

0 comments on commit 87066d4

Please sign in to comment.