@mysten/sui 2.26.1 → 2.26.2
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 +8 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +36 -36
- package/dist/bcs/pure.d.mts.map +1 -1
- package/dist/bcs/pure.mjs.map +1 -1
- package/dist/client/types.d.mts.map +1 -1
- package/dist/cryptography/signature-scheme.d.mts.map +1 -1
- package/dist/cryptography/signature-scheme.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +8 -8
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
- 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/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +9 -9
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/Transaction.mjs.map +1 -1
- package/dist/transactions/executor/parallel.d.mts.map +1 -1
- package/dist/transactions/executor/parallel.mjs.map +1 -1
- package/dist/transactions/executor/serial.d.mts.map +1 -1
- package/dist/transactions/executor/serial.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/clients/grpc.md +1 -1
- package/docs/clients/index.md +1 -1
- package/docs/cryptography/index.md +1 -1
- package/docs/cryptography/keypairs.md +1 -1
- package/docs/cryptography/signers/index.md +1 -1
- package/docs/cryptography/signers/webcrypto.md +1 -1
- package/docs/llms-index.md +11 -11
- package/docs/migrations/0.38.md +1 -1
- package/docs/migrations/sui-2.0/dapp-kit.md +2 -3
- package/docs/migrations/sui-2.0/kiosk.md +1 -1
- package/docs/migrations/sui-2.0/sui.md +1 -1
- package/docs/transactions/signing-and-execution.md +14 -25
- package/docs/utils/derived_objects.md +1 -1
- package/docs/utils/index.md +1 -1
- package/package.json +25 -25
- package/src/bcs/pure.ts +1 -10
- package/src/bcs/types.ts +1 -3
- package/src/client/types.ts +1 -2
- package/src/cryptography/signature-scheme.ts +1 -6
- package/src/graphql/client.ts +1 -4
- package/src/graphql/core.ts +32 -36
- package/src/grpc/client.ts +1 -2
- package/src/grpc/core.ts +28 -32
- package/src/jsonRpc/core.ts +23 -27
- package/src/transactions/Transaction.ts +1 -2
- package/src/transactions/executor/parallel.ts +1 -2
- package/src/transactions/executor/serial.ts +1 -2
- package/src/version.ts +1 -1
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
This guide helps you migrate from the original `@mysten/dapp-kit` (legacy) to the new
|
|
6
6
|
`@mysten/dapp-kit-react` package.
|
|
7
7
|
|
|
8
|
-
> **Note:** The legacy `@mysten/dapp-kit` package
|
|
9
|
-
>
|
|
10
|
-
> `@mysten/dapp-kit-react` for new features and gRPC support.
|
|
8
|
+
> **Note:** The legacy `@mysten/dapp-kit` package only supports the deprecated JSON RPC API and will not
|
|
9
|
+
> receive further updates. Migrate to `@mysten/dapp-kit-react` for gRPC support and new features.
|
|
11
10
|
|
|
12
11
|
## Overview
|
|
13
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mysten/kiosk
|
|
2
2
|
|
|
3
|
-
> Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
|
|
3
|
+
> >- Migrate @mysten/kiosk to 2.0 with client extension pattern and KioskTransaction
|
|
4
4
|
|
|
5
5
|
This package now exports a client extension that integrates with Sui clients.
|
|
6
6
|
|
|
@@ -75,29 +75,24 @@ Available keypair types:
|
|
|
75
75
|
|
|
76
76
|
## With dapp-kit (React frontend)
|
|
77
77
|
|
|
78
|
-
In a React app, use the `
|
|
79
|
-
|
|
78
|
+
In a React app, use the `useDAppKit` hook. The user's connected wallet signs and submits the
|
|
79
|
+
transaction:
|
|
80
80
|
|
|
81
81
|
```tsx
|
|
82
82
|
|
|
83
83
|
function SendButton() {
|
|
84
|
-
const
|
|
84
|
+
const dAppKit = useDAppKit();
|
|
85
85
|
|
|
86
|
-
function handleClick() {
|
|
86
|
+
async function handleClick() {
|
|
87
87
|
const tx = new Transaction();
|
|
88
88
|
// ... build your transaction ...
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
onError: (error) => {
|
|
97
|
-
console.error('Transaction failed:', error);
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
);
|
|
90
|
+
const result = await dAppKit.signAndExecuteTransaction({ transaction: tx });
|
|
91
|
+
if (result.FailedTransaction) {
|
|
92
|
+
throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log('Transaction digest:', result.Transaction.digest);
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
return <button onClick={handleClick}>Send</button>;
|
|
@@ -127,20 +122,14 @@ const { signature } = await keypair.signTransaction(bytes);
|
|
|
127
122
|
```tsx
|
|
128
123
|
|
|
129
124
|
function SignButton() {
|
|
130
|
-
const
|
|
125
|
+
const dAppKit = useDAppKit();
|
|
131
126
|
|
|
132
|
-
function handleClick() {
|
|
127
|
+
async function handleClick() {
|
|
133
128
|
const tx = new Transaction();
|
|
134
129
|
// ... build your transaction ...
|
|
135
130
|
|
|
136
|
-
signTransaction(
|
|
137
|
-
|
|
138
|
-
{
|
|
139
|
-
onSuccess: ({ bytes, signature }) => {
|
|
140
|
-
// Send bytes + signature to your backend, sponsor, etc.
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
);
|
|
131
|
+
const { bytes, signature } = await dAppKit.signTransaction({ transaction: tx });
|
|
132
|
+
// Send bytes + signature to your backend, sponsor, etc.
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
return <button onClick={handleClick}>Sign</button>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Derived Objects
|
|
2
2
|
|
|
3
|
-
> Compute derived object IDs from parent objects for deterministic offline derivation.
|
|
3
|
+
> >- Compute derived object IDs from parent objects for deterministic offline derivation.
|
|
4
4
|
|
|
5
5
|
Derived objects enable deterministic IDs for objects, enabling offline derivation of object IDs.
|
|
6
6
|
[Click here to read more.](https://docs.sui.io/concepts/sui-move-concepts/derived-objects)
|
package/docs/utils/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The `@mysten/sui/utils` package
|
|
2
2
|
|
|
3
|
-
> Utility functions for addresses, coins, and common operations in the Sui TypeScript SDK.
|
|
3
|
+
> >- Utility functions for addresses, coins, and common operations in the Sui TypeScript SDK.
|
|
4
4
|
|
|
5
5
|
This package contains some utilities that simplify common operations when working with the Sui
|
|
6
6
|
TypeScript SDK.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui TypeScript API",
|
|
5
5
|
"homepage": "https://sdk.mystenlabs.com",
|
|
6
|
-
"version": "2.26.
|
|
6
|
+
"version": "2.26.2",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -131,45 +131,45 @@
|
|
|
131
131
|
"access": "public"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
|
-
"@0no-co/graphqlsp": "^1.17.
|
|
135
|
-
"@graphql-codegen/add": "^7.0
|
|
136
|
-
"@graphql-codegen/cli": "^7.
|
|
137
|
-
"@graphql-codegen/typed-document-node": "^7.0
|
|
138
|
-
"@graphql-codegen/typescript": "6.0
|
|
139
|
-
"@graphql-codegen/typescript-document-nodes": "6.0
|
|
140
|
-
"@graphql-codegen/typescript-operations": "^6.
|
|
134
|
+
"@0no-co/graphqlsp": "^1.17.3",
|
|
135
|
+
"@graphql-codegen/add": "^7.1.0",
|
|
136
|
+
"@graphql-codegen/cli": "^7.2.0",
|
|
137
|
+
"@graphql-codegen/typed-document-node": "^7.1.0",
|
|
138
|
+
"@graphql-codegen/typescript": "6.1.0",
|
|
139
|
+
"@graphql-codegen/typescript-document-nodes": "6.1.0",
|
|
140
|
+
"@graphql-codegen/typescript-operations": "^6.1.6",
|
|
141
141
|
"@grpc/grpc-js": ">=1.14.4",
|
|
142
|
-
"@parcel/watcher": "^2.
|
|
142
|
+
"@parcel/watcher": "^2.6.0",
|
|
143
143
|
"@protobuf-ts/grpc-transport": "^2.11.1",
|
|
144
|
-
"@types/node": "^
|
|
144
|
+
"@types/node": "^26.2.0",
|
|
145
145
|
"@types/tmp": "^0.2.6",
|
|
146
146
|
"cross-env": "^10.1.0",
|
|
147
147
|
"graphql-config": "^5.1.5",
|
|
148
|
-
"msw": "^2.
|
|
148
|
+
"msw": "^2.15.0",
|
|
149
149
|
"tmp": "^0.2.7",
|
|
150
150
|
"ts-retry-promise": "^0.8.1",
|
|
151
|
-
"typescript": "^
|
|
152
|
-
"vite": "^8.
|
|
151
|
+
"typescript": "^7.0.2",
|
|
152
|
+
"vite": "^8.2.1",
|
|
153
153
|
"vite-tsconfig-paths": "^6.0.4",
|
|
154
|
-
"vitest": "^4.1.
|
|
155
|
-
"wait-on": "^9.0
|
|
154
|
+
"vitest": "^4.1.10",
|
|
155
|
+
"wait-on": "^9.1.0"
|
|
156
156
|
},
|
|
157
157
|
"dependencies": {
|
|
158
158
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
159
|
-
"@noble/curves": "^2.
|
|
160
|
-
"@noble/hashes": "^2.
|
|
159
|
+
"@noble/curves": "^2.3.0",
|
|
160
|
+
"@noble/hashes": "^2.3.0",
|
|
161
161
|
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
|
162
162
|
"@protobuf-ts/runtime": "^2.11.1",
|
|
163
163
|
"@protobuf-ts/runtime-rpc": "^2.11.1",
|
|
164
|
-
"@scure/base": "^2.
|
|
165
|
-
"@scure/bip32": "^2.
|
|
166
|
-
"@scure/bip39": "^2.
|
|
167
|
-
"gql.tada": "^1.
|
|
168
|
-
"graphql": "^
|
|
169
|
-
"poseidon-lite": "0.
|
|
164
|
+
"@scure/base": "^2.3.0",
|
|
165
|
+
"@scure/bip32": "^2.3.0",
|
|
166
|
+
"@scure/bip39": "^2.3.0",
|
|
167
|
+
"gql.tada": "^1.11.3",
|
|
168
|
+
"graphql": "^17.0.2",
|
|
169
|
+
"poseidon-lite": "0.3.0",
|
|
170
170
|
"valibot": "^1.4.2",
|
|
171
|
-
"@mysten/bcs": "^2.1.
|
|
172
|
-
"@mysten/utils": "^0.4.
|
|
171
|
+
"@mysten/bcs": "^2.1.1",
|
|
172
|
+
"@mysten/utils": "^0.4.1"
|
|
173
173
|
},
|
|
174
174
|
"scripts": {
|
|
175
175
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
package/src/bcs/pure.ts
CHANGED
|
@@ -7,16 +7,7 @@ import type { BcsType } from '@mysten/bcs';
|
|
|
7
7
|
import { Address } from './bcs.js';
|
|
8
8
|
|
|
9
9
|
export type BasePureType =
|
|
10
|
-
| '
|
|
11
|
-
| 'u16'
|
|
12
|
-
| 'u32'
|
|
13
|
-
| 'u64'
|
|
14
|
-
| 'u128'
|
|
15
|
-
| 'u256'
|
|
16
|
-
| 'bool'
|
|
17
|
-
| 'id'
|
|
18
|
-
| 'string'
|
|
19
|
-
| 'address';
|
|
10
|
+
'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256' | 'bool' | 'id' | 'string' | 'address';
|
|
20
11
|
|
|
21
12
|
interface PureShapeByType {
|
|
22
13
|
u8: number;
|
package/src/bcs/types.ts
CHANGED
|
@@ -132,6 +132,4 @@ type ValidDuring = {
|
|
|
132
132
|
* Indications the expiration time for a transaction.
|
|
133
133
|
*/
|
|
134
134
|
export type TransactionExpiration =
|
|
135
|
-
|
|
136
|
-
| { Epoch: number }
|
|
137
|
-
| { ValidDuring: ValidDuring };
|
|
135
|
+
{ None: null } | { Epoch: number } | { ValidDuring: ValidDuring };
|
package/src/client/types.ts
CHANGED
|
@@ -411,8 +411,7 @@ export namespace SuiClientTypes {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
export type WaitForTransactionOptions<Include extends TransactionInclude = {}> =
|
|
414
|
-
|
|
|
415
|
-
| WaitForTransactionByResult<Include>;
|
|
414
|
+
WaitForTransactionByDigest<Include> | WaitForTransactionByResult<Include>;
|
|
416
415
|
|
|
417
416
|
export interface WaitForTransactionByDigest<
|
|
418
417
|
Include extends TransactionInclude = {},
|
|
@@ -27,11 +27,6 @@ export const SIGNATURE_FLAG_TO_SCHEME = {
|
|
|
27
27
|
} as const;
|
|
28
28
|
|
|
29
29
|
export type SignatureScheme =
|
|
30
|
-
| '
|
|
31
|
-
| 'Secp256k1'
|
|
32
|
-
| 'Secp256r1'
|
|
33
|
-
| 'MultiSig'
|
|
34
|
-
| 'ZkLogin'
|
|
35
|
-
| 'Passkey';
|
|
30
|
+
'ED25519' | 'Secp256k1' | 'Secp256r1' | 'MultiSig' | 'ZkLogin' | 'Passkey';
|
|
36
31
|
|
|
37
32
|
export type SignatureFlag = keyof typeof SIGNATURE_FLAG_TO_SCHEME;
|
package/src/graphql/client.ts
CHANGED
|
@@ -15,10 +15,7 @@ import { normalizeStructTag } from '../utils/sui-types.js';
|
|
|
15
15
|
import { deriveDynamicFieldID } from '../utils/dynamic-fields.js';
|
|
16
16
|
import type { TransactionPlugin } from '../transactions/index.js';
|
|
17
17
|
|
|
18
|
-
export type GraphQLDocument<
|
|
19
|
-
Result = Record<string, unknown>,
|
|
20
|
-
Variables = Record<string, unknown>,
|
|
21
|
-
> =
|
|
18
|
+
export type GraphQLDocument<Result = Record<string, unknown>, Variables = Record<string, unknown>> =
|
|
22
19
|
| string
|
|
23
20
|
| DocumentNode
|
|
24
21
|
| TypedDocumentString<Result, Variables>
|
package/src/graphql/core.ts
CHANGED
|
@@ -215,32 +215,30 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
215
215
|
);
|
|
216
216
|
|
|
217
217
|
return {
|
|
218
|
-
objects: objects.nodes.map(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
? obj.contents
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
display
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}),
|
|
243
|
-
),
|
|
218
|
+
objects: objects.nodes.map((obj): SuiClientTypes.Object<Include> => ({
|
|
219
|
+
objectId: obj.address,
|
|
220
|
+
version: obj.version?.toString()!,
|
|
221
|
+
digest: obj.digest!,
|
|
222
|
+
owner: mapOwner(obj.owner!),
|
|
223
|
+
type: obj.contents?.type?.repr!,
|
|
224
|
+
content: (obj.contents?.bcs
|
|
225
|
+
? fromBase64(obj.contents.bcs)
|
|
226
|
+
: undefined) as SuiClientTypes.Object<Include>['content'],
|
|
227
|
+
previousTransaction: (obj.previousTransaction?.digest ??
|
|
228
|
+
undefined) as SuiClientTypes.Object<Include>['previousTransaction'],
|
|
229
|
+
objectBcs: (obj.objectBcs
|
|
230
|
+
? fromBase64(obj.objectBcs)
|
|
231
|
+
: undefined) as SuiClientTypes.Object<Include>['objectBcs'],
|
|
232
|
+
json: (options.include?.json
|
|
233
|
+
? obj.contents?.json
|
|
234
|
+
? (obj.contents.json as Record<string, unknown>)
|
|
235
|
+
: null
|
|
236
|
+
: undefined) as SuiClientTypes.Object<Include>['json'],
|
|
237
|
+
display: mapDisplay(
|
|
238
|
+
options.include?.display,
|
|
239
|
+
obj.contents?.display,
|
|
240
|
+
) as SuiClientTypes.Object<Include>['display'],
|
|
241
|
+
})),
|
|
244
242
|
hasNextPage: objects.pageInfo.hasNextPage,
|
|
245
243
|
cursor: objects.pageInfo.endCursor ?? null,
|
|
246
244
|
};
|
|
@@ -266,16 +264,14 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
266
264
|
return {
|
|
267
265
|
cursor: coins.pageInfo.endCursor ?? null,
|
|
268
266
|
hasNextPage: coins.pageInfo.hasNextPage,
|
|
269
|
-
objects: coins.nodes.map(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}),
|
|
278
|
-
),
|
|
267
|
+
objects: coins.nodes.map((coin): SuiClientTypes.Coin => ({
|
|
268
|
+
objectId: coin.address,
|
|
269
|
+
version: coin.version?.toString()!,
|
|
270
|
+
digest: coin.digest!,
|
|
271
|
+
owner: mapOwner(coin.owner!),
|
|
272
|
+
type: coin.contents?.type?.repr!,
|
|
273
|
+
balance: (coin.contents?.json as { balance: string })?.balance,
|
|
274
|
+
})),
|
|
279
275
|
};
|
|
280
276
|
}
|
|
281
277
|
|
package/src/grpc/client.ts
CHANGED
|
@@ -108,8 +108,7 @@ export interface GrpcWaitForTransactionByResult<
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export type GrpcWaitForTransactionOptions<Include extends GrpcTransactionInclude = {}> =
|
|
111
|
-
|
|
|
112
|
-
| GrpcWaitForTransactionByResult<Include>;
|
|
111
|
+
GrpcWaitForTransactionByDigest<Include> | GrpcWaitForTransactionByResult<Include>;
|
|
113
112
|
|
|
114
113
|
export interface GrpcExecuteTransactionOptions<
|
|
115
114
|
Include extends GrpcTransactionInclude = {},
|
package/src/grpc/core.ts
CHANGED
|
@@ -240,28 +240,26 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
240
240
|
{ abort: options.signal },
|
|
241
241
|
);
|
|
242
242
|
|
|
243
|
-
const objects = response.response.objects.map(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
? object.json
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
display
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}),
|
|
264
|
-
);
|
|
243
|
+
const objects = response.response.objects.map((object): SuiClientTypes.Object<Include> => ({
|
|
244
|
+
objectId: object.objectId!,
|
|
245
|
+
version: object.version?.toString()!,
|
|
246
|
+
digest: object.digest!,
|
|
247
|
+
content: object.contents?.value as SuiClientTypes.Object<Include>['content'],
|
|
248
|
+
owner: mapOwner(object.owner)!,
|
|
249
|
+
type: object.objectType!,
|
|
250
|
+
previousTransaction: (object.previousTransaction ??
|
|
251
|
+
undefined) as SuiClientTypes.Object<Include>['previousTransaction'],
|
|
252
|
+
objectBcs: object.bcs?.value as SuiClientTypes.Object<Include>['objectBcs'],
|
|
253
|
+
json: (options.include?.json
|
|
254
|
+
? object.json
|
|
255
|
+
? (Value.toJson(object.json) as Record<string, unknown>)
|
|
256
|
+
: null
|
|
257
|
+
: undefined) as SuiClientTypes.Object<Include>['json'],
|
|
258
|
+
display: mapDisplayProto(
|
|
259
|
+
options.include?.display,
|
|
260
|
+
object.display,
|
|
261
|
+
) as SuiClientTypes.Object<Include>['display'],
|
|
262
|
+
}));
|
|
265
263
|
|
|
266
264
|
return {
|
|
267
265
|
objects,
|
|
@@ -289,16 +287,14 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
289
287
|
);
|
|
290
288
|
|
|
291
289
|
return {
|
|
292
|
-
objects: response.response.objects.map(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}),
|
|
301
|
-
),
|
|
290
|
+
objects: response.response.objects.map((object): SuiClientTypes.Coin => ({
|
|
291
|
+
objectId: object.objectId!,
|
|
292
|
+
version: object.version?.toString()!,
|
|
293
|
+
digest: object.digest!,
|
|
294
|
+
owner: mapOwner(object.owner)!,
|
|
295
|
+
type: object.objectType!,
|
|
296
|
+
balance: object.balance?.toString()!,
|
|
297
|
+
})),
|
|
302
298
|
cursor: response.response.nextPageToken ? toBase64(response.response.nextPageToken) : null,
|
|
303
299
|
hasNextPage: response.response.nextPageToken !== undefined,
|
|
304
300
|
};
|
package/src/jsonRpc/core.ts
CHANGED
|
@@ -293,19 +293,17 @@ export class JSONRpcCoreClient extends CoreClient {
|
|
|
293
293
|
});
|
|
294
294
|
|
|
295
295
|
return {
|
|
296
|
-
objects: coins.data.map(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}),
|
|
308
|
-
),
|
|
296
|
+
objects: coins.data.map((coin): SuiClientTypes.Coin => ({
|
|
297
|
+
objectId: coin.coinObjectId,
|
|
298
|
+
version: coin.version,
|
|
299
|
+
digest: coin.digest,
|
|
300
|
+
balance: coin.balance,
|
|
301
|
+
type: normalizeStructTag(`0x2::coin::Coin<${coin.coinType}>`),
|
|
302
|
+
owner: {
|
|
303
|
+
$kind: 'AddressOwner' as const,
|
|
304
|
+
AddressOwner: options.owner,
|
|
305
|
+
},
|
|
306
|
+
})),
|
|
309
307
|
hasNextPage: coins.hasNextPage,
|
|
310
308
|
cursor: coins.nextCursor ?? null,
|
|
311
309
|
};
|
|
@@ -815,20 +813,18 @@ export class JSONRpcCoreClient extends CoreClient {
|
|
|
815
813
|
});
|
|
816
814
|
|
|
817
815
|
return {
|
|
818
|
-
events: page.data.map(
|
|
819
|
-
(event)
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}),
|
|
831
|
-
),
|
|
816
|
+
events: page.data.map((event): SuiClientTypes.EventEntry => ({
|
|
817
|
+
packageId: normalizeSuiAddress(event.packageId),
|
|
818
|
+
module: event.transactionModule,
|
|
819
|
+
sender: normalizeSuiAddress(event.sender),
|
|
820
|
+
eventType: normalizeStructTag(event.type),
|
|
821
|
+
bcs: event.bcsEncoding === 'base58' ? fromBase58(event.bcs) : fromBase64(event.bcs),
|
|
822
|
+
json: (event.parsedJson as Record<string, unknown>) ?? null,
|
|
823
|
+
// queryEvents responses do not include checkpoint information
|
|
824
|
+
checkpoint: null,
|
|
825
|
+
transactionDigest: event.id.txDigest,
|
|
826
|
+
eventIndex: Number(event.id.eventSeq),
|
|
827
|
+
})),
|
|
832
828
|
hasNextPage: page.hasNextPage,
|
|
833
829
|
startCursor: page.data.length ? JSON.stringify(page.data[0].id) : null,
|
|
834
830
|
endCursor:
|
|
@@ -50,8 +50,7 @@ export type TransactionResult = Extract<Argument, { Result: unknown }> &
|
|
|
50
50
|
Extract<Argument, { NestedResult: unknown }>[];
|
|
51
51
|
|
|
52
52
|
export type TransactionResultArgument =
|
|
53
|
-
| Extract<Argument, {
|
|
54
|
-
| readonly Extract<Argument, { NestedResult: unknown }>[];
|
|
53
|
+
Extract<Argument, { Result: unknown }> | readonly Extract<Argument, { NestedResult: unknown }>[];
|
|
55
54
|
|
|
56
55
|
export type AsyncTransactionThunk<
|
|
57
56
|
T extends TransactionResultArgument | void = TransactionResultArgument | void,
|
|
@@ -51,8 +51,7 @@ export interface ParallelTransactionExecutorAddressBalanceOptions extends Parall
|
|
|
51
51
|
|
|
52
52
|
/** Options for ParallelTransactionExecutor - discriminated union based on gasMode */
|
|
53
53
|
export type ParallelTransactionExecutorOptions =
|
|
54
|
-
|
|
|
55
|
-
| ParallelTransactionExecutorAddressBalanceOptions;
|
|
54
|
+
ParallelTransactionExecutorCoinOptions | ParallelTransactionExecutorAddressBalanceOptions;
|
|
56
55
|
|
|
57
56
|
interface CoinWithBalance {
|
|
58
57
|
id: string;
|
|
@@ -27,8 +27,7 @@ export interface SerialTransactionExecutorAddressBalanceOptions extends SerialTr
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export type SerialTransactionExecutorOptions =
|
|
30
|
-
|
|
|
31
|
-
| SerialTransactionExecutorAddressBalanceOptions;
|
|
30
|
+
SerialTransactionExecutorCoinOptions | SerialTransactionExecutorAddressBalanceOptions;
|
|
32
31
|
|
|
33
32
|
export class SerialTransactionExecutor {
|
|
34
33
|
#queue = new SerialQueue();
|
package/src/version.ts
CHANGED