Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove protobufjs and replace with protons #81

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/libp2p-daemon-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import errcode from 'err-code'
import { TCP } from '@libp2p/tcp'
import { IRequest, PSMessage, Request, Response } from '@libp2p/daemon-protocol'
import { PSMessage, Request, Response } from '@libp2p/daemon-protocol'
import { StreamHandler } from '@libp2p/daemon-protocol/stream-handler'
import { Multiaddr } from '@multiformats/multiaddr'
import { DHT } from './dht.js'
Expand Down Expand Up @@ -43,11 +43,11 @@ class Client implements DaemonClient {
* Sends the request to the daemon and returns a stream. This
* should only be used when sending daemon requests.
*/
async send (request: IRequest) {
async send (request: Request) {
const maConn = await this.connectDaemon()

const streamHandler = new StreamHandler({ stream: maConn })
streamHandler.write(Request.encode(request).finish())
streamHandler.write(Request.encode(request))
return streamHandler
}

Expand Down Expand Up @@ -189,7 +189,7 @@ class Client implements DaemonClient {

const sh = await this.send({
type: Request.Type.STREAM_HANDLER,
streamOpen: null,
streamOpen: undefined,
streamHandler: {
addr: addr.bytes,
proto: [protocol]
Expand Down Expand Up @@ -234,7 +234,7 @@ export interface DaemonClient {
dht: DHTClient
pubsub: PubSubClient

send: (request: IRequest) => Promise<StreamHandler>
send: (request: Request) => Promise<StreamHandler>
openStream: (peerId: PeerId, protocol: string) => Promise<Duplex<Uint8Array>>
}

Expand Down
9 changes: 3 additions & 6 deletions packages/libp2p-daemon-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@
"clean": "aegir clean",
"lint": "aegir lint",
"build": "aegir build",
"postbuild": "cp src/*.js src/*.d.ts dist/src",
"generate": "npm run generate:proto && npm run generate:proto-types",
"generate:proto": "pbjs -t static-module -w es6 -r libp2p-daemon --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/protocol/index.js ./src/protocol/index.proto",
"generate:proto-types": "pbts -o src/protocol/index.d.ts src/protocol/index.js",
"release": "aegir release"
},
"dependencies": {
"protobufjs": "^6.10.2"
"protons-runtime": "^1.0.0"
},
"devDependencies": {
"aegir": "^37.0.5"
"aegir": "^37.0.5",
"protons": "^3.0.1"
}
}
Loading