This repository was archived by the owner on Jul 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +15
-31
lines changed
packages/core/js-client/src Expand file tree Collapse file tree 4 files changed +15
-31
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,6 @@ Here is an example using the JSDELIVR CDN:
33
33
``` html
34
34
<head >
35
35
<title >Cool App</title >
36
- <script
37
- type =" module"
38
- src =" https://cdn.jsdelivr.net/npm/@fluencelabs/js-client/dist/browser/index.min.js"
39
- ></script >
40
36
<script type =" module" >
41
37
import {
42
38
Fluence ,
Original file line number Diff line number Diff line change @@ -90,10 +90,6 @@ export class ClientPeer extends FluencePeer implements IFluenceClient {
90
90
) ;
91
91
}
92
92
93
- getPeerSecretKey ( ) : Uint8Array {
94
- return this . keyPair . toEd25519PrivateKey ( ) ;
95
- }
96
-
97
93
connectionState : ConnectionState = "disconnected" ;
98
94
connectionStateChangeHandler : ( state : ConnectionState ) => void = ( ) => { } ;
99
95
Original file line number Diff line number Diff line change @@ -21,29 +21,25 @@ import { z } from "zod";
21
21
*/
22
22
export type PeerIdB58 = string ;
23
23
24
+ const relaySchema = z . object ( {
25
+ peerId : z . string ( ) ,
26
+ multiaddr : z . string ( ) ,
27
+ } ) ;
28
+
24
29
/**
25
- * Node of the Fluence network specified as a pair of node's multiaddr and it's peer id
30
+ * Relay of the Fluence network specified as a pair of node's multiaddr and it's peer id
26
31
*/
27
- export type Node = {
28
- peerId : PeerIdB58 ;
29
- multiaddr : string ;
30
- } ;
31
-
32
- export const relaySchema = z . union ( [
33
- z . string ( ) ,
34
- z . object ( {
35
- peerId : z . string ( ) ,
36
- multiaddr : z . string ( ) ,
37
- } ) ,
38
- ] ) ;
32
+ export type Relay = z . infer < typeof relaySchema > ;
33
+
34
+ export const relayOptionsSchema = z . union ( [ z . string ( ) , relaySchema ] ) ;
39
35
40
36
/**
41
- * A node in Fluence network a client can connect to.
37
+ * A relay in Fluence network a client can connect to.
42
38
* Can be in the form of:
43
39
* - string: multiaddr in string format
44
- * - Node: node structure, @see Node
40
+ * - Relay: relay structure, @see Relay
45
41
*/
46
- export type RelayOptions = z . infer < typeof relaySchema > ;
42
+ export type RelayOptions = z . infer < typeof relayOptionsSchema > ;
47
43
48
44
/**
49
45
* Fluence Peer's key pair types
@@ -102,11 +98,6 @@ export interface IFluenceClient {
102
98
handler : ( state : ConnectionState ) => void ,
103
99
) : ConnectionState ;
104
100
105
- /**
106
- * Return peer's secret key as byte array.
107
- */
108
- getPeerSecretKey ( ) : Uint8Array ;
109
-
110
101
/**
111
102
* Return peer's public key as a base58 string (multihash/CIDv0).
112
103
*/
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
22
22
configSchema ,
23
23
ConnectionState ,
24
24
RelayOptions ,
25
- relaySchema ,
25
+ relayOptionsSchema ,
26
26
} from "./clientPeer/types.js" ;
27
27
import { callAquaFunction } from "./compilerSupport/callFunction.js" ;
28
28
import { registerService } from "./compilerSupport/registerService.js" ;
@@ -36,7 +36,7 @@ const createClient = async (
36
36
config : ClientConfig = { } ,
37
37
) : Promise < ClientPeer > => {
38
38
try {
39
- relay = relaySchema . parse ( relay ) ;
39
+ relay = relayOptionsSchema . parse ( relay ) ;
40
40
config = configSchema . parse ( config ) ;
41
41
} catch ( e ) {
42
42
if ( e instanceof ZodError ) {
@@ -125,6 +125,7 @@ export type {
125
125
ClientConfig ,
126
126
IFluenceClient ,
127
127
ConnectionState ,
128
+ Relay ,
128
129
RelayOptions ,
129
130
KeyPairOptions ,
130
131
} from "./clientPeer/types.js" ;
You can’t perform that action at this time.
0 commit comments