@mysten/sui 2.24.0 → 2.26.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 +69 -0
- package/dist/bcs/bcs.d.mts +6 -6
- 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/errors.d.mts +31 -2
- package/dist/client/errors.d.mts.map +1 -1
- package/dist/client/errors.mjs +15 -13
- package/dist/client/errors.mjs.map +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.mjs +2 -2
- 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/cryptography/signature.d.mts +6 -6
- package/dist/graphql/client.d.mts +5 -1
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +15 -2
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +4 -4
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +61 -18
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +16 -0
- package/dist/grpc/client.d.mts +5 -1
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +14 -2
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +29 -12
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_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/grpc/proto/sui/rpc/v2/transaction_execution_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 +1 -1
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +73 -22
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +6 -6
- package/dist/transactions/data/v1.d.mts +220 -220
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.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 +150 -710
- package/docs/clients/executing.md +113 -0
- package/docs/clients/graphql.md +80 -70
- package/docs/clients/grpc.md +223 -208
- package/docs/clients/index.md +56 -67
- package/docs/clients/querying.md +539 -0
- package/docs/llms-index.md +6 -5
- package/docs/migrations/sui-2.0/json-rpc-migration.md +3 -1
- package/docs/transactions/signing-and-execution.md +8 -28
- package/package.json +1 -1
- package/src/client/core.ts +1 -0
- package/src/client/errors.ts +39 -23
- package/src/client/index.ts +9 -1
- package/src/client/mvr.ts +6 -0
- package/src/graphql/client.ts +29 -2
- package/src/graphql/core.ts +53 -16
- package/src/graphql/generated/schema.graphql +11 -1
- package/src/graphql/generated/tada-env.ts +20 -0
- package/src/grpc/client.ts +28 -2
- package/src/grpc/core.ts +90 -65
- package/src/jsonRpc/client.ts +15 -0
- package/src/jsonRpc/core.ts +102 -24
- package/src/version.ts +1 -1
- package/docs/clients/json-rpc.md +0 -243
package/src/client/errors.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { ObjectResponseError } from '../jsonRpc/index.js';
|
|
5
4
|
import type { SuiClientTypes } from './types.js';
|
|
6
5
|
|
|
7
6
|
export class SuiClientError extends Error {}
|
|
@@ -18,33 +17,50 @@ export class SimulationError extends SuiClientError {
|
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
export type ObjectErrorReason = 'notFound' | 'deleted' | 'unknown';
|
|
21
|
+
|
|
22
|
+
export interface ObjectErrorOptions {
|
|
23
|
+
/** A transport-neutral reason shared by all Core API clients. */
|
|
24
|
+
reason: ObjectErrorReason;
|
|
25
|
+
/** The requested object ID, when the lookup identifies one. */
|
|
26
|
+
objectId?: string;
|
|
27
|
+
/** The original transport error or response. */
|
|
28
|
+
cause?: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** An error returned for an individual object lookup. */
|
|
21
32
|
export class ObjectError extends SuiClientError {
|
|
33
|
+
/** The transport's error code. Use `reason` for transport-neutral handling. */
|
|
22
34
|
code: string;
|
|
35
|
+
/** A transport-neutral reason shared by all Core API clients. */
|
|
36
|
+
readonly reason: ObjectErrorReason;
|
|
37
|
+
/** The requested object ID, when the lookup identifies one. */
|
|
38
|
+
readonly objectId?: string;
|
|
23
39
|
|
|
24
|
-
constructor(code: string, message: string) {
|
|
25
|
-
super(message);
|
|
40
|
+
constructor(code: string, message: string, options?: ObjectErrorOptions) {
|
|
41
|
+
super(message, { cause: options?.cause });
|
|
26
42
|
this.code = code;
|
|
43
|
+
this.reason = options?.reason ?? 'unknown';
|
|
44
|
+
this.objectId = options?.objectId;
|
|
27
45
|
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type TransactionErrorReason = 'notFound';
|
|
49
|
+
|
|
50
|
+
const TRANSACTION_ERROR_MESSAGES: Record<TransactionErrorReason, (digest: string) => string> = {
|
|
51
|
+
notFound: (digest) => `Transaction ${digest} not found`,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** An error returned by a transaction lookup. */
|
|
55
|
+
export class TransactionError extends SuiClientError {
|
|
56
|
+
/** A transport-neutral reason shared by all Core API clients. */
|
|
57
|
+
readonly reason: TransactionErrorReason;
|
|
58
|
+
/** The requested transaction digest. */
|
|
59
|
+
readonly digest: string;
|
|
28
60
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case 'dynamicFieldNotFound':
|
|
34
|
-
return new ObjectError(
|
|
35
|
-
response.code,
|
|
36
|
-
`Dynamic field not found for object ${response.parent_object_id}`,
|
|
37
|
-
);
|
|
38
|
-
case 'deleted':
|
|
39
|
-
return new ObjectError(response.code, `Object ${response.object_id} has been deleted`);
|
|
40
|
-
case 'displayError':
|
|
41
|
-
return new ObjectError(response.code, `Display error: ${response.error}`);
|
|
42
|
-
case 'unknown':
|
|
43
|
-
default:
|
|
44
|
-
return new ObjectError(
|
|
45
|
-
response.code,
|
|
46
|
-
`Unknown error while loading object${objectId ? ` ${objectId}` : ''}`,
|
|
47
|
-
);
|
|
48
|
-
}
|
|
61
|
+
constructor(reason: TransactionErrorReason, digest: string, options?: { cause?: unknown }) {
|
|
62
|
+
super(TRANSACTION_ERROR_MESSAGES[reason](digest), options);
|
|
63
|
+
this.reason = reason;
|
|
64
|
+
this.digest = digest;
|
|
49
65
|
}
|
|
50
66
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -22,7 +22,15 @@ export {
|
|
|
22
22
|
type ClientWithCoreApi,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export {
|
|
25
|
+
export {
|
|
26
|
+
ObjectError,
|
|
27
|
+
SimulationError,
|
|
28
|
+
SuiClientError,
|
|
29
|
+
TransactionError,
|
|
30
|
+
type ObjectErrorOptions,
|
|
31
|
+
type ObjectErrorReason,
|
|
32
|
+
type TransactionErrorReason,
|
|
33
|
+
} from './errors.js';
|
|
26
34
|
|
|
27
35
|
export { ClientCache, type ClientCacheOptions } from './cache.js';
|
|
28
36
|
export { type NamedPackagesOverrides } from './mvr.js';
|
package/src/client/mvr.ts
CHANGED
|
@@ -401,6 +401,12 @@ export function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promis
|
|
|
401
401
|
return promise;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
+
// An `abort` event is not replayed for listeners added after the fact, so a signal that was
|
|
405
|
+
// already aborted would otherwise resolve normally.
|
|
406
|
+
if (signal.aborted) {
|
|
407
|
+
return Promise.reject(signal.reason);
|
|
408
|
+
}
|
|
409
|
+
|
|
404
410
|
return new Promise<T>((resolve, reject) => {
|
|
405
411
|
const onAbort = () => reject(signal.reason);
|
|
406
412
|
signal.addEventListener('abort', onAbort, { once: true });
|
package/src/graphql/client.ts
CHANGED
|
@@ -249,8 +249,28 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
|
|
|
249
249
|
return this.core.simulateTransaction(input);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
getReferenceGasPrice(
|
|
253
|
-
|
|
252
|
+
getReferenceGasPrice(
|
|
253
|
+
input?: SuiClientTypes.GetReferenceGasPriceOptions,
|
|
254
|
+
): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
|
|
255
|
+
return this.core.getReferenceGasPrice(input);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
getCurrentSystemState(
|
|
259
|
+
input?: SuiClientTypes.GetCurrentSystemStateOptions,
|
|
260
|
+
): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
|
|
261
|
+
return this.core.getCurrentSystemState(input);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
getProtocolConfig(
|
|
265
|
+
input?: SuiClientTypes.GetProtocolConfigOptions,
|
|
266
|
+
): Promise<SuiClientTypes.GetProtocolConfigResponse> {
|
|
267
|
+
return this.core.getProtocolConfig(input);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
getChainIdentifier(
|
|
271
|
+
input?: SuiClientTypes.GetChainIdentifierOptions,
|
|
272
|
+
): Promise<SuiClientTypes.GetChainIdentifierResponse> {
|
|
273
|
+
return this.core.getChainIdentifier(input);
|
|
254
274
|
}
|
|
255
275
|
|
|
256
276
|
async listDynamicFields<Include extends DynamicFieldInclude = {}>(
|
|
@@ -260,6 +280,7 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
|
|
|
260
280
|
|
|
261
281
|
const { data, errors } = await this.query({
|
|
262
282
|
query: GetDynamicFieldsDocument,
|
|
283
|
+
signal: input.signal,
|
|
263
284
|
variables: {
|
|
264
285
|
parentId: input.parentId,
|
|
265
286
|
first: input.limit,
|
|
@@ -338,6 +359,12 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
|
|
|
338
359
|
return this.core.getDynamicField(input);
|
|
339
360
|
}
|
|
340
361
|
|
|
362
|
+
getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(
|
|
363
|
+
input: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,
|
|
364
|
+
): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {
|
|
365
|
+
return this.core.getDynamicObjectField(input);
|
|
366
|
+
}
|
|
367
|
+
|
|
341
368
|
listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
342
369
|
input: SuiClientTypes.ListTransactionsOptions<Include>,
|
|
343
370
|
): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
|
package/src/graphql/core.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { CoreClient } from '../client/core.js';
|
|
5
|
+
import { raceSignal } from '../client/mvr.js';
|
|
5
6
|
import type { SuiClientTypes } from '../client/types.js';
|
|
6
7
|
import { SUI_TYPE_ARG } from '../utils/constants.js';
|
|
7
8
|
import type { GraphQLQueryOptions, SuiGraphQLClient } from './client.js';
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
VerifyZkLoginSignatureDocument,
|
|
38
39
|
ZkLoginIntentScope,
|
|
39
40
|
} from './generated/queries.js';
|
|
40
|
-
import { ObjectError, SimulationError } from '../client/errors.js';
|
|
41
|
+
import { ObjectError, SimulationError, TransactionError } from '../client/errors.js';
|
|
41
42
|
import { chunk, fromBase64, toBase64 } from '@mysten/utils';
|
|
42
43
|
import { normalizeStructTag, normalizeSuiAddress } from '../utils/sui-types.js';
|
|
43
44
|
import {
|
|
@@ -85,6 +86,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
85
86
|
>(
|
|
86
87
|
options: GraphQLQueryOptions<Result, Variables>,
|
|
87
88
|
getData?: (result: Result) => Data,
|
|
89
|
+
createMissingDataError?: () => Error,
|
|
88
90
|
): Promise<NonNullable<Data>> {
|
|
89
91
|
const { data, errors } = await this.#graphqlClient.query(options);
|
|
90
92
|
|
|
@@ -93,7 +95,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
93
95
|
const extractedData = data && (getData ? getData(data) : data);
|
|
94
96
|
|
|
95
97
|
if (extractedData == null) {
|
|
96
|
-
throw new Error('Missing response data');
|
|
98
|
+
throw createMissingDataError?.() ?? new Error('Missing response data');
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
return extractedData as NonNullable<Data>;
|
|
@@ -109,6 +111,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
109
111
|
const page = await this.#graphqlQuery(
|
|
110
112
|
{
|
|
111
113
|
query: MultiGetObjectsDocument,
|
|
114
|
+
signal: options.signal,
|
|
112
115
|
variables: {
|
|
113
116
|
objectKeys: batch.map((address) => ({ address })),
|
|
114
117
|
includeContent: options.include?.content ?? false,
|
|
@@ -122,11 +125,14 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
122
125
|
);
|
|
123
126
|
results.push(
|
|
124
127
|
...batch
|
|
125
|
-
.map((
|
|
128
|
+
.map((objectId) => ({ objectId, normalized: normalizeSuiAddress(objectId) }))
|
|
126
129
|
.map(
|
|
127
|
-
(
|
|
128
|
-
page.find((obj) => obj?.address ===
|
|
129
|
-
new ObjectError('notFound', `Object ${
|
|
130
|
+
({ objectId, normalized }) =>
|
|
131
|
+
page.find((obj) => obj?.address === normalized) ??
|
|
132
|
+
new ObjectError('notFound', `Object ${normalized} not found`, {
|
|
133
|
+
reason: 'notFound',
|
|
134
|
+
objectId,
|
|
135
|
+
}),
|
|
130
136
|
)
|
|
131
137
|
.map((obj) => {
|
|
132
138
|
if (obj instanceof ObjectError) {
|
|
@@ -187,12 +193,16 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
187
193
|
const objects = await this.#graphqlQuery(
|
|
188
194
|
{
|
|
189
195
|
query: GetOwnedObjectsDocument,
|
|
196
|
+
signal: options.signal,
|
|
190
197
|
variables: {
|
|
191
198
|
owner: options.owner,
|
|
192
199
|
limit: options.limit,
|
|
193
200
|
cursor: options.cursor,
|
|
194
201
|
filter: options.type
|
|
195
|
-
? {
|
|
202
|
+
? {
|
|
203
|
+
type: (await this.mvr.resolveType({ type: options.type, signal: options.signal }))
|
|
204
|
+
.type,
|
|
205
|
+
}
|
|
196
206
|
: undefined,
|
|
197
207
|
includeContent: options.include?.content ?? false,
|
|
198
208
|
includePreviousTransaction: options.include?.previousTransaction ?? false,
|
|
@@ -242,11 +252,12 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
242
252
|
const coins = await this.#graphqlQuery(
|
|
243
253
|
{
|
|
244
254
|
query: GetCoinsDocument,
|
|
255
|
+
signal: options.signal,
|
|
245
256
|
variables: {
|
|
246
257
|
owner: options.owner,
|
|
247
258
|
cursor: options.cursor,
|
|
248
259
|
first: options.limit,
|
|
249
|
-
type: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: coinType })).type}>`,
|
|
260
|
+
type: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: coinType, signal: options.signal })).type}>`,
|
|
250
261
|
},
|
|
251
262
|
},
|
|
252
263
|
(result) => result.address?.objects,
|
|
@@ -275,9 +286,10 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
275
286
|
const result = await this.#graphqlQuery(
|
|
276
287
|
{
|
|
277
288
|
query: GetBalanceDocument,
|
|
289
|
+
signal: options.signal,
|
|
278
290
|
variables: {
|
|
279
291
|
owner: options.owner,
|
|
280
|
-
coinType: (await this.mvr.resolveType({ type: coinType })).type,
|
|
292
|
+
coinType: (await this.mvr.resolveType({ type: coinType, signal: options.signal })).type,
|
|
281
293
|
},
|
|
282
294
|
},
|
|
283
295
|
(result) => result.address?.balance,
|
|
@@ -298,10 +310,13 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
298
310
|
async getCoinMetadata(
|
|
299
311
|
options: SuiClientTypes.GetCoinMetadataOptions,
|
|
300
312
|
): Promise<SuiClientTypes.GetCoinMetadataResponse> {
|
|
301
|
-
const coinType = (
|
|
313
|
+
const coinType = (
|
|
314
|
+
await this.mvr.resolveType({ type: options.coinType, signal: options.signal })
|
|
315
|
+
).type;
|
|
302
316
|
|
|
303
317
|
const { data, errors } = await this.#graphqlClient.query({
|
|
304
318
|
query: GetCoinMetadataDocument,
|
|
319
|
+
signal: options.signal,
|
|
305
320
|
variables: {
|
|
306
321
|
coinType,
|
|
307
322
|
},
|
|
@@ -331,6 +346,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
331
346
|
const balances = await this.#graphqlQuery(
|
|
332
347
|
{
|
|
333
348
|
query: GetAllBalancesDocument,
|
|
349
|
+
signal: options.signal,
|
|
334
350
|
variables: {
|
|
335
351
|
owner: options.owner,
|
|
336
352
|
limit: options.limit,
|
|
@@ -361,6 +377,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
361
377
|
const result = await this.#graphqlQuery(
|
|
362
378
|
{
|
|
363
379
|
query: GetTransactionBlockDocument,
|
|
380
|
+
signal: options.signal,
|
|
364
381
|
variables: {
|
|
365
382
|
digest: options.digest,
|
|
366
383
|
includeTransaction: options.include?.transaction ?? false,
|
|
@@ -372,6 +389,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
372
389
|
},
|
|
373
390
|
},
|
|
374
391
|
(result) => result.transaction,
|
|
392
|
+
() => new TransactionError('notFound', options.digest),
|
|
375
393
|
);
|
|
376
394
|
|
|
377
395
|
return parseTransaction(result, options.include);
|
|
@@ -382,6 +400,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
382
400
|
const result = await this.#graphqlQuery(
|
|
383
401
|
{
|
|
384
402
|
query: ExecuteTransactionDocument,
|
|
403
|
+
signal: options.signal,
|
|
385
404
|
variables: {
|
|
386
405
|
transactionDataBcs: toBase64(options.transaction),
|
|
387
406
|
signatures: options.signatures,
|
|
@@ -417,6 +436,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
417
436
|
const result = await this.#graphqlQuery(
|
|
418
437
|
{
|
|
419
438
|
query: SimulateTransactionDocument,
|
|
439
|
+
signal: options.signal,
|
|
420
440
|
variables: {
|
|
421
441
|
transaction:
|
|
422
442
|
options.transaction instanceof Uint8Array
|
|
@@ -470,10 +490,13 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
470
490
|
};
|
|
471
491
|
}
|
|
472
492
|
}
|
|
473
|
-
async getReferenceGasPrice(
|
|
493
|
+
async getReferenceGasPrice(
|
|
494
|
+
options?: SuiClientTypes.GetReferenceGasPriceOptions,
|
|
495
|
+
): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
|
|
474
496
|
const result = await this.#graphqlQuery(
|
|
475
497
|
{
|
|
476
498
|
query: GetReferenceGasPriceDocument,
|
|
499
|
+
signal: options?.signal,
|
|
477
500
|
},
|
|
478
501
|
(result) => result.epoch?.referenceGasPrice,
|
|
479
502
|
);
|
|
@@ -483,10 +506,13 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
483
506
|
};
|
|
484
507
|
}
|
|
485
508
|
|
|
486
|
-
async getProtocolConfig(
|
|
509
|
+
async getProtocolConfig(
|
|
510
|
+
options?: SuiClientTypes.GetProtocolConfigOptions,
|
|
511
|
+
): Promise<SuiClientTypes.GetProtocolConfigResponse> {
|
|
487
512
|
const result = await this.#graphqlQuery(
|
|
488
513
|
{
|
|
489
514
|
query: GetProtocolConfigDocument,
|
|
515
|
+
signal: options?.signal,
|
|
490
516
|
},
|
|
491
517
|
(result) => result.epoch?.protocolConfigs,
|
|
492
518
|
);
|
|
@@ -509,10 +535,13 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
509
535
|
};
|
|
510
536
|
}
|
|
511
537
|
|
|
512
|
-
async getCurrentSystemState(
|
|
538
|
+
async getCurrentSystemState(
|
|
539
|
+
options?: SuiClientTypes.GetCurrentSystemStateOptions,
|
|
540
|
+
): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
|
|
513
541
|
const result = await this.#graphqlQuery(
|
|
514
542
|
{
|
|
515
543
|
query: GetCurrentSystemStateDocument,
|
|
544
|
+
signal: options?.signal,
|
|
516
545
|
},
|
|
517
546
|
(result) => result.epoch,
|
|
518
547
|
);
|
|
@@ -744,6 +773,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
744
773
|
|
|
745
774
|
const { data } = await this.#graphqlClient.query({
|
|
746
775
|
query: VerifyZkLoginSignatureDocument,
|
|
776
|
+
signal: options.signal,
|
|
747
777
|
variables: {
|
|
748
778
|
bytes: options.bytes,
|
|
749
779
|
signature: options.signature,
|
|
@@ -797,8 +827,11 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
797
827
|
const moveFunction = await this.#graphqlQuery(
|
|
798
828
|
{
|
|
799
829
|
query: GetMoveFunctionDocument,
|
|
830
|
+
signal: options.signal,
|
|
800
831
|
variables: {
|
|
801
|
-
package: (
|
|
832
|
+
package: (
|
|
833
|
+
await this.mvr.resolvePackage({ package: options.packageId, signal: options.signal })
|
|
834
|
+
).package,
|
|
802
835
|
module: options.moduleName,
|
|
803
836
|
function: options.name,
|
|
804
837
|
},
|
|
@@ -856,9 +889,11 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
856
889
|
}
|
|
857
890
|
|
|
858
891
|
async getChainIdentifier(
|
|
859
|
-
|
|
892
|
+
options?: SuiClientTypes.GetChainIdentifierOptions,
|
|
860
893
|
): Promise<SuiClientTypes.GetChainIdentifierResponse> {
|
|
861
|
-
|
|
894
|
+
// The result is cached and shared across callers, so the underlying request must
|
|
895
|
+
// not carry any single caller's signal. Isolate cancellation per-caller instead.
|
|
896
|
+
const cached = this.cache.read(['chainIdentifier'], async () => {
|
|
862
897
|
const checkpoint = await this.#graphqlQuery(
|
|
863
898
|
{
|
|
864
899
|
query: GetChainIdentifierDocument,
|
|
@@ -872,6 +907,8 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
872
907
|
chainIdentifier: checkpoint.digest,
|
|
873
908
|
};
|
|
874
909
|
});
|
|
910
|
+
|
|
911
|
+
return raceSignal(Promise.resolve(cached), options?.signal);
|
|
875
912
|
}
|
|
876
913
|
|
|
877
914
|
resolveTransactionPlugin() {
|
|
@@ -1225,7 +1225,7 @@ type EndOfEpochTransaction {
|
|
|
1225
1225
|
transactions(first: Int, after: String, last: Int, before: String): EndOfEpochTransactionKindConnection
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
|
-
union EndOfEpochTransactionKind = ChangeEpochTransaction | AuthenticatorStateCreateTransaction | AuthenticatorStateExpireTransaction | RandomnessStateCreateTransaction | CoinDenyListStateCreateTransaction | StoreExecutionTimeObservationsTransaction | BridgeStateCreateTransaction | BridgeCommitteeInitTransaction | AccumulatorRootCreateTransaction | CoinRegistryCreateTransaction | DisplayRegistryCreateTransaction | AddressAliasStateCreateTransaction | WriteAccumulatorStorageCostTransaction
|
|
1228
|
+
union EndOfEpochTransactionKind = ChangeEpochTransaction | AuthenticatorStateCreateTransaction | AuthenticatorStateExpireTransaction | RandomnessStateCreateTransaction | CoinDenyListStateCreateTransaction | StoreExecutionTimeObservationsTransaction | BridgeStateCreateTransaction | BridgeCommitteeInitTransaction | AccumulatorRootCreateTransaction | CoinRegistryCreateTransaction | DisplayRegistryCreateTransaction | AddressAliasStateCreateTransaction | WriteAccumulatorStorageCostTransaction | ForwardingAddressRegistryCreateTransaction
|
|
1229
1229
|
|
|
1230
1230
|
type EndOfEpochTransactionKindConnection {
|
|
1231
1231
|
"""
|
|
@@ -1578,6 +1578,16 @@ type FeatureFlag {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
|
|
1580
1580
|
|
|
1581
|
+
"""
|
|
1582
|
+
System transaction for creating the forwarding address registry.
|
|
1583
|
+
"""
|
|
1584
|
+
type ForwardingAddressRegistryCreateTransaction {
|
|
1585
|
+
"""
|
|
1586
|
+
A workaround to define an empty variant of a GraphQL union.
|
|
1587
|
+
"""
|
|
1588
|
+
_: Boolean
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1581
1591
|
"""
|
|
1582
1592
|
Access to the gas inputs, after they have been smashed into one coin. The gas coin can only be used by reference, except for with `TransferObjectsTransaction` that can accept it by value.
|
|
1583
1593
|
"""
|
|
@@ -3697,6 +3697,10 @@ const introspection = {
|
|
|
3697
3697
|
"kind": "OBJECT",
|
|
3698
3698
|
"name": "DisplayRegistryCreateTransaction"
|
|
3699
3699
|
},
|
|
3700
|
+
{
|
|
3701
|
+
"kind": "OBJECT",
|
|
3702
|
+
"name": "ForwardingAddressRegistryCreateTransaction"
|
|
3703
|
+
},
|
|
3700
3704
|
{
|
|
3701
3705
|
"kind": "OBJECT",
|
|
3702
3706
|
"name": "RandomnessStateCreateTransaction"
|
|
@@ -4551,6 +4555,22 @@ const introspection = {
|
|
|
4551
4555
|
],
|
|
4552
4556
|
"interfaces": []
|
|
4553
4557
|
},
|
|
4558
|
+
{
|
|
4559
|
+
"kind": "OBJECT",
|
|
4560
|
+
"name": "ForwardingAddressRegistryCreateTransaction",
|
|
4561
|
+
"fields": [
|
|
4562
|
+
{
|
|
4563
|
+
"name": "_",
|
|
4564
|
+
"type": {
|
|
4565
|
+
"kind": "SCALAR",
|
|
4566
|
+
"name": "Boolean"
|
|
4567
|
+
},
|
|
4568
|
+
"args": [],
|
|
4569
|
+
"isDeprecated": false
|
|
4570
|
+
}
|
|
4571
|
+
],
|
|
4572
|
+
"interfaces": []
|
|
4573
|
+
},
|
|
4554
4574
|
{
|
|
4555
4575
|
"kind": "OBJECT",
|
|
4556
4576
|
"name": "GasCoin",
|
package/src/grpc/client.ts
CHANGED
|
@@ -246,8 +246,28 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
|
|
|
246
246
|
return this.core.simulateTransaction(input) as Promise<GrpcSimulateTransactionResult<Include>>;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
getReferenceGasPrice(
|
|
250
|
-
|
|
249
|
+
getReferenceGasPrice(
|
|
250
|
+
input?: SuiClientTypes.GetReferenceGasPriceOptions,
|
|
251
|
+
): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
|
|
252
|
+
return this.core.getReferenceGasPrice(input);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
getCurrentSystemState(
|
|
256
|
+
input?: SuiClientTypes.GetCurrentSystemStateOptions,
|
|
257
|
+
): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
|
|
258
|
+
return this.core.getCurrentSystemState(input);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getProtocolConfig(
|
|
262
|
+
input?: SuiClientTypes.GetProtocolConfigOptions,
|
|
263
|
+
): Promise<SuiClientTypes.GetProtocolConfigResponse> {
|
|
264
|
+
return this.core.getProtocolConfig(input);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
getChainIdentifier(
|
|
268
|
+
input?: SuiClientTypes.GetChainIdentifierOptions,
|
|
269
|
+
): Promise<SuiClientTypes.GetChainIdentifierResponse> {
|
|
270
|
+
return this.core.getChainIdentifier(input);
|
|
251
271
|
}
|
|
252
272
|
|
|
253
273
|
async listDynamicFields<Include extends DynamicFieldInclude = {}>(
|
|
@@ -305,6 +325,12 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
|
|
|
305
325
|
return this.core.getDynamicField(input);
|
|
306
326
|
}
|
|
307
327
|
|
|
328
|
+
getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(
|
|
329
|
+
input: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,
|
|
330
|
+
): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {
|
|
331
|
+
return this.core.getDynamicObjectField(input);
|
|
332
|
+
}
|
|
333
|
+
|
|
308
334
|
listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
309
335
|
input: SuiClientTypes.ListTransactionsOptions<Include>,
|
|
310
336
|
): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
|