@mysten/sui 2.22.1 → 2.23.1
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 +38 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/bcs.d.mts.map +1 -1
- package/dist/bcs/bcs.mjs +1 -19
- package/dist/bcs/bcs.mjs.map +1 -1
- package/dist/bcs/index.d.mts +3812 -906
- package/dist/bcs/index.d.mts.map +1 -1
- package/dist/bcs/index.mjs +2 -1
- package/dist/bcs/index.mjs.map +1 -1
- package/dist/bcs/transactions.mjs +147 -0
- package/dist/bcs/transactions.mjs.map +1 -0
- package/dist/client/core-resolver.mjs +2 -1
- package/dist/client/core-resolver.mjs.map +1 -1
- package/dist/client/core.d.mts +2 -0
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/query-filters.mjs +119 -0
- package/dist/client/query-filters.mjs.map +1 -0
- package/dist/client/types.d.mts +166 -1
- package/dist/client/types.d.mts.map +1 -1
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +13 -1
- package/dist/client/utils.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/graphql/client.d.mts +15 -2
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +6 -0
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +5 -1
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +85 -3
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +137 -1
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +108 -0
- package/dist/graphql/index.d.mts +2 -2
- package/dist/grpc/client.d.mts +11 -0
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +6 -0
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +5 -1
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +100 -2
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/filters.mjs +45 -0
- package/dist/grpc/filters.mjs.map +1 -0
- package/dist/grpc/proto/sui/rpc/v2/event.d.mts +31 -0
- package/dist/grpc/proto/sui/rpc/v2/event.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/event.mjs +30 -0
- package/dist/grpc/proto/sui/rpc/v2/event.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/executed_transaction.d.mts +7 -0
- package/dist/grpc/proto/sui/rpc/v2/executed_transaction.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/executed_transaction.mjs +8 -0
- package/dist/grpc/proto/sui/rpc/v2/executed_transaction.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/filter.d.mts +423 -0
- package/dist/grpc/proto/sui/rpc/v2/filter.d.mts.map +1 -0
- package/dist/grpc/proto/sui/rpc/v2/filter.mjs +297 -0
- package/dist/grpc/proto/sui/rpc/v2/filter.mjs.map +1 -0
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +62 -6
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.mjs +37 -0
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts +293 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs +241 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs.map +1 -1
- 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/protocol_config.d.mts +15 -2
- package/dist/grpc/proto/sui/rpc/v2/protocol_config.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/protocol_config.mjs +11 -0
- package/dist/grpc/proto/sui/rpc/v2/protocol_config.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts +211 -0
- package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts.map +1 -0
- package/dist/grpc/proto/sui/rpc/v2/query_options.mjs +163 -0
- package/dist/grpc/proto/sui/rpc/v2/query_options.mjs.map +1 -0
- 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 +105 -23
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs +56 -9
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.d.mts +148 -8
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.mjs +109 -8
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/grpc/proto/types.d.mts +5 -3
- package/dist/grpc/proto/types.mjs +33 -2
- package/dist/grpc/proto/types.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +10 -0
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +85 -2
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +9 -9
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/intents/CoinWithBalance.mjs +14 -18
- package/dist/transactions/intents/CoinWithBalance.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/docs/clients/core.md +115 -1
- package/docs/clients/grpc.md +68 -0
- package/docs/migrations/sui-2.0/json-rpc-migration.md +104 -101
- package/package.json +2 -2
- package/src/bcs/bcs.ts +0 -27
- package/src/bcs/index.ts +7 -5
- package/src/bcs/transactions.ts +226 -0
- package/src/client/core-resolver.ts +5 -1
- package/src/client/core.ts +8 -0
- package/src/client/query-filters.ts +195 -0
- package/src/client/types.ts +186 -1
- package/src/client/utils.ts +13 -0
- package/src/graphql/client.ts +25 -1
- package/src/graphql/core.ts +143 -3
- package/src/graphql/generated/queries.ts +226 -0
- package/src/graphql/generated/schema.graphql +75 -0
- package/src/graphql/generated/tada-env.ts +133 -0
- package/src/graphql/index.ts +1 -0
- package/src/graphql/queries/listEvents.graphql +40 -0
- package/src/graphql/queries/transactions.graphql +26 -0
- package/src/grpc/client.ts +19 -0
- package/src/grpc/core.ts +187 -3
- package/src/grpc/filters.ts +68 -0
- package/src/grpc/proto/sui/rpc/v2/event.ts +49 -0
- package/src/grpc/proto/sui/rpc/v2/executed_transaction.ts +15 -0
- package/src/grpc/proto/sui/rpc/v2/filter.ts +589 -0
- package/src/grpc/proto/sui/rpc/v2/ledger_service.client.ts +111 -0
- package/src/grpc/proto/sui/rpc/v2/ledger_service.ts +406 -0
- package/src/grpc/proto/sui/rpc/v2/protocol_config.ts +22 -2
- package/src/grpc/proto/sui/rpc/v2/query_options.ts +255 -0
- package/src/grpc/proto/sui/rpc/v2/subscription_service.client.ts +136 -18
- package/src/grpc/proto/sui/rpc/v2/subscription_service.ts +187 -7
- package/src/grpc/proto/types.ts +2 -0
- package/src/jsonRpc/core.ts +136 -2
- package/src/transactions/intents/CoinWithBalance.ts +41 -41
- package/src/version.ts +1 -1
package/src/grpc/client.ts
CHANGED
|
@@ -127,6 +127,15 @@ export interface GrpcSimulateTransactionOptions<
|
|
|
127
127
|
Include extends GrpcSimulateTransactionInclude = {},
|
|
128
128
|
> extends SuiClientTypes.SimulateTransactionOptions<Include> {
|
|
129
129
|
include?: Include & GrpcSimulateTransactionInclude;
|
|
130
|
+
/**
|
|
131
|
+
* Overrides whether the server selects gas payment during simulation.
|
|
132
|
+
*
|
|
133
|
+
* When not set, gas selection is enabled only when the transaction's gas payment is explicitly
|
|
134
|
+
* set to an empty list (`[]`), which indicates gas is paid from the sender's address balance.
|
|
135
|
+
* Transactions with gas coins set are simulated as-is, and transactions without a gas payment
|
|
136
|
+
* are simulated with a mocked gas coin.
|
|
137
|
+
*/
|
|
138
|
+
doGasSelection?: boolean;
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
export class SuiGrpcClient extends BaseClient implements SuiClientTypes.TransportMethods {
|
|
@@ -296,6 +305,16 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
|
|
|
296
305
|
return this.core.getDynamicField(input);
|
|
297
306
|
}
|
|
298
307
|
|
|
308
|
+
listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
309
|
+
input: SuiClientTypes.ListTransactionsOptions<Include>,
|
|
310
|
+
): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
|
|
311
|
+
return this.core.listTransactions(input);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
listEvents(input: SuiClientTypes.ListEventsOptions): Promise<SuiClientTypes.ListEventsResponse> {
|
|
315
|
+
return this.core.listEvents(input);
|
|
316
|
+
}
|
|
317
|
+
|
|
299
318
|
getMoveFunction(
|
|
300
319
|
input: SuiClientTypes.GetMoveFunctionOptions,
|
|
301
320
|
): Promise<SuiClientTypes.GetMoveFunctionResponse> {
|
package/src/grpc/core.ts
CHANGED
|
@@ -44,12 +44,23 @@ import {
|
|
|
44
44
|
grpcTransactionToTransactionData,
|
|
45
45
|
} from '../client/transaction-resolver.js';
|
|
46
46
|
import { setAddressBalanceTransactionExpirationFromSimulatedEpoch } from '../client/address-balance-transaction-expiration.js';
|
|
47
|
+
import { transactionBytesHaveEmptyGasPayment } from '../client/utils.js';
|
|
47
48
|
import { Value } from './proto/google/protobuf/struct.js';
|
|
48
49
|
import { ExecutedTransaction } from './proto/sui/rpc/v2/executed_transaction.js';
|
|
49
50
|
import {
|
|
50
51
|
SimulateTransactionRequest_TransactionChecks,
|
|
51
52
|
SimulateTransactionResponse,
|
|
52
53
|
} from './proto/sui/rpc/v2/transaction_execution_service.js';
|
|
54
|
+
import type { QueryEnd, QueryOptions } from './proto/sui/rpc/v2/query_options.js';
|
|
55
|
+
import { Ordering, QueryEndReason } from './proto/sui/rpc/v2/query_options.js';
|
|
56
|
+
import type { ResolvedPagination } from '../client/query-filters.js';
|
|
57
|
+
import {
|
|
58
|
+
resolveEventFilter,
|
|
59
|
+
resolvePagination,
|
|
60
|
+
resolveTransactionFilter,
|
|
61
|
+
validateTransactionQuery,
|
|
62
|
+
} from '../client/query-filters.js';
|
|
63
|
+
import { toGrpcEventFilter, toGrpcTransactionFilter } from './filters.js';
|
|
53
64
|
|
|
54
65
|
export interface GrpcCoreClientOptions extends CoreClientOptions {
|
|
55
66
|
client: SuiGrpcClient;
|
|
@@ -387,8 +398,9 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
387
398
|
);
|
|
388
399
|
}
|
|
389
400
|
async simulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(
|
|
390
|
-
options: SuiClientTypes.SimulateTransactionOptions<Include
|
|
401
|
+
options: SuiClientTypes.SimulateTransactionOptions<Include> & { doGasSelection?: boolean },
|
|
391
402
|
): Promise<SuiClientTypes.SimulateTransactionResult<Include>> {
|
|
403
|
+
// The simulated transaction is nested one level deeper in the response
|
|
392
404
|
const paths = transactionReadMaskPaths(options.include, 'transaction.');
|
|
393
405
|
if (options.include?.commandResults) {
|
|
394
406
|
paths.push('command_outputs');
|
|
@@ -398,6 +410,15 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
398
410
|
await options.transaction.prepareForSerialization({ client: this });
|
|
399
411
|
}
|
|
400
412
|
|
|
413
|
+
// A gas payment explicitly set to an empty list means gas is paid from the sender's
|
|
414
|
+
// address balance, so the server needs to perform gas selection rather than simulating
|
|
415
|
+
// with a mocked gas coin.
|
|
416
|
+
const doGasSelection =
|
|
417
|
+
options.doGasSelection ??
|
|
418
|
+
(options.transaction instanceof Uint8Array
|
|
419
|
+
? transactionBytesHaveEmptyGasPayment(options.transaction)
|
|
420
|
+
: options.transaction.getData().gasData.payment?.length === 0);
|
|
421
|
+
|
|
401
422
|
const { response } = await this.#client.transactionExecutionService.simulateTransaction(
|
|
402
423
|
{
|
|
403
424
|
transaction:
|
|
@@ -411,7 +432,7 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
411
432
|
readMask: {
|
|
412
433
|
paths,
|
|
413
434
|
},
|
|
414
|
-
doGasSelection
|
|
435
|
+
doGasSelection,
|
|
415
436
|
checks:
|
|
416
437
|
options.checksEnabled === false
|
|
417
438
|
? SimulateTransactionRequest_TransactionChecks.DISABLED
|
|
@@ -567,6 +588,158 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
567
588
|
return this.#client.listDynamicFields(options);
|
|
568
589
|
}
|
|
569
590
|
|
|
591
|
+
async listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
592
|
+
options: SuiClientTypes.ListTransactionsOptions<Include>,
|
|
593
|
+
): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
|
|
594
|
+
const paths = transactionReadMaskPaths(options.include);
|
|
595
|
+
|
|
596
|
+
const filter = options.filter
|
|
597
|
+
? await resolveTransactionFilter(this.mvr, options.filter, options.signal)
|
|
598
|
+
: undefined;
|
|
599
|
+
const pagination = resolvePagination(options);
|
|
600
|
+
validateTransactionQuery(filter, pagination);
|
|
601
|
+
|
|
602
|
+
const call = this.#client.ledgerService.listTransactions(
|
|
603
|
+
{
|
|
604
|
+
readMask: { paths },
|
|
605
|
+
filter: filter && toGrpcTransactionFilter(filter),
|
|
606
|
+
// Request one extra item as lookahead: the server reports its item limit as reached
|
|
607
|
+
// without scanning past it, so an exact-limit final page is otherwise
|
|
608
|
+
// indistinguishable from one with more results
|
|
609
|
+
options: toGrpcQueryOptions(pagination, pagination.limit + 1),
|
|
610
|
+
},
|
|
611
|
+
{ abort: options.signal },
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
const transactions: SuiClientTypes.TransactionResult<Include>[] = [];
|
|
615
|
+
let startCursor: string | null = null;
|
|
616
|
+
let endCursor: string | null = null;
|
|
617
|
+
let frontier: string | null = null;
|
|
618
|
+
let end: QueryEnd | undefined;
|
|
619
|
+
let sawLookaheadItem = false;
|
|
620
|
+
|
|
621
|
+
for await (const frame of call.responses) {
|
|
622
|
+
if (frame.watermark?.cursor) {
|
|
623
|
+
frontier = toBase64(frame.watermark.cursor);
|
|
624
|
+
}
|
|
625
|
+
if (frame.transaction) {
|
|
626
|
+
if (transactions.length >= pagination.limit) {
|
|
627
|
+
sawLookaheadItem = true;
|
|
628
|
+
} else {
|
|
629
|
+
startCursor ??= frontier;
|
|
630
|
+
endCursor = frontier;
|
|
631
|
+
transactions.push(
|
|
632
|
+
parseGrpcTransactionResponse(frame.transaction, { include: options.include }),
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if (frame.end) {
|
|
637
|
+
end = frame.end;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// ITEM_LIMIT without the lookahead item means the server clamped the requested limit to
|
|
642
|
+
// its own maximum, so the filled page is still evidence of a possible next page
|
|
643
|
+
const hasNextPage =
|
|
644
|
+
sawLookaheadItem ||
|
|
645
|
+
end?.reason === QueryEndReason.SCAN_LIMIT ||
|
|
646
|
+
end?.reason === QueryEndReason.ITEM_LIMIT;
|
|
647
|
+
|
|
648
|
+
return {
|
|
649
|
+
transactions,
|
|
650
|
+
hasNextPage,
|
|
651
|
+
startCursor,
|
|
652
|
+
// Scans that stopped early without filling the page continue from the scan frontier
|
|
653
|
+
// (so already-scanned positions are not revisited), full pages continue after the last
|
|
654
|
+
// returned item, and terminal pages have no positions to continue from
|
|
655
|
+
endCursor: sawLookaheadItem ? endCursor : hasNextPage ? (frontier ?? endCursor) : endCursor,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
async listEvents(
|
|
660
|
+
options: SuiClientTypes.ListEventsOptions,
|
|
661
|
+
): Promise<SuiClientTypes.ListEventsResponse> {
|
|
662
|
+
const pagination = resolvePagination(options);
|
|
663
|
+
const call = this.#client.ledgerService.listEvents(
|
|
664
|
+
{
|
|
665
|
+
readMask: {
|
|
666
|
+
paths: [
|
|
667
|
+
'package_id',
|
|
668
|
+
'module',
|
|
669
|
+
'sender',
|
|
670
|
+
'event_type',
|
|
671
|
+
'contents',
|
|
672
|
+
'json',
|
|
673
|
+
'checkpoint',
|
|
674
|
+
'transaction_digest',
|
|
675
|
+
'event_index',
|
|
676
|
+
],
|
|
677
|
+
},
|
|
678
|
+
filter: options.filter
|
|
679
|
+
? toGrpcEventFilter(await resolveEventFilter(this.mvr, options.filter, options.signal))
|
|
680
|
+
: undefined,
|
|
681
|
+
// Request one extra item as lookahead: the server reports its item limit as reached
|
|
682
|
+
// without scanning past it, so an exact-limit final page is otherwise
|
|
683
|
+
// indistinguishable from one with more results
|
|
684
|
+
options: toGrpcQueryOptions(pagination, pagination.limit + 1),
|
|
685
|
+
},
|
|
686
|
+
{ abort: options.signal },
|
|
687
|
+
);
|
|
688
|
+
|
|
689
|
+
const events: SuiClientTypes.EventEntry[] = [];
|
|
690
|
+
let startCursor: string | null = null;
|
|
691
|
+
let endCursor: string | null = null;
|
|
692
|
+
let frontier: string | null = null;
|
|
693
|
+
let end: QueryEnd | undefined;
|
|
694
|
+
let sawLookaheadItem = false;
|
|
695
|
+
|
|
696
|
+
for await (const frame of call.responses) {
|
|
697
|
+
if (frame.watermark?.cursor) {
|
|
698
|
+
frontier = toBase64(frame.watermark.cursor);
|
|
699
|
+
}
|
|
700
|
+
if (frame.event) {
|
|
701
|
+
if (events.length >= pagination.limit) {
|
|
702
|
+
sawLookaheadItem = true;
|
|
703
|
+
} else {
|
|
704
|
+
startCursor ??= frontier;
|
|
705
|
+
endCursor = frontier;
|
|
706
|
+
const event = frame.event;
|
|
707
|
+
events.push({
|
|
708
|
+
packageId: normalizeSuiAddress(event.packageId!),
|
|
709
|
+
module: event.module!,
|
|
710
|
+
sender: normalizeSuiAddress(event.sender!),
|
|
711
|
+
eventType: normalizeStructTag(event.eventType!),
|
|
712
|
+
bcs: event.contents?.value ?? new Uint8Array(),
|
|
713
|
+
json: event.json ? (Value.toJson(event.json) as Record<string, unknown>) : null,
|
|
714
|
+
checkpoint: event.checkpoint?.toString() ?? null,
|
|
715
|
+
transactionDigest: event.transactionDigest!,
|
|
716
|
+
eventIndex: event.eventIndex!,
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if (frame.end) {
|
|
721
|
+
end = frame.end;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// ITEM_LIMIT without the lookahead item means the server clamped the requested limit to
|
|
726
|
+
// its own maximum, so the filled page is still evidence of a possible next page
|
|
727
|
+
const hasNextPage =
|
|
728
|
+
sawLookaheadItem ||
|
|
729
|
+
end?.reason === QueryEndReason.SCAN_LIMIT ||
|
|
730
|
+
end?.reason === QueryEndReason.ITEM_LIMIT;
|
|
731
|
+
|
|
732
|
+
return {
|
|
733
|
+
events,
|
|
734
|
+
hasNextPage,
|
|
735
|
+
startCursor,
|
|
736
|
+
// Scans that stopped early without filling the page continue from the scan frontier
|
|
737
|
+
// (so already-scanned positions are not revisited), full pages continue after the last
|
|
738
|
+
// returned item, and terminal pages have no positions to continue from
|
|
739
|
+
endCursor: sawLookaheadItem ? endCursor : hasNextPage ? (frontier ?? endCursor) : endCursor,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
|
|
570
743
|
async verifyZkLoginSignature(
|
|
571
744
|
options: SuiClientTypes.VerifyZkLoginSignatureOptions,
|
|
572
745
|
): Promise<SuiClientTypes.ZkLoginVerifyResponse> {
|
|
@@ -787,11 +960,21 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
787
960
|
}
|
|
788
961
|
}
|
|
789
962
|
|
|
963
|
+
function toGrpcQueryOptions(pagination: ResolvedPagination, limit: number): QueryOptions {
|
|
964
|
+
return {
|
|
965
|
+
limit,
|
|
966
|
+
ordering: pagination.descending ? Ordering.DESCENDING : Ordering.ASCENDING,
|
|
967
|
+
after: pagination.after ? fromBase64(pagination.after) : undefined,
|
|
968
|
+
before: pagination.before ? fromBase64(pagination.before) : undefined,
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
|
|
790
972
|
function transactionReadMaskPaths(
|
|
791
973
|
include: SuiClientTypes.TransactionInclude | undefined,
|
|
792
974
|
prefix = '',
|
|
793
|
-
) {
|
|
975
|
+
): string[] {
|
|
794
976
|
const paths = ['digest', 'transaction.digest', 'signatures', 'effects.status'];
|
|
977
|
+
|
|
795
978
|
if (include?.transaction) {
|
|
796
979
|
paths.push(
|
|
797
980
|
'transaction.sender',
|
|
@@ -813,6 +996,7 @@ function transactionReadMaskPaths(
|
|
|
813
996
|
paths.push('events');
|
|
814
997
|
}
|
|
815
998
|
if (include?.objectTypes) {
|
|
999
|
+
// Use effects.changed_objects to match JSON-RPC behavior (which uses objectChanges)
|
|
816
1000
|
paths.push('effects.changed_objects.object_type');
|
|
817
1001
|
paths.push('effects.changed_objects.object_id');
|
|
818
1002
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { ResolvedEventFilter, ResolvedTransactionFilter } from '../client/query-filters.js';
|
|
5
|
+
import type { EventFilter, TransactionFilter } from './proto/sui/rpc/v2/filter.js';
|
|
6
|
+
|
|
7
|
+
export function toGrpcTransactionFilter(filter: ResolvedTransactionFilter): TransactionFilter {
|
|
8
|
+
return {
|
|
9
|
+
terms: [
|
|
10
|
+
{
|
|
11
|
+
literals: [
|
|
12
|
+
filter.$kind === 'sender'
|
|
13
|
+
? {
|
|
14
|
+
negated: false,
|
|
15
|
+
predicate: { oneofKind: 'sender', sender: { address: filter.sender } },
|
|
16
|
+
}
|
|
17
|
+
: {
|
|
18
|
+
negated: false,
|
|
19
|
+
predicate: {
|
|
20
|
+
oneofKind: 'moveCall',
|
|
21
|
+
moveCall: {
|
|
22
|
+
function: [filter.package, filter.module, filter.function]
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
.join('::'),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function toGrpcEventFilter(filter: ResolvedEventFilter): EventFilter {
|
|
35
|
+
return {
|
|
36
|
+
terms: [
|
|
37
|
+
{
|
|
38
|
+
literals: [
|
|
39
|
+
filter.$kind === 'sender'
|
|
40
|
+
? {
|
|
41
|
+
negated: false,
|
|
42
|
+
predicate: { oneofKind: 'sender', sender: { address: filter.sender } },
|
|
43
|
+
}
|
|
44
|
+
: filter.$kind === 'emitModule'
|
|
45
|
+
? {
|
|
46
|
+
negated: false,
|
|
47
|
+
predicate: {
|
|
48
|
+
oneofKind: 'emitModule',
|
|
49
|
+
emitModule: { module: `${filter.package}::${filter.module}` },
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
: {
|
|
53
|
+
negated: false,
|
|
54
|
+
predicate: {
|
|
55
|
+
oneofKind: 'eventType',
|
|
56
|
+
eventType: {
|
|
57
|
+
eventType:
|
|
58
|
+
filter.$kind === 'eventTypeModule'
|
|
59
|
+
? `${filter.package}::${filter.module}`
|
|
60
|
+
: filter.eventType,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -81,6 +81,37 @@ export interface Event {
|
|
|
81
81
|
* @generated from protobuf field: optional google.protobuf.Value json = 6;
|
|
82
82
|
*/
|
|
83
83
|
json?: Value;
|
|
84
|
+
/**
|
|
85
|
+
* The sequence number of the checkpoint that includes the transaction
|
|
86
|
+
* that emitted this event. Populated when the event is delivered on its
|
|
87
|
+
* own (for example via `LedgerService.ListEvents`); left unset when the
|
|
88
|
+
* event is carried inside its transaction's `events` list, where the
|
|
89
|
+
* enclosing `ExecutedTransaction` already provides this context.
|
|
90
|
+
*
|
|
91
|
+
* @generated from protobuf field: optional uint64 checkpoint = 7;
|
|
92
|
+
*/
|
|
93
|
+
checkpoint?: bigint;
|
|
94
|
+
/**
|
|
95
|
+
* The digest of the transaction that emitted this event.
|
|
96
|
+
*
|
|
97
|
+
* @generated from protobuf field: optional string transaction_digest = 8;
|
|
98
|
+
*/
|
|
99
|
+
transactionDigest?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Zero-based position of the emitting transaction within its containing
|
|
102
|
+
* checkpoint. For clients verifying authenticated event streams this
|
|
103
|
+
* index is part of the BCS-encoded `EventCommitment` leaf used to
|
|
104
|
+
* construct the per-checkpoint merkle root.
|
|
105
|
+
*
|
|
106
|
+
* @generated from protobuf field: optional uint64 transaction_index = 9;
|
|
107
|
+
*/
|
|
108
|
+
transactionIndex?: bigint;
|
|
109
|
+
/**
|
|
110
|
+
* Zero-based index of this event within its transaction's event list.
|
|
111
|
+
*
|
|
112
|
+
* @generated from protobuf field: optional uint32 event_index = 10;
|
|
113
|
+
*/
|
|
114
|
+
eventIndex?: number;
|
|
84
115
|
}
|
|
85
116
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
86
117
|
class TransactionEvents$Type extends MessageType<TransactionEvents> {
|
|
@@ -106,6 +137,24 @@ class Event$Type extends MessageType<Event> {
|
|
|
106
137
|
{ no: 4, name: 'event_type', kind: 'scalar', opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
107
138
|
{ no: 5, name: 'contents', kind: 'message', T: () => Bcs },
|
|
108
139
|
{ no: 6, name: 'json', kind: 'message', T: () => Value },
|
|
140
|
+
{
|
|
141
|
+
no: 7,
|
|
142
|
+
name: 'checkpoint',
|
|
143
|
+
kind: 'scalar',
|
|
144
|
+
opt: true,
|
|
145
|
+
T: 4 /*ScalarType.UINT64*/,
|
|
146
|
+
L: 0 /*LongType.BIGINT*/,
|
|
147
|
+
},
|
|
148
|
+
{ no: 8, name: 'transaction_digest', kind: 'scalar', opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
149
|
+
{
|
|
150
|
+
no: 9,
|
|
151
|
+
name: 'transaction_index',
|
|
152
|
+
kind: 'scalar',
|
|
153
|
+
opt: true,
|
|
154
|
+
T: 4 /*ScalarType.UINT64*/,
|
|
155
|
+
L: 0 /*LongType.BIGINT*/,
|
|
156
|
+
},
|
|
157
|
+
{ no: 10, name: 'event_index', kind: 'scalar', opt: true, T: 13 /*ScalarType.UINT32*/ },
|
|
109
158
|
]);
|
|
110
159
|
}
|
|
111
160
|
}
|
|
@@ -80,6 +80,13 @@ export interface ExecutedTransaction {
|
|
|
80
80
|
* @generated from protobuf field: optional sui.rpc.v2.ObjectSet objects = 9;
|
|
81
81
|
*/
|
|
82
82
|
objects?: ObjectSet;
|
|
83
|
+
/**
|
|
84
|
+
* Zero-based position of this transaction within the checkpoint that
|
|
85
|
+
* includes it.
|
|
86
|
+
*
|
|
87
|
+
* @generated from protobuf field: optional uint64 transaction_index = 10;
|
|
88
|
+
*/
|
|
89
|
+
transactionIndex?: bigint;
|
|
83
90
|
}
|
|
84
91
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
85
92
|
class ExecutedTransaction$Type extends MessageType<ExecutedTransaction> {
|
|
@@ -113,6 +120,14 @@ class ExecutedTransaction$Type extends MessageType<ExecutedTransaction> {
|
|
|
113
120
|
T: () => BalanceChange,
|
|
114
121
|
},
|
|
115
122
|
{ no: 9, name: 'objects', kind: 'message', T: () => ObjectSet },
|
|
123
|
+
{
|
|
124
|
+
no: 10,
|
|
125
|
+
name: 'transaction_index',
|
|
126
|
+
kind: 'scalar',
|
|
127
|
+
opt: true,
|
|
128
|
+
T: 4 /*ScalarType.UINT64*/,
|
|
129
|
+
L: 0 /*LongType.BIGINT*/,
|
|
130
|
+
},
|
|
116
131
|
]);
|
|
117
132
|
}
|
|
118
133
|
}
|