Skip to content

Commit

Permalink
Implement the connect function in TS
Browse files Browse the repository at this point in the history
We simply connect to the typescripted client a good example of the
usage is like this

> ind.connect('localhost', 50051)
  • Loading branch information
mariari committed Oct 16, 2024
1 parent 893fa78 commit bee5042
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as announce_pb from './proto/anoma_pb';
import * as service from './proto/anoma_grpc_pb';
import * as grpc from '@grpc/grpc-js';

export function connect(address: string, port: number, creds?: grpc.ChannelCredentials)
: service.IntentsClient {
if (typeof creds == 'undefined') {
creds = grpc.credentials.createInsecure();
}
let target: string = address + ':' + port;
return new service.IntentsClient(target, creds)
}

0 comments on commit bee5042

Please sign in to comment.