@mysten/docs 0.1.44 → 0.1.45
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/dapp-kit/getting-started/react.md +2 -2
- package/dist/dapp-kit/getting-started/vue.md +2 -2
- package/dist/dapp-kit/llms-index.md +4 -4
- package/dist/dapp-kit/react/hooks/use-current-client.md +6 -5
- package/dist/dapp-kit/state.md +2 -2
- package/dist/kiosk/advanced-examples.md +3 -3
- package/dist/kiosk/from-v1.md +9 -9
- package/dist/kiosk/index.md +6 -3
- package/dist/kiosk/kiosk-client/introduction.md +10 -7
- package/dist/kiosk/llms-index.md +4 -4
- package/dist/llms-index.md +25 -25
- package/dist/seal/index.md +3 -0
- package/dist/sui/clients/core.md +31 -10
- package/dist/sui/clients/graphql.md +43 -8
- package/dist/sui/clients/grpc.md +91 -9
- package/dist/sui/clients/index.md +86 -39
- package/dist/sui/clients/json-rpc.md +30 -26
- package/dist/sui/executors.md +28 -13
- package/dist/sui/index.md +1 -1
- package/dist/sui/llms-index.md +17 -17
- package/dist/sui/migrations/sui-2.0/dapp-kit.md +3 -3
- package/dist/sui/migrations/sui-2.0/deepbook-v3.md +2 -2
- package/dist/sui/migrations/sui-2.0/index.md +46 -25
- package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +460 -284
- package/dist/sui/migrations/sui-2.0/kiosk.md +10 -9
- package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +17 -11
- package/dist/sui/migrations/sui-2.0/sui.md +47 -29
- package/dist/sui/migrations/sui-2.0/suins.md +2 -2
- package/dist/sui/migrations/sui-2.0/walrus.md +3 -3
- package/dist/sui/migrations/sui-2.0/zksend.md +9 -8
- package/dist/sui/sdk-building.md +7 -5
- package/package.json +21 -21
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Migrate to 2.0
|
|
2
2
|
|
|
3
|
-
> Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages
|
|
3
|
+
> Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages
|
|
4
4
|
|
|
5
5
|
This guide covers the breaking changes across the latest release of all the `@mysten/*` packages.
|
|
6
6
|
|
|
7
|
-
The primary goal of this release is to support the
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
The primary goal of this release is to support the gRPC and GraphQL APIs across all Mysten SDKs.
|
|
8
|
+
These releases also include removals of deprecated APIs, some renaming for better consistency, and
|
|
9
|
+
significant internal refactoring to improve maintainability. Starting with this release, Mysten
|
|
10
10
|
packages will now be published as ESM only packages.
|
|
11
11
|
|
|
12
12
|
## Quick reference
|
|
@@ -65,39 +65,51 @@ updates.
|
|
|
65
65
|
|
|
66
66
|
### Client migration
|
|
67
67
|
|
|
68
|
-
The
|
|
68
|
+
The recommended app migration is to create one `SuiGrpcClient` and use its top-level methods:
|
|
69
69
|
|
|
70
70
|
```diff
|
|
71
71
|
- import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
72
|
-
+ import {
|
|
72
|
+
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
73
73
|
|
|
74
74
|
- const client = new SuiClient({ url: getFullnodeUrl('mainnet') });
|
|
75
|
-
+ const client = new
|
|
76
|
-
+
|
|
75
|
+
+ const client = new SuiGrpcClient({
|
|
76
|
+
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
77
77
|
+ network: 'mainnet',
|
|
78
78
|
+ });
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Then migrate old JSON-RPC method names to the gRPC top-level methods:
|
|
82
82
|
|
|
83
83
|
```diff
|
|
84
|
-
-
|
|
85
|
-
+
|
|
84
|
+
- const coins = await client.getCoins({ owner });
|
|
85
|
+
+ const coins = await client.listCoins({ owner });
|
|
86
|
+
|
|
87
|
+
- const txs = await client.queryTransactionBlocks({ filter, options });
|
|
88
|
+
+ const txs = await client.listTransactions({ filter, include });
|
|
89
|
+
|
|
90
|
+
- const events = await client.queryEvents({ query, order: 'descending' });
|
|
91
|
+
+ const events = await client.listEvents({ filter, order: 'descending' });
|
|
86
92
|
|
|
87
|
-
- const
|
|
88
|
-
+ const
|
|
93
|
+
- const transaction = await client.getTransactionBlock({ digest, options });
|
|
94
|
+
+ const transaction = await client.getTransaction({ digest, include });
|
|
89
95
|
```
|
|
90
96
|
|
|
91
|
-
The gRPC runs on full nodes so in most cases you
|
|
92
|
-
to gRPC.
|
|
97
|
+
The gRPC API runs on full nodes, so in most cases you can use the same full node host when migrating
|
|
98
|
+
from JSON-RPC to gRPC. Standard transaction and event queries are top-level methods on both
|
|
99
|
+
`SuiGrpcClient` and `SuiGraphQLClient`. Use custom GraphQL queries for indexed data, historical
|
|
100
|
+
object versions, or selection sets that are not covered by the shared methods.
|
|
101
|
+
|
|
102
|
+
`SuiJsonRpcClient` still exists under `@mysten/sui/jsonRpc` for legacy code, but JSON-RPC APIs are
|
|
103
|
+
deprecated in the Sui TypeScript SDK. See
|
|
104
|
+
[Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration) for detailed replacements.
|
|
93
105
|
|
|
94
106
|
### Network parameter required
|
|
95
107
|
|
|
96
108
|
All client constructors now require an explicit `network` parameter:
|
|
97
109
|
|
|
98
110
|
```ts
|
|
99
|
-
const
|
|
100
|
-
|
|
111
|
+
const grpcClient = new SuiGrpcClient({
|
|
112
|
+
baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
101
113
|
network: 'mainnet', // Required
|
|
102
114
|
});
|
|
103
115
|
|
|
@@ -106,23 +118,32 @@ const graphqlClient = new SuiGraphQLClient({
|
|
|
106
118
|
network: 'mainnet', // Required
|
|
107
119
|
});
|
|
108
120
|
|
|
109
|
-
const
|
|
110
|
-
|
|
121
|
+
const jsonRpcClient = new SuiJsonRpcClient({
|
|
122
|
+
url: 'https://fullnode.mainnet.sui.io:443',
|
|
111
123
|
network: 'mainnet', // Required
|
|
112
124
|
});
|
|
113
125
|
```
|
|
114
126
|
|
|
115
127
|
### `ClientWithCoreApi` Interface
|
|
116
128
|
|
|
117
|
-
Many SDK methods now accept any client implementing `ClientWithCoreApi
|
|
118
|
-
|
|
129
|
+
Many SDK methods now accept any client implementing `ClientWithCoreApi`. SDKs use
|
|
130
|
+
`client.core.<method>()` so they can work across `SuiGrpcClient`, `SuiGraphQLClient`, and the
|
|
131
|
+
deprecated `SuiJsonRpcClient` while apps keep using the top-level methods on their chosen client:
|
|
119
132
|
|
|
120
133
|
```ts
|
|
121
134
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
const client = new SuiGrpcClient({
|
|
136
|
+
baseUrl: 'https://fullnode.mainnet.sui.io:443',
|
|
137
|
+
network: 'mainnet',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// App code: use top-level methods.
|
|
141
|
+
const { balance } = await client.getBalance({ owner });
|
|
142
|
+
|
|
143
|
+
// SDK code: accept ClientWithCoreApi and use client.core.
|
|
144
|
+
async function readForSdk(client: ClientWithCoreApi, objectId: string) {
|
|
145
|
+
return client.core.getObject({ objectId });
|
|
146
|
+
}
|
|
126
147
|
```
|
|
127
148
|
|
|
128
149
|
## Package-specific guides
|