@mysten/sui 2.31.1 → 2.31.2
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 +7 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +36 -36
- package/dist/client/mvr.mjs +2 -1
- package/dist/client/mvr.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/jsonRpc/client.mjs +1 -1
- package/dist/transactions/Transaction.d.mts +3 -3
- package/dist/transactions/data/internal.d.mts +133 -133
- package/dist/transactions/data/v1.d.mts +239 -239
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.map +1 -1
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.mjs +2 -1
- package/dist/utils/move-registry.d.mts +3 -2
- package/dist/utils/move-registry.d.mts.map +1 -1
- package/dist/utils/move-registry.mjs +2 -18
- package/dist/utils/move-registry.mjs.map +1 -1
- package/dist/utils/named-packages.d.mts +5 -0
- package/dist/utils/named-packages.d.mts.map +1 -0
- package/dist/utils/named-packages.mjs +23 -0
- package/dist/utils/named-packages.mjs.map +1 -0
- package/dist/utils/sui-types.mjs +1 -1
- package/dist/utils/sui-types.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/package.json +1 -1
- package/src/utils/move-registry.ts +2 -25
- package/src/utils/named-packages.ts +29 -0
- package/src/utils/sui-types.ts +1 -1
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mysten/sui.js
|
|
2
2
|
|
|
3
|
+
## 2.31.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8508156: Break the circular dependency between struct-tag and named-package utilities to prevent
|
|
8
|
+
initialization errors in Next.js Turbopack production builds.
|
|
9
|
+
|
|
3
10
|
## 2.31.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/bcs/bcs.d.mts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { TypeTag as TypeTag$1 } from "./types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_bcs1241 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):
|
|
8
|
-
intent:
|
|
9
|
-
scope:
|
|
7
|
+
declare function IntentMessage<T extends BcsType<any>>(T: T): _mysten_bcs1241.BcsStruct<{
|
|
8
|
+
intent: _mysten_bcs1241.BcsStruct<{
|
|
9
|
+
scope: _mysten_bcs1241.BcsEnum<{
|
|
10
10
|
TransactionData: null;
|
|
11
11
|
TransactionEffects: null;
|
|
12
12
|
CheckpointSummary: null;
|
|
13
13
|
PersonalMessage: null;
|
|
14
14
|
}, "IntentScope">;
|
|
15
|
-
version:
|
|
15
|
+
version: _mysten_bcs1241.BcsEnum<{
|
|
16
16
|
V0: null;
|
|
17
17
|
}, "IntentVersion">;
|
|
18
|
-
appId:
|
|
18
|
+
appId: _mysten_bcs1241.BcsEnum<{
|
|
19
19
|
Sui: null;
|
|
20
20
|
}, "AppId">;
|
|
21
21
|
}, string>;
|
package/dist/bcs/index.d.mts
CHANGED
|
@@ -549,7 +549,7 @@ declare const suiBcs: {
|
|
|
549
549
|
version: string;
|
|
550
550
|
digest: string;
|
|
551
551
|
};
|
|
552
|
-
}, "
|
|
552
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
553
553
|
FundsWithdrawal: {
|
|
554
554
|
reservation: {
|
|
555
555
|
MaxAmountU64: string;
|
|
@@ -568,7 +568,7 @@ declare const suiBcs: {
|
|
|
568
568
|
};
|
|
569
569
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
570
570
|
};
|
|
571
|
-
}, "
|
|
571
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
572
572
|
Pure: {
|
|
573
573
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
574
574
|
};
|
|
@@ -805,7 +805,7 @@ declare const suiBcs: {
|
|
|
805
805
|
TransactionEffects: true;
|
|
806
806
|
CheckpointSummary: true;
|
|
807
807
|
PersonalMessage: true;
|
|
808
|
-
}, "
|
|
808
|
+
}, "TransactionEffects" | "TransactionData" | "CheckpointSummary" | "PersonalMessage">;
|
|
809
809
|
version: {
|
|
810
810
|
V0: true;
|
|
811
811
|
$kind: "V0";
|
|
@@ -839,7 +839,7 @@ declare const suiBcs: {
|
|
|
839
839
|
version: string;
|
|
840
840
|
digest: string;
|
|
841
841
|
};
|
|
842
|
-
}, "
|
|
842
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
843
843
|
FundsWithdrawal: {
|
|
844
844
|
reservation: {
|
|
845
845
|
MaxAmountU64: string;
|
|
@@ -858,7 +858,7 @@ declare const suiBcs: {
|
|
|
858
858
|
};
|
|
859
859
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
860
860
|
};
|
|
861
|
-
}, "
|
|
861
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[];
|
|
862
862
|
commands: _mysten_bcs0.EnumOutputShapeWithKeys<{
|
|
863
863
|
MoveCall: {
|
|
864
864
|
package: string;
|
|
@@ -997,7 +997,7 @@ declare const suiBcs: {
|
|
|
997
997
|
startVersion: string;
|
|
998
998
|
owner: string;
|
|
999
999
|
};
|
|
1000
|
-
}, "AddressOwner" | "
|
|
1000
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">;
|
|
1001
1001
|
};
|
|
1002
1002
|
$kind: "RawObject";
|
|
1003
1003
|
}[];
|
|
@@ -1130,7 +1130,7 @@ declare const suiBcs: {
|
|
|
1130
1130
|
version: string;
|
|
1131
1131
|
digest: string;
|
|
1132
1132
|
};
|
|
1133
|
-
}, "
|
|
1133
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
1134
1134
|
FundsWithdrawal: {
|
|
1135
1135
|
reservation: {
|
|
1136
1136
|
MaxAmountU64: string;
|
|
@@ -1149,7 +1149,7 @@ declare const suiBcs: {
|
|
|
1149
1149
|
};
|
|
1150
1150
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
1151
1151
|
};
|
|
1152
|
-
}, "
|
|
1152
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[];
|
|
1153
1153
|
commands: _mysten_bcs0.EnumOutputShapeWithKeys<{
|
|
1154
1154
|
MoveCall: {
|
|
1155
1155
|
package: string;
|
|
@@ -1231,7 +1231,7 @@ declare const suiBcs: {
|
|
|
1231
1231
|
};
|
|
1232
1232
|
}, "MoveCall" | "TransferObjects" | "SplitCoins" | "MergeCoins" | "Publish" | "MakeMoveVec" | "Upgrade">[];
|
|
1233
1233
|
};
|
|
1234
|
-
}, "
|
|
1234
|
+
}, "EndOfEpochTransaction" | "ProgrammableSystemTransaction" | "ProgrammableTransaction" | "ChangeEpoch" | "Genesis" | "ConsensusCommitPrologue" | "AuthenticatorStateUpdate" | "RandomnessStateUpdate" | "ConsensusCommitPrologueV2" | "ConsensusCommitPrologueV3" | "ConsensusCommitPrologueV4">;
|
|
1235
1235
|
sender: string;
|
|
1236
1236
|
gasData: {
|
|
1237
1237
|
payment: {
|
|
@@ -1266,7 +1266,7 @@ declare const suiBcs: {
|
|
|
1266
1266
|
proposers: number[];
|
|
1267
1267
|
} | null;
|
|
1268
1268
|
};
|
|
1269
|
-
}, "
|
|
1269
|
+
}, "Epoch" | "None" | "ValidDuring" | "Validity">;
|
|
1270
1270
|
};
|
|
1271
1271
|
$kind: "V1";
|
|
1272
1272
|
};
|
|
@@ -1877,7 +1877,7 @@ declare const suiBcs: {
|
|
|
1877
1877
|
version: string;
|
|
1878
1878
|
digest: string;
|
|
1879
1879
|
};
|
|
1880
|
-
}, "
|
|
1880
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
1881
1881
|
FundsWithdrawal: {
|
|
1882
1882
|
reservation: {
|
|
1883
1883
|
MaxAmountU64: string;
|
|
@@ -1896,7 +1896,7 @@ declare const suiBcs: {
|
|
|
1896
1896
|
};
|
|
1897
1897
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
1898
1898
|
};
|
|
1899
|
-
}, "
|
|
1899
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
1900
1900
|
Pure: {
|
|
1901
1901
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
1902
1902
|
};
|
|
@@ -2181,7 +2181,7 @@ declare const suiBcs: {
|
|
|
2181
2181
|
startVersion: string;
|
|
2182
2182
|
owner: string;
|
|
2183
2183
|
};
|
|
2184
|
-
}, "AddressOwner" | "
|
|
2184
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">;
|
|
2185
2185
|
};
|
|
2186
2186
|
$kind: "RawObject";
|
|
2187
2187
|
}[], Iterable<{
|
|
@@ -2459,7 +2459,7 @@ declare const suiBcs: {
|
|
|
2459
2459
|
version: string;
|
|
2460
2460
|
digest: string;
|
|
2461
2461
|
};
|
|
2462
|
-
}, "
|
|
2462
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
2463
2463
|
FundsWithdrawal: {
|
|
2464
2464
|
reservation: {
|
|
2465
2465
|
MaxAmountU64: string;
|
|
@@ -2478,7 +2478,7 @@ declare const suiBcs: {
|
|
|
2478
2478
|
};
|
|
2479
2479
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
2480
2480
|
};
|
|
2481
|
-
}, "
|
|
2481
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
2482
2482
|
Pure: {
|
|
2483
2483
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
2484
2484
|
};
|
|
@@ -2794,7 +2794,7 @@ declare const suiBcs: {
|
|
|
2794
2794
|
version: string;
|
|
2795
2795
|
digest: string;
|
|
2796
2796
|
};
|
|
2797
|
-
}, "
|
|
2797
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
2798
2798
|
FundsWithdrawal: {
|
|
2799
2799
|
reservation: {
|
|
2800
2800
|
MaxAmountU64: string;
|
|
@@ -2813,7 +2813,7 @@ declare const suiBcs: {
|
|
|
2813
2813
|
};
|
|
2814
2814
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
2815
2815
|
};
|
|
2816
|
-
}, "
|
|
2816
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
2817
2817
|
Pure: {
|
|
2818
2818
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
2819
2819
|
};
|
|
@@ -3098,7 +3098,7 @@ declare const suiBcs: {
|
|
|
3098
3098
|
startVersion: string;
|
|
3099
3099
|
owner: string;
|
|
3100
3100
|
};
|
|
3101
|
-
}, "AddressOwner" | "
|
|
3101
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">;
|
|
3102
3102
|
};
|
|
3103
3103
|
$kind: "RawObject";
|
|
3104
3104
|
}[], Iterable<{
|
|
@@ -3376,7 +3376,7 @@ declare const suiBcs: {
|
|
|
3376
3376
|
version: string;
|
|
3377
3377
|
digest: string;
|
|
3378
3378
|
};
|
|
3379
|
-
}, "
|
|
3379
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
3380
3380
|
FundsWithdrawal: {
|
|
3381
3381
|
reservation: {
|
|
3382
3382
|
MaxAmountU64: string;
|
|
@@ -3395,7 +3395,7 @@ declare const suiBcs: {
|
|
|
3395
3395
|
};
|
|
3396
3396
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
3397
3397
|
};
|
|
3398
|
-
}, "
|
|
3398
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
3399
3399
|
Pure: {
|
|
3400
3400
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
3401
3401
|
};
|
|
@@ -3687,7 +3687,7 @@ declare const suiBcs: {
|
|
|
3687
3687
|
version: string;
|
|
3688
3688
|
digest: string;
|
|
3689
3689
|
};
|
|
3690
|
-
}, "
|
|
3690
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
3691
3691
|
FundsWithdrawal: {
|
|
3692
3692
|
reservation: {
|
|
3693
3693
|
MaxAmountU64: string;
|
|
@@ -3706,7 +3706,7 @@ declare const suiBcs: {
|
|
|
3706
3706
|
};
|
|
3707
3707
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
3708
3708
|
};
|
|
3709
|
-
}, "
|
|
3709
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
3710
3710
|
Pure: {
|
|
3711
3711
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
3712
3712
|
};
|
|
@@ -3991,7 +3991,7 @@ declare const suiBcs: {
|
|
|
3991
3991
|
startVersion: string;
|
|
3992
3992
|
owner: string;
|
|
3993
3993
|
};
|
|
3994
|
-
}, "AddressOwner" | "
|
|
3994
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">;
|
|
3995
3995
|
};
|
|
3996
3996
|
$kind: "RawObject";
|
|
3997
3997
|
}[], Iterable<{
|
|
@@ -4269,7 +4269,7 @@ declare const suiBcs: {
|
|
|
4269
4269
|
version: string;
|
|
4270
4270
|
digest: string;
|
|
4271
4271
|
};
|
|
4272
|
-
}, "
|
|
4272
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
4273
4273
|
FundsWithdrawal: {
|
|
4274
4274
|
reservation: {
|
|
4275
4275
|
MaxAmountU64: string;
|
|
@@ -4288,7 +4288,7 @@ declare const suiBcs: {
|
|
|
4288
4288
|
};
|
|
4289
4289
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
4290
4290
|
};
|
|
4291
|
-
}, "
|
|
4291
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
4292
4292
|
Pure: {
|
|
4293
4293
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
4294
4294
|
};
|
|
@@ -4762,7 +4762,7 @@ declare const suiBcs: {
|
|
|
4762
4762
|
startVersion: string;
|
|
4763
4763
|
owner: string;
|
|
4764
4764
|
};
|
|
4765
|
-
}, "AddressOwner" | "
|
|
4765
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
|
|
4766
4766
|
objectId: string | Uint8Array<ArrayBufferLike>;
|
|
4767
4767
|
version: string | number | bigint;
|
|
4768
4768
|
digest: string;
|
|
@@ -4795,7 +4795,7 @@ declare const suiBcs: {
|
|
|
4795
4795
|
startVersion: string;
|
|
4796
4796
|
owner: string;
|
|
4797
4797
|
};
|
|
4798
|
-
}, "AddressOwner" | "
|
|
4798
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
|
|
4799
4799
|
objectId: string | Uint8Array<ArrayBufferLike>;
|
|
4800
4800
|
version: string | number | bigint;
|
|
4801
4801
|
digest: string;
|
|
@@ -4828,7 +4828,7 @@ declare const suiBcs: {
|
|
|
4828
4828
|
startVersion: string;
|
|
4829
4829
|
owner: string;
|
|
4830
4830
|
};
|
|
4831
|
-
}, "AddressOwner" | "
|
|
4831
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], Iterable<readonly [{
|
|
4832
4832
|
objectId: string | Uint8Array<ArrayBufferLike>;
|
|
4833
4833
|
version: string | number | bigint;
|
|
4834
4834
|
digest: string;
|
|
@@ -5096,7 +5096,7 @@ declare const suiBcs: {
|
|
|
5096
5096
|
startVersion: string;
|
|
5097
5097
|
owner: string;
|
|
5098
5098
|
};
|
|
5099
|
-
}, "AddressOwner" | "
|
|
5099
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
|
|
5100
5100
|
}, "NotExist" | "Exist">;
|
|
5101
5101
|
outputState: _mysten_bcs0.EnumOutputShapeWithKeys<{
|
|
5102
5102
|
NotExist: true;
|
|
@@ -5111,7 +5111,7 @@ declare const suiBcs: {
|
|
|
5111
5111
|
startVersion: string;
|
|
5112
5112
|
owner: string;
|
|
5113
5113
|
};
|
|
5114
|
-
}, "AddressOwner" | "
|
|
5114
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
|
|
5115
5115
|
PackageWrite: [string, string];
|
|
5116
5116
|
AccumulatorWriteV1: {
|
|
5117
5117
|
address: {
|
|
@@ -5197,7 +5197,7 @@ declare const suiBcs: {
|
|
|
5197
5197
|
ReadConsensusStreamEnded: string;
|
|
5198
5198
|
Cancelled: string;
|
|
5199
5199
|
PerEpochConfig: true;
|
|
5200
|
-
}, "
|
|
5200
|
+
}, "MutateConsensusStreamEnded" | "PerEpochConfig" | "ReadConsensusStreamEnded" | "ReadOnlyRoot" | "Cancelled">][], Iterable<readonly [string | Uint8Array<ArrayBufferLike>, _mysten_bcs0.EnumInputShape<{
|
|
5201
5201
|
ReadOnlyRoot: readonly [string | number | bigint, string];
|
|
5202
5202
|
MutateConsensusStreamEnded: string | number | bigint;
|
|
5203
5203
|
ReadConsensusStreamEnded: string | number | bigint;
|
|
@@ -5258,7 +5258,7 @@ declare const suiBcs: {
|
|
|
5258
5258
|
version: string;
|
|
5259
5259
|
digest: string;
|
|
5260
5260
|
};
|
|
5261
|
-
}, "
|
|
5261
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
5262
5262
|
FundsWithdrawal: {
|
|
5263
5263
|
reservation: {
|
|
5264
5264
|
MaxAmountU64: string;
|
|
@@ -5277,7 +5277,7 @@ declare const suiBcs: {
|
|
|
5277
5277
|
};
|
|
5278
5278
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
5279
5279
|
};
|
|
5280
|
-
}, "
|
|
5280
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
5281
5281
|
Pure: {
|
|
5282
5282
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
5283
5283
|
};
|
|
@@ -5562,7 +5562,7 @@ declare const suiBcs: {
|
|
|
5562
5562
|
startVersion: string;
|
|
5563
5563
|
owner: string;
|
|
5564
5564
|
};
|
|
5565
|
-
}, "AddressOwner" | "
|
|
5565
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">;
|
|
5566
5566
|
};
|
|
5567
5567
|
$kind: "RawObject";
|
|
5568
5568
|
}[], Iterable<{
|
|
@@ -5840,7 +5840,7 @@ declare const suiBcs: {
|
|
|
5840
5840
|
version: string;
|
|
5841
5841
|
digest: string;
|
|
5842
5842
|
};
|
|
5843
|
-
}, "
|
|
5843
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
5844
5844
|
FundsWithdrawal: {
|
|
5845
5845
|
reservation: {
|
|
5846
5846
|
MaxAmountU64: string;
|
|
@@ -5859,7 +5859,7 @@ declare const suiBcs: {
|
|
|
5859
5859
|
};
|
|
5860
5860
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
5861
5861
|
};
|
|
5862
|
-
}, "
|
|
5862
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
5863
5863
|
Pure: {
|
|
5864
5864
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
5865
5865
|
};
|
package/dist/client/mvr.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isValidNamedPackage
|
|
1
|
+
import { isValidNamedPackage } from "../utils/named-packages.mjs";
|
|
2
2
|
import { isValidSuiAddress, normalizeStructTag, normalizeSuiAddress, parseStructTag } from "../utils/sui-types.mjs";
|
|
3
|
+
import { isValidNamedType } from "../utils/move-registry.mjs";
|
|
3
4
|
import { PACKAGE_VERSION } from "../version.mjs";
|
|
4
5
|
import { DataLoader, chunk } from "@mysten/utils";
|
|
5
6
|
|
package/dist/client/mvr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvr.mjs","names":["#cache","#url","#pageSize","#overrides","#mvrPackageDataLoader","#resolvePackages","#mvrTypeDataLoader","#resolveTypes","#fetch"],"sources":["../../src/client/mvr.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { chunk, DataLoader } from '@mysten/utils';\nimport { isValidNamedPackage, isValidNamedType } from '../utils/move-registry.js';\nimport type { StructTag } from '../utils/sui-types.js';\nimport {\n\tisValidSuiAddress,\n\tnormalizeStructTag,\n\tnormalizeSuiAddress,\n\tparseStructTag,\n} from '../utils/sui-types.js';\nimport type { ClientCache } from './cache.js';\nimport type { TransactionDataBuilder } from '../transactions/TransactionData.js';\nimport { PACKAGE_VERSION } from '../version.js';\nimport type { SuiClientTypes } from './types.js';\n\nconst NAME_SEPARATOR = '/';\nconst MVR_API_HEADER = {\n\t'Mvr-Source': `@mysten/sui@${PACKAGE_VERSION}`,\n};\n\nexport interface MvrClientOptions {\n\tcache: ClientCache;\n\turl?: string;\n\tpageSize?: number;\n\toverrides?: {\n\t\tpackages?: Record<string, string>;\n\t\ttypes?: Record<string, string>;\n\t};\n}\n\nexport class MvrClient implements SuiClientTypes.MvrMethods {\n\t#cache: ClientCache;\n\t#url?: string;\n\t#pageSize: number;\n\t#overrides: {\n\t\tpackages?: Record<string, string>;\n\t\ttypes?: Record<string, string>;\n\t};\n\n\tconstructor({ cache, url, pageSize = 50, overrides }: MvrClientOptions) {\n\t\tthis.#cache = cache;\n\t\tthis.#url = url;\n\t\tthis.#pageSize = pageSize;\n\t\tthis.#overrides = {\n\t\t\tpackages: overrides?.packages,\n\t\t\ttypes: overrides?.types,\n\t\t};\n\n\t\tvalidateOverrides(this.#overrides);\n\t}\n\n\tget #mvrPackageDataLoader() {\n\t\treturn this.#cache.readSync(['#mvrPackageDataLoader', this.#url ?? ''], () => {\n\t\t\tconst loader = new DataLoader<string, string>(async (packages) => {\n\t\t\t\tif (!this.#url) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`MVR Api URL is not set for the current client (resolving ${packages.join(', ')})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolved = await this.#resolvePackages(packages);\n\n\t\t\t\treturn packages.map(\n\t\t\t\t\t(pkg) => resolved[pkg] ?? new Error(`Failed to resolve package: ${pkg}`),\n\t\t\t\t);\n\t\t\t});\n\t\t\tconst overrides = this.#overrides?.packages;\n\n\t\t\tif (overrides) {\n\t\t\t\tfor (const [pkg, id] of Object.entries(overrides)) {\n\t\t\t\t\tloader.prime(pkg, id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn loader;\n\t\t});\n\t}\n\n\tget #mvrTypeDataLoader() {\n\t\treturn this.#cache.readSync(['#mvrTypeDataLoader', this.#url ?? ''], () => {\n\t\t\tconst loader = new DataLoader<string, string>(async (types) => {\n\t\t\t\tif (!this.#url) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`MVR Api URL is not set for the current client (resolving ${types.join(', ')})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolved = await this.#resolveTypes(types);\n\n\t\t\t\treturn types.map((type) => resolved[type] ?? new Error(`Failed to resolve type: ${type}`));\n\t\t\t});\n\n\t\t\tconst overrides = this.#overrides?.types;\n\n\t\t\tif (overrides) {\n\t\t\t\tfor (const [type, id] of Object.entries(overrides)) {\n\t\t\t\t\tloader.prime(type, id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn loader;\n\t\t});\n\t}\n\n\tasync #resolvePackages(packages: readonly string[]) {\n\t\tif (packages.length === 0) return {};\n\n\t\tconst batches = chunk(packages, this.#pageSize);\n\t\tconst results: Record<string, string> = {};\n\n\t\tawait Promise.all(\n\t\t\tbatches.map(async (batch) => {\n\t\t\t\tconst data = await this.#fetch<{ resolution: Record<string, { package_id: string }> }>(\n\t\t\t\t\t'/v1/resolution/bulk',\n\t\t\t\t\t{\n\t\t\t\t\t\tnames: batch,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!data?.resolution) return;\n\n\t\t\t\tfor (const pkg of Object.keys(data?.resolution)) {\n\t\t\t\t\tconst pkgData = data.resolution[pkg]?.package_id;\n\n\t\t\t\t\tif (!pkgData) continue;\n\n\t\t\t\t\tresults[pkg] = pkgData;\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn results;\n\t}\n\n\tasync #resolveTypes(types: readonly string[]) {\n\t\tif (types.length === 0) return {};\n\n\t\tconst batches = chunk(types, this.#pageSize);\n\t\tconst results: Record<string, string> = {};\n\n\t\tawait Promise.all(\n\t\t\tbatches.map(async (batch) => {\n\t\t\t\tconst data = await this.#fetch<{ resolution: Record<string, { type_tag: string }> }>(\n\t\t\t\t\t'/v1/struct-definition/bulk',\n\t\t\t\t\t{\n\t\t\t\t\t\ttypes: batch,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!data?.resolution) return;\n\n\t\t\t\tfor (const type of Object.keys(data?.resolution)) {\n\t\t\t\t\tconst typeData = data.resolution[type]?.type_tag;\n\t\t\t\t\tif (!typeData) continue;\n\n\t\t\t\t\tresults[type] = typeData;\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn results;\n\t}\n\n\tasync #fetch<T>(url: string, body: Record<string, unknown>): Promise<T> {\n\t\tif (!this.#url) {\n\t\t\tthrow new Error('MVR Api URL is not set for the current client');\n\t\t}\n\n\t\tconst response = await fetch(`${this.#url}${url}`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t...MVR_API_HEADER,\n\t\t\t},\n\t\t\tbody: JSON.stringify(body),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst errorBody = await response.json().catch(() => ({}));\n\t\t\tthrow new Error(`Failed to resolve types: ${errorBody?.message}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync resolvePackage({\n\t\tpackage: name,\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolvePackageOptions): Promise<SuiClientTypes.MvrResolvePackageResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tif (!hasMvrName(name)) {\n\t\t\treturn {\n\t\t\t\tpackage: name,\n\t\t\t};\n\t\t}\n\t\tconst resolved = await raceSignal(this.#mvrPackageDataLoader.load(name), signal);\n\t\treturn {\n\t\t\tpackage: resolved,\n\t\t};\n\t}\n\n\tasync resolveType({\n\t\ttype,\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolveTypeOptions): Promise<SuiClientTypes.MvrResolveTypeResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tif (!hasMvrName(type)) {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t};\n\t\t}\n\n\t\tconst mvrTypes = [...extractMvrTypes(type)];\n\t\tconst resolvedTypes = await raceSignal(this.#mvrTypeDataLoader.loadMany(mvrTypes), signal);\n\n\t\tconst typeMap: Record<string, string> = {};\n\n\t\tfor (let i = 0; i < mvrTypes.length; i++) {\n\t\t\tconst resolvedType = resolvedTypes[i];\n\t\t\tif (resolvedType instanceof Error) {\n\t\t\t\tthrow resolvedType;\n\t\t\t}\n\t\t\ttypeMap[mvrTypes[i]] = resolvedType;\n\t\t}\n\n\t\treturn {\n\t\t\ttype: replaceMvrNames(type, typeMap),\n\t\t};\n\t}\n\n\tasync resolve({\n\t\ttypes = [],\n\t\tpackages = [],\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolveOptions): Promise<SuiClientTypes.MvrResolveResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tconst mvrTypes = new Set<string>();\n\n\t\tfor (const type of types ?? []) {\n\t\t\textractMvrTypes(type, mvrTypes);\n\t\t}\n\n\t\tconst typesArray = [...mvrTypes];\n\t\tconst [resolvedTypes, resolvedPackages] = await raceSignal(\n\t\t\tPromise.all([\n\t\t\t\ttypesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [],\n\t\t\t\tpackages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : [],\n\t\t\t]),\n\t\t\tsignal,\n\t\t);\n\n\t\tconst typeMap: Record<string, string> = {\n\t\t\t...this.#overrides?.types,\n\t\t};\n\n\t\tfor (const [i, type] of typesArray.entries()) {\n\t\t\tconst resolvedType = resolvedTypes[i];\n\t\t\tif (resolvedType instanceof Error) {\n\t\t\t\tthrow resolvedType;\n\t\t\t}\n\t\t\ttypeMap[type] = resolvedType;\n\t\t}\n\n\t\tconst replacedTypes: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\ttype: string;\n\t\t\t}\n\t\t> = {};\n\n\t\tfor (const type of types ?? []) {\n\t\t\tconst resolvedType = replaceMvrNames(type, typeMap);\n\n\t\t\treplacedTypes[type] = {\n\t\t\t\ttype: resolvedType,\n\t\t\t};\n\t\t}\n\n\t\tconst replacedPackages: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tpackage: string;\n\t\t\t}\n\t\t> = {};\n\n\t\tfor (const [i, pkg] of (packages ?? []).entries()) {\n\t\t\tconst resolvedPkg = this.#overrides?.packages?.[pkg] ?? resolvedPackages[i];\n\n\t\t\tif (resolvedPkg instanceof Error) {\n\t\t\t\tthrow resolvedPkg;\n\t\t\t}\n\n\t\t\treplacedPackages[pkg] = {\n\t\t\t\tpackage: resolvedPkg,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttypes: replacedTypes,\n\t\t\tpackages: replacedPackages,\n\t\t};\n\t}\n}\n\nfunction validateOverrides(overrides?: {\n\tpackages?: Record<string, string>;\n\ttypes?: Record<string, string>;\n}) {\n\tif (overrides?.packages) {\n\t\tfor (const [pkg, id] of Object.entries(overrides.packages)) {\n\t\t\tif (!isValidNamedPackage(pkg)) {\n\t\t\t\tthrow new Error(`Invalid package name: ${pkg}`);\n\t\t\t}\n\t\t\tif (!isValidSuiAddress(normalizeSuiAddress(id))) {\n\t\t\t\tthrow new Error(`Invalid package ID: ${id}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (overrides?.types) {\n\t\tfor (const [type, val] of Object.entries(overrides.types)) {\n\t\t\t// validate that types are first-level only.\n\t\t\tif (parseStructTag(type).typeParams.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Type overrides must be first-level only. If you want to supply generic types, just pass each type individually.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst parsedValue = parseStructTag(val);\n\n\t\t\tif (!isValidSuiAddress(parsedValue.address)) {\n\t\t\t\tthrow new Error(`Invalid type: ${val}`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Extracts all named types from a given type.\n */\nexport function extractMvrTypes(type: string | StructTag, types = new Set<string>()) {\n\tif (typeof type === 'string' && !hasMvrName(type)) return types;\n\n\tif (typeof type === 'string' && type.startsWith('vector<') && type.endsWith('>')) {\n\t\treturn extractMvrTypes(type.slice(7, -1), types);\n\t}\n\n\tconst tag = isStructTag(type) ? type : parseStructTag(type);\n\n\tif (hasMvrName(tag.address)) types.add(`${tag.address}::${tag.module}::${tag.name}`);\n\n\tfor (const param of tag.typeParams) {\n\t\textractMvrTypes(param, types);\n\t}\n\n\treturn types;\n}\n\n/**\n * Traverses a type, and replaces any found names with their resolved equivalents,\n * based on the supplied type cache.\n */\nfunction replaceMvrNames(tag: string | StructTag, typeCache: Record<string, string>): string {\n\tif (typeof tag === 'string' && !tag.includes('::')) {\n\t\treturn tag;\n\t}\n\n\tif (typeof tag === 'string' && tag.startsWith('vector<') && tag.endsWith('>')) {\n\t\treturn `vector<${replaceMvrNames(tag.slice(7, -1), typeCache)}>`;\n\t}\n\n\tconst type = isStructTag(tag) ? tag : parseStructTag(tag);\n\n\tconst typeTag = `${type.address}::${type.module}::${type.name}`;\n\tconst cacheHit = typeCache[typeTag];\n\n\treturn normalizeStructTag({\n\t\t...type,\n\t\taddress: cacheHit ? cacheHit.split('::')[0] : type.address,\n\t\ttypeParams: type.typeParams.map((param) => replaceMvrNames(param, typeCache)),\n\t});\n}\n\nexport function hasMvrName(nameOrType: string) {\n\treturn (\n\t\tnameOrType.includes(NAME_SEPARATOR) || nameOrType.includes('@') || nameOrType.includes('.sui')\n\t);\n}\n\n/**\n * Races a promise against an optional AbortSignal. MVR resolution batches lookups\n * from independent callers into a single request via a shared DataLoader, so a\n * caller's signal cannot cancel the shared network request without affecting other\n * callers. Instead, this rejects the awaiting caller as soon as its signal aborts\n * (the underlying request continues in the background).\n *\n * The same isolation applies to any shared/cached request (e.g. `cache.read`).\n */\nexport function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n\tif (!signal) {\n\t\treturn promise;\n\t}\n\n\t// An `abort` event is not replayed for listeners added after the fact, so a signal that was\n\t// already aborted would otherwise resolve normally.\n\tif (signal.aborted) {\n\t\treturn Promise.reject(signal.reason);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst onAbort = () => reject(signal.reason);\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\n\t\tpromise.then(resolve, reject).finally(() => {\n\t\t\tsignal.removeEventListener('abort', onAbort);\n\t\t});\n\t});\n}\n\nfunction isStructTag(type: string | StructTag): type is StructTag {\n\treturn (\n\t\ttypeof type === 'object' &&\n\t\t'address' in type &&\n\t\t'module' in type &&\n\t\t'name' in type &&\n\t\t'typeParams' in type\n\t);\n}\n\nexport type NamedPackagesOverrides = {\n\tpackages: Record<string, string>;\n\ttypes: Record<string, string>;\n};\n\n/**\n * Looks up all `.move` names in a transaction block.\n * Returns a list of all the names found.\n */\nexport function findNamesInTransaction(builder: TransactionDataBuilder): {\n\tpackages: string[];\n\ttypes: string[];\n} {\n\tconst packages: Set<string> = new Set();\n\tconst types: Set<string> = new Set();\n\n\tfor (const command of builder.commands) {\n\t\tswitch (command.$kind) {\n\t\t\tcase 'MakeMoveVec':\n\t\t\t\tif (command.MakeMoveVec.type) {\n\t\t\t\t\tgetNamesFromTypeList([command.MakeMoveVec.type]).forEach((type) => {\n\t\t\t\t\t\ttypes.add(type);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'MoveCall':\n\t\t\t\tconst moveCall = command.MoveCall;\n\n\t\t\t\tconst pkg = moveCall.package.split('::')[0];\n\t\t\t\tif (hasMvrName(pkg)) {\n\t\t\t\t\tif (!isValidNamedPackage(pkg)) throw new Error(`Invalid package name: ${pkg}`);\n\t\t\t\t\tpackages.add(pkg);\n\t\t\t\t}\n\n\t\t\t\tgetNamesFromTypeList(moveCall.typeArguments ?? []).forEach((type) => {\n\t\t\t\t\ttypes.add(type);\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn {\n\t\tpackages: [...packages],\n\t\ttypes: [...types],\n\t};\n}\n\n/**\n * Replace all names & types in a transaction block\n * with their resolved names/types.\n */\nexport function replaceNames(\n\tbuilder: TransactionDataBuilder,\n\tresolved: SuiClientTypes.MvrResolveResponse,\n) {\n\tfor (const command of builder.commands) {\n\t\t// Replacements for `MakeMoveVec` commands (that can include types)\n\t\tif (command.MakeMoveVec?.type) {\n\t\t\tif (!hasMvrName(command.MakeMoveVec.type)) continue;\n\t\t\tif (!resolved.types[command.MakeMoveVec.type])\n\t\t\t\tthrow new Error(`No resolution found for type: ${command.MakeMoveVec.type}`);\n\t\t\tcommand.MakeMoveVec.type = resolved.types[command.MakeMoveVec.type].type;\n\t\t}\n\t\t// Replacements for `MoveCall` commands (that can include packages & types)\n\t\tconst tx = command.MoveCall;\n\t\tif (!tx) continue;\n\n\t\tconst nameParts = tx.package.split('::');\n\t\tconst name = nameParts[0];\n\n\t\tif (hasMvrName(name) && !resolved.packages[name])\n\t\t\tthrow new Error(`No address found for package: ${name}`);\n\n\t\t// Replace package name with address.\n\t\tif (hasMvrName(name)) {\n\t\t\tnameParts[0] = resolved.packages[name].package;\n\t\t\ttx.package = nameParts.join('::');\n\t\t}\n\n\t\tconst types = tx.typeArguments;\n\t\tif (!types) continue;\n\n\t\tfor (let i = 0; i < types.length; i++) {\n\t\t\tif (!hasMvrName(types[i])) continue;\n\n\t\t\tif (!resolved.types[types[i]]) throw new Error(`No resolution found for type: ${types[i]}`);\n\t\t\ttypes[i] = resolved.types[types[i]].type;\n\t\t}\n\n\t\ttx.typeArguments = types;\n\t}\n}\n\n/**\n * Returns a list of unique types that include a name\n * from the given list. This list is retrieved from the Transaction Data.\n */\nfunction getNamesFromTypeList(types: string[]) {\n\tconst names = new Set<string>();\n\tfor (const type of types) {\n\t\tif (hasMvrName(type)) {\n\t\t\tif (!isValidNamedType(type)) throw new Error(`Invalid type with names: ${type}`);\n\t\t\tnames.add(type);\n\t\t}\n\t}\n\treturn names;\n}\n"],"mappings":";;;;;;AAiBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB,EACtB,cAAc,eAAe,mBAC7B;AAYD,IAAa,YAAb,MAA4D;CAC3D;CACA;CACA;CACA;CAKA,YAA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W,KAAK,IAAI,CAAC,SAAS,SAAS,MAC1C,OAAM,IAAI,MAAM,iCAAiC,OAAO;AAGzD,MAAI,WAAW,KAAK,EAAE;AACrB,aAAU,KAAK,SAAS,SAAS,MAAM;AACvC,MAAG,UAAU,UAAU,KAAK,KAAK;;EAGlC,MAAM,QAAQ,GAAG;AACjB,MAAI,CAAC,MAAO;AAEZ,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,OAAI,CAAC,WAAW,MAAM,GAAG,CAAE;AAE3B,OAAI,CAAC,SAAS,MAAM,MAAM,IAAK,OAAM,IAAI,MAAM,iCAAiC,MAAM,KAAK;AAC3F,SAAM,KAAK,SAAS,MAAM,MAAM,IAAI;;AAGrC,KAAG,gBAAgB;;;;;;;AAQrB,SAAS,qBAAqB,OAAiB;CAC9C,MAAM,wBAAQ,IAAI,KAAa;AAC/B,MAAK,MAAM,QAAQ,MAClB,KAAI,WAAW,KAAK,EAAE;AACrB,MAAI,CAAC,iBAAiB,KAAK,CAAE,OAAM,IAAI,MAAM,4BAA4B,OAAO;AAChF,QAAM,IAAI,KAAK;;AAGjB,QAAO"}
|
|
1
|
+
{"version":3,"file":"mvr.mjs","names":["#cache","#url","#pageSize","#overrides","#mvrPackageDataLoader","#resolvePackages","#mvrTypeDataLoader","#resolveTypes","#fetch"],"sources":["../../src/client/mvr.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { chunk, DataLoader } from '@mysten/utils';\nimport { isValidNamedPackage, isValidNamedType } from '../utils/move-registry.js';\nimport type { StructTag } from '../utils/sui-types.js';\nimport {\n\tisValidSuiAddress,\n\tnormalizeStructTag,\n\tnormalizeSuiAddress,\n\tparseStructTag,\n} from '../utils/sui-types.js';\nimport type { ClientCache } from './cache.js';\nimport type { TransactionDataBuilder } from '../transactions/TransactionData.js';\nimport { PACKAGE_VERSION } from '../version.js';\nimport type { SuiClientTypes } from './types.js';\n\nconst NAME_SEPARATOR = '/';\nconst MVR_API_HEADER = {\n\t'Mvr-Source': `@mysten/sui@${PACKAGE_VERSION}`,\n};\n\nexport interface MvrClientOptions {\n\tcache: ClientCache;\n\turl?: string;\n\tpageSize?: number;\n\toverrides?: {\n\t\tpackages?: Record<string, string>;\n\t\ttypes?: Record<string, string>;\n\t};\n}\n\nexport class MvrClient implements SuiClientTypes.MvrMethods {\n\t#cache: ClientCache;\n\t#url?: string;\n\t#pageSize: number;\n\t#overrides: {\n\t\tpackages?: Record<string, string>;\n\t\ttypes?: Record<string, string>;\n\t};\n\n\tconstructor({ cache, url, pageSize = 50, overrides }: MvrClientOptions) {\n\t\tthis.#cache = cache;\n\t\tthis.#url = url;\n\t\tthis.#pageSize = pageSize;\n\t\tthis.#overrides = {\n\t\t\tpackages: overrides?.packages,\n\t\t\ttypes: overrides?.types,\n\t\t};\n\n\t\tvalidateOverrides(this.#overrides);\n\t}\n\n\tget #mvrPackageDataLoader() {\n\t\treturn this.#cache.readSync(['#mvrPackageDataLoader', this.#url ?? ''], () => {\n\t\t\tconst loader = new DataLoader<string, string>(async (packages) => {\n\t\t\t\tif (!this.#url) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`MVR Api URL is not set for the current client (resolving ${packages.join(', ')})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolved = await this.#resolvePackages(packages);\n\n\t\t\t\treturn packages.map(\n\t\t\t\t\t(pkg) => resolved[pkg] ?? new Error(`Failed to resolve package: ${pkg}`),\n\t\t\t\t);\n\t\t\t});\n\t\t\tconst overrides = this.#overrides?.packages;\n\n\t\t\tif (overrides) {\n\t\t\t\tfor (const [pkg, id] of Object.entries(overrides)) {\n\t\t\t\t\tloader.prime(pkg, id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn loader;\n\t\t});\n\t}\n\n\tget #mvrTypeDataLoader() {\n\t\treturn this.#cache.readSync(['#mvrTypeDataLoader', this.#url ?? ''], () => {\n\t\t\tconst loader = new DataLoader<string, string>(async (types) => {\n\t\t\t\tif (!this.#url) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`MVR Api URL is not set for the current client (resolving ${types.join(', ')})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst resolved = await this.#resolveTypes(types);\n\n\t\t\t\treturn types.map((type) => resolved[type] ?? new Error(`Failed to resolve type: ${type}`));\n\t\t\t});\n\n\t\t\tconst overrides = this.#overrides?.types;\n\n\t\t\tif (overrides) {\n\t\t\t\tfor (const [type, id] of Object.entries(overrides)) {\n\t\t\t\t\tloader.prime(type, id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn loader;\n\t\t});\n\t}\n\n\tasync #resolvePackages(packages: readonly string[]) {\n\t\tif (packages.length === 0) return {};\n\n\t\tconst batches = chunk(packages, this.#pageSize);\n\t\tconst results: Record<string, string> = {};\n\n\t\tawait Promise.all(\n\t\t\tbatches.map(async (batch) => {\n\t\t\t\tconst data = await this.#fetch<{ resolution: Record<string, { package_id: string }> }>(\n\t\t\t\t\t'/v1/resolution/bulk',\n\t\t\t\t\t{\n\t\t\t\t\t\tnames: batch,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!data?.resolution) return;\n\n\t\t\t\tfor (const pkg of Object.keys(data?.resolution)) {\n\t\t\t\t\tconst pkgData = data.resolution[pkg]?.package_id;\n\n\t\t\t\t\tif (!pkgData) continue;\n\n\t\t\t\t\tresults[pkg] = pkgData;\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn results;\n\t}\n\n\tasync #resolveTypes(types: readonly string[]) {\n\t\tif (types.length === 0) return {};\n\n\t\tconst batches = chunk(types, this.#pageSize);\n\t\tconst results: Record<string, string> = {};\n\n\t\tawait Promise.all(\n\t\t\tbatches.map(async (batch) => {\n\t\t\t\tconst data = await this.#fetch<{ resolution: Record<string, { type_tag: string }> }>(\n\t\t\t\t\t'/v1/struct-definition/bulk',\n\t\t\t\t\t{\n\t\t\t\t\t\ttypes: batch,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!data?.resolution) return;\n\n\t\t\t\tfor (const type of Object.keys(data?.resolution)) {\n\t\t\t\t\tconst typeData = data.resolution[type]?.type_tag;\n\t\t\t\t\tif (!typeData) continue;\n\n\t\t\t\t\tresults[type] = typeData;\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn results;\n\t}\n\n\tasync #fetch<T>(url: string, body: Record<string, unknown>): Promise<T> {\n\t\tif (!this.#url) {\n\t\t\tthrow new Error('MVR Api URL is not set for the current client');\n\t\t}\n\n\t\tconst response = await fetch(`${this.#url}${url}`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t...MVR_API_HEADER,\n\t\t\t},\n\t\t\tbody: JSON.stringify(body),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst errorBody = await response.json().catch(() => ({}));\n\t\t\tthrow new Error(`Failed to resolve types: ${errorBody?.message}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync resolvePackage({\n\t\tpackage: name,\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolvePackageOptions): Promise<SuiClientTypes.MvrResolvePackageResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tif (!hasMvrName(name)) {\n\t\t\treturn {\n\t\t\t\tpackage: name,\n\t\t\t};\n\t\t}\n\t\tconst resolved = await raceSignal(this.#mvrPackageDataLoader.load(name), signal);\n\t\treturn {\n\t\t\tpackage: resolved,\n\t\t};\n\t}\n\n\tasync resolveType({\n\t\ttype,\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolveTypeOptions): Promise<SuiClientTypes.MvrResolveTypeResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tif (!hasMvrName(type)) {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t};\n\t\t}\n\n\t\tconst mvrTypes = [...extractMvrTypes(type)];\n\t\tconst resolvedTypes = await raceSignal(this.#mvrTypeDataLoader.loadMany(mvrTypes), signal);\n\n\t\tconst typeMap: Record<string, string> = {};\n\n\t\tfor (let i = 0; i < mvrTypes.length; i++) {\n\t\t\tconst resolvedType = resolvedTypes[i];\n\t\t\tif (resolvedType instanceof Error) {\n\t\t\t\tthrow resolvedType;\n\t\t\t}\n\t\t\ttypeMap[mvrTypes[i]] = resolvedType;\n\t\t}\n\n\t\treturn {\n\t\t\ttype: replaceMvrNames(type, typeMap),\n\t\t};\n\t}\n\n\tasync resolve({\n\t\ttypes = [],\n\t\tpackages = [],\n\t\tsignal,\n\t}: SuiClientTypes.MvrResolveOptions): Promise<SuiClientTypes.MvrResolveResponse> {\n\t\tsignal?.throwIfAborted();\n\t\tconst mvrTypes = new Set<string>();\n\n\t\tfor (const type of types ?? []) {\n\t\t\textractMvrTypes(type, mvrTypes);\n\t\t}\n\n\t\tconst typesArray = [...mvrTypes];\n\t\tconst [resolvedTypes, resolvedPackages] = await raceSignal(\n\t\t\tPromise.all([\n\t\t\t\ttypesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [],\n\t\t\t\tpackages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : [],\n\t\t\t]),\n\t\t\tsignal,\n\t\t);\n\n\t\tconst typeMap: Record<string, string> = {\n\t\t\t...this.#overrides?.types,\n\t\t};\n\n\t\tfor (const [i, type] of typesArray.entries()) {\n\t\t\tconst resolvedType = resolvedTypes[i];\n\t\t\tif (resolvedType instanceof Error) {\n\t\t\t\tthrow resolvedType;\n\t\t\t}\n\t\t\ttypeMap[type] = resolvedType;\n\t\t}\n\n\t\tconst replacedTypes: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\ttype: string;\n\t\t\t}\n\t\t> = {};\n\n\t\tfor (const type of types ?? []) {\n\t\t\tconst resolvedType = replaceMvrNames(type, typeMap);\n\n\t\t\treplacedTypes[type] = {\n\t\t\t\ttype: resolvedType,\n\t\t\t};\n\t\t}\n\n\t\tconst replacedPackages: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tpackage: string;\n\t\t\t}\n\t\t> = {};\n\n\t\tfor (const [i, pkg] of (packages ?? []).entries()) {\n\t\t\tconst resolvedPkg = this.#overrides?.packages?.[pkg] ?? resolvedPackages[i];\n\n\t\t\tif (resolvedPkg instanceof Error) {\n\t\t\t\tthrow resolvedPkg;\n\t\t\t}\n\n\t\t\treplacedPackages[pkg] = {\n\t\t\t\tpackage: resolvedPkg,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttypes: replacedTypes,\n\t\t\tpackages: replacedPackages,\n\t\t};\n\t}\n}\n\nfunction validateOverrides(overrides?: {\n\tpackages?: Record<string, string>;\n\ttypes?: Record<string, string>;\n}) {\n\tif (overrides?.packages) {\n\t\tfor (const [pkg, id] of Object.entries(overrides.packages)) {\n\t\t\tif (!isValidNamedPackage(pkg)) {\n\t\t\t\tthrow new Error(`Invalid package name: ${pkg}`);\n\t\t\t}\n\t\t\tif (!isValidSuiAddress(normalizeSuiAddress(id))) {\n\t\t\t\tthrow new Error(`Invalid package ID: ${id}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (overrides?.types) {\n\t\tfor (const [type, val] of Object.entries(overrides.types)) {\n\t\t\t// validate that types are first-level only.\n\t\t\tif (parseStructTag(type).typeParams.length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Type overrides must be first-level only. If you want to supply generic types, just pass each type individually.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst parsedValue = parseStructTag(val);\n\n\t\t\tif (!isValidSuiAddress(parsedValue.address)) {\n\t\t\t\tthrow new Error(`Invalid type: ${val}`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Extracts all named types from a given type.\n */\nexport function extractMvrTypes(type: string | StructTag, types = new Set<string>()) {\n\tif (typeof type === 'string' && !hasMvrName(type)) return types;\n\n\tif (typeof type === 'string' && type.startsWith('vector<') && type.endsWith('>')) {\n\t\treturn extractMvrTypes(type.slice(7, -1), types);\n\t}\n\n\tconst tag = isStructTag(type) ? type : parseStructTag(type);\n\n\tif (hasMvrName(tag.address)) types.add(`${tag.address}::${tag.module}::${tag.name}`);\n\n\tfor (const param of tag.typeParams) {\n\t\textractMvrTypes(param, types);\n\t}\n\n\treturn types;\n}\n\n/**\n * Traverses a type, and replaces any found names with their resolved equivalents,\n * based on the supplied type cache.\n */\nfunction replaceMvrNames(tag: string | StructTag, typeCache: Record<string, string>): string {\n\tif (typeof tag === 'string' && !tag.includes('::')) {\n\t\treturn tag;\n\t}\n\n\tif (typeof tag === 'string' && tag.startsWith('vector<') && tag.endsWith('>')) {\n\t\treturn `vector<${replaceMvrNames(tag.slice(7, -1), typeCache)}>`;\n\t}\n\n\tconst type = isStructTag(tag) ? tag : parseStructTag(tag);\n\n\tconst typeTag = `${type.address}::${type.module}::${type.name}`;\n\tconst cacheHit = typeCache[typeTag];\n\n\treturn normalizeStructTag({\n\t\t...type,\n\t\taddress: cacheHit ? cacheHit.split('::')[0] : type.address,\n\t\ttypeParams: type.typeParams.map((param) => replaceMvrNames(param, typeCache)),\n\t});\n}\n\nexport function hasMvrName(nameOrType: string) {\n\treturn (\n\t\tnameOrType.includes(NAME_SEPARATOR) || nameOrType.includes('@') || nameOrType.includes('.sui')\n\t);\n}\n\n/**\n * Races a promise against an optional AbortSignal. MVR resolution batches lookups\n * from independent callers into a single request via a shared DataLoader, so a\n * caller's signal cannot cancel the shared network request without affecting other\n * callers. Instead, this rejects the awaiting caller as soon as its signal aborts\n * (the underlying request continues in the background).\n *\n * The same isolation applies to any shared/cached request (e.g. `cache.read`).\n */\nexport function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n\tif (!signal) {\n\t\treturn promise;\n\t}\n\n\t// An `abort` event is not replayed for listeners added after the fact, so a signal that was\n\t// already aborted would otherwise resolve normally.\n\tif (signal.aborted) {\n\t\treturn Promise.reject(signal.reason);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst onAbort = () => reject(signal.reason);\n\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\n\t\tpromise.then(resolve, reject).finally(() => {\n\t\t\tsignal.removeEventListener('abort', onAbort);\n\t\t});\n\t});\n}\n\nfunction isStructTag(type: string | StructTag): type is StructTag {\n\treturn (\n\t\ttypeof type === 'object' &&\n\t\t'address' in type &&\n\t\t'module' in type &&\n\t\t'name' in type &&\n\t\t'typeParams' in type\n\t);\n}\n\nexport type NamedPackagesOverrides = {\n\tpackages: Record<string, string>;\n\ttypes: Record<string, string>;\n};\n\n/**\n * Looks up all `.move` names in a transaction block.\n * Returns a list of all the names found.\n */\nexport function findNamesInTransaction(builder: TransactionDataBuilder): {\n\tpackages: string[];\n\ttypes: string[];\n} {\n\tconst packages: Set<string> = new Set();\n\tconst types: Set<string> = new Set();\n\n\tfor (const command of builder.commands) {\n\t\tswitch (command.$kind) {\n\t\t\tcase 'MakeMoveVec':\n\t\t\t\tif (command.MakeMoveVec.type) {\n\t\t\t\t\tgetNamesFromTypeList([command.MakeMoveVec.type]).forEach((type) => {\n\t\t\t\t\t\ttypes.add(type);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'MoveCall':\n\t\t\t\tconst moveCall = command.MoveCall;\n\n\t\t\t\tconst pkg = moveCall.package.split('::')[0];\n\t\t\t\tif (hasMvrName(pkg)) {\n\t\t\t\t\tif (!isValidNamedPackage(pkg)) throw new Error(`Invalid package name: ${pkg}`);\n\t\t\t\t\tpackages.add(pkg);\n\t\t\t\t}\n\n\t\t\t\tgetNamesFromTypeList(moveCall.typeArguments ?? []).forEach((type) => {\n\t\t\t\t\ttypes.add(type);\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn {\n\t\tpackages: [...packages],\n\t\ttypes: [...types],\n\t};\n}\n\n/**\n * Replace all names & types in a transaction block\n * with their resolved names/types.\n */\nexport function replaceNames(\n\tbuilder: TransactionDataBuilder,\n\tresolved: SuiClientTypes.MvrResolveResponse,\n) {\n\tfor (const command of builder.commands) {\n\t\t// Replacements for `MakeMoveVec` commands (that can include types)\n\t\tif (command.MakeMoveVec?.type) {\n\t\t\tif (!hasMvrName(command.MakeMoveVec.type)) continue;\n\t\t\tif (!resolved.types[command.MakeMoveVec.type])\n\t\t\t\tthrow new Error(`No resolution found for type: ${command.MakeMoveVec.type}`);\n\t\t\tcommand.MakeMoveVec.type = resolved.types[command.MakeMoveVec.type].type;\n\t\t}\n\t\t// Replacements for `MoveCall` commands (that can include packages & types)\n\t\tconst tx = command.MoveCall;\n\t\tif (!tx) continue;\n\n\t\tconst nameParts = tx.package.split('::');\n\t\tconst name = nameParts[0];\n\n\t\tif (hasMvrName(name) && !resolved.packages[name])\n\t\t\tthrow new Error(`No address found for package: ${name}`);\n\n\t\t// Replace package name with address.\n\t\tif (hasMvrName(name)) {\n\t\t\tnameParts[0] = resolved.packages[name].package;\n\t\t\ttx.package = nameParts.join('::');\n\t\t}\n\n\t\tconst types = tx.typeArguments;\n\t\tif (!types) continue;\n\n\t\tfor (let i = 0; i < types.length; i++) {\n\t\t\tif (!hasMvrName(types[i])) continue;\n\n\t\t\tif (!resolved.types[types[i]]) throw new Error(`No resolution found for type: ${types[i]}`);\n\t\t\ttypes[i] = resolved.types[types[i]].type;\n\t\t}\n\n\t\ttx.typeArguments = types;\n\t}\n}\n\n/**\n * Returns a list of unique types that include a name\n * from the given list. This list is retrieved from the Transaction Data.\n */\nfunction getNamesFromTypeList(types: string[]) {\n\tconst names = new Set<string>();\n\tfor (const type of types) {\n\t\tif (hasMvrName(type)) {\n\t\t\tif (!isValidNamedType(type)) throw new Error(`Invalid type with names: ${type}`);\n\t\t\tnames.add(type);\n\t\t}\n\t}\n\treturn names;\n}\n"],"mappings":";;;;;;;AAiBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB,EACtB,cAAc,eAAe,mBAC7B;AAYD,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AM,KAAK;EACxC,MAAM,OAAO,UAAU;AAEvB,MAAI,WAAW,KAAK,IAAI,CAAC,SAAS,SAAS,MAC1C,OAAM,IAAI,MAAM,iCAAiC,OAAO;AAGzD,MAAI,WAAW,KAAK,EAAE;AACrB,aAAU,KAAK,SAAS,SAAS,MAAM;AACvC,MAAG,UAAU,UAAU,KAAK,KAAK;;EAGlC,MAAM,QAAQ,GAAG;AACjB,MAAI,CAAC,MAAO;AAEZ,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,OAAI,CAAC,WAAW,MAAM,GAAG,CAAE;AAE3B,OAAI,CAAC,SAAS,MAAM,MAAM,IAAK,OAAM,IAAI,MAAM,iCAAiC,MAAM,KAAK;AAC3F,SAAM,KAAK,SAAS,MAAM,MAAM,IAAI;;AAGrC,KAAG,gBAAgB;;;;;;;AAQrB,SAAS,qBAAqB,OAAiB;CAC9C,MAAM,wBAAQ,IAAI,KAAa;AAC/B,MAAK,MAAM,QAAQ,MAClB,KAAI,WAAW,KAAK,EAAE;AACrB,MAAI,CAAC,iBAAiB,KAAK,CAAE,OAAM,IAAI,MAAM,4BAA4B,OAAO;AAChF,QAAM,IAAI,KAAK;;AAGjB,QAAO"}
|
|
@@ -23,6 +23,12 @@ declare function toSerializedSignature({
|
|
|
23
23
|
* Decodes a serialized signature into its constituent components: the signature scheme, the actual signature, and the public key
|
|
24
24
|
*/
|
|
25
25
|
declare function parseSerializedSignature(serializedSignature: string): {
|
|
26
|
+
serializedSignature: string;
|
|
27
|
+
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
|
|
28
|
+
signature: Uint8Array<ArrayBuffer>;
|
|
29
|
+
publicKey: Uint8Array<ArrayBuffer>;
|
|
30
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
31
|
+
} | {
|
|
26
32
|
signatureScheme: "Passkey";
|
|
27
33
|
serializedSignature: string;
|
|
28
34
|
signature: Uint8Array<ArrayBufferLike>;
|
|
@@ -30,12 +36,6 @@ declare function parseSerializedSignature(serializedSignature: string): {
|
|
|
30
36
|
clientDataJson: string;
|
|
31
37
|
userSignature: Uint8Array<ArrayBuffer>;
|
|
32
38
|
publicKey: Uint8Array<ArrayBuffer>;
|
|
33
|
-
} | {
|
|
34
|
-
serializedSignature: string;
|
|
35
|
-
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
|
|
36
|
-
signature: Uint8Array<ArrayBuffer>;
|
|
37
|
-
publicKey: Uint8Array<ArrayBuffer>;
|
|
38
|
-
bytes: Uint8Array<ArrayBuffer>;
|
|
39
39
|
} | {
|
|
40
40
|
serializedSignature: string;
|
|
41
41
|
signatureScheme: "ZkLogin";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AdvanceCheckpointRequest, AdvanceCheckpointResponse, AdvanceClockRequest, AdvanceClockResponse, GetStatusRequest, GetStatusResponse } from "./forking_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime1 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc1 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/forking/v1alpha/forking_service.client.d.ts
|
|
@@ -37,9 +37,9 @@ interface IForkingServiceClient {
|
|
|
37
37
|
declare class ForkingServiceClient implements IForkingServiceClient, ServiceInfo {
|
|
38
38
|
private readonly _transport;
|
|
39
39
|
typeName: string;
|
|
40
|
-
methods:
|
|
40
|
+
methods: _protobuf_ts_runtime_rpc1.MethodInfo<any, any>[];
|
|
41
41
|
options: {
|
|
42
|
-
[extensionName: string]:
|
|
42
|
+
[extensionName: string]: _protobuf_ts_runtime1.JsonValue;
|
|
43
43
|
};
|
|
44
44
|
constructor(_transport: RpcTransport);
|
|
45
45
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetDatatypeRequest, GetDatatypeResponse, GetFunctionRequest, GetFunctionResponse, GetPackageRequest, GetPackageResponse, ListPackageVersionsRequest, ListPackageVersionsResponse } from "./move_package_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime2 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc2 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts
|
|
@@ -31,9 +31,9 @@ interface IMovePackageServiceClient {
|
|
|
31
31
|
declare class MovePackageServiceClient implements IMovePackageServiceClient, ServiceInfo {
|
|
32
32
|
private readonly _transport;
|
|
33
33
|
typeName: string;
|
|
34
|
-
methods:
|
|
34
|
+
methods: _protobuf_ts_runtime_rpc2.MethodInfo<any, any>[];
|
|
35
35
|
options: {
|
|
36
|
-
[extensionName: string]:
|
|
36
|
+
[extensionName: string]: _protobuf_ts_runtime2.JsonValue;
|
|
37
37
|
};
|
|
38
38
|
constructor(_transport: RpcTransport);
|
|
39
39
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VerifySignatureRequest, VerifySignatureResponse } from "./signature_verification_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime5 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc5 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts
|
|
@@ -21,9 +21,9 @@ interface ISignatureVerificationServiceClient {
|
|
|
21
21
|
declare class SignatureVerificationServiceClient implements ISignatureVerificationServiceClient, ServiceInfo {
|
|
22
22
|
private readonly _transport;
|
|
23
23
|
typeName: string;
|
|
24
|
-
methods:
|
|
24
|
+
methods: _protobuf_ts_runtime_rpc5.MethodInfo<any, any>[];
|
|
25
25
|
options: {
|
|
26
|
-
[extensionName: string]:
|
|
26
|
+
[extensionName: string]: _protobuf_ts_runtime5.JsonValue;
|
|
27
27
|
};
|
|
28
28
|
constructor(_transport: RpcTransport);
|
|
29
29
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetBalanceRequest, GetBalanceResponse, GetCoinInfoRequest, GetCoinInfoResponse, ListBalancesRequest, ListBalancesResponse, ListDynamicFieldsRequest, ListDynamicFieldsResponse, ListOwnedObjectsRequest, ListOwnedObjectsResponse } from "./state_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime3 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc3 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/state_service.client.d.ts
|
|
@@ -35,9 +35,9 @@ interface IStateServiceClient {
|
|
|
35
35
|
declare class StateServiceClient implements IStateServiceClient, ServiceInfo {
|
|
36
36
|
private readonly _transport;
|
|
37
37
|
typeName: string;
|
|
38
|
-
methods:
|
|
38
|
+
methods: _protobuf_ts_runtime_rpc3.MethodInfo<any, any>[];
|
|
39
39
|
options: {
|
|
40
|
-
[extensionName: string]:
|
|
40
|
+
[extensionName: string]: _protobuf_ts_runtime3.JsonValue;
|
|
41
41
|
};
|
|
42
42
|
constructor(_transport: RpcTransport);
|
|
43
43
|
/**
|
package/dist/jsonRpc/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeSuiNSName } from "../utils/suins.mjs";
|
|
2
|
-
import { isValidNamedPackage } from "../utils/
|
|
2
|
+
import { isValidNamedPackage } from "../utils/named-packages.mjs";
|
|
3
3
|
import { isValidSuiAddress, isValidSuiObjectId, isValidTransactionDigest, normalizeSuiAddress, normalizeSuiObjectId } from "../utils/sui-types.mjs";
|
|
4
4
|
import { BaseClient } from "../client/client.mjs";
|
|
5
5
|
import { hasMvrName } from "../client/mvr.mjs";
|
|
@@ -130,7 +130,7 @@ declare class Transaction {
|
|
|
130
130
|
chain: string;
|
|
131
131
|
nonce: number;
|
|
132
132
|
};
|
|
133
|
-
}, "
|
|
133
|
+
}, "Epoch" | "None" | "ValidDuring" | "Validity"> | null | undefined;
|
|
134
134
|
gasData: {
|
|
135
135
|
budget: string | number | null;
|
|
136
136
|
price: string | number | null;
|
|
@@ -158,7 +158,7 @@ declare class Transaction {
|
|
|
158
158
|
version: string | number;
|
|
159
159
|
digest: string;
|
|
160
160
|
};
|
|
161
|
-
}, "
|
|
161
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
162
162
|
Pure: {
|
|
163
163
|
bytes: string;
|
|
164
164
|
};
|
|
@@ -190,7 +190,7 @@ declare class Transaction {
|
|
|
190
190
|
};
|
|
191
191
|
}, "Sender" | "Sponsor" | "SenderAllowance">;
|
|
192
192
|
};
|
|
193
|
-
}, "
|
|
193
|
+
}, "Object" | "Pure" | "FundsWithdrawal" | "UnresolvedPure" | "UnresolvedObject">[];
|
|
194
194
|
commands: _mysten_bcs1397.EnumOutputShapeWithKeys<{
|
|
195
195
|
MoveCall: {
|
|
196
196
|
package: string;
|