@mysten/sui 2.21.0 → 2.22.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mysten/sui.js
2
2
 
3
+ ## 2.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 899d9e3: Add gRPC client transaction results that include protobuf JSON with
8
+ `include: { protoJson: true }`.
9
+
3
10
  ## 2.21.0
4
11
 
5
12
  ### Minor Changes
@@ -1,21 +1,21 @@
1
1
  import { TypeTag as TypeTag$1 } from "./types.mjs";
2
- import * as _mysten_bcs830 from "@mysten/bcs";
2
+ import * as _mysten_bcs817 from "@mysten/bcs";
3
3
  import { BcsType } from "@mysten/bcs";
4
4
 
5
5
  //#region src/bcs/bcs.d.ts
6
6
  declare const TypeTag: BcsType<string, string | TypeTag$1, string>;
7
- declare function IntentMessage<T extends BcsType<any>>(T: T): _mysten_bcs830.BcsStruct<{
8
- intent: _mysten_bcs830.BcsStruct<{
9
- scope: _mysten_bcs830.BcsEnum<{
7
+ declare function IntentMessage<T extends BcsType<any>>(T: T): _mysten_bcs817.BcsStruct<{
8
+ intent: _mysten_bcs817.BcsStruct<{
9
+ scope: _mysten_bcs817.BcsEnum<{
10
10
  TransactionData: null;
11
11
  TransactionEffects: null;
12
12
  CheckpointSummary: null;
13
13
  PersonalMessage: null;
14
14
  }, "IntentScope">;
15
- version: _mysten_bcs830.BcsEnum<{
15
+ version: _mysten_bcs817.BcsEnum<{
16
16
  V0: null;
17
17
  }, "IntentVersion">;
18
- appId: _mysten_bcs830.BcsEnum<{
18
+ appId: _mysten_bcs817.BcsEnum<{
19
19
  Sui: null;
20
20
  }, "AppId">;
21
21
  }, string>;
@@ -545,7 +545,7 @@ declare const suiBcs: {
545
545
  version: string;
546
546
  digest: string;
547
547
  };
548
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
548
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
549
549
  FundsWithdrawal: {
550
550
  reservation: {
551
551
  MaxAmountU64: string;
@@ -560,7 +560,7 @@ declare const suiBcs: {
560
560
  Sponsor: true;
561
561
  }, "Sender" | "Sponsor">;
562
562
  };
563
- }, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
563
+ }, "Pure" | "Object" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
564
564
  Pure: {
565
565
  bytes: string | Uint8Array<ArrayBufferLike>;
566
566
  };
@@ -793,7 +793,7 @@ declare const suiBcs: {
793
793
  TransactionEffects: true;
794
794
  CheckpointSummary: true;
795
795
  PersonalMessage: true;
796
- }, "TransactionEffects" | "TransactionData" | "CheckpointSummary" | "PersonalMessage">;
796
+ }, "TransactionData" | "TransactionEffects" | "CheckpointSummary" | "PersonalMessage">;
797
797
  version: {
798
798
  V0: true;
799
799
  $kind: "V0";
@@ -827,7 +827,7 @@ declare const suiBcs: {
827
827
  version: string;
828
828
  digest: string;
829
829
  };
830
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
830
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
831
831
  FundsWithdrawal: {
832
832
  reservation: {
833
833
  MaxAmountU64: string;
@@ -842,7 +842,7 @@ declare const suiBcs: {
842
842
  Sponsor: true;
843
843
  }, "Sender" | "Sponsor">;
844
844
  };
845
- }, "Object" | "Pure" | "FundsWithdrawal">[];
845
+ }, "Pure" | "Object" | "FundsWithdrawal">[];
846
846
  commands: _mysten_bcs0.EnumOutputShapeWithKeys<{
847
847
  MoveCall: {
848
848
  package: string;
@@ -950,7 +950,7 @@ declare const suiBcs: {
950
950
  chain: string;
951
951
  nonce: number;
952
952
  };
953
- }, "Epoch" | "None" | "ValidDuring">;
953
+ }, "None" | "Epoch" | "ValidDuring">;
954
954
  };
955
955
  $kind: "V1";
956
956
  };
@@ -1193,7 +1193,7 @@ declare const suiBcs: {
1193
1193
  version: string;
1194
1194
  digest: string;
1195
1195
  };
1196
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
1196
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
1197
1197
  FundsWithdrawal: {
1198
1198
  reservation: {
1199
1199
  MaxAmountU64: string;
@@ -1208,7 +1208,7 @@ declare const suiBcs: {
1208
1208
  Sponsor: true;
1209
1209
  }, "Sender" | "Sponsor">;
1210
1210
  };
1211
- }, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1211
+ }, "Pure" | "Object" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1212
1212
  Pure: {
1213
1213
  bytes: string | Uint8Array<ArrayBufferLike>;
1214
1214
  };
@@ -1508,7 +1508,7 @@ declare const suiBcs: {
1508
1508
  version: string;
1509
1509
  digest: string;
1510
1510
  };
1511
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
1511
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
1512
1512
  FundsWithdrawal: {
1513
1513
  reservation: {
1514
1514
  MaxAmountU64: string;
@@ -1523,7 +1523,7 @@ declare const suiBcs: {
1523
1523
  Sponsor: true;
1524
1524
  }, "Sender" | "Sponsor">;
1525
1525
  };
1526
- }, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1526
+ }, "Pure" | "Object" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1527
1527
  Pure: {
1528
1528
  bytes: string | Uint8Array<ArrayBufferLike>;
1529
1529
  };
@@ -1799,7 +1799,7 @@ declare const suiBcs: {
1799
1799
  version: string;
1800
1800
  digest: string;
1801
1801
  };
1802
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
1802
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
1803
1803
  FundsWithdrawal: {
1804
1804
  reservation: {
1805
1805
  MaxAmountU64: string;
@@ -1814,7 +1814,7 @@ declare const suiBcs: {
1814
1814
  Sponsor: true;
1815
1815
  }, "Sender" | "Sponsor">;
1816
1816
  };
1817
- }, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1817
+ }, "Pure" | "Object" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
1818
1818
  Pure: {
1819
1819
  bytes: string | Uint8Array<ArrayBufferLike>;
1820
1820
  };
@@ -2271,7 +2271,7 @@ declare const suiBcs: {
2271
2271
  startVersion: string;
2272
2272
  owner: string;
2273
2273
  };
2274
- }, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
2274
+ }, "AddressOwner" | "ObjectOwner" | "Shared" | "Immutable" | "ConsensusAddressOwner">][], Iterable<readonly [{
2275
2275
  objectId: string | Uint8Array<ArrayBufferLike>;
2276
2276
  version: string | number | bigint;
2277
2277
  digest: string;
@@ -2304,7 +2304,7 @@ declare const suiBcs: {
2304
2304
  startVersion: string;
2305
2305
  owner: string;
2306
2306
  };
2307
- }, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
2307
+ }, "AddressOwner" | "ObjectOwner" | "Shared" | "Immutable" | "ConsensusAddressOwner">][], Iterable<readonly [{
2308
2308
  objectId: string | Uint8Array<ArrayBufferLike>;
2309
2309
  version: string | number | bigint;
2310
2310
  digest: string;
@@ -2337,7 +2337,7 @@ declare const suiBcs: {
2337
2337
  startVersion: string;
2338
2338
  owner: string;
2339
2339
  };
2340
- }, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
2340
+ }, "AddressOwner" | "ObjectOwner" | "Shared" | "Immutable" | "ConsensusAddressOwner">][], Iterable<readonly [{
2341
2341
  objectId: string | Uint8Array<ArrayBufferLike>;
2342
2342
  version: string | number | bigint;
2343
2343
  digest: string;
@@ -2604,7 +2604,7 @@ declare const suiBcs: {
2604
2604
  startVersion: string;
2605
2605
  owner: string;
2606
2606
  };
2607
- }, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
2607
+ }, "AddressOwner" | "ObjectOwner" | "Shared" | "Immutable" | "ConsensusAddressOwner">];
2608
2608
  }, "NotExist" | "Exist">;
2609
2609
  outputState: _mysten_bcs0.EnumOutputShapeWithKeys<{
2610
2610
  NotExist: true;
@@ -2619,7 +2619,7 @@ declare const suiBcs: {
2619
2619
  startVersion: string;
2620
2620
  owner: string;
2621
2621
  };
2622
- }, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
2622
+ }, "AddressOwner" | "ObjectOwner" | "Shared" | "Immutable" | "ConsensusAddressOwner">];
2623
2623
  PackageWrite: [string, string];
2624
2624
  AccumulatorWriteV1: {
2625
2625
  address: {
@@ -2705,7 +2705,7 @@ declare const suiBcs: {
2705
2705
  ReadConsensusStreamEnded: string;
2706
2706
  Cancelled: string;
2707
2707
  PerEpochConfig: true;
2708
- }, "MutateConsensusStreamEnded" | "PerEpochConfig" | "ReadConsensusStreamEnded" | "ReadOnlyRoot" | "Cancelled">][], Iterable<readonly [string | Uint8Array<ArrayBufferLike>, _mysten_bcs0.EnumInputShape<{
2708
+ }, "ReadOnlyRoot" | "MutateConsensusStreamEnded" | "ReadConsensusStreamEnded" | "Cancelled" | "PerEpochConfig">][], Iterable<readonly [string | Uint8Array<ArrayBufferLike>, _mysten_bcs0.EnumInputShape<{
2709
2709
  ReadOnlyRoot: readonly [string | number | bigint, string];
2710
2710
  MutateConsensusStreamEnded: string | number | bigint;
2711
2711
  ReadConsensusStreamEnded: string | number | bigint;
@@ -2751,7 +2751,7 @@ declare const suiBcs: {
2751
2751
  version: string;
2752
2752
  digest: string;
2753
2753
  };
2754
- }, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
2754
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
2755
2755
  FundsWithdrawal: {
2756
2756
  reservation: {
2757
2757
  MaxAmountU64: string;
@@ -2766,7 +2766,7 @@ declare const suiBcs: {
2766
2766
  Sponsor: true;
2767
2767
  }, "Sender" | "Sponsor">;
2768
2768
  };
2769
- }, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
2769
+ }, "Pure" | "Object" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
2770
2770
  Pure: {
2771
2771
  bytes: string | Uint8Array<ArrayBufferLike>;
2772
2772
  };
@@ -30,6 +30,12 @@ declare function parseSerializedSignature(serializedSignature: string): {
30
30
  clientDataJson: string;
31
31
  userSignature: Uint8Array<ArrayBuffer>;
32
32
  publicKey: Uint8Array<ArrayBuffer>;
33
+ } | {
34
+ serializedSignature: string;
35
+ signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
36
+ signature: Uint8Array<ArrayBuffer>;
37
+ publicKey: Uint8Array<ArrayBuffer>;
38
+ bytes: Uint8Array<ArrayBuffer>;
33
39
  } | {
34
40
  serializedSignature: string;
35
41
  signatureScheme: "ZkLogin";
@@ -54,12 +60,6 @@ declare function parseSerializedSignature(serializedSignature: string): {
54
60
  };
55
61
  signature: Uint8Array<ArrayBufferLike>;
56
62
  publicKey: Uint8Array<ArrayBuffer>;
57
- } | {
58
- serializedSignature: string;
59
- signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
60
- signature: Uint8Array<ArrayBuffer>;
61
- publicKey: Uint8Array<ArrayBuffer>;
62
- bytes: Uint8Array<ArrayBuffer>;
63
63
  } | {
64
64
  serializedSignature: string;
65
65
  signatureScheme: "MultiSig";
@@ -3,6 +3,8 @@ import { TransactionPlugin } from "../transactions/resolve.mjs";
3
3
  import "../transactions/index.mjs";
4
4
  import { BaseClient } from "../client/client.mjs";
5
5
  import "../client/index.mjs";
6
+ import { ExecutedTransaction } from "./proto/sui/rpc/v2/executed_transaction.mjs";
7
+ import { SimulateTransactionResponse } from "./proto/sui/rpc/v2/transaction_execution_service.mjs";
6
8
  import { TransactionExecutionServiceClient } from "./proto/sui/rpc/v2/transaction_execution_service.client.mjs";
7
9
  import { LedgerServiceClient } from "./proto/sui/rpc/v2/ledger_service.client.mjs";
8
10
  import { MovePackageServiceClient } from "./proto/sui/rpc/v2/move_package_service.client.mjs";
@@ -40,6 +42,44 @@ interface ListDynamicFieldsWithValueResponse<Include extends DynamicFieldInclude
40
42
  cursor: string | null;
41
43
  dynamicFields: DynamicFieldEntryWithValue<Include>[];
42
44
  }
45
+ interface GrpcTransactionInclude extends SuiClientTypes.TransactionInclude {
46
+ /** Include the parsed protobuf JSON value for the gRPC transaction response. */
47
+ protoJson?: boolean;
48
+ }
49
+ interface GrpcSimulateTransactionInclude extends SuiClientTypes.SimulateTransactionInclude {
50
+ /** Include the parsed protobuf JSON value for the gRPC simulation response. */
51
+ protoJson?: boolean;
52
+ }
53
+ type GrpcTransactionProtoJson = ReturnType<typeof ExecutedTransaction.toJson>;
54
+ type GrpcSimulateTransactionProtoJson = ReturnType<typeof SimulateTransactionResponse.toJson>;
55
+ type ProtoJson<Include extends {
56
+ protoJson?: boolean;
57
+ }, Json> = Include['protoJson'] extends true ? Json : undefined;
58
+ type GrpcTransactionResult<Include extends GrpcTransactionInclude = {}> = SuiClientTypes.TransactionResult<Include> & {
59
+ protoJson: ProtoJson<Include, GrpcTransactionProtoJson>;
60
+ };
61
+ type GrpcSimulateTransactionResult<Include extends GrpcSimulateTransactionInclude = {}> = SuiClientTypes.SimulateTransactionResult<Include> & {
62
+ protoJson: ProtoJson<Include, GrpcSimulateTransactionProtoJson>;
63
+ };
64
+ interface GrpcGetTransactionOptions<Include extends GrpcTransactionInclude = {}> extends SuiClientTypes.GetTransactionOptions<Include> {
65
+ include?: Include & GrpcTransactionInclude;
66
+ }
67
+ interface GrpcWaitForTransactionByDigest<Include extends GrpcTransactionInclude = {}> extends SuiClientTypes.WaitForTransactionByDigest<Include> {
68
+ include?: Include & GrpcTransactionInclude;
69
+ }
70
+ interface GrpcWaitForTransactionByResult<Include extends GrpcTransactionInclude = {}> extends SuiClientTypes.WaitForTransactionByResult<Include> {
71
+ include?: Include & GrpcTransactionInclude;
72
+ }
73
+ type GrpcWaitForTransactionOptions<Include extends GrpcTransactionInclude = {}> = GrpcWaitForTransactionByDigest<Include> | GrpcWaitForTransactionByResult<Include>;
74
+ interface GrpcExecuteTransactionOptions<Include extends GrpcTransactionInclude = {}> extends SuiClientTypes.ExecuteTransactionOptions<Include> {
75
+ include?: Include & GrpcTransactionInclude;
76
+ }
77
+ interface GrpcSignAndExecuteTransactionOptions<Include extends GrpcTransactionInclude = {}> extends SuiClientTypes.SignAndExecuteTransactionOptions<Include> {
78
+ include?: Include & GrpcTransactionInclude;
79
+ }
80
+ interface GrpcSimulateTransactionOptions<Include extends GrpcSimulateTransactionInclude = {}> extends SuiClientTypes.SimulateTransactionOptions<Include> {
81
+ include?: Include & GrpcSimulateTransactionInclude;
82
+ }
43
83
  declare class SuiGrpcClient extends BaseClient implements SuiClientTypes.TransportMethods {
44
84
  [SUI_CLIENT_BRAND]: boolean;
45
85
  core: GrpcCoreClient;
@@ -60,11 +100,11 @@ declare class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpo
60
100
  getBalance(input: SuiClientTypes.GetBalanceOptions): Promise<SuiClientTypes.GetBalanceResponse>;
61
101
  listBalances(input: SuiClientTypes.ListBalancesOptions): Promise<SuiClientTypes.ListBalancesResponse>;
62
102
  getCoinMetadata(input: SuiClientTypes.GetCoinMetadataOptions): Promise<SuiClientTypes.GetCoinMetadataResponse>;
63
- getTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(input: SuiClientTypes.GetTransactionOptions<Include>): Promise<SuiClientTypes.TransactionResult<Include>>;
64
- executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(input: SuiClientTypes.ExecuteTransactionOptions<Include>): Promise<SuiClientTypes.TransactionResult<Include>>;
65
- signAndExecuteTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(input: SuiClientTypes.SignAndExecuteTransactionOptions<Include>): Promise<SuiClientTypes.TransactionResult<Include>>;
66
- waitForTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(input: SuiClientTypes.WaitForTransactionOptions<Include>): Promise<SuiClientTypes.TransactionResult<Include>>;
67
- simulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(input: SuiClientTypes.SimulateTransactionOptions<Include>): Promise<SuiClientTypes.SimulateTransactionResult<Include>>;
103
+ getTransaction<Include extends GrpcTransactionInclude = {}>(input: GrpcGetTransactionOptions<Include>): Promise<GrpcTransactionResult<Include>>;
104
+ executeTransaction<Include extends GrpcTransactionInclude = {}>(input: GrpcExecuteTransactionOptions<Include>): Promise<GrpcTransactionResult<Include>>;
105
+ signAndExecuteTransaction<Include extends GrpcTransactionInclude = {}>(input: GrpcSignAndExecuteTransactionOptions<Include>): Promise<GrpcTransactionResult<Include>>;
106
+ waitForTransaction<Include extends GrpcTransactionInclude = {}>(input: GrpcWaitForTransactionOptions<Include>): Promise<GrpcTransactionResult<Include>>;
107
+ simulateTransaction<Include extends GrpcSimulateTransactionInclude = {}>(input: GrpcSimulateTransactionOptions<Include>): Promise<GrpcSimulateTransactionResult<Include>>;
68
108
  getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse>;
69
109
  listDynamicFields<Include extends DynamicFieldInclude = {}>(input: SuiClientTypes.ListDynamicFieldsOptions & {
70
110
  include?: Include & DynamicFieldInclude;
@@ -76,5 +116,5 @@ declare class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpo
76
116
  defaultNameServiceName(input: SuiClientTypes.DefaultNameServiceNameOptions): Promise<SuiClientTypes.DefaultNameServiceNameResponse>;
77
117
  }
78
118
  //#endregion
79
- export { SuiGrpcClient, SuiGrpcClientOptions, isSuiGrpcClient };
119
+ export { GrpcExecuteTransactionOptions, GrpcGetTransactionOptions, GrpcSignAndExecuteTransactionOptions, GrpcSimulateTransactionInclude, GrpcSimulateTransactionOptions, GrpcSimulateTransactionProtoJson, GrpcSimulateTransactionResult, GrpcTransactionInclude, GrpcTransactionProtoJson, GrpcTransactionResult, GrpcWaitForTransactionOptions, SuiGrpcClient, SuiGrpcClientOptions, isSuiGrpcClient };
80
120
  //# sourceMappingURL=client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../../src/grpc/client.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAsBU,uBAAA,SAAgC,cAAA;EACzC,SAAA;AAAA;AAAA,KAGW,oBAAA;EACX,OAAA,EAAS,cAAA,CAAe,OAAA;EACxB,GAAA,GAAM,cAAA,CAAe,UAAA;AAAA;EAGnB,SAAA,EAAW,YAAA;AAAA,IAEX,uBAAA;AAAA,cAGG,gBAAA;AAAA,iBAEU,eAAA,CAAgB,MAAA,YAAkB,MAAA,IAAU,aAAA;AAAA,UAM3C,mBAAA;EAChB,KAAA;AAAA;AAAA,KAGW,0BAAA,iBAA2C,mBAAA,SACtD,cAAA,CAAe,iBAAA;EACd,KAAA,EAAO,OAAA;IAAkB,KAAA;EAAA,IAAgB,cAAA,CAAe,iBAAA;AAAA;AAAA,UAGzC,kCAAA,iBAAmD,mBAAA;EACnE,WAAA;EACA,MAAA;EACA,aAAA,EAAe,0BAAA,CAA2B,OAAA;AAAA;AAAA,cAG9B,aAAA,SAAsB,UAAA,YAAsB,cAAA,CAAe,gBAAA;EAAA,CAclE,gBAAA;EAbL,IAAA,EAAM,cAAA;EAAA,IACF,GAAA,CAAA,GAAO,cAAA,CAAe,UAAA;EAG1B,2BAAA,EAA6B,iCAAA;EAC7B,aAAA,EAAe,mBAAA;EACf,YAAA,EAAc,kBAAA;EACd,mBAAA,EAAqB,yBAAA;EACrB,kBAAA,EAAoB,wBAAA;EACpB,4BAAA,EAA8B,kCAAA;EAC9B,WAAA,EAAa,iBAAA;EACb,cAAA,EAAgB,oBAAA;cAMJ,OAAA,EAAS,oBAAA;EAsBrB,UAAA,iBAA2B,cAAA,CAAe,aA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AA,GACpB,OAAA,CAAQ,cAAA,CAAe,uBAAA;EAI1B,eAAA,CACC,KAAA,EAAO,cAAA,CAAe,sBAAA,GACpB,OAAA,CAAQ,cAAA,CAAe,uBAAA;EAI1B,wBAAA,CAAA,GAA4B,iBAAA;EAI5B,sBAAA,CACC,KAAA,EAAO,cAAA,CAAe,6BAAA,GACpB,OAAA,CAAQ,cAAA,CAAe,qBAAA;EAI1B,sBAAA,CACC,KAAA,EAAO,cAAA,CAAe,6BAAA,GACpB,OAAA,CAAQ,cAAA,CAAe,8BAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../../src/grpc/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { GrpcWebOptions } from '@protobuf-ts/grpcweb-transport';\nimport { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport';\nimport { TransactionExecutionServiceClient } from './proto/sui/rpc/v2/transaction_execution_service.client.js';\nimport { LedgerServiceClient } from './proto/sui/rpc/v2/ledger_service.client.js';\nimport { MovePackageServiceClient } from './proto/sui/rpc/v2/move_package_service.client.js';\nimport { SignatureVerificationServiceClient } from './proto/sui/rpc/v2/signature_verification_service.client.js';\nimport type { RpcTransport } from '@protobuf-ts/runtime-rpc';\nimport { StateServiceClient } from './proto/sui/rpc/v2/state_service.client.js';\nimport { SubscriptionServiceClient } from './proto/sui/rpc/v2/subscription_service.client.js';\nimport { GrpcCoreClient } from './core.js';\nimport type { SuiClientTypes } from '../client/index.js';\nimport { BaseClient } from '../client/index.js';\nimport { DynamicField_DynamicFieldKind } from './proto/sui/rpc/v2/state_service.js';\nimport { normalizeStructTag } from '../utils/sui-types.js';\nimport { fromBase64, toBase64 } from '@mysten/utils';\nimport { NameServiceClient } from './proto/sui/rpc/v2/name_service.client.js';\nimport { ForkingServiceClient } from './proto/sui/forking/v1alpha/forking_service.client.js';\nimport type { TransactionPlugin } from '../transactions/index.js';\n\ninterface SuiGrpcTransportOptions extends GrpcWebOptions {\n\ttransport?: never;\n}\n\nexport type SuiGrpcClientOptions = {\n\tnetwork: SuiClientTypes.Network;\n\tmvr?: SuiClientTypes.MvrOptions;\n} & (\n\t| {\n\t\t\ttransport: RpcTransport;\n\t }\n\t| SuiGrpcTransportOptions\n);\n\nconst SUI_CLIENT_BRAND = Symbol.for('@mysten/SuiGrpcClient') as never;\n\nexport function isSuiGrpcClient(client: unknown): client is SuiGrpcClient {\n\treturn (\n\t\ttypeof client === 'object' && client !== null && (client as any)[SUI_CLIENT_BRAND] === true\n\t);\n}\n\nexport interface DynamicFieldInclude {\n\tvalue?: boolean;\n}\n\nexport type DynamicFieldEntryWithValue<Include extends DynamicFieldInclude = {}> =\n\tSuiClientTypes.DynamicFieldEntry & {\n\t\tvalue: Include extends { value: true } ? SuiClientTypes.DynamicFieldValue : undefined;\n\t};\n\nexport interface ListDynamicFieldsWithValueResponse<Include extends DynamicFieldInclude = {}> {\n\thasNextPage: boolean;\n\tcursor: string | null;\n\tdynamicFields: DynamicFieldEntryWithValue<Include>[];\n}\n\nexport class SuiGrpcClient extends BaseClient implements SuiClientTypes.TransportMethods {\n\tcore: GrpcCoreClient;\n\tget mvr(): SuiClientTypes.MvrMethods {\n\t\treturn this.core.mvr;\n\t}\n\ttransactionExecutionService: TransactionExecutionServiceClient;\n\tledgerService: LedgerServiceClient;\n\tstateService: StateServiceClient;\n\tsubscriptionService: SubscriptionServiceClient;\n\tmovePackageService: MovePackageServiceClient;\n\tsignatureVerificationService: SignatureVerificationServiceClient;\n\tnameService: NameServiceClient;\n\tforkingService: ForkingServiceClient;\n\n\tget [SUI_CLIENT_BRAND]() {\n\t\treturn true;\n\t}\n\n\tconstructor(options: SuiGrpcClientOptions) {\n\t\tsuper({ network: options.network });\n\t\tconst transport =\n\t\t\toptions.transport ??\n\t\t\tnew GrpcWebFetchTransport({ baseUrl: options.baseUrl, fetchInit: options.fetchInit });\n\t\tthis.transactionExecutionService = new TransactionExecutionServiceClient(transport);\n\t\tthis.ledgerService = new LedgerServiceClient(transport);\n\t\tthis.stateService = new StateServiceClient(transport);\n\t\tthis.subscriptionService = new SubscriptionServiceClient(transport);\n\t\tthis.movePackageService = new MovePackageServiceClient(transport);\n\t\tthis.signatureVerificationService = new SignatureVerificationServiceClient(transport);\n\t\tthis.nameService = new NameServiceClient(transport);\n\t\tthis.forkingService = new ForkingServiceClient(transport);\n\n\t\tthis.core = new GrpcCoreClient({\n\t\t\tclient: this,\n\t\t\tbase: this,\n\t\t\tnetwork: options.network,\n\t\t\tmvr: options.mvr,\n\t\t});\n\t}\n\n\tgetObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.GetObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectsResponse<Include>> {\n\t\treturn this.core.getObjects(input);\n\t}\n\n\tgetObject<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.GetObjectOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectResponse<Include>> {\n\t\treturn this.core.getObject(input);\n\t}\n\n\tlistCoins(input: SuiClientTypes.ListCoinsOptions): Promise<SuiClientTypes.ListCoinsResponse> {\n\t\treturn this.core.listCoins(input);\n\t}\n\n\tlistOwnedObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.ListOwnedObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.ListOwnedObjectsResponse<Include>> {\n\t\treturn this.core.listOwnedObjects(input);\n\t}\n\n\tgetBalance(input: SuiClientTypes.GetBalanceOptions): Promise<SuiClientTypes.GetBalanceResponse> {\n\t\treturn this.core.getBalance(input);\n\t}\n\n\tlistBalances(\n\t\tinput: SuiClientTypes.ListBalancesOptions,\n\t): Promise<SuiClientTypes.ListBalancesResponse> {\n\t\treturn this.core.listBalances(input);\n\t}\n\n\tgetCoinMetadata(\n\t\tinput: SuiClientTypes.GetCoinMetadataOptions,\n\t): Promise<SuiClientTypes.GetCoinMetadataResponse> {\n\t\treturn this.core.getCoinMetadata(input);\n\t}\n\n\tgetTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\tinput: SuiClientTypes.GetTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\treturn this.core.getTransaction(input);\n\t}\n\n\texecuteTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\tinput: SuiClientTypes.ExecuteTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\treturn this.core.executeTransaction(input);\n\t}\n\n\tsignAndExecuteTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\tinput: SuiClientTypes.SignAndExecuteTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\treturn this.core.signAndExecuteTransaction(input);\n\t}\n\n\twaitForTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\tinput: SuiClientTypes.WaitForTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\treturn this.core.waitForTransaction(input);\n\t}\n\n\tsimulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(\n\t\tinput: SuiClientTypes.SimulateTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.SimulateTransactionResult<Include>> {\n\t\treturn this.core.simulateTransaction(input);\n\t}\n\n\tgetReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {\n\t\treturn this.core.getReferenceGasPrice();\n\t}\n\n\tasync listDynamicFields<Include extends DynamicFieldInclude = {}>(\n\t\tinput: SuiClientTypes.ListDynamicFieldsOptions & { include?: Include & DynamicFieldInclude },\n\t): Promise<ListDynamicFieldsWithValueResponse<Include>> {\n\t\tconst includeValue = input.include?.value ?? false;\n\t\tconst paths = ['field_id', 'name', 'value_type', 'kind', 'child_id'];\n\t\tif (includeValue) {\n\t\t\tpaths.push('value');\n\t\t}\n\n\t\tconst response = await this.stateService.listDynamicFields(\n\t\t\t{\n\t\t\t\tparent: input.parentId,\n\t\t\t\tpageToken: input.cursor ? fromBase64(input.cursor) : undefined,\n\t\t\t\tpageSize: input.limit,\n\t\t\t\treadMask: {\n\t\t\t\t\tpaths,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ abort: input.signal },\n\t\t);\n\n\t\treturn {\n\t\t\tdynamicFields: response.response.dynamicFields.map(\n\t\t\t\t(field): DynamicFieldEntryWithValue<Include> => {\n\t\t\t\t\tconst isDynamicObject = field.kind === DynamicField_DynamicFieldKind.OBJECT;\n\t\t\t\t\tconst fieldType = isDynamicObject\n\t\t\t\t\t\t? `0x2::dynamic_field::Field<0x2::dynamic_object_field::Wrapper<${field.name?.name!}>,0x2::object::ID>`\n\t\t\t\t\t\t: `0x2::dynamic_field::Field<${field.name?.name!},${field.valueType!}>`;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t$kind: isDynamicObject ? 'DynamicObject' : 'DynamicField',\n\t\t\t\t\t\tfieldId: field.fieldId!,\n\t\t\t\t\t\tname: {\n\t\t\t\t\t\t\ttype: field.name?.name!,\n\t\t\t\t\t\t\tbcs: field.name?.value!,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalueType: field.valueType!,\n\t\t\t\t\t\ttype: normalizeStructTag(fieldType),\n\t\t\t\t\t\tchildId: field.childId,\n\t\t\t\t\t\tvalue: (includeValue\n\t\t\t\t\t\t\t? { type: field.valueType!, bcs: field.value?.value ?? new Uint8Array() }\n\t\t\t\t\t\t\t: undefined) as DynamicFieldEntryWithValue<Include>['value'],\n\t\t\t\t\t} as DynamicFieldEntryWithValue<Include>;\n\t\t\t\t},\n\t\t\t),\n\t\t\tcursor: response.response.nextPageToken ? toBase64(response.response.nextPageToken) : null,\n\t\t\thasNextPage: response.response.nextPageToken !== undefined,\n\t\t};\n\t}\n\n\tgetDynamicField(\n\t\tinput: SuiClientTypes.GetDynamicFieldOptions,\n\t): Promise<SuiClientTypes.GetDynamicFieldResponse> {\n\t\treturn this.core.getDynamicField(input);\n\t}\n\n\tgetMoveFunction(\n\t\tinput: SuiClientTypes.GetMoveFunctionOptions,\n\t): Promise<SuiClientTypes.GetMoveFunctionResponse> {\n\t\treturn this.core.getMoveFunction(input);\n\t}\n\n\tresolveTransactionPlugin(): TransactionPlugin {\n\t\treturn this.core.resolveTransactionPlugin();\n\t}\n\n\tverifyZkLoginSignature(\n\t\tinput: SuiClientTypes.VerifyZkLoginSignatureOptions,\n\t): Promise<SuiClientTypes.ZkLoginVerifyResponse> {\n\t\treturn this.core.verifyZkLoginSignature(input);\n\t}\n\n\tdefaultNameServiceName(\n\t\tinput: SuiClientTypes.DefaultNameServiceNameOptions,\n\t): Promise<SuiClientTypes.DefaultNameServiceNameResponse> {\n\t\treturn this.core.defaultNameServiceName(input);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,OAAO,IAAI,wBAAwB;AAE5D,SAAgB,gBAAgB,QAA0C;AACzE,QACC,OAAO,WAAW,YAAY,WAAW,QAAS,OAAe,sBAAsB;;AAmBzF,IAAa,gBAAb,cAAmC,WAAsD;CAExF,IAAI,MAAiC;AACpC,SAAO,KAAK,KAAK;;CAWlB,KAAK,oBAAoB;AACxB,SAAO;;CAGR,YAAY,SAA+B;AAC1C,QAAM,EAAE,SAAS,QAAQ,SAAS,CAAC;EACnC,MAAM,YACL,QAAQ,aACR,IAAI,sBAAsB;GAAE,SAAS,QAAQ;GAAS,WAAW,QAAQ;GAAW,CAAC;AACtF,OAAK,8BAA8B,IAAI,kCAAkC,UAAU;AACnF,OAAK,gBAAgB,IAAI,oBAAoB,UAAU;AACvD,OAAK,eAAe,IAAI,mBAAmB,UAAU;AACrD,OAAK,sBAAsB,IAAI,0BAA0B,UAAU;AACnE,OAAK,qBAAqB,IAAI,yBAAyB,UAAU;AACjE,OAAK,+BAA+B,IAAI,mCAAmC,UAAU;AACrF,OAAK,cAAc,IAAI,kBAAkB,UAAU;AACnD,OAAK,iB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,SAAO;GACN,eAAe,SAAS,SAAS,cAAc,KAC7C,UAA+C;IAC/C,MAAM,kBAAkB,MAAM,SAAS,8BAA8B;IACrE,MAAM,YAAY,kBACf,gEAAgE,MAAM,MAAM,KAAM,sBAClF,6BAA6B,MAAM,MAAM,KAAM,GAAG,MAAM,UAAW;AACtE,WAAO;KACN,OAAO,kBAAkB,kBAAkB;KAC3C,SAAS,MAAM;KACf,MAAM;MACL,MAAM,MAAM,MAAM;MAClB,KAAK,MAAM,MAAM;MACjB;KACD,WAAW,MAAM;KACjB,MAAM,mBAAmB,UAAU;KACnC,SAAS,MAAM;KACf,OAAQ,eACL;MAAE,MAAM,MAAM;MAAY,KAAK,MAAM,OAAO,SAAS,IAAI,YAAY;MAAE,GACvE;KACH;KAEF;GACD,QAAQ,SAAS,SAAS,gBAAgB,SAAS,SAAS,SAAS,cAAc,GAAG;GACtF,aAAa,SAAS,SAAS,kBAAkB;GACjD;;CAGF,gBACC,OACkD;AAClD,SAAO,KAAK,KAAK,gBAAgB,MAAM;;CAGxC,gBACC,OACkD;AAClD,SAAO,KAAK,KAAK,gBAAgB,MAAM;;CAGxC,2BAA8C;AAC7C,SAAO,KAAK,KAAK,0BAA0B;;CAG5C,uBACC,OACgD;AAChD,SAAO,KAAK,KAAK,uBAAuB,MAAM;;CAG/C,uBACC,OACyD;AACzD,SAAO,KAAK,KAAK,uBAAuB,MAAM"}
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../../src/grpc/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { GrpcWebOptions } from '@protobuf-ts/grpcweb-transport';\nimport { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport';\nimport { TransactionExecutionServiceClient } from './proto/sui/rpc/v2/transaction_execution_service.client.js';\nimport { LedgerServiceClient } from './proto/sui/rpc/v2/ledger_service.client.js';\nimport { MovePackageServiceClient } from './proto/sui/rpc/v2/move_package_service.client.js';\nimport { SignatureVerificationServiceClient } from './proto/sui/rpc/v2/signature_verification_service.client.js';\nimport type { RpcTransport } from '@protobuf-ts/runtime-rpc';\nimport { StateServiceClient } from './proto/sui/rpc/v2/state_service.client.js';\nimport { SubscriptionServiceClient } from './proto/sui/rpc/v2/subscription_service.client.js';\nimport { GrpcCoreClient } from './core.js';\nimport type { SuiClientTypes } from '../client/index.js';\nimport { BaseClient } from '../client/index.js';\nimport { DynamicField_DynamicFieldKind } from './proto/sui/rpc/v2/state_service.js';\nimport { normalizeStructTag } from '../utils/sui-types.js';\nimport { fromBase64, toBase64 } from '@mysten/utils';\nimport { NameServiceClient } from './proto/sui/rpc/v2/name_service.client.js';\nimport { ForkingServiceClient } from './proto/sui/forking/v1alpha/forking_service.client.js';\nimport type { TransactionPlugin } from '../transactions/index.js';\n\ninterface SuiGrpcTransportOptions extends GrpcWebOptions {\n\ttransport?: never;\n}\n\nexport type SuiGrpcClientOptions = {\n\tnetwork: SuiClientTypes.Network;\n\tmvr?: SuiClientTypes.MvrOptions;\n} & (\n\t| {\n\t\t\ttransport: RpcTransport;\n\t }\n\t| SuiGrpcTransportOptions\n);\n\nconst SUI_CLIENT_BRAND = Symbol.for('@mysten/SuiGrpcClient') as never;\n\nexport function isSuiGrpcClient(client: unknown): client is SuiGrpcClient {\n\treturn (\n\t\ttypeof client === 'object' && client !== null && (client as any)[SUI_CLIENT_BRAND] === true\n\t);\n}\n\nexport interface DynamicFieldInclude {\n\tvalue?: boolean;\n}\n\nexport type DynamicFieldEntryWithValue<Include extends DynamicFieldInclude = {}> =\n\tSuiClientTypes.DynamicFieldEntry & {\n\t\tvalue: Include extends { value: true } ? SuiClientTypes.DynamicFieldValue : undefined;\n\t};\n\nexport interface ListDynamicFieldsWithValueResponse<Include extends DynamicFieldInclude = {}> {\n\thasNextPage: boolean;\n\tcursor: string | null;\n\tdynamicFields: DynamicFieldEntryWithValue<Include>[];\n}\n\nexport interface GrpcTransactionInclude extends SuiClientTypes.TransactionInclude {\n\t/** Include the parsed protobuf JSON value for the gRPC transaction response. */\n\tprotoJson?: boolean;\n}\n\nexport interface GrpcSimulateTransactionInclude extends SuiClientTypes.SimulateTransactionInclude {\n\t/** Include the parsed protobuf JSON value for the gRPC simulation response. */\n\tprotoJson?: boolean;\n}\n\nexport type GrpcTransactionProtoJson = ReturnType<\n\ttypeof import('./proto/sui/rpc/v2/executed_transaction.js').ExecutedTransaction.toJson\n>;\n\nexport type GrpcSimulateTransactionProtoJson = ReturnType<\n\ttypeof import('./proto/sui/rpc/v2/transaction_execution_service.js').SimulateTransactionResponse.toJson\n>;\n\ntype ProtoJson<Include extends { protoJson?: boolean }, Json> = Include['protoJson'] extends true\n\t? Json\n\t: undefined;\n\nexport type GrpcTransactionResult<Include extends GrpcTransactionInclude = {}> =\n\tSuiClientTypes.TransactionResult<Include> & {\n\t\tprotoJson: ProtoJson<Include, GrpcTransactionProtoJson>;\n\t};\n\nexport type GrpcSimulateTransactionResult<Include extends GrpcSimulateTransactionInclude = {}> =\n\tSuiClientTypes.SimulateTransactionResult<Include> & {\n\t\tprotoJson: ProtoJson<Include, GrpcSimulateTransactionProtoJson>;\n\t};\n\nexport interface GrpcGetTransactionOptions<\n\tInclude extends GrpcTransactionInclude = {},\n> extends SuiClientTypes.GetTransactionOptions<Include> {\n\tinclude?: Include & GrpcTransactionInclude;\n}\n\nexport interface GrpcWaitForTransactionByDigest<\n\tInclude extends GrpcTransactionInclude = {},\n> extends SuiClientTypes.WaitForTransactionByDigest<Include> {\n\tinclude?: Include & GrpcTransactionInclude;\n}\n\nexport interface GrpcWaitForTransactionByResult<\n\tInclude extends GrpcTransactionInclude = {},\n> extends SuiClientTypes.WaitForTransactionByResult<Include> {\n\tinclude?: Include & GrpcTransactionInclude;\n}\n\nexport type GrpcWaitForTransactionOptions<Include extends GrpcTransactionInclude = {}> =\n\t| GrpcWaitForTransactionByDigest<Include>\n\t| GrpcWaitForTransactionByResult<Include>;\n\nexport interface GrpcExecuteTransactionOptions<\n\tInclude extends GrpcTransactionInclude = {},\n> extends SuiClientTypes.ExecuteTransactionOptions<Include> {\n\tinclude?: Include & GrpcTransactionInclude;\n}\n\nexport interface GrpcSignAndExecuteTransactionOptions<\n\tInclude extends GrpcTransactionInclude = {},\n> extends SuiClientTypes.SignAndExecuteTransactionOptions<Include> {\n\tinclude?: Include & GrpcTransactionInclude;\n}\n\nexport interface GrpcSimulateTransactionOptions<\n\tInclude extends GrpcSimulateTransactionInclude = {},\n> extends SuiClientTypes.SimulateTransactionOptions<Include> {\n\tinclude?: Include & GrpcSimulateTransactionInclude;\n}\n\nexport class SuiGrpcClient extends BaseClient implements SuiClientTypes.TransportMethods {\n\tcore: GrpcCoreClient;\n\tget mvr(): SuiClientTypes.MvrMethods {\n\t\treturn this.core.mvr;\n\t}\n\ttransactionExecutionService: TransactionExecutionServiceClient;\n\tledgerService: LedgerServiceClient;\n\tstateService: StateServiceClient;\n\tsubscriptionService: SubscriptionServiceClient;\n\tmovePackageService: MovePackageServiceClient;\n\tsignatureVerificationService: SignatureVerificationServiceClient;\n\tnameService: NameServiceClient;\n\tforkingService: ForkingServiceClient;\n\n\tget [SUI_CLIENT_BRAND]() {\n\t\treturn true;\n\t}\n\n\tconstructor(options: SuiGrpcClientOptions) {\n\t\tsuper({ network: options.network });\n\t\tconst transport =\n\t\t\toptions.transport ??\n\t\t\tnew GrpcWebFetchTransport({ baseUrl: options.baseUrl, fetchInit: options.fetchInit });\n\t\tthis.transactionExecutionService = new TransactionExecutionServiceClient(transport);\n\t\tthis.ledgerService = new LedgerServiceClient(transport);\n\t\tthis.stateService = new StateServiceClient(transport);\n\t\tthis.subscriptionService = new SubscriptionServiceClient(transport);\n\t\tthis.movePackageService = new MovePackageServiceClient(transport);\n\t\tthis.signatureVerificationService = new SignatureVerificationServiceClient(transport);\n\t\tthis.nameService = new NameServiceClient(transport);\n\t\tthis.forkingService = new ForkingServiceClient(transport);\n\n\t\tthis.core = new GrpcCoreClient({\n\t\t\tclient: this,\n\t\t\tbase: this,\n\t\t\tnetwork: options.network,\n\t\t\tmvr: options.mvr,\n\t\t});\n\t}\n\n\tgetObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.GetObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectsResponse<Include>> {\n\t\treturn this.core.getObjects(input);\n\t}\n\n\tgetObject<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.GetObjectOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectResponse<Include>> {\n\t\treturn this.core.getObject(input);\n\t}\n\n\tlistCoins(input: SuiClientTypes.ListCoinsOptions): Promise<SuiClientTypes.ListCoinsResponse> {\n\t\treturn this.core.listCoins(input);\n\t}\n\n\tlistOwnedObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\tinput: SuiClientTypes.ListOwnedObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.ListOwnedObjectsResponse<Include>> {\n\t\treturn this.core.listOwnedObjects(input);\n\t}\n\n\tgetBalance(input: SuiClientTypes.GetBalanceOptions): Promise<SuiClientTypes.GetBalanceResponse> {\n\t\treturn this.core.getBalance(input);\n\t}\n\n\tlistBalances(\n\t\tinput: SuiClientTypes.ListBalancesOptions,\n\t): Promise<SuiClientTypes.ListBalancesResponse> {\n\t\treturn this.core.listBalances(input);\n\t}\n\n\tgetCoinMetadata(\n\t\tinput: SuiClientTypes.GetCoinMetadataOptions,\n\t): Promise<SuiClientTypes.GetCoinMetadataResponse> {\n\t\treturn this.core.getCoinMetadata(input);\n\t}\n\n\tgetTransaction<Include extends GrpcTransactionInclude = {}>(\n\t\tinput: GrpcGetTransactionOptions<Include>,\n\t): Promise<GrpcTransactionResult<Include>> {\n\t\treturn this.core.getTransaction(input) as Promise<GrpcTransactionResult<Include>>;\n\t}\n\n\texecuteTransaction<Include extends GrpcTransactionInclude = {}>(\n\t\tinput: GrpcExecuteTransactionOptions<Include>,\n\t): Promise<GrpcTransactionResult<Include>> {\n\t\treturn this.core.executeTransaction(input) as Promise<GrpcTransactionResult<Include>>;\n\t}\n\n\tsignAndExecuteTransaction<Include extends GrpcTransactionInclude = {}>(\n\t\tinput: GrpcSignAndExecuteTransactionOptions<Include>,\n\t): Promise<GrpcTransactionResult<Include>> {\n\t\treturn this.core.signAndExecuteTransaction(input) as Promise<GrpcTransactionResult<Include>>;\n\t}\n\n\twaitForTransaction<Include extends GrpcTransactionInclude = {}>(\n\t\tinput: GrpcWaitForTransactionOptions<Include>,\n\t): Promise<GrpcTransactionResult<Include>> {\n\t\treturn this.core.waitForTransaction(input) as Promise<GrpcTransactionResult<Include>>;\n\t}\n\n\tsimulateTransaction<Include extends GrpcSimulateTransactionInclude = {}>(\n\t\tinput: GrpcSimulateTransactionOptions<Include>,\n\t): Promise<GrpcSimulateTransactionResult<Include>> {\n\t\treturn this.core.simulateTransaction(input) as Promise<GrpcSimulateTransactionResult<Include>>;\n\t}\n\n\tgetReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {\n\t\treturn this.core.getReferenceGasPrice();\n\t}\n\n\tasync listDynamicFields<Include extends DynamicFieldInclude = {}>(\n\t\tinput: SuiClientTypes.ListDynamicFieldsOptions & { include?: Include & DynamicFieldInclude },\n\t): Promise<ListDynamicFieldsWithValueResponse<Include>> {\n\t\tconst includeValue = input.include?.value ?? false;\n\t\tconst paths = ['field_id', 'name', 'value_type', 'kind', 'child_id'];\n\t\tif (includeValue) {\n\t\t\tpaths.push('value');\n\t\t}\n\n\t\tconst response = await this.stateService.listDynamicFields(\n\t\t\t{\n\t\t\t\tparent: input.parentId,\n\t\t\t\tpageToken: input.cursor ? fromBase64(input.cursor) : undefined,\n\t\t\t\tpageSize: input.limit,\n\t\t\t\treadMask: {\n\t\t\t\t\tpaths,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ abort: input.signal },\n\t\t);\n\n\t\treturn {\n\t\t\tdynamicFields: response.response.dynamicFields.map(\n\t\t\t\t(field): DynamicFieldEntryWithValue<Include> => {\n\t\t\t\t\tconst isDynamicObject = field.kind === DynamicField_DynamicFieldKind.OBJECT;\n\t\t\t\t\tconst fieldType = isDynamicObject\n\t\t\t\t\t\t? `0x2::dynamic_field::Field<0x2::dynamic_object_field::Wrapper<${field.name?.name!}>,0x2::object::ID>`\n\t\t\t\t\t\t: `0x2::dynamic_field::Field<${field.name?.name!},${field.valueType!}>`;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t$kind: isDynamicObject ? 'DynamicObject' : 'DynamicField',\n\t\t\t\t\t\tfieldId: field.fieldId!,\n\t\t\t\t\t\tname: {\n\t\t\t\t\t\t\ttype: field.name?.name!,\n\t\t\t\t\t\t\tbcs: field.name?.value!,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalueType: field.valueType!,\n\t\t\t\t\t\ttype: normalizeStructTag(fieldType),\n\t\t\t\t\t\tchildId: field.childId,\n\t\t\t\t\t\tvalue: (includeValue\n\t\t\t\t\t\t\t? { type: field.valueType!, bcs: field.value?.value ?? new Uint8Array() }\n\t\t\t\t\t\t\t: undefined) as DynamicFieldEntryWithValue<Include>['value'],\n\t\t\t\t\t} as DynamicFieldEntryWithValue<Include>;\n\t\t\t\t},\n\t\t\t),\n\t\t\tcursor: response.response.nextPageToken ? toBase64(response.response.nextPageToken) : null,\n\t\t\thasNextPage: response.response.nextPageToken !== undefined,\n\t\t};\n\t}\n\n\tgetDynamicField(\n\t\tinput: SuiClientTypes.GetDynamicFieldOptions,\n\t): Promise<SuiClientTypes.GetDynamicFieldResponse> {\n\t\treturn this.core.getDynamicField(input);\n\t}\n\n\tgetMoveFunction(\n\t\tinput: SuiClientTypes.GetMoveFunctionOptions,\n\t): Promise<SuiClientTypes.GetMoveFunctionResponse> {\n\t\treturn this.core.getMoveFunction(input);\n\t}\n\n\tresolveTransactionPlugin(): TransactionPlugin {\n\t\treturn this.core.resolveTransactionPlugin();\n\t}\n\n\tverifyZkLoginSignature(\n\t\tinput: SuiClientTypes.VerifyZkLoginSignatureOptions,\n\t): Promise<SuiClientTypes.ZkLoginVerifyResponse> {\n\t\treturn this.core.verifyZkLoginSignature(input);\n\t}\n\n\tdefaultNameServiceName(\n\t\tinput: SuiClientTypes.DefaultNameServiceNameOptions,\n\t): Promise<SuiClientTypes.DefaultNameServiceNameResponse> {\n\t\treturn this.core.defaultNameServiceName(input);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,OAAO,IAAI,wBAAwB;AAE5D,SAAgB,gBAAgB,QAA0C;AACzE,QACC,OAAO,WAAW,YAAY,WAAW,QAAS,OAAe,sBAAsB;;AA2FzF,IAAa,gBAAb,cAAmC,WAAsD;CAExF,IAAI,MAAiC;AACpC,SAAO,KAAK,KAAK;;CAWlB,KAAK,oBAAoB;AACxB,SAAO;;CAGR,YAAY,SAA+B;AAC1C,QAAM,EAAE,SAAS,QAAQ,SAAS,CAAC;EACnC,MAAM,YACL,QAAQ,aACR,IAAI,sBAAsB;GAAE,SAAS,QAAQ;GAAS,WAAW,QAAQ;GAAW,CAAC;AACtF,OAAK,8BAA8B,IAAI,kCAAkC,UAAU;AACnF,OAAK,gBAAgB,IAAI,oBAAoB,UAAU;AACvD,OAAK,eAAe,IAAI,mBAAmB,UAAU;AACrD,OAAK,sBAAsB,IAAI,0BAA0B,UAAU;AACnE,OAAK,qBAAqB,IAAI,yBAAyB,UAAU;AACjE,OAAK,+BAA+B,IAAI,mCAAmC,UAAU;AACrF,OAAK,cAAc,IAAI,kBAAkB,UAAU;AACnD,OAAK,iBAAiB,IAAI,qBAAqB,UAAU;AAEzD,OAAK,OAAO,IAAI,eAAe;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS,QAAQ;GACjB,KAAK,QAAQ;GACb,CAAC;;CAGH,WACC,OACsD;AACtD,SAAO,KAAK,KAAK,WAAW,MAAM;;CAGnC,UACC,OACqD;AACrD,SAAO,KAAK,KAAK,UAAU,MAAM;;CAGlC,UAAU,OAAmF;AAC5F,SAAO,KAA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AAA,CACL,OAAA,EAAS,cAAA,CAAe,6BAAA,GACtB,OAAA,CAAQ,cAAA,CAAe,8BAAA;EAiBpB,eAAA,CACL,OAAA,EAAS,cAAA,CAAe,sBAAA,GACtB,OAAA,CAAQ,cAAA,CAAe,uBAAA;EA4DpB,kBAAA,CACL,OAAA,GAAU,cAAA,CAAe,yBAAA,GACvB,OAAA,CAAQ,cAAA,CAAe,0BAAA;EAmB1B,wBAAA,CAAA,IAGE,eAAA,EAAiB,sBAAA,EACjB,OAAA,EAAS,uBAAA,EACT,IAAA,QAAY,OAAA,WAAa,OAAA;AAAA;AAAA,iBAqgBZ,4BAAA,iBACC,cAAA,CAAe,kBAAA,MAAA,CAE/B,WAAA,EAAa,mBAAA,EACb,OAAA;EACC,OAAA,GAAU,OAAA,GAAU,cAAA,CAAe,kBAAA;AAAA,IAElC,cAAA,CAAe,iBAAA,CAAkB,OAAA;AAAA,iBA4FpB,oCAAA,iBACC,cAAA,CAAe,0BAAA,MAAA,CAE/B,QAAA,EAAU,2BAAA,EACV,OAAA;EACC,OAAA,GAAU,OAAA,GAAU,cAAA,CAAe,0BAAA;AAAA,IAElC,cAAA,CAAe,yBAAA,CAA0B,OAAA"}
@@ -11,7 +11,8 @@ import { Owner_OwnerKind } from "./proto/sui/rpc/v2/owner.mjs";
11
11
  import { applyGrpcResolvedTransaction, grpcTransactionToTransactionData, transactionDataToGrpcTransaction, transactionToGrpcTransaction } from "../client/transaction-resolver.mjs";
12
12
  import { CommandArgumentError_CommandArgumentErrorKind } from "./proto/sui/rpc/v2/execution_status.mjs";
13
13
  import { ChangedObject_IdOperation, ChangedObject_InputObjectState, ChangedObject_OutputObjectState, UnchangedConsensusObject_UnchangedConsensusObjectKind } from "./proto/sui/rpc/v2/effects.mjs";
14
- import { SimulateTransactionRequest_TransactionChecks } from "./proto/sui/rpc/v2/transaction_execution_service.mjs";
14
+ import { ExecutedTransaction } from "./proto/sui/rpc/v2/executed_transaction.mjs";
15
+ import { SimulateTransactionRequest_TransactionChecks, SimulateTransactionResponse } from "./proto/sui/rpc/v2/transaction_execution_service.mjs";
15
16
  import { chunk, fromBase64, toBase64 } from "@mysten/utils";
16
17
 
17
18
  //#region src/grpc/core.ts
@@ -195,70 +196,26 @@ var GrpcCoreClient = class extends CoreClient {
195
196
  };
196
197
  }
197
198
  async getTransaction(options) {
198
- const paths = [
199
- "digest",
200
- "transaction.digest",
201
- "signatures",
202
- "effects.status"
203
- ];
204
- if (options.include?.transaction) paths.push("transaction.sender", "transaction.gas_payment", "transaction.expiration", "transaction.kind");
205
- if (options.include?.bcs) paths.push("transaction.bcs");
206
- if (options.include?.balanceChanges) paths.push("balance_changes");
207
- if (options.include?.effects) paths.push("effects");
208
- if (options.include?.events) paths.push("events");
209
- if (options.include?.objectTypes) {
210
- paths.push("effects.changed_objects.object_type");
211
- paths.push("effects.changed_objects.object_id");
212
- }
213
199
  const { response } = await this.#client.ledgerService.getTransaction({
214
200
  digest: options.digest,
215
- readMask: { paths }
201
+ readMask: { paths: transactionReadMaskPaths(options.include) }
216
202
  }, { abort: options.signal });
217
203
  if (!response.transaction) throw new Error(`Transaction ${options.digest} not found`);
218
- return parseGrpcTransactionResponse(response.transaction, { include: options.include });
204
+ return withProtoJson(parseGrpcTransactionResponse(response.transaction, { include: options.include }), options.include, () => ExecutedTransaction.toJson(response.transaction));
219
205
  }
220
206
  async executeTransaction(options) {
221
- const paths = [
222
- "digest",
223
- "transaction.digest",
224
- "signatures",
225
- "effects.status"
226
- ];
227
- if (options.include?.transaction) paths.push("transaction.sender", "transaction.gas_payment", "transaction.expiration", "transaction.kind");
228
- if (options.include?.bcs) paths.push("transaction.bcs");
229
- if (options.include?.balanceChanges) paths.push("balance_changes");
230
- if (options.include?.effects) paths.push("effects");
231
- if (options.include?.events) paths.push("events");
232
- if (options.include?.objectTypes) {
233
- paths.push("effects.changed_objects.object_type");
234
- paths.push("effects.changed_objects.object_id");
235
- }
236
207
  const { response } = await this.#client.transactionExecutionService.executeTransaction({
237
208
  transaction: { bcs: { value: options.transaction } },
238
209
  signatures: options.signatures.map((signature) => ({
239
210
  bcs: { value: fromBase64(signature) },
240
211
  signature: { oneofKind: void 0 }
241
212
  })),
242
- readMask: { paths }
213
+ readMask: { paths: transactionReadMaskPaths(options.include) }
243
214
  }, { abort: options.signal });
244
- return parseGrpcTransactionResponse(response.transaction, { include: options.include });
215
+ return withProtoJson(parseGrpcTransactionResponse(response.transaction, { include: options.include }), options.include, () => ExecutedTransaction.toJson(response.transaction));
245
216
  }
246
217
  async simulateTransaction(options) {
247
- const paths = [
248
- "transaction.digest",
249
- "transaction.transaction.digest",
250
- "transaction.signatures",
251
- "transaction.effects.status"
252
- ];
253
- if (options.include?.transaction) paths.push("transaction.transaction.sender", "transaction.transaction.gas_payment", "transaction.transaction.expiration", "transaction.transaction.kind");
254
- if (options.include?.bcs) paths.push("transaction.transaction.bcs");
255
- if (options.include?.balanceChanges) paths.push("transaction.balance_changes");
256
- if (options.include?.effects) paths.push("transaction.effects");
257
- if (options.include?.events) paths.push("transaction.events");
258
- if (options.include?.objectTypes) {
259
- paths.push("transaction.effects.changed_objects.object_type");
260
- paths.push("transaction.effects.changed_objects.object_id");
261
- }
218
+ const paths = transactionReadMaskPaths(options.include, "transaction.");
262
219
  if (options.include?.commandResults) paths.push("command_outputs");
263
220
  if (!(options.transaction instanceof Uint8Array)) await options.transaction.prepareForSerialization({ client: this });
264
221
  const { response } = await this.#client.transactionExecutionService.simulateTransaction({
@@ -267,7 +224,7 @@ var GrpcCoreClient = class extends CoreClient {
267
224
  doGasSelection: false,
268
225
  checks: options.checksEnabled === false ? SimulateTransactionRequest_TransactionChecks.DISABLED : SimulateTransactionRequest_TransactionChecks.ENABLED
269
226
  }, { abort: options.signal });
270
- return parseGrpcSimulateTransactionResponse(response, { include: options.include });
227
+ return withProtoJson(parseGrpcSimulateTransactionResponse(response, { include: options.include }), options.include, () => SimulateTransactionResponse.toJson(response));
271
228
  }
272
229
  async getReferenceGasPrice(options) {
273
230
  return { referenceGasPrice: (await this.#client.ledgerService.getEpoch({ readMask: { paths: ["reference_gas_price"] } }, { abort: options?.signal })).response.epoch?.referenceGasPrice?.toString() ?? "" };
@@ -446,6 +403,31 @@ var GrpcCoreClient = class extends CoreClient {
446
403
  };
447
404
  }
448
405
  };
406
+ function transactionReadMaskPaths(include, prefix = "") {
407
+ const paths = [
408
+ "digest",
409
+ "transaction.digest",
410
+ "signatures",
411
+ "effects.status"
412
+ ];
413
+ if (include?.transaction) paths.push("transaction.sender", "transaction.gas_payment", "transaction.expiration", "transaction.kind");
414
+ if (include?.bcs) paths.push("transaction.bcs");
415
+ if (include?.balanceChanges) paths.push("balance_changes");
416
+ if (include?.effects) paths.push("effects");
417
+ if (include?.events) paths.push("events");
418
+ if (include?.objectTypes) {
419
+ paths.push("effects.changed_objects.object_type");
420
+ paths.push("effects.changed_objects.object_id");
421
+ }
422
+ return prefix ? paths.map((path) => prefix + path) : paths;
423
+ }
424
+ function withProtoJson(result, include, getProtoJson) {
425
+ if (!include?.protoJson) return result;
426
+ return {
427
+ ...result,
428
+ protoJson: getProtoJson()
429
+ };
430
+ }
449
431
  function mapDisplayProto(include, display) {
450
432
  if (!include) return void 0;
451
433
  if (display === void 0) return null;