@mysten/sui 2.23.2 → 2.25.0
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/CHANGELOG.md +67 -0
- package/README.md +9 -9
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/client/core.d.mts +1 -0
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +4 -1
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/mvr.mjs +1 -0
- package/dist/client/mvr.mjs.map +1 -1
- package/dist/client/types.d.mts +7 -0
- package/dist/client/types.d.mts.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/graphql/client.d.mts +6 -1
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +18 -2
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +5 -4
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +60 -14
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +8 -1
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +16 -0
- package/dist/grpc/client.d.mts +6 -1
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +17 -2
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +1 -0
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +20 -0
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
- package/dist/jsonRpc/client.d.mts.map +1 -1
- package/dist/jsonRpc/client.mjs +60 -15
- package/dist/jsonRpc/client.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +6 -1
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +25 -7
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/docs/bcs.md +2 -2
- package/docs/clients/core.md +151 -690
- package/docs/clients/executing.md +113 -0
- package/docs/clients/graphql.md +91 -46
- package/docs/clients/grpc.md +239 -142
- package/docs/clients/index.md +87 -51
- package/docs/clients/querying.md +539 -0
- package/docs/executors.md +28 -13
- package/docs/index.md +1 -1
- package/docs/llms-index.md +18 -17
- package/docs/migrations/sui-2.0/dapp-kit.md +3 -3
- package/docs/migrations/sui-2.0/deepbook-v3.md +2 -2
- package/docs/migrations/sui-2.0/index.md +46 -25
- package/docs/migrations/sui-2.0/json-rpc-migration.md +462 -284
- package/docs/migrations/sui-2.0/kiosk.md +10 -9
- package/docs/migrations/sui-2.0/sdk-maintainers.md +17 -11
- package/docs/migrations/sui-2.0/sui.md +47 -29
- package/docs/migrations/sui-2.0/suins.md +2 -2
- package/docs/migrations/sui-2.0/walrus.md +3 -3
- package/docs/migrations/sui-2.0/zksend.md +9 -8
- package/docs/sdk-building.md +7 -5
- package/docs/transactions/signing-and-execution.md +8 -28
- package/package.json +1 -1
- package/src/client/core.ts +5 -0
- package/src/client/mvr.ts +6 -0
- package/src/client/types.ts +11 -0
- package/src/graphql/client.ts +35 -2
- package/src/graphql/core.ts +57 -10
- package/src/graphql/generated/queries.ts +14 -0
- package/src/graphql/generated/schema.graphql +11 -1
- package/src/graphql/generated/tada-env.ts +20 -0
- package/src/graphql/queries/nameService.graphql +6 -0
- package/src/grpc/client.ts +34 -2
- package/src/grpc/core.ts +35 -0
- package/src/jsonRpc/client.ts +15 -0
- package/src/jsonRpc/core.ts +31 -6
- package/src/version.ts +1 -1
- package/docs/clients/json-rpc.md +0 -239
package/docs/llms-index.md
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
- [Sui TypeScript SDK](..md): TypeScript SDK for building on the Sui blockchain
|
|
5
5
|
- [LLM Documentation](./llm-docs.md): Give AI agents access to Sui SDK documentation in your project.
|
|
6
|
-
- [Sui Clients](./clients.md): Choose
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
6
|
+
- [Sui Clients](./clients.md): Choose between SuiGrpcClient and SuiGraphQLClient and understand their shared API
|
|
7
|
+
- [Querying Data](./clients/querying.md): Read objects, coins, balances, dynamic fields, and history with any Sui client
|
|
8
|
+
- [Executing Transactions](./clients/executing.md): Simulate, execute, and wait for transactions with any Sui client
|
|
9
|
+
- [SuiGrpcClient](./clients/grpc.md): Connect to Sui over gRPC, with native service clients and real-time subscriptions
|
|
10
|
+
- [SuiGraphQLClient](./clients/graphql.md): Connect to Sui over GraphQL and write type-safe custom queries
|
|
11
|
+
- [Core API](./clients/core.md): The transport-agnostic client contract that SDKs and libraries build against
|
|
11
12
|
- [Building Transactions](./transactions/basics.md): Construct programmable transaction blocks with the Transaction API
|
|
12
13
|
- [Signing and Execution](./transactions/signing-and-execution.md): Sign transactions and execute them on the Sui network
|
|
13
14
|
- [Coins and Balances](./transactions/coins-and-balances.md): Work with coin objects and address balances in transactions
|
|
@@ -26,21 +27,21 @@
|
|
|
26
27
|
- [Derived Objects](./utils/derived_objects.md): Compute derived object IDs from parent objects for deterministic offline derivation.
|
|
27
28
|
- [BCS](./bcs.md): Binary Canonical Serialization for encoding Sui Move types.
|
|
28
29
|
- [ZkLogin](./zklogin.md): Zero-knowledge authentication with OAuth providers on Sui.
|
|
29
|
-
- [Transaction Executors](./executors.md): Manage transaction execution with queuing and parallel strategies
|
|
30
|
+
- [Transaction Executors](./executors.md): Manage transaction execution with queuing and parallel strategies
|
|
30
31
|
- [Transaction Plugins](./plugins.md): Extend transaction building with reusable plugins.
|
|
31
|
-
- [Building SDKs](./sdk-building.md): Build custom SDKs on top of the Sui TypeScript SDK
|
|
32
|
-
- [Migrate to 2.0](./migrations/sui-2.0.md): Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages
|
|
32
|
+
- [Building SDKs](./sdk-building.md): Build custom SDKs on top of the Sui TypeScript SDK
|
|
33
|
+
- [Migrate to 2.0](./migrations/sui-2.0.md): Migration guide for Sui TypeScript SDK 2.0 covering all @mysten packages
|
|
33
34
|
- [Agent Migration Prompt](./migrations/sui-2.0/agent-prompt.md): AI agent prompt for automated SDK 2.0 migration of your codebase.
|
|
34
|
-
- [@mysten/sui](./migrations/sui-2.0/sui.md): Migrate @mysten/sui from 1.x to 2.0 with
|
|
35
|
-
- [Migrating from JSON-RPC](./migrations/sui-2.0/json-rpc-migration.md): Migrate
|
|
36
|
-
- [@mysten/dapp-kit](./migrations/sui-2.0/dapp-kit.md): Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0
|
|
37
|
-
- [@mysten/kiosk](./migrations/sui-2.0/kiosk.md): Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
|
|
38
|
-
- [@mysten/zksend](./migrations/sui-2.0/zksend.md): Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API
|
|
39
|
-
- [@mysten/suins](./migrations/sui-2.0/suins.md): Migrate @mysten/suins to 2.0 with client extension pattern
|
|
40
|
-
- [@mysten/deepbook-v3](./migrations/sui-2.0/deepbook-v3.md): Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern
|
|
41
|
-
- [@mysten/walrus](./migrations/sui-2.0/walrus.md): Migrate @mysten/walrus to 2.0 with required client parameter and updated API
|
|
35
|
+
- [@mysten/sui](./migrations/sui-2.0/sui.md): Migrate @mysten/sui from 1.x to 2.0 with gRPC clients, Core API, and BCS changes
|
|
36
|
+
- [Migrating from JSON-RPC](./migrations/sui-2.0/json-rpc-migration.md): Migrate deprecated JSON-RPC code to shared gRPC and GraphQL top-level methods
|
|
37
|
+
- [@mysten/dapp-kit](./migrations/sui-2.0/dapp-kit.md): Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0
|
|
38
|
+
- [@mysten/kiosk](./migrations/sui-2.0/kiosk.md): Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
|
|
39
|
+
- [@mysten/zksend](./migrations/sui-2.0/zksend.md): Migrate @mysten/zksend to 2.0 with client extension pattern and simplified API
|
|
40
|
+
- [@mysten/suins](./migrations/sui-2.0/suins.md): Migrate @mysten/suins to 2.0 with client extension pattern
|
|
41
|
+
- [@mysten/deepbook-v3](./migrations/sui-2.0/deepbook-v3.md): Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern
|
|
42
|
+
- [@mysten/walrus](./migrations/sui-2.0/walrus.md): Migrate @mysten/walrus to 2.0 with required client parameter and updated API
|
|
42
43
|
- [@mysten/seal](./migrations/sui-2.0/seal.md): Migrate @mysten/seal to 2.0 with the new registration function pattern.
|
|
43
44
|
- [Wallet Builders](./migrations/sui-2.0/wallet-builders.md): Migration guide for wallet extension developers upgrading to 2.0.
|
|
44
|
-
- [SDK Maintainers](./migrations/sui-2.0/sdk-maintainers.md): Migration guide for SDK maintainers and library authors upgrading to 2.0
|
|
45
|
+
- [SDK Maintainers](./migrations/sui-2.0/sdk-maintainers.md): Migration guide for SDK maintainers and library authors upgrading to 2.0
|
|
45
46
|
- [Migrate to 1.0](./migrations/sui-1.0.md): Migrate to Sui TypeScript SDK 1.0 with new features and API changes.
|
|
46
47
|
- [Migrate to 0.38.0](./migrations/0.38.md): Migrate from SDK version 0.37 to 0.38 with updated module structure and API changes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mysten/dapp-kit
|
|
2
2
|
|
|
3
|
-
> Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0
|
|
3
|
+
> Migrate @mysten/dapp-kit to the new dapp-kit-react package in 2.0
|
|
4
4
|
|
|
5
5
|
This guide helps you migrate from the original `@mysten/dapp-kit` (legacy) to the new
|
|
6
6
|
`@mysten/dapp-kit-react` package.
|
|
@@ -271,7 +271,7 @@ The built-in data fetching hooks have been removed. Use TanStack Query's `useQue
|
|
|
271
271
|
- });
|
|
272
272
|
+ const { data, isLoading, error } = useQuery({
|
|
273
273
|
+ queryKey: ['object', objectId],
|
|
274
|
-
+ queryFn: () => client.
|
|
274
|
+
+ queryFn: () => client.getObject({ objectId }),
|
|
275
275
|
+ });
|
|
276
276
|
// ...
|
|
277
277
|
}
|
|
@@ -289,7 +289,7 @@ If you don't need React Query's caching and state management, you can fetch data
|
|
|
289
289
|
const [error, setError] = useState<string | null>(null);
|
|
290
290
|
|
|
291
291
|
useEffect(() => {
|
|
292
|
-
client
|
|
292
|
+
client
|
|
293
293
|
.getObject({ objectId })
|
|
294
294
|
.then((result) => setData(result.object ?? null))
|
|
295
295
|
.catch((err) => setError(err.message))
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @mysten/deepbook-v3
|
|
2
2
|
|
|
3
|
-
> Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern
|
|
3
|
+
> Migrate @mysten/deepbook-v3 to 2.0 with client extension pattern
|
|
4
4
|
|
|
5
5
|
This package now exports a client extension that integrates with Sui clients.
|
|
6
6
|
|
|
7
7
|
```diff
|
|
8
8
|
- import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
9
9
|
- import { DeepBookClient } from '@mysten/deepbook-v3';
|
|
10
|
-
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
10
|
+
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
11
11
|
+ import { deepbook } from '@mysten/deepbook-v3';
|
|
12
12
|
|
|
13
13
|
- const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') });
|
|
@@ -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
|