@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
|
@@ -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.
|
|
6
|
+
"version": "2.27.0",
|
|
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
|
@@ -326,6 +326,16 @@ export namespace SuiClientTypes {
|
|
|
326
326
|
digest: string;
|
|
327
327
|
signatures: string[];
|
|
328
328
|
epoch: string | null;
|
|
329
|
+
/**
|
|
330
|
+
* Timestamp of the checkpoint containing this transaction, in milliseconds since Unix epoch.
|
|
331
|
+
* `null` for transactions that have not been checkpointed, including execution and simulation results.
|
|
332
|
+
*/
|
|
333
|
+
timestampMs: number | null;
|
|
334
|
+
/**
|
|
335
|
+
* Sequence number of the checkpoint containing this transaction.
|
|
336
|
+
* `null` for transactions that have not been checkpointed, including execution and simulation results.
|
|
337
|
+
*/
|
|
338
|
+
checkpoint: string | null;
|
|
329
339
|
status: ExecutionStatus;
|
|
330
340
|
balanceChanges: Include extends { balanceChanges: true } ? BalanceChange[] : undefined;
|
|
331
341
|
effects: Include extends { effects: true } ? TransactionEffects : undefined;
|
|
@@ -411,8 +421,7 @@ export namespace SuiClientTypes {
|
|
|
411
421
|
}
|
|
412
422
|
|
|
413
423
|
export type WaitForTransactionOptions<Include extends TransactionInclude = {}> =
|
|
414
|
-
|
|
|
415
|
-
| WaitForTransactionByResult<Include>;
|
|
424
|
+
WaitForTransactionByDigest<Include> | WaitForTransactionByResult<Include>;
|
|
416
425
|
|
|
417
426
|
export interface WaitForTransactionByDigest<
|
|
418
427
|
Include extends TransactionInclude = {},
|
package/src/client/utils.ts
CHANGED
|
@@ -478,11 +478,108 @@ export function parseTransactionEffectsBcs(effects: Uint8Array): SuiClientTypes.
|
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
function parseTransactionEffectsV1(
|
|
481
|
+
function parseTransactionEffectsV1({
|
|
482
|
+
bytes,
|
|
483
|
+
effects,
|
|
484
|
+
}: {
|
|
482
485
|
bytes: Uint8Array;
|
|
483
486
|
effects: NonNullable<(typeof bcs.TransactionEffects.$inferType)['V1']>;
|
|
484
487
|
}): SuiClientTypes.TransactionEffects {
|
|
485
|
-
|
|
488
|
+
const modifiedAtVersions = new Map(effects.modifiedAtVersions);
|
|
489
|
+
const sharedObjects = new Map(effects.sharedObjects.map((object) => [object.objectId, object]));
|
|
490
|
+
const mapChangedObject = (
|
|
491
|
+
reference: (typeof effects.deleted)[number],
|
|
492
|
+
change: Pick<
|
|
493
|
+
SuiClientTypes.ChangedObject,
|
|
494
|
+
'inputState' | 'outputState' | 'outputOwner' | 'idOperation'
|
|
495
|
+
>,
|
|
496
|
+
): SuiClientTypes.ChangedObject => {
|
|
497
|
+
const sharedInput = sharedObjects.get(reference.objectId);
|
|
498
|
+
return {
|
|
499
|
+
objectId: reference.objectId,
|
|
500
|
+
inputState: change.inputState,
|
|
501
|
+
inputVersion:
|
|
502
|
+
change.inputState === 'Exists'
|
|
503
|
+
? (sharedInput?.version ?? modifiedAtVersions.get(reference.objectId) ?? null)
|
|
504
|
+
: null,
|
|
505
|
+
inputDigest: change.inputState === 'Exists' ? (sharedInput?.digest ?? null) : null,
|
|
506
|
+
inputOwner: null,
|
|
507
|
+
outputState: change.outputState,
|
|
508
|
+
outputVersion: change.outputState === 'DoesNotExist' ? null : reference.version,
|
|
509
|
+
outputDigest: change.outputState === 'DoesNotExist' ? null : reference.digest,
|
|
510
|
+
outputOwner: change.outputOwner,
|
|
511
|
+
idOperation: change.idOperation,
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const written = (
|
|
516
|
+
changes: typeof effects.created,
|
|
517
|
+
inputState: 'DoesNotExist' | 'Exists',
|
|
518
|
+
idOperation: 'Created' | 'None',
|
|
519
|
+
): SuiClientTypes.ChangedObject[] =>
|
|
520
|
+
changes.map(([reference, owner]) =>
|
|
521
|
+
mapChangedObject(reference, {
|
|
522
|
+
inputState,
|
|
523
|
+
outputState: 'ObjectWrite',
|
|
524
|
+
outputOwner: owner,
|
|
525
|
+
idOperation,
|
|
526
|
+
}),
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
const removed = (
|
|
530
|
+
changes: typeof effects.deleted,
|
|
531
|
+
inputState: 'DoesNotExist' | 'Exists',
|
|
532
|
+
idOperation: 'Deleted' | 'None',
|
|
533
|
+
): SuiClientTypes.ChangedObject[] =>
|
|
534
|
+
changes.map((reference) =>
|
|
535
|
+
mapChangedObject(reference, {
|
|
536
|
+
inputState,
|
|
537
|
+
outputState: 'DoesNotExist',
|
|
538
|
+
outputOwner: null,
|
|
539
|
+
idOperation,
|
|
540
|
+
}),
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
const changedObjects = [
|
|
544
|
+
...written(effects.created, 'DoesNotExist', 'Created'),
|
|
545
|
+
...written(effects.mutated, 'Exists', 'None'),
|
|
546
|
+
...written(effects.unwrapped, 'DoesNotExist', 'None'),
|
|
547
|
+
...removed(effects.deleted, 'Exists', 'Deleted'),
|
|
548
|
+
...removed(effects.unwrappedThenDeleted, 'DoesNotExist', 'Deleted'),
|
|
549
|
+
...removed(effects.wrapped, 'Exists', 'None'),
|
|
550
|
+
];
|
|
551
|
+
const gasObjectId = effects.gasObject[0].objectId;
|
|
552
|
+
const gasObject = changedObjects.find((object) => object.objectId === gasObjectId) ?? null;
|
|
553
|
+
const changedObjectIds = new Set(changedObjects.map((object) => object.objectId));
|
|
554
|
+
const lamportVersion = effects.modifiedAtVersions.reduce(
|
|
555
|
+
(max, [, version]) => (BigInt(version) > max ? BigInt(version) : max),
|
|
556
|
+
0n,
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
return {
|
|
560
|
+
bcs: bytes,
|
|
561
|
+
version: 1,
|
|
562
|
+
status:
|
|
563
|
+
effects.status.$kind === 'Success'
|
|
564
|
+
? { success: true, error: null }
|
|
565
|
+
: { success: false, error: parseBcsExecutionError(effects.status.Failure) },
|
|
566
|
+
gasUsed: effects.gasUsed,
|
|
567
|
+
transactionDigest: effects.transactionDigest,
|
|
568
|
+
gasObject,
|
|
569
|
+
eventsDigest: effects.eventsDigest,
|
|
570
|
+
dependencies: effects.dependencies,
|
|
571
|
+
lamportVersion: (lamportVersion + 1n).toString(),
|
|
572
|
+
changedObjects,
|
|
573
|
+
unchangedConsensusObjects: effects.sharedObjects
|
|
574
|
+
.filter((object) => !changedObjectIds.has(object.objectId))
|
|
575
|
+
.map((object) => ({
|
|
576
|
+
kind: 'ReadOnlyRoot',
|
|
577
|
+
objectId: object.objectId,
|
|
578
|
+
version: object.version,
|
|
579
|
+
digest: object.digest,
|
|
580
|
+
})),
|
|
581
|
+
auxiliaryDataDigest: null,
|
|
582
|
+
};
|
|
486
583
|
}
|
|
487
584
|
|
|
488
585
|
function parseTransactionEffectsV2({
|
|
@@ -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
|
|
|
@@ -1126,6 +1122,9 @@ function parseTransaction<Include extends SuiClientTypes.TransactionInclude = {}
|
|
|
1126
1122
|
|
|
1127
1123
|
const bcsBytes =
|
|
1128
1124
|
include?.bcs && transaction.transactionBcs ? fromBase64(transaction.transactionBcs) : undefined;
|
|
1125
|
+
const timestampMs = transaction.effects?.timestamp
|
|
1126
|
+
? Date.parse(transaction.effects.timestamp)
|
|
1127
|
+
: null;
|
|
1129
1128
|
|
|
1130
1129
|
const result: SuiClientTypes.Transaction<Include> = {
|
|
1131
1130
|
digest: transaction.digest!,
|
|
@@ -1134,6 +1133,8 @@ function parseTransaction<Include extends SuiClientTypes.TransactionInclude = {}
|
|
|
1134
1133
|
? parseTransactionEffectsBcs(fromBase64(transaction.effects?.effectsBcs!))
|
|
1135
1134
|
: undefined) as SuiClientTypes.Transaction<Include>['effects'],
|
|
1136
1135
|
epoch: transaction.effects?.epoch?.epochId?.toString() ?? null,
|
|
1136
|
+
timestampMs: timestampMs !== null && !Number.isNaN(timestampMs) ? timestampMs : null,
|
|
1137
|
+
checkpoint: transaction.effects?.checkpoint?.sequenceNumber?.toString() ?? null,
|
|
1137
1138
|
objectTypes: (include?.objectTypes
|
|
1138
1139
|
? objectTypes
|
|
1139
1140
|
: undefined) as SuiClientTypes.Transaction<Include>['objectTypes'],
|
|
@@ -380,7 +380,7 @@ export type SimulateTransactionQueryVariables = Exact<{
|
|
|
380
380
|
}>;
|
|
381
381
|
|
|
382
382
|
|
|
383
|
-
export type SimulateTransactionQuery = { simulateTransaction: { effects: { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null } | null, outputs?: Array<{ returnValues: Array<{ value: { bcs: string | null } | null }> | null, mutatedReferences: Array<{ value: { bcs: string | null } | null }> | null }> | null } };
|
|
383
|
+
export type SimulateTransactionQuery = { simulateTransaction: { effects: { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, timestamp: string | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, checkpoint: { sequenceNumber: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null } | null, outputs?: Array<{ returnValues: Array<{ value: { bcs: string | null } | null }> | null, mutatedReferences: Array<{ value: { bcs: string | null } | null }> | null }> | null } };
|
|
384
384
|
|
|
385
385
|
export type ExecuteTransactionMutationVariables = Exact<{
|
|
386
386
|
transactionDataBcs: string;
|
|
@@ -394,7 +394,7 @@ export type ExecuteTransactionMutationVariables = Exact<{
|
|
|
394
394
|
}>;
|
|
395
395
|
|
|
396
396
|
|
|
397
|
-
export type ExecuteTransactionMutation = { executeTransaction: { effects: { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null } | null } };
|
|
397
|
+
export type ExecuteTransactionMutation = { executeTransaction: { effects: { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, timestamp: string | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, checkpoint: { sequenceNumber: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null } | null } };
|
|
398
398
|
|
|
399
399
|
export type GetTransactionBlockQueryVariables = Exact<{
|
|
400
400
|
digest: string;
|
|
@@ -407,7 +407,7 @@ export type GetTransactionBlockQueryVariables = Exact<{
|
|
|
407
407
|
}>;
|
|
408
408
|
|
|
409
409
|
|
|
410
|
-
export type GetTransactionBlockQuery = { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null };
|
|
410
|
+
export type GetTransactionBlockQuery = { transaction: { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, timestamp: string | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, checkpoint: { sequenceNumber: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null } | null };
|
|
411
411
|
|
|
412
412
|
export type ListTransactionsQueryVariables = Exact<{
|
|
413
413
|
filter?: TransactionFilter | null | undefined;
|
|
@@ -424,9 +424,9 @@ export type ListTransactionsQueryVariables = Exact<{
|
|
|
424
424
|
}>;
|
|
425
425
|
|
|
426
426
|
|
|
427
|
-
export type ListTransactionsQuery = { transactions: { pageInfo: { hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null, endCursor: string | null }, nodes: Array<{ digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null }> } | null };
|
|
427
|
+
export type ListTransactionsQuery = { transactions: { pageInfo: { hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null, endCursor: string | null }, nodes: Array<{ digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, timestamp: string | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, checkpoint: { sequenceNumber: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null }> } | null };
|
|
428
428
|
|
|
429
|
-
export type Transaction_FieldsFragment = { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null };
|
|
429
|
+
export type Transaction_FieldsFragment = { digest: string, transactionJson?: unknown, transactionBcs?: string | null, signatures: Array<{ signatureBytes: string | null }>, effects: { status: ExecutionStatus | null, timestamp: string | null, effectsBcs?: string | null, effectsJson?: unknown, balanceChangesJson?: unknown, checkpoint: { sequenceNumber: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null, epoch: { epochId: number } | null, objectChanges?: { nodes: Array<{ address: string, outputState: { asMoveObject: { contents: { type: { repr: string } | null } | null } | null } | null }> } | null, events?: { pageInfo: { hasNextPage: boolean }, nodes: Array<{ transactionModule: { name: string, package: { address: string } | null } | null, sender: { address: string } | null, contents: { bcs: string | null, json: unknown, type: { repr: string } | null } | null }> } | null } | null };
|
|
430
430
|
|
|
431
431
|
export type ResolveTransactionQueryVariables = Exact<{
|
|
432
432
|
transaction: unknown;
|
|
@@ -596,6 +596,10 @@ export const Transaction_FieldsFragmentDoc = new TypedDocumentString(`
|
|
|
596
596
|
}
|
|
597
597
|
effects {
|
|
598
598
|
status
|
|
599
|
+
timestamp
|
|
600
|
+
checkpoint {
|
|
601
|
+
sequenceNumber
|
|
602
|
+
}
|
|
599
603
|
executionError {
|
|
600
604
|
message
|
|
601
605
|
abortCode
|
|
@@ -1068,6 +1072,10 @@ export const SimulateTransactionDocument = new TypedDocumentString(`
|
|
|
1068
1072
|
}
|
|
1069
1073
|
effects {
|
|
1070
1074
|
status
|
|
1075
|
+
timestamp
|
|
1076
|
+
checkpoint {
|
|
1077
|
+
sequenceNumber
|
|
1078
|
+
}
|
|
1071
1079
|
executionError {
|
|
1072
1080
|
message
|
|
1073
1081
|
abortCode
|
|
@@ -1152,6 +1160,10 @@ export const ExecuteTransactionDocument = new TypedDocumentString(`
|
|
|
1152
1160
|
}
|
|
1153
1161
|
effects {
|
|
1154
1162
|
status
|
|
1163
|
+
timestamp
|
|
1164
|
+
checkpoint {
|
|
1165
|
+
sequenceNumber
|
|
1166
|
+
}
|
|
1155
1167
|
executionError {
|
|
1156
1168
|
message
|
|
1157
1169
|
abortCode
|
|
@@ -1229,6 +1241,10 @@ export const GetTransactionBlockDocument = new TypedDocumentString(`
|
|
|
1229
1241
|
}
|
|
1230
1242
|
effects {
|
|
1231
1243
|
status
|
|
1244
|
+
timestamp
|
|
1245
|
+
checkpoint {
|
|
1246
|
+
sequenceNumber
|
|
1247
|
+
}
|
|
1232
1248
|
executionError {
|
|
1233
1249
|
message
|
|
1234
1250
|
abortCode
|
|
@@ -1320,6 +1336,10 @@ export const ListTransactionsDocument = new TypedDocumentString(`
|
|
|
1320
1336
|
}
|
|
1321
1337
|
effects {
|
|
1322
1338
|
status
|
|
1339
|
+
timestamp
|
|
1340
|
+
checkpoint {
|
|
1341
|
+
sequenceNumber
|
|
1342
|
+
}
|
|
1323
1343
|
executionError {
|
|
1324
1344
|
message
|
|
1325
1345
|
abortCode
|
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 = {},
|