@mysten/sui 2.20.3 → 2.20.4
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 +11 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +20 -20
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +4 -1
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/mvr.mjs +29 -7
- package/dist/client/mvr.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +8 -8
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +1 -1
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +4 -4
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +44 -27
- 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/transaction_execution_service.client.d.mts +4 -4
- package/dist/jsonRpc/client.d.mts +160 -0
- package/dist/jsonRpc/client.d.mts.map +1 -1
- package/dist/jsonRpc/client.mjs +142 -0
- package/dist/jsonRpc/client.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +80 -0
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +80 -0
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/jsonRpc/errors.d.mts +12 -0
- package/dist/jsonRpc/errors.d.mts.map +1 -1
- package/dist/jsonRpc/errors.mjs +12 -0
- package/dist/jsonRpc/errors.mjs.map +1 -1
- package/dist/jsonRpc/http-transport.d.mts +30 -0
- package/dist/jsonRpc/http-transport.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.mjs +16 -0
- package/dist/jsonRpc/http-transport.mjs.map +1 -1
- package/dist/jsonRpc/network.d.mts +4 -0
- package/dist/jsonRpc/network.d.mts.map +1 -1
- package/dist/jsonRpc/network.mjs +4 -0
- package/dist/jsonRpc/network.mjs.map +1 -1
- package/dist/jsonRpc/types/chain.d.mts +68 -0
- package/dist/jsonRpc/types/chain.d.mts.map +1 -1
- package/dist/jsonRpc/types/changes.d.mts +24 -0
- package/dist/jsonRpc/types/changes.d.mts.map +1 -1
- package/dist/jsonRpc/types/coins.d.mts +4 -0
- package/dist/jsonRpc/types/coins.d.mts.map +1 -1
- package/dist/jsonRpc/types/common.d.mts +4 -0
- package/dist/jsonRpc/types/common.d.mts.map +1 -1
- package/dist/jsonRpc/types/generated.d.mts +497 -16
- package/dist/jsonRpc/types/generated.d.mts.map +1 -1
- package/dist/jsonRpc/types/params.d.mts +289 -41
- package/dist/jsonRpc/types/params.d.mts.map +1 -1
- package/dist/transactions/Transaction.d.mts +9 -9
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/package.json +3 -3
- package/src/client/core.ts +1 -0
- package/src/client/mvr.ts +39 -6
- package/src/grpc/client.ts +10 -7
- package/src/grpc/core.ts +200 -134
- package/src/jsonRpc/client.ts +160 -0
- package/src/jsonRpc/core.ts +80 -0
- package/src/jsonRpc/errors.ts +12 -0
- package/src/jsonRpc/http-transport.ts +30 -0
- package/src/jsonRpc/network.ts +4 -0
- package/src/jsonRpc/types/chain.ts +68 -0
- package/src/jsonRpc/types/changes.ts +24 -0
- package/src/jsonRpc/types/coins.ts +4 -0
- package/src/jsonRpc/types/common.ts +4 -0
- package/src/jsonRpc/types/generated.ts +497 -16
- package/src/jsonRpc/types/params.ts +289 -41
- package/src/version.ts +1 -1
package/src/grpc/core.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import type { CoreClientOptions, SuiClientTypes } from '../client/index.js';
|
|
5
5
|
import { CoreClient, formatMoveAbortMessage, SimulationError } from '../client/index.js';
|
|
6
|
+
import { raceSignal } from '../client/mvr.js';
|
|
6
7
|
import type { SuiGrpcClient } from './client.js';
|
|
7
8
|
import type { Owner } from './proto/sui/rpc/v2/owner.js';
|
|
8
9
|
import { Owner_OwnerKind } from './proto/sui/rpc/v2/owner.js';
|
|
@@ -80,12 +81,15 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
for (const batch of batches) {
|
|
83
|
-
const response = await this.#client.ledgerService.batchGetObjects(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const response = await this.#client.ledgerService.batchGetObjects(
|
|
85
|
+
{
|
|
86
|
+
requests: batch.map((id) => ({ objectId: id })),
|
|
87
|
+
readMask: {
|
|
88
|
+
paths,
|
|
89
|
+
},
|
|
87
90
|
},
|
|
88
|
-
|
|
91
|
+
{ abort: options.signal },
|
|
92
|
+
);
|
|
89
93
|
|
|
90
94
|
results.push(
|
|
91
95
|
...response.response.objects.map((object): SuiClientTypes.Object<Include> | Error => {
|
|
@@ -160,17 +164,20 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
160
164
|
paths.push('display');
|
|
161
165
|
}
|
|
162
166
|
|
|
163
|
-
const response = await this.#client.stateService.listOwnedObjects(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
const response = await this.#client.stateService.listOwnedObjects(
|
|
168
|
+
{
|
|
169
|
+
owner: options.owner,
|
|
170
|
+
objectType: options.type
|
|
171
|
+
? (await this.mvr.resolveType({ type: options.type, signal: options.signal })).type
|
|
172
|
+
: undefined,
|
|
173
|
+
pageToken: options.cursor ? fromBase64(options.cursor) : undefined,
|
|
174
|
+
pageSize: options.limit,
|
|
175
|
+
readMask: {
|
|
176
|
+
paths,
|
|
177
|
+
},
|
|
172
178
|
},
|
|
173
|
-
|
|
179
|
+
{ abort: options.signal },
|
|
180
|
+
);
|
|
174
181
|
|
|
175
182
|
const objects = response.response.objects.map(
|
|
176
183
|
(object): SuiClientTypes.Object<Include> => ({
|
|
@@ -207,15 +214,18 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
207
214
|
const paths = ['owner', 'object_type', 'digest', 'version', 'object_id', 'balance'];
|
|
208
215
|
const coinType = options.coinType ?? SUI_TYPE_ARG;
|
|
209
216
|
|
|
210
|
-
const response = await this.#client.stateService.listOwnedObjects(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
const response = await this.#client.stateService.listOwnedObjects(
|
|
218
|
+
{
|
|
219
|
+
owner: options.owner,
|
|
220
|
+
objectType: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: coinType, signal: options.signal })).type}>`,
|
|
221
|
+
pageToken: options.cursor ? fromBase64(options.cursor) : undefined,
|
|
222
|
+
pageSize: options.limit,
|
|
223
|
+
readMask: {
|
|
224
|
+
paths,
|
|
225
|
+
},
|
|
217
226
|
},
|
|
218
|
-
|
|
227
|
+
{ abort: options.signal },
|
|
228
|
+
);
|
|
219
229
|
|
|
220
230
|
return {
|
|
221
231
|
objects: response.response.objects.map(
|
|
@@ -237,10 +247,13 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
237
247
|
options: SuiClientTypes.GetBalanceOptions,
|
|
238
248
|
): Promise<SuiClientTypes.GetBalanceResponse> {
|
|
239
249
|
const coinType = options.coinType ?? SUI_TYPE_ARG;
|
|
240
|
-
const result = await this.#client.stateService.getBalance(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
const result = await this.#client.stateService.getBalance(
|
|
251
|
+
{
|
|
252
|
+
owner: options.owner,
|
|
253
|
+
coinType: (await this.mvr.resolveType({ type: coinType, signal: options.signal })).type,
|
|
254
|
+
},
|
|
255
|
+
{ abort: options.signal },
|
|
256
|
+
);
|
|
244
257
|
|
|
245
258
|
return {
|
|
246
259
|
balance: {
|
|
@@ -255,14 +268,23 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
255
268
|
async getCoinMetadata(
|
|
256
269
|
options: SuiClientTypes.GetCoinMetadataOptions,
|
|
257
270
|
): Promise<SuiClientTypes.GetCoinMetadataResponse> {
|
|
258
|
-
const coinType = (
|
|
271
|
+
const coinType = (
|
|
272
|
+
await this.mvr.resolveType({ type: options.coinType, signal: options.signal })
|
|
273
|
+
).type;
|
|
259
274
|
|
|
260
275
|
let response;
|
|
261
276
|
try {
|
|
262
|
-
({ response } = await this.#client.stateService.getCoinInfo(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
({ response } = await this.#client.stateService.getCoinInfo(
|
|
278
|
+
{
|
|
279
|
+
coinType,
|
|
280
|
+
},
|
|
281
|
+
{ abort: options.signal },
|
|
282
|
+
));
|
|
283
|
+
} catch (error) {
|
|
284
|
+
// Don't swallow cancellation — only treat the coin as missing on real errors.
|
|
285
|
+
if (options.signal?.aborted) {
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
266
288
|
return { coinMetadata: null };
|
|
267
289
|
}
|
|
268
290
|
|
|
@@ -285,11 +307,14 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
285
307
|
async listBalances(
|
|
286
308
|
options: SuiClientTypes.ListBalancesOptions,
|
|
287
309
|
): Promise<SuiClientTypes.ListBalancesResponse> {
|
|
288
|
-
const result = await this.#client.stateService.listBalances(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
310
|
+
const result = await this.#client.stateService.listBalances(
|
|
311
|
+
{
|
|
312
|
+
owner: options.owner,
|
|
313
|
+
pageToken: options.cursor ? fromBase64(options.cursor) : undefined,
|
|
314
|
+
pageSize: options.limit,
|
|
315
|
+
},
|
|
316
|
+
{ abort: options.signal },
|
|
317
|
+
);
|
|
293
318
|
|
|
294
319
|
return {
|
|
295
320
|
hasNextPage: !!result.response.nextPageToken,
|
|
@@ -331,12 +356,15 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
331
356
|
paths.push('effects.changed_objects.object_id');
|
|
332
357
|
}
|
|
333
358
|
|
|
334
|
-
const { response } = await this.#client.ledgerService.getTransaction(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
359
|
+
const { response } = await this.#client.ledgerService.getTransaction(
|
|
360
|
+
{
|
|
361
|
+
digest: options.digest,
|
|
362
|
+
readMask: {
|
|
363
|
+
paths,
|
|
364
|
+
},
|
|
338
365
|
},
|
|
339
|
-
|
|
366
|
+
{ abort: options.signal },
|
|
367
|
+
);
|
|
340
368
|
|
|
341
369
|
if (!response.transaction) {
|
|
342
370
|
throw new Error(`Transaction ${options.digest} not found`);
|
|
@@ -373,24 +401,27 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
373
401
|
paths.push('effects.changed_objects.object_id');
|
|
374
402
|
}
|
|
375
403
|
|
|
376
|
-
const { response } = await this.#client.transactionExecutionService.executeTransaction(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
signatures: options.signatures.map((signature) => ({
|
|
383
|
-
bcs: {
|
|
384
|
-
value: fromBase64(signature),
|
|
404
|
+
const { response } = await this.#client.transactionExecutionService.executeTransaction(
|
|
405
|
+
{
|
|
406
|
+
transaction: {
|
|
407
|
+
bcs: {
|
|
408
|
+
value: options.transaction,
|
|
409
|
+
},
|
|
385
410
|
},
|
|
386
|
-
|
|
387
|
-
|
|
411
|
+
signatures: options.signatures.map((signature) => ({
|
|
412
|
+
bcs: {
|
|
413
|
+
value: fromBase64(signature),
|
|
414
|
+
},
|
|
415
|
+
signature: {
|
|
416
|
+
oneofKind: undefined,
|
|
417
|
+
},
|
|
418
|
+
})),
|
|
419
|
+
readMask: {
|
|
420
|
+
paths,
|
|
388
421
|
},
|
|
389
|
-
})),
|
|
390
|
-
readMask: {
|
|
391
|
-
paths,
|
|
392
422
|
},
|
|
393
|
-
|
|
423
|
+
{ abort: options.signal },
|
|
424
|
+
);
|
|
394
425
|
|
|
395
426
|
return parseTransaction(response.transaction!, options.include);
|
|
396
427
|
}
|
|
@@ -436,24 +467,27 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
436
467
|
await options.transaction.prepareForSerialization({ client: this });
|
|
437
468
|
}
|
|
438
469
|
|
|
439
|
-
const { response } = await this.#client.transactionExecutionService.simulateTransaction(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
470
|
+
const { response } = await this.#client.transactionExecutionService.simulateTransaction(
|
|
471
|
+
{
|
|
472
|
+
transaction:
|
|
473
|
+
options.transaction instanceof Uint8Array
|
|
474
|
+
? {
|
|
475
|
+
bcs: {
|
|
476
|
+
value: options.transaction,
|
|
477
|
+
},
|
|
478
|
+
}
|
|
479
|
+
: transactionToGrpcTransaction(options.transaction),
|
|
480
|
+
readMask: {
|
|
481
|
+
paths,
|
|
482
|
+
},
|
|
483
|
+
doGasSelection: false,
|
|
484
|
+
checks:
|
|
485
|
+
options.checksEnabled === false
|
|
486
|
+
? SimulateTransactionRequest_TransactionChecks.DISABLED
|
|
487
|
+
: SimulateTransactionRequest_TransactionChecks.ENABLED,
|
|
450
488
|
},
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
options.checksEnabled === false
|
|
454
|
-
? SimulateTransactionRequest_TransactionChecks.DISABLED
|
|
455
|
-
: SimulateTransactionRequest_TransactionChecks.ENABLED,
|
|
456
|
-
});
|
|
489
|
+
{ abort: options.signal },
|
|
490
|
+
);
|
|
457
491
|
|
|
458
492
|
const transactionResult = parseTransaction(response.transaction!, options.include);
|
|
459
493
|
|
|
@@ -486,22 +520,32 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
486
520
|
};
|
|
487
521
|
}
|
|
488
522
|
}
|
|
489
|
-
async getReferenceGasPrice(
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
523
|
+
async getReferenceGasPrice(
|
|
524
|
+
options?: SuiClientTypes.GetReferenceGasPriceOptions,
|
|
525
|
+
): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
|
|
526
|
+
const response = await this.#client.ledgerService.getEpoch(
|
|
527
|
+
{
|
|
528
|
+
readMask: {
|
|
529
|
+
paths: ['reference_gas_price'],
|
|
530
|
+
},
|
|
493
531
|
},
|
|
494
|
-
|
|
532
|
+
{ abort: options?.signal },
|
|
533
|
+
);
|
|
495
534
|
|
|
496
535
|
return {
|
|
497
536
|
referenceGasPrice: response.response.epoch?.referenceGasPrice?.toString() ?? '',
|
|
498
537
|
};
|
|
499
538
|
}
|
|
500
539
|
|
|
501
|
-
async getProtocolConfig(
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
540
|
+
async getProtocolConfig(
|
|
541
|
+
options?: SuiClientTypes.GetProtocolConfigOptions,
|
|
542
|
+
): Promise<SuiClientTypes.GetProtocolConfigResponse> {
|
|
543
|
+
const response = await this.#client.ledgerService.getEpoch(
|
|
544
|
+
{
|
|
545
|
+
readMask: { paths: ['protocol_config'] },
|
|
546
|
+
},
|
|
547
|
+
{ abort: options?.signal },
|
|
548
|
+
);
|
|
505
549
|
|
|
506
550
|
const protocolConfig = response.response.epoch?.protocolConfig;
|
|
507
551
|
if (!protocolConfig) {
|
|
@@ -525,26 +569,31 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
525
569
|
};
|
|
526
570
|
}
|
|
527
571
|
|
|
528
|
-
async getCurrentSystemState(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
572
|
+
async getCurrentSystemState(
|
|
573
|
+
options?: SuiClientTypes.GetCurrentSystemStateOptions,
|
|
574
|
+
): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
|
|
575
|
+
const response = await this.#client.ledgerService.getEpoch(
|
|
576
|
+
{
|
|
577
|
+
readMask: {
|
|
578
|
+
paths: [
|
|
579
|
+
'system_state.version',
|
|
580
|
+
'system_state.epoch',
|
|
581
|
+
'system_state.protocol_version',
|
|
582
|
+
'system_state.reference_gas_price',
|
|
583
|
+
'system_state.epoch_start_timestamp_ms',
|
|
584
|
+
'system_state.safe_mode',
|
|
585
|
+
'system_state.safe_mode_storage_rewards',
|
|
586
|
+
'system_state.safe_mode_computation_rewards',
|
|
587
|
+
'system_state.safe_mode_storage_rebates',
|
|
588
|
+
'system_state.safe_mode_non_refundable_storage_fee',
|
|
589
|
+
'system_state.parameters',
|
|
590
|
+
'system_state.storage_fund',
|
|
591
|
+
'system_state.stake_subsidy',
|
|
592
|
+
],
|
|
593
|
+
},
|
|
546
594
|
},
|
|
547
|
-
|
|
595
|
+
{ abort: options?.signal },
|
|
596
|
+
);
|
|
548
597
|
|
|
549
598
|
const epoch = response.response.epoch;
|
|
550
599
|
const systemState = epoch?.systemState;
|
|
@@ -624,22 +673,25 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
624
673
|
? bcs.byteVector().serialize(messageBytes).toBytes()
|
|
625
674
|
: messageBytes;
|
|
626
675
|
|
|
627
|
-
const { response } = await this.#client.signatureVerificationService.verifySignature(
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
signature: {
|
|
633
|
-
bcs: {
|
|
634
|
-
value: fromBase64(options.signature),
|
|
676
|
+
const { response } = await this.#client.signatureVerificationService.verifySignature(
|
|
677
|
+
{
|
|
678
|
+
message: {
|
|
679
|
+
name: options.intentScope,
|
|
680
|
+
value: messageValue,
|
|
635
681
|
},
|
|
636
682
|
signature: {
|
|
637
|
-
|
|
683
|
+
bcs: {
|
|
684
|
+
value: fromBase64(options.signature),
|
|
685
|
+
},
|
|
686
|
+
signature: {
|
|
687
|
+
oneofKind: undefined,
|
|
688
|
+
},
|
|
638
689
|
},
|
|
690
|
+
address: options.address,
|
|
691
|
+
jwks: [],
|
|
639
692
|
},
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
});
|
|
693
|
+
{ abort: options.signal },
|
|
694
|
+
);
|
|
643
695
|
|
|
644
696
|
return {
|
|
645
697
|
success: response.isValid ?? false,
|
|
@@ -652,9 +704,12 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
652
704
|
): Promise<SuiClientTypes.DefaultNameServiceNameResponse> {
|
|
653
705
|
const name =
|
|
654
706
|
(
|
|
655
|
-
await this.#client.nameService.reverseLookupName(
|
|
656
|
-
|
|
657
|
-
|
|
707
|
+
await this.#client.nameService.reverseLookupName(
|
|
708
|
+
{
|
|
709
|
+
address: options.address,
|
|
710
|
+
},
|
|
711
|
+
{ abort: options.signal },
|
|
712
|
+
)
|
|
658
713
|
).response.record?.name ?? null;
|
|
659
714
|
return {
|
|
660
715
|
data: {
|
|
@@ -666,13 +721,17 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
666
721
|
async getMoveFunction(
|
|
667
722
|
options: SuiClientTypes.GetMoveFunctionOptions,
|
|
668
723
|
): Promise<SuiClientTypes.GetMoveFunctionResponse> {
|
|
669
|
-
const resolvedPackageId = (
|
|
670
|
-
.package
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
724
|
+
const resolvedPackageId = (
|
|
725
|
+
await this.mvr.resolvePackage({ package: options.packageId, signal: options.signal })
|
|
726
|
+
).package;
|
|
727
|
+
const { response } = await this.#client.movePackageService.getFunction(
|
|
728
|
+
{
|
|
729
|
+
packageId: resolvedPackageId,
|
|
730
|
+
moduleName: options.moduleName,
|
|
731
|
+
name: options.name,
|
|
732
|
+
},
|
|
733
|
+
{ abort: options.signal },
|
|
734
|
+
);
|
|
676
735
|
|
|
677
736
|
let visibility: 'public' | 'private' | 'friend' | 'unknown' = 'unknown';
|
|
678
737
|
|
|
@@ -722,17 +781,24 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
722
781
|
}
|
|
723
782
|
|
|
724
783
|
async getChainIdentifier(
|
|
725
|
-
|
|
784
|
+
options?: SuiClientTypes.GetChainIdentifierOptions,
|
|
726
785
|
): Promise<SuiClientTypes.GetChainIdentifierResponse> {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
786
|
+
// The result is cached and shared across callers, so the underlying request must
|
|
787
|
+
// not carry any single caller's signal. Isolate cancellation per-caller instead.
|
|
788
|
+
return raceSignal(
|
|
789
|
+
Promise.resolve(
|
|
790
|
+
this.cache.read(['chainIdentifier'], async () => {
|
|
791
|
+
const { response } = await this.#client.ledgerService.getServiceInfo({});
|
|
792
|
+
if (!response.chainId) {
|
|
793
|
+
throw new Error('Chain identifier not found in service info');
|
|
794
|
+
}
|
|
795
|
+
return {
|
|
796
|
+
chainIdentifier: response.chainId,
|
|
797
|
+
};
|
|
798
|
+
}),
|
|
799
|
+
),
|
|
800
|
+
options?.signal,
|
|
801
|
+
);
|
|
736
802
|
}
|
|
737
803
|
|
|
738
804
|
resolveTransactionPlugin() {
|