@mysten/docs 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sui/clients/grpc.md +57 -2
- package/package.json +10 -10
package/dist/sui/clients/grpc.md
CHANGED
|
@@ -28,13 +28,26 @@ const grpcClient = new SuiGrpcClient({
|
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## Transport options
|
|
32
|
+
|
|
33
|
+
By default, `SuiGrpcClient` uses `GrpcWebFetchTransport` from
|
|
34
|
+
[protobuf-ts](https://github.com/timostamm/protobuf-ts), which works in browsers and Node.js via the
|
|
35
|
+
Fetch API. You can also provide a custom transport for advanced use cases.
|
|
36
|
+
|
|
37
|
+
The `GrpcWebFetchTransport` class, `GrpcWebOptions` type, and `RpcTransport` type are all
|
|
38
|
+
re-exported from `@mysten/sui/grpc` for convenience.
|
|
39
|
+
|
|
40
|
+
### gRPC-web transport (default)
|
|
41
|
+
|
|
42
|
+
The default transport uses the gRPC-web protocol over HTTP/1.1 or HTTP/2. You can customize it by
|
|
43
|
+
passing `GrpcWebFetchTransport` options directly:
|
|
32
44
|
|
|
33
45
|
```typescript
|
|
34
46
|
|
|
35
47
|
const transport = new GrpcWebFetchTransport({
|
|
36
48
|
baseUrl: 'https://your-custom-grpc-endpoint.com',
|
|
37
|
-
//
|
|
49
|
+
format: 'binary', // default is 'text' (base64-encoded)
|
|
50
|
+
// Additional transport options like fetchInit
|
|
38
51
|
});
|
|
39
52
|
|
|
40
53
|
const grpcClient = new SuiGrpcClient({
|
|
@@ -43,6 +56,48 @@ const grpcClient = new SuiGrpcClient({
|
|
|
43
56
|
});
|
|
44
57
|
```
|
|
45
58
|
|
|
59
|
+
### Native gRPC transport
|
|
60
|
+
|
|
61
|
+
For server-side applications (Node.js, Bun, etc.), you can use the native gRPC transport with
|
|
62
|
+
`@protobuf-ts/grpc-transport` and `@grpc/grpc-js`. This uses HTTP/2 with the native gRPC protocol
|
|
63
|
+
rather than the gRPC-web translation layer.
|
|
64
|
+
|
|
65
|
+
Install the required packages:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @protobuf-ts/grpc-transport @grpc/grpc-js
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then create the client with a `GrpcTransport`:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
|
|
75
|
+
const transport = new GrpcTransport({
|
|
76
|
+
host: 'fullnode.testnet.sui.io:443',
|
|
77
|
+
channelCredentials: ChannelCredentials.createSsl(),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const grpcClient = new SuiGrpcClient({
|
|
81
|
+
network: 'testnet',
|
|
82
|
+
transport,
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For local development without TLS:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
|
|
90
|
+
const transport = new GrpcTransport({
|
|
91
|
+
host: '127.0.0.1:9000',
|
|
92
|
+
channelCredentials: ChannelCredentials.createInsecure(),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const grpcClient = new SuiGrpcClient({
|
|
96
|
+
network: 'localnet',
|
|
97
|
+
transport,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
46
101
|
## Using service clients
|
|
47
102
|
|
|
48
103
|
The `SuiGrpcClient` exposes several service clients for lower-level access to the gRPC API. These
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten/docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "LLM-friendly documentation for the Sui TypeScript SDK ecosystem",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
"react-dom": "^19.2.3",
|
|
29
29
|
"@mysten/bcs": "2.0.3",
|
|
30
30
|
"@mysten/dapp-kit": "1.0.4",
|
|
31
|
-
"@mysten/
|
|
31
|
+
"@mysten/dapp-kit-core": "1.3.0",
|
|
32
32
|
"@mysten/dapp-kit-react": "2.0.1",
|
|
33
|
-
"@mysten/
|
|
33
|
+
"@mysten/deepbook-v3": "1.2.1",
|
|
34
34
|
"@mysten/enoki": "1.0.4",
|
|
35
|
+
"@mysten/enoki-connect": "1.0.2",
|
|
36
|
+
"@mysten/kiosk": "1.2.0",
|
|
37
|
+
"@mysten/payment-kit": "0.1.5",
|
|
35
38
|
"@mysten/seal": "1.1.1",
|
|
36
39
|
"@mysten/signers": "1.0.2",
|
|
37
|
-
"@mysten/enoki-connect": "1.0.2",
|
|
38
40
|
"@mysten/slush-wallet": "1.0.3",
|
|
39
|
-
"@mysten/sui": "2.
|
|
40
|
-
"@mysten/utils": "0.3.1",
|
|
41
|
+
"@mysten/sui": "2.15.0",
|
|
41
42
|
"@mysten/suins": "1.0.2",
|
|
43
|
+
"@mysten/utils": "0.3.1",
|
|
42
44
|
"@mysten/wallet-standard": "0.20.1",
|
|
43
|
-
"@mysten/
|
|
44
|
-
"@mysten/
|
|
45
|
-
"@mysten/payment-kit": "0.1.5",
|
|
46
|
-
"@mysten/walrus": "1.1.0"
|
|
45
|
+
"@mysten/walrus": "1.1.0",
|
|
46
|
+
"@mysten/zksend": "1.0.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@tailwindcss/postcss": "^4.1.18",
|