@mysten/sui 2.26.1 → 2.27.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 +15 -0
- package/dist/bcs/pure.d.mts.map +1 -1
- package/dist/bcs/pure.mjs.map +1 -1
- package/dist/client/types.d.mts +10 -0
- package/dist/client/types.d.mts.map +1 -1
- package/dist/client/utils.mjs +67 -2
- package/dist/client/utils.mjs.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 +6 -6
- 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 +3 -0
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.mjs +20 -0
- package/dist/graphql/generated/queries.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 +6 -2
- 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/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/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +4 -0
- package/dist/jsonRpc/core.mjs.map +1 -1
- 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/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 +11 -2
- package/src/client/utils.ts +99 -2
- package/src/cryptography/signature-scheme.ts +1 -6
- package/src/graphql/client.ts +1 -4
- package/src/graphql/core.ts +37 -36
- package/src/graphql/generated/queries.ts +25 -5
- package/src/graphql/queries/transactions.graphql +4 -0
- package/src/grpc/client.ts +1 -2
- package/src/grpc/core.ts +42 -34
- package/src/jsonRpc/core.ts +27 -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
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
|
};
|
|
@@ -1044,7 +1040,14 @@ function transactionReadMaskPaths(
|
|
|
1044
1040
|
include: SuiClientTypes.TransactionInclude | undefined,
|
|
1045
1041
|
prefix = '',
|
|
1046
1042
|
): string[] {
|
|
1047
|
-
const paths = [
|
|
1043
|
+
const paths = [
|
|
1044
|
+
'digest',
|
|
1045
|
+
'transaction.digest',
|
|
1046
|
+
'signatures',
|
|
1047
|
+
'effects.status',
|
|
1048
|
+
'timestamp',
|
|
1049
|
+
'checkpoint',
|
|
1050
|
+
];
|
|
1048
1051
|
|
|
1049
1052
|
if (include?.transaction) {
|
|
1050
1053
|
paths.push(
|
|
@@ -1446,7 +1449,7 @@ export function parseTransactionEffects({
|
|
|
1446
1449
|
return {
|
|
1447
1450
|
bcs: effects.bcs?.value!,
|
|
1448
1451
|
|
|
1449
|
-
version: 2,
|
|
1452
|
+
version: effects.version ?? 2,
|
|
1450
1453
|
status: effects.status?.success
|
|
1451
1454
|
? {
|
|
1452
1455
|
success: true,
|
|
@@ -1559,6 +1562,11 @@ export function parseGrpcTransactionResponse<
|
|
|
1559
1562
|
const result: SuiClientTypes.Transaction<Include> = {
|
|
1560
1563
|
digest: transaction.digest!,
|
|
1561
1564
|
epoch: transaction.effects?.epoch?.toString() ?? null,
|
|
1565
|
+
timestampMs: transaction.timestamp
|
|
1566
|
+
? Number(transaction.timestamp.seconds) * 1000 +
|
|
1567
|
+
Math.floor(transaction.timestamp.nanos / 1_000_000)
|
|
1568
|
+
: null,
|
|
1569
|
+
checkpoint: transaction.checkpoint?.toString() ?? null,
|
|
1562
1570
|
status,
|
|
1563
1571
|
effects: effects as SuiClientTypes.Transaction<Include>['effects'],
|
|
1564
1572
|
objectTypes: (include?.objectTypes
|
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
|
};
|
|
@@ -532,6 +530,8 @@ export class JSONRpcCoreClient extends CoreClient {
|
|
|
532
530
|
const transactionData: SuiClientTypes.Transaction<Include> = {
|
|
533
531
|
digest: TransactionDataBuilder.getDigestFromBytes(transactionBytes),
|
|
534
532
|
epoch: null,
|
|
533
|
+
timestampMs: null,
|
|
534
|
+
checkpoint: null,
|
|
535
535
|
status: effects.status,
|
|
536
536
|
effects: (options.include?.effects
|
|
537
537
|
? effects
|
|
@@ -815,20 +815,18 @@ export class JSONRpcCoreClient extends CoreClient {
|
|
|
815
815
|
});
|
|
816
816
|
|
|
817
817
|
return {
|
|
818
|
-
events: page.data.map(
|
|
819
|
-
(event)
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}),
|
|
831
|
-
),
|
|
818
|
+
events: page.data.map((event): SuiClientTypes.EventEntry => ({
|
|
819
|
+
packageId: normalizeSuiAddress(event.packageId),
|
|
820
|
+
module: event.transactionModule,
|
|
821
|
+
sender: normalizeSuiAddress(event.sender),
|
|
822
|
+
eventType: normalizeStructTag(event.type),
|
|
823
|
+
bcs: event.bcsEncoding === 'base58' ? fromBase58(event.bcs) : fromBase64(event.bcs),
|
|
824
|
+
json: (event.parsedJson as Record<string, unknown>) ?? null,
|
|
825
|
+
// queryEvents responses do not include checkpoint information
|
|
826
|
+
checkpoint: null,
|
|
827
|
+
transactionDigest: event.id.txDigest,
|
|
828
|
+
eventIndex: Number(event.id.eventSeq),
|
|
829
|
+
})),
|
|
832
830
|
hasNextPage: page.hasNextPage,
|
|
833
831
|
startCursor: page.data.length ? JSON.stringify(page.data[0].id) : null,
|
|
834
832
|
endCursor:
|
|
@@ -1232,6 +1230,8 @@ function parseTransaction<Include extends SuiClientTypes.TransactionInclude = {}
|
|
|
1232
1230
|
const result: SuiClientTypes.Transaction<Include> = {
|
|
1233
1231
|
digest: transaction.digest,
|
|
1234
1232
|
epoch: transaction.effects?.executedEpoch ?? null,
|
|
1233
|
+
timestampMs: transaction.timestampMs == null ? null : Number(transaction.timestampMs),
|
|
1234
|
+
checkpoint: transaction.checkpoint ?? null,
|
|
1235
1235
|
status,
|
|
1236
1236
|
effects: (include?.effects && effectsBytes
|
|
1237
1237
|
? parseTransactionEffectsBcs(effectsBytes)
|
|
@@ -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