@mysten/sui 2.20.2 → 2.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +20 -20
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +4 -1
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/mvr.mjs +29 -7
- package/dist/client/mvr.mjs.map +1 -1
- package/dist/client/transaction-resolver.mjs +1 -0
- package/dist/client/transaction-resolver.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +8 -8
- package/dist/graphql/core.mjs +3 -1
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +6 -2
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +1 -1
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +4 -4
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +45 -27
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/jsonRpc/client.d.mts +160 -0
- package/dist/jsonRpc/client.d.mts.map +1 -1
- package/dist/jsonRpc/client.mjs +142 -0
- package/dist/jsonRpc/client.mjs.map +1 -1
- package/dist/jsonRpc/core.d.mts +80 -0
- package/dist/jsonRpc/core.d.mts.map +1 -1
- package/dist/jsonRpc/core.mjs +80 -0
- package/dist/jsonRpc/core.mjs.map +1 -1
- package/dist/jsonRpc/errors.d.mts +12 -0
- package/dist/jsonRpc/errors.d.mts.map +1 -1
- package/dist/jsonRpc/errors.mjs +12 -0
- package/dist/jsonRpc/errors.mjs.map +1 -1
- package/dist/jsonRpc/http-transport.d.mts +30 -0
- package/dist/jsonRpc/http-transport.d.mts.map +1 -1
- package/dist/jsonRpc/http-transport.mjs +16 -0
- package/dist/jsonRpc/http-transport.mjs.map +1 -1
- package/dist/jsonRpc/network.d.mts +4 -0
- package/dist/jsonRpc/network.d.mts.map +1 -1
- package/dist/jsonRpc/network.mjs +4 -0
- package/dist/jsonRpc/network.mjs.map +1 -1
- package/dist/jsonRpc/types/chain.d.mts +68 -0
- package/dist/jsonRpc/types/chain.d.mts.map +1 -1
- package/dist/jsonRpc/types/changes.d.mts +24 -0
- package/dist/jsonRpc/types/changes.d.mts.map +1 -1
- package/dist/jsonRpc/types/coins.d.mts +4 -0
- package/dist/jsonRpc/types/coins.d.mts.map +1 -1
- package/dist/jsonRpc/types/common.d.mts +4 -0
- package/dist/jsonRpc/types/common.d.mts.map +1 -1
- package/dist/jsonRpc/types/generated.d.mts +497 -16
- package/dist/jsonRpc/types/generated.d.mts.map +1 -1
- package/dist/jsonRpc/types/params.d.mts +289 -41
- package/dist/jsonRpc/types/params.d.mts.map +1 -1
- package/dist/transactions/Transaction.d.mts +9 -9
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/data/v1.d.mts +220 -220
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/client/core.ts +1 -0
- package/src/client/mvr.ts +39 -6
- package/src/client/transaction-resolver.ts +1 -0
- package/src/graphql/core.ts +2 -0
- package/src/graphql/generated/queries.ts +211 -4923
- package/src/graphql/queries/transactions.graphql +10 -2
- package/src/grpc/client.ts +10 -7
- package/src/grpc/core.ts +204 -134
- package/src/jsonRpc/client.ts +160 -0
- package/src/jsonRpc/core.ts +80 -0
- package/src/jsonRpc/errors.ts +12 -0
- package/src/jsonRpc/http-transport.ts +30 -0
- package/src/jsonRpc/network.ts +4 -0
- package/src/jsonRpc/types/chain.ts +68 -0
- package/src/jsonRpc/types/changes.ts +24 -0
- package/src/jsonRpc/types/coins.ts +4 -0
- package/src/jsonRpc/types/common.ts +4 -0
- package/src/jsonRpc/types/generated.ts +497 -16
- package/src/jsonRpc/types/params.ts +289 -41
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @mysten/sui.js
|
|
2
2
|
|
|
3
|
+
## 2.20.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7333638: Deprecate JSON-RPC client APIs, transport APIs, and JSON-RPC-specific types. Migrate to
|
|
8
|
+
`SuiGrpcClient` or `SuiGraphQLClient`.
|
|
9
|
+
- e77aa8d: Forward `AbortSignal` from `SuiGrpcClient` method options to the underlying gRPC
|
|
10
|
+
requests. Previously methods like `listOwnedObjects` accepted a `signal` but never passed it
|
|
11
|
+
through, so passing `signal` did not cancel the request. MVR
|
|
12
|
+
(`resolveType`/`resolvePackage`/`resolve`) resolution is now also cancellable via the same signal.
|
|
13
|
+
|
|
14
|
+
## 2.20.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 5028c01: Fix kind-only transaction builds (`onlyTransactionKind: true`) that reference an owned
|
|
19
|
+
object without a sender set (e.g. the seal use-case). The gRPC and GraphQL clients now disable
|
|
20
|
+
simulation validation checks when resolving kind-only builds, so a transaction that would fail to
|
|
21
|
+
simulate can still be serialized. Kind-only builds also no longer leak the dummy `0x0` sender used
|
|
22
|
+
for resolution back into the transaction data, matching the JSON-RPC client's behavior.
|
|
23
|
+
|
|
3
24
|
## 2.20.2
|
|
4
25
|
|
|
5
26
|
### 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_bcs823 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_bcs823.BcsStruct<{
|
|
8
|
+
intent: _mysten_bcs823.BcsStruct<{
|
|
9
|
+
scope: _mysten_bcs823.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_bcs823.BcsEnum<{
|
|
16
16
|
V0: null;
|
|
17
17
|
}, "IntentVersion">;
|
|
18
|
-
appId:
|
|
18
|
+
appId: _mysten_bcs823.BcsEnum<{
|
|
19
19
|
Sui: null;
|
|
20
20
|
}, "AppId">;
|
|
21
21
|
}, string>;
|
package/dist/bcs/index.d.mts
CHANGED
|
@@ -545,7 +545,7 @@ declare const suiBcs: {
|
|
|
545
545
|
version: string;
|
|
546
546
|
digest: string;
|
|
547
547
|
};
|
|
548
|
-
}, "
|
|
548
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
563
|
+
}, "Object" | "Pure" | "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
|
-
}, "
|
|
796
|
+
}, "TransactionEffects" | "TransactionData" | "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
|
-
}, "
|
|
830
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
845
|
+
}, "Object" | "Pure" | "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
|
-
}, "
|
|
953
|
+
}, "Epoch" | "None" | "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
|
-
}, "
|
|
1196
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
1211
|
+
}, "Object" | "Pure" | "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
|
-
}, "
|
|
1511
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
1526
|
+
}, "Object" | "Pure" | "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
|
-
}, "
|
|
1802
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
1817
|
+
}, "Object" | "Pure" | "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" | "
|
|
2274
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], 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" | "
|
|
2307
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], 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" | "
|
|
2340
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">][], 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" | "
|
|
2607
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
|
|
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" | "
|
|
2622
|
+
}, "AddressOwner" | "ConsensusAddressOwner" | "Immutable" | "ObjectOwner" | "Shared">];
|
|
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
|
-
}, "
|
|
2708
|
+
}, "MutateConsensusStreamEnded" | "PerEpochConfig" | "ReadConsensusStreamEnded" | "ReadOnlyRoot" | "Cancelled">][], 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
|
-
}, "
|
|
2754
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
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
|
-
}, "
|
|
2769
|
+
}, "Object" | "Pure" | "FundsWithdrawal">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
2770
2770
|
Pure: {
|
|
2771
2771
|
bytes: string | Uint8Array<ArrayBufferLike>;
|
|
2772
2772
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.mts","names":[],"sources":["../../src/client/core.ts"],"mappings":";;;;;;KAYY,iBAAA,GAAoB,oBAAA;EAC/B,IAAA,EAAM,UAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,cAAA,CAAe,gBAAA;EACzD,IAAA,EAAM,UAAA;EACN,GAAA,GAAM,cAAA,CAAe,UAAA;AAAA;AAAA,uBAQA,UAAA,SAAmB,UAAA,YAAsB,cAAA,CAAe,gBAAA;EAC7E,IAAA;EACA,GAAA,EAAK,cAAA,CAAe,UAAA;cAER,OAAA,EAAS,iBAAA;EAAA,SAWZ,UAAA,iBAA2B,cAAA,CAAe,aAAA,MAAA,CAClD,OAAA,EAAS,cAAA,CAAe,iBAAA,CAAkB,OAAA,IACxC,OAAA,CAAQ,cAAA,CAAe,kBAAA,CAAmB,OAAA;EAEvC,SAAA,iBAA0B,cAAA,CAAe,aAAA,MAAA,CAC9C,OAAA,EAAS,cAAA,CAAe,gBAAA,CAAiB,OAAA,IACvC,OAAA,CAAQ,cAAA,CAAe,iBAAA,CAAkB,OAAA;EAAA,SAenC,SAAA,CACR,OAAA,EAAS,cAAA,CAAe,gBAAA,GACtB,OAAA,CAAQ,cAAA,CAAe,iBAAA;EAAA,SAEjB,gBAAA,iBAAiC,cAAA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
|
|
33
33
|
}
|
|
34
34
|
async getDynamicField(options) {
|
|
35
|
-
const normalizedNameType = TypeTagSerializer.parseFromStr((await this.core.mvr.resolveType({
|
|
35
|
+
const normalizedNameType = TypeTagSerializer.parseFromStr((await this.core.mvr.resolveType({
|
|
36
|
+
type: options.name.type,
|
|
37
|
+
signal: options.signal
|
|
38
|
+
})).type);
|
|
36
39
|
const fieldId = deriveDynamicFieldID(options.parentId, normalizedNameType, options.name.bcs);
|
|
37
40
|
const { objects: [fieldObject] } = await this.getObjects({
|
|
38
41
|
objectIds: [fieldId],
|
package/dist/client/core.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.mjs","names":["bcs"],"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TypeTagSerializer } from '../bcs/type-tag-serializer.js';\nimport type { TransactionPlugin } from '../transactions/index.js';\nimport { deriveDynamicFieldID } from '../utils/dynamic-fields.js';\nimport { normalizeStructTag, parseStructTag, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport { BaseClient } from './client.js';\nimport type { ClientWithExtensions, SuiClientTypes } from './types.js';\nimport { MvrClient } from './mvr.js';\nimport { bcs } from '../bcs/index.js';\n\nexport type ClientWithCoreApi = ClientWithExtensions<{\n\tcore: CoreClient;\n}>;\n\nexport interface CoreClientOptions extends SuiClientTypes.SuiClientOptions {\n\tbase: BaseClient;\n\tmvr?: SuiClientTypes.MvrOptions;\n}\n\nconst DEFAULT_MVR_URLS: Record<string, string> = {\n\tmainnet: 'https://mainnet.mvr.mystenlabs.com',\n\ttestnet: 'https://testnet.mvr.mystenlabs.com',\n};\n\nexport abstract class CoreClient extends BaseClient implements SuiClientTypes.TransportMethods {\n\tcore = this;\n\tmvr: SuiClientTypes.MvrMethods;\n\n\tconstructor(options: CoreClientOptions) {\n\t\tsuper(options);\n\n\t\tthis.mvr = new MvrClient({\n\t\t\tcache: this.cache.scope('core.mvr'),\n\t\t\turl: options.mvr?.url ?? DEFAULT_MVR_URLS[this.network],\n\t\t\tpageSize: options.mvr?.pageSize,\n\t\t\toverrides: options.mvr?.overrides,\n\t\t});\n\t}\n\n\tabstract getObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectsResponse<Include>>;\n\n\tasync getObject<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetObjectOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectResponse<Include>> {\n\t\tconst { objectId } = options;\n\t\tconst {\n\t\t\tobjects: [result],\n\t\t} = await this.getObjects({\n\t\t\tobjectIds: [objectId],\n\t\t\tsignal: options.signal,\n\t\t\tinclude: options.include,\n\t\t});\n\t\tif (result instanceof Error) {\n\t\t\tthrow result;\n\t\t}\n\t\treturn { object: result };\n\t}\n\n\tabstract listCoins(\n\t\toptions: SuiClientTypes.ListCoinsOptions,\n\t): Promise<SuiClientTypes.ListCoinsResponse>;\n\n\tabstract listOwnedObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.ListOwnedObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.ListOwnedObjectsResponse<Include>>;\n\n\tabstract getBalance(\n\t\toptions: SuiClientTypes.GetBalanceOptions,\n\t): Promise<SuiClientTypes.GetBalanceResponse>;\n\n\tabstract listBalances(\n\t\toptions: SuiClientTypes.ListBalancesOptions,\n\t): Promise<SuiClientTypes.ListBalancesResponse>;\n\n\tabstract getCoinMetadata(\n\t\toptions: SuiClientTypes.GetCoinMetadataOptions,\n\t): Promise<SuiClientTypes.GetCoinMetadataResponse>;\n\n\tabstract getTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.GetTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>>;\n\n\tabstract executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.ExecuteTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>>;\n\n\tabstract simulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(\n\t\toptions: SuiClientTypes.SimulateTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.SimulateTransactionResult<Include>>;\n\n\tabstract getReferenceGasPrice(\n\t\toptions?: SuiClientTypes.GetReferenceGasPriceOptions,\n\t): Promise<SuiClientTypes.GetReferenceGasPriceResponse>;\n\n\tabstract getCurrentSystemState(\n\t\toptions?: SuiClientTypes.GetCurrentSystemStateOptions,\n\t): Promise<SuiClientTypes.GetCurrentSystemStateResponse>;\n\n\tabstract getProtocolConfig(\n\t\toptions?: SuiClientTypes.GetProtocolConfigOptions,\n\t): Promise<SuiClientTypes.GetProtocolConfigResponse>;\n\n\tabstract getChainIdentifier(\n\t\toptions?: SuiClientTypes.GetChainIdentifierOptions,\n\t): Promise<SuiClientTypes.GetChainIdentifierResponse>;\n\n\tabstract listDynamicFields(\n\t\toptions: SuiClientTypes.ListDynamicFieldsOptions,\n\t): Promise<SuiClientTypes.ListDynamicFieldsResponse>;\n\n\tabstract resolveTransactionPlugin(): TransactionPlugin;\n\n\tabstract verifyZkLoginSignature(\n\t\toptions: SuiClientTypes.VerifyZkLoginSignatureOptions,\n\t): Promise<SuiClientTypes.ZkLoginVerifyResponse>;\n\n\tabstract getMoveFunction(\n\t\toptions: SuiClientTypes.GetMoveFunctionOptions,\n\t): Promise<SuiClientTypes.GetMoveFunctionResponse>;\n\n\tabstract defaultNameServiceName(\n\t\toptions: SuiClientTypes.DefaultNameServiceNameOptions,\n\t): Promise<SuiClientTypes.DefaultNameServiceNameResponse>;\n\n\tasync getDynamicField(\n\t\toptions: SuiClientTypes.GetDynamicFieldOptions,\n\t): Promise<SuiClientTypes.GetDynamicFieldResponse> {\n\t\tconst normalizedNameType = TypeTagSerializer.parseFromStr(\n\t\t\t(\n\t\t\t\tawait this.core.mvr.resolveType({\n\t\t\t\t\ttype: options.name.type,\n\t\t\t\t})\n\t\t\t).type,\n\t\t);\n\t\tconst fieldId = deriveDynamicFieldID(options.parentId, normalizedNameType, options.name.bcs);\n\t\tconst {\n\t\t\tobjects: [fieldObject],\n\t\t} = await this.getObjects({\n\t\t\tobjectIds: [fieldId],\n\t\t\tsignal: options.signal,\n\t\t\tinclude: {\n\t\t\t\tpreviousTransaction: true,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t});\n\n\t\tif (fieldObject instanceof Error) {\n\t\t\tthrow fieldObject;\n\t\t}\n\n\t\tconst fieldType = parseStructTag(fieldObject.type);\n\t\tconst content = await fieldObject.content;\n\n\t\tconst nameTypeParam = fieldType.typeParams[0];\n\t\tconst isDynamicObject =\n\t\t\ttypeof nameTypeParam !== 'string' &&\n\t\t\tnameTypeParam.module === 'dynamic_object_field' &&\n\t\t\tnameTypeParam.name === 'Wrapper';\n\n\t\tconst valueBcs = content.slice(SUI_ADDRESS_LENGTH + options.name.bcs.length);\n\n\t\tconst valueType =\n\t\t\ttypeof fieldType.typeParams[1] === 'string'\n\t\t\t\t? fieldType.typeParams[1]\n\t\t\t\t: normalizeStructTag(fieldType.typeParams[1]);\n\n\t\treturn {\n\t\t\tdynamicField: {\n\t\t\t\t$kind: isDynamicObject ? 'DynamicObject' : 'DynamicField',\n\t\t\t\tfieldId: fieldObject.objectId,\n\t\t\t\tdigest: fieldObject.digest,\n\t\t\t\tversion: fieldObject.version,\n\t\t\t\ttype: fieldObject.type,\n\t\t\t\tpreviousTransaction: fieldObject.previousTransaction,\n\t\t\t\tname: {\n\t\t\t\t\ttype:\n\t\t\t\t\t\ttypeof nameTypeParam === 'string' ? nameTypeParam : normalizeStructTag(nameTypeParam),\n\t\t\t\t\tbcs: options.name.bcs,\n\t\t\t\t},\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: valueType,\n\t\t\t\t\tbcs: valueBcs,\n\t\t\t\t},\n\t\t\t\tchildId: isDynamicObject ? bcs.Address.parse(valueBcs) : undefined,\n\t\t\t} as SuiClientTypes.GetDynamicFieldResponse['dynamicField'],\n\t\t};\n\t}\n\n\tasync getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,\n\t): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {\n\t\tconst resolvedNameType = (\n\t\t\tawait this.core.mvr.resolveType({\n\t\t\t\ttype: options.name.type,\n\t\t\t})\n\t\t).type;\n\t\tconst wrappedType = `0x2::dynamic_object_field::Wrapper<${resolvedNameType}>`;\n\n\t\tconst { dynamicField } = await this.getDynamicField({\n\t\t\tparentId: options.parentId,\n\t\t\tname: {\n\t\t\t\ttype: wrappedType,\n\t\t\t\tbcs: options.name.bcs,\n\t\t\t},\n\t\t\tsignal: options.signal,\n\t\t});\n\n\t\tconst { object } = await this.getObject({\n\t\t\tobjectId: dynamicField.childId!,\n\t\t\tsignal: options.signal,\n\t\t\tinclude: options.include,\n\t\t});\n\n\t\treturn { object };\n\t}\n\n\tasync waitForTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.WaitForTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\tconst { signal, timeout = 60 * 1000, pollSchedule, include } = options;\n\n\t\tconst digest =\n\t\t\t'result' in options && options.result\n\t\t\t\t? (options.result.Transaction ?? options.result.FailedTransaction)!.digest\n\t\t\t\t: options.digest;\n\n\t\tconst abortSignal = signal\n\t\t\t? AbortSignal.any([AbortSignal.timeout(timeout), signal])\n\t\t\t: AbortSignal.timeout(timeout);\n\n\t\tconst abortPromise = new Promise((_, reject) => {\n\t\t\tabortSignal.addEventListener('abort', () => reject(abortSignal.reason));\n\t\t});\n\n\t\tabortPromise.catch(() => {\n\t\t\t// Swallow unhandled rejections that might be thrown after early return\n\t\t});\n\n\t\t// Default schedule tuned to testnet measurements:\n\t\t// - Fullnode (gRPC/JSON-RPC): p50=130ms, p95=330ms\n\t\t// - GraphQL indexer: p50=1300ms, p95=1430ms\n\t\t// After schedule exhausted, repeats the last interval.\n\t\tconst schedule = pollSchedule ?? [0, 300, 600, 1500, 3500];\n\t\tconst t0 = Date.now();\n\t\tlet scheduleIndex = 0;\n\t\tconst lastInterval =\n\t\t\tschedule.length > 0\n\t\t\t\t? schedule[schedule.length - 1] - (schedule[schedule.length - 2] ?? 0)\n\t\t\t\t: 2_000;\n\n\t\twhile (true) {\n\t\t\tif (scheduleIndex < schedule.length) {\n\t\t\t\tconst remaining = t0 + schedule[scheduleIndex] - Date.now();\n\t\t\t\tscheduleIndex++;\n\t\t\t\tif (remaining > 0) {\n\t\t\t\t\tawait Promise.race([\n\t\t\t\t\t\tnew Promise((resolve) => setTimeout(resolve, remaining)),\n\t\t\t\t\t\tabortPromise,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait Promise.race([\n\t\t\t\t\tnew Promise((resolve) => setTimeout(resolve, lastInterval)),\n\t\t\t\t\tabortPromise,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\tabortSignal.throwIfAborted();\n\t\t\ttry {\n\t\t\t\treturn await this.getTransaction({\n\t\t\t\t\tdigest,\n\t\t\t\t\tinclude,\n\t\t\t\t\tsignal: abortSignal,\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tasync signAndExecuteTransaction<Include extends SuiClientTypes.TransactionInclude = {}>({\n\t\ttransaction,\n\t\tsigner,\n\t\tadditionalSignatures = [],\n\t\t...input\n\t}: SuiClientTypes.SignAndExecuteTransactionOptions<Include>): Promise<\n\t\tSuiClientTypes.TransactionResult<Include>\n\t> {\n\t\tlet transactionBytes;\n\n\t\tif (transaction instanceof Uint8Array) {\n\t\t\ttransactionBytes = transaction;\n\t\t} else {\n\t\t\ttransaction.setSenderIfNotSet(signer.toSuiAddress());\n\t\t\ttransactionBytes = await transaction.build({ client: this });\n\t\t}\n\n\t\tconst { signature } = await signer.signTransaction(transactionBytes);\n\n\t\treturn this.executeTransaction({\n\t\t\ttransaction: transactionBytes,\n\t\t\tsignatures: [signature, ...additionalSignatures],\n\t\t\t...input,\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,mBAA2C;CAChD,SAAS;CACT,SAAS;CACT;AAED,IAAsB,aAAtB,cAAyC,WAAsD;CAI9F,YAAY,SAA4B;AACvC,QAAM,QAAQ;cAJR;AAMN,OAAK,MAAM,IAAI,UAAU;GACxB,OAAO,KAAK,MAAM,MAAM,WAAW;GACnC,KAAK,QAAQ,KAAK,OAAO,iBAAiB,KAAK;GAC/C,UAAU,QAAQ,KAAK;GACvB,WAAW,QAAQ,KAAK;GACxB,CAAC;;CAOH,MAAM,UACL,SACqD;EACrD,MAAM,EAAE,aAAa;EACrB,MAAM,EACL,SAAS,CAAC,YACP,MAAM,KAAK,WAAW;GACzB,WAAW,CAAC,SAAS;GACrB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,CAAC;AACF,MAAI,kBAAkB,MACrB,OAAM;AAEP,SAAO,EAAE,QAAQ,QAAQ;;CAqE1B,MAAM,gBACL,SACkD;EAClD,MAAM,qBAAqB,kBAAkB,cAE3C,MAAM,KAAK,KAAK,IAAI,YAAY,EAC/B,MAAM,QAAQ,KAAK,MACnB,CAAC,EACD,KACF;EACD,MAAM,UAAU,qBAAqB,QAAQ,UAAU,oBAAoB,QAAQ,KAAK,IAAI;EAC5F,MAAM,EACL,SAAS,CAAC,iBACP,MAAM,KAAK,WAAW;GACzB,WAAW,CAAC,QAAQ;GACpB,QAAQ,QAAQ;GAChB,SAAS;IACR,qBAAqB;IACrB,SAAS;IACT;GACD,CAAC;AAEF,MAAI,uBAAuB,MAC1B,OAAM;EAGP,MAAM,YAAY,eAAe,YAAY,KAAK;EAClD,MAAM,UAAU,MAAM,YAAY;EAElC,MAAM,gBAAgB,UAAU,WAAW;EAC3C,MA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right (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TypeTagSerializer } from '../bcs/type-tag-serializer.js';\nimport type { TransactionPlugin } from '../transactions/index.js';\nimport { deriveDynamicFieldID } from '../utils/dynamic-fields.js';\nimport { normalizeStructTag, parseStructTag, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport { BaseClient } from './client.js';\nimport type { ClientWithExtensions, SuiClientTypes } from './types.js';\nimport { MvrClient } from './mvr.js';\nimport { bcs } from '../bcs/index.js';\n\nexport type ClientWithCoreApi = ClientWithExtensions<{\n\tcore: CoreClient;\n}>;\n\nexport interface CoreClientOptions extends SuiClientTypes.SuiClientOptions {\n\tbase: BaseClient;\n\tmvr?: SuiClientTypes.MvrOptions;\n}\n\nconst DEFAULT_MVR_URLS: Record<string, string> = {\n\tmainnet: 'https://mainnet.mvr.mystenlabs.com',\n\ttestnet: 'https://testnet.mvr.mystenlabs.com',\n};\n\nexport abstract class CoreClient extends BaseClient implements SuiClientTypes.TransportMethods {\n\tcore = this;\n\tmvr: SuiClientTypes.MvrMethods;\n\n\tconstructor(options: CoreClientOptions) {\n\t\tsuper(options);\n\n\t\tthis.mvr = new MvrClient({\n\t\t\tcache: this.cache.scope('core.mvr'),\n\t\t\turl: options.mvr?.url ?? DEFAULT_MVR_URLS[this.network],\n\t\t\tpageSize: options.mvr?.pageSize,\n\t\t\toverrides: options.mvr?.overrides,\n\t\t});\n\t}\n\n\tabstract getObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectsResponse<Include>>;\n\n\tasync getObject<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetObjectOptions<Include>,\n\t): Promise<SuiClientTypes.GetObjectResponse<Include>> {\n\t\tconst { objectId } = options;\n\t\tconst {\n\t\t\tobjects: [result],\n\t\t} = await this.getObjects({\n\t\t\tobjectIds: [objectId],\n\t\t\tsignal: options.signal,\n\t\t\tinclude: options.include,\n\t\t});\n\t\tif (result instanceof Error) {\n\t\t\tthrow result;\n\t\t}\n\t\treturn { object: result };\n\t}\n\n\tabstract listCoins(\n\t\toptions: SuiClientTypes.ListCoinsOptions,\n\t): Promise<SuiClientTypes.ListCoinsResponse>;\n\n\tabstract listOwnedObjects<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.ListOwnedObjectsOptions<Include>,\n\t): Promise<SuiClientTypes.ListOwnedObjectsResponse<Include>>;\n\n\tabstract getBalance(\n\t\toptions: SuiClientTypes.GetBalanceOptions,\n\t): Promise<SuiClientTypes.GetBalanceResponse>;\n\n\tabstract listBalances(\n\t\toptions: SuiClientTypes.ListBalancesOptions,\n\t): Promise<SuiClientTypes.ListBalancesResponse>;\n\n\tabstract getCoinMetadata(\n\t\toptions: SuiClientTypes.GetCoinMetadataOptions,\n\t): Promise<SuiClientTypes.GetCoinMetadataResponse>;\n\n\tabstract getTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.GetTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>>;\n\n\tabstract executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.ExecuteTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>>;\n\n\tabstract simulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(\n\t\toptions: SuiClientTypes.SimulateTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.SimulateTransactionResult<Include>>;\n\n\tabstract getReferenceGasPrice(\n\t\toptions?: SuiClientTypes.GetReferenceGasPriceOptions,\n\t): Promise<SuiClientTypes.GetReferenceGasPriceResponse>;\n\n\tabstract getCurrentSystemState(\n\t\toptions?: SuiClientTypes.GetCurrentSystemStateOptions,\n\t): Promise<SuiClientTypes.GetCurrentSystemStateResponse>;\n\n\tabstract getProtocolConfig(\n\t\toptions?: SuiClientTypes.GetProtocolConfigOptions,\n\t): Promise<SuiClientTypes.GetProtocolConfigResponse>;\n\n\tabstract getChainIdentifier(\n\t\toptions?: SuiClientTypes.GetChainIdentifierOptions,\n\t): Promise<SuiClientTypes.GetChainIdentifierResponse>;\n\n\tabstract listDynamicFields(\n\t\toptions: SuiClientTypes.ListDynamicFieldsOptions,\n\t): Promise<SuiClientTypes.ListDynamicFieldsResponse>;\n\n\tabstract resolveTransactionPlugin(): TransactionPlugin;\n\n\tabstract verifyZkLoginSignature(\n\t\toptions: SuiClientTypes.VerifyZkLoginSignatureOptions,\n\t): Promise<SuiClientTypes.ZkLoginVerifyResponse>;\n\n\tabstract getMoveFunction(\n\t\toptions: SuiClientTypes.GetMoveFunctionOptions,\n\t): Promise<SuiClientTypes.GetMoveFunctionResponse>;\n\n\tabstract defaultNameServiceName(\n\t\toptions: SuiClientTypes.DefaultNameServiceNameOptions,\n\t): Promise<SuiClientTypes.DefaultNameServiceNameResponse>;\n\n\tasync getDynamicField(\n\t\toptions: SuiClientTypes.GetDynamicFieldOptions,\n\t): Promise<SuiClientTypes.GetDynamicFieldResponse> {\n\t\tconst normalizedNameType = TypeTagSerializer.parseFromStr(\n\t\t\t(\n\t\t\t\tawait this.core.mvr.resolveType({\n\t\t\t\t\ttype: options.name.type,\n\t\t\t\t\tsignal: options.signal,\n\t\t\t\t})\n\t\t\t).type,\n\t\t);\n\t\tconst fieldId = deriveDynamicFieldID(options.parentId, normalizedNameType, options.name.bcs);\n\t\tconst {\n\t\t\tobjects: [fieldObject],\n\t\t} = await this.getObjects({\n\t\t\tobjectIds: [fieldId],\n\t\t\tsignal: options.signal,\n\t\t\tinclude: {\n\t\t\t\tpreviousTransaction: true,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t});\n\n\t\tif (fieldObject instanceof Error) {\n\t\t\tthrow fieldObject;\n\t\t}\n\n\t\tconst fieldType = parseStructTag(fieldObject.type);\n\t\tconst content = await fieldObject.content;\n\n\t\tconst nameTypeParam = fieldType.typeParams[0];\n\t\tconst isDynamicObject =\n\t\t\ttypeof nameTypeParam !== 'string' &&\n\t\t\tnameTypeParam.module === 'dynamic_object_field' &&\n\t\t\tnameTypeParam.name === 'Wrapper';\n\n\t\tconst valueBcs = content.slice(SUI_ADDRESS_LENGTH + options.name.bcs.length);\n\n\t\tconst valueType =\n\t\t\ttypeof fieldType.typeParams[1] === 'string'\n\t\t\t\t? fieldType.typeParams[1]\n\t\t\t\t: normalizeStructTag(fieldType.typeParams[1]);\n\n\t\treturn {\n\t\t\tdynamicField: {\n\t\t\t\t$kind: isDynamicObject ? 'DynamicObject' : 'DynamicField',\n\t\t\t\tfieldId: fieldObject.objectId,\n\t\t\t\tdigest: fieldObject.digest,\n\t\t\t\tversion: fieldObject.version,\n\t\t\t\ttype: fieldObject.type,\n\t\t\t\tpreviousTransaction: fieldObject.previousTransaction,\n\t\t\t\tname: {\n\t\t\t\t\ttype:\n\t\t\t\t\t\ttypeof nameTypeParam === 'string' ? nameTypeParam : normalizeStructTag(nameTypeParam),\n\t\t\t\t\tbcs: options.name.bcs,\n\t\t\t\t},\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: valueType,\n\t\t\t\t\tbcs: valueBcs,\n\t\t\t\t},\n\t\t\t\tchildId: isDynamicObject ? bcs.Address.parse(valueBcs) : undefined,\n\t\t\t} as SuiClientTypes.GetDynamicFieldResponse['dynamicField'],\n\t\t};\n\t}\n\n\tasync getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(\n\t\toptions: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,\n\t): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {\n\t\tconst resolvedNameType = (\n\t\t\tawait this.core.mvr.resolveType({\n\t\t\t\ttype: options.name.type,\n\t\t\t})\n\t\t).type;\n\t\tconst wrappedType = `0x2::dynamic_object_field::Wrapper<${resolvedNameType}>`;\n\n\t\tconst { dynamicField } = await this.getDynamicField({\n\t\t\tparentId: options.parentId,\n\t\t\tname: {\n\t\t\t\ttype: wrappedType,\n\t\t\t\tbcs: options.name.bcs,\n\t\t\t},\n\t\t\tsignal: options.signal,\n\t\t});\n\n\t\tconst { object } = await this.getObject({\n\t\t\tobjectId: dynamicField.childId!,\n\t\t\tsignal: options.signal,\n\t\t\tinclude: options.include,\n\t\t});\n\n\t\treturn { object };\n\t}\n\n\tasync waitForTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\toptions: SuiClientTypes.WaitForTransactionOptions<Include>,\n\t): Promise<SuiClientTypes.TransactionResult<Include>> {\n\t\tconst { signal, timeout = 60 * 1000, pollSchedule, include } = options;\n\n\t\tconst digest =\n\t\t\t'result' in options && options.result\n\t\t\t\t? (options.result.Transaction ?? options.result.FailedTransaction)!.digest\n\t\t\t\t: options.digest;\n\n\t\tconst abortSignal = signal\n\t\t\t? AbortSignal.any([AbortSignal.timeout(timeout), signal])\n\t\t\t: AbortSignal.timeout(timeout);\n\n\t\tconst abortPromise = new Promise((_, reject) => {\n\t\t\tabortSignal.addEventListener('abort', () => reject(abortSignal.reason));\n\t\t});\n\n\t\tabortPromise.catch(() => {\n\t\t\t// Swallow unhandled rejections that might be thrown after early return\n\t\t});\n\n\t\t// Default schedule tuned to testnet measurements:\n\t\t// - Fullnode (gRPC/JSON-RPC): p50=130ms, p95=330ms\n\t\t// - GraphQL indexer: p50=1300ms, p95=1430ms\n\t\t// After schedule exhausted, repeats the last interval.\n\t\tconst schedule = pollSchedule ?? [0, 300, 600, 1500, 3500];\n\t\tconst t0 = Date.now();\n\t\tlet scheduleIndex = 0;\n\t\tconst lastInterval =\n\t\t\tschedule.length > 0\n\t\t\t\t? schedule[schedule.length - 1] - (schedule[schedule.length - 2] ?? 0)\n\t\t\t\t: 2_000;\n\n\t\twhile (true) {\n\t\t\tif (scheduleIndex < schedule.length) {\n\t\t\t\tconst remaining = t0 + schedule[scheduleIndex] - Date.now();\n\t\t\t\tscheduleIndex++;\n\t\t\t\tif (remaining > 0) {\n\t\t\t\t\tawait Promise.race([\n\t\t\t\t\t\tnew Promise((resolve) => setTimeout(resolve, remaining)),\n\t\t\t\t\t\tabortPromise,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait Promise.race([\n\t\t\t\t\tnew Promise((resolve) => setTimeout(resolve, lastInterval)),\n\t\t\t\t\tabortPromise,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\tabortSignal.throwIfAborted();\n\t\t\ttry {\n\t\t\t\treturn await this.getTransaction({\n\t\t\t\t\tdigest,\n\t\t\t\t\tinclude,\n\t\t\t\t\tsignal: abortSignal,\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tasync signAndExecuteTransaction<Include extends SuiClientTypes.TransactionInclude = {}>({\n\t\ttransaction,\n\t\tsigner,\n\t\tadditionalSignatures = [],\n\t\t...input\n\t}: SuiClientTypes.SignAndExecuteTransactionOptions<Include>): Promise<\n\t\tSuiClientTypes.TransactionResult<Include>\n\t> {\n\t\tlet transactionBytes;\n\n\t\tif (transaction instanceof Uint8Array) {\n\t\t\ttransactionBytes = transaction;\n\t\t} else {\n\t\t\ttransaction.setSenderIfNotSet(signer.toSuiAddress());\n\t\t\ttransactionBytes = await transaction.build({ client: this });\n\t\t}\n\n\t\tconst { signature } = await signer.signTransaction(transactionBytes);\n\n\t\treturn this.executeTransaction({\n\t\t\ttransaction: transactionBytes,\n\t\t\tsignatures: [signature, ...additionalSignatures],\n\t\t\t...input,\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,mBAA2C;CAChD,SAAS;CACT,SAAS;CACT;AAED,IAAsB,aAAtB,cAAyC,WAAsD;CAI9F,YAAY,SAA4B;AACvC,QAAM,QAAQ;cAJR;AAMN,OAAK,MAAM,IAAI,UAAU;GACxB,OAAO,KAAK,MAAM,MAAM,WAAW;GACnC,KAAK,QAAQ,KAAK,OAAO,iBAAiB,KAAK;GAC/C,UAAU,QAAQ,KAAK;G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YAAY,KAAK,SAAS,iBAAiB,KAAK,KAAK;AAC3D;AACA,QAAI,YAAY,EACf,OAAM,QAAQ,KAAK,CAClB,IAAI,SAAS,YAAY,WAAW,SAAS,UAAU,CAAC,EACxD,aACA,CAAC;SAGH,OAAM,QAAQ,KAAK,CAClB,IAAI,SAAS,YAAY,WAAW,SAAS,aAAa,CAAC,EAC3D,aACA,CAAC;AAGH,eAAY,gBAAgB;AAC5B,OAAI;AACH,WAAO,MAAM,KAAK,eAAe;KAChC;KACA;KACA,QAAQ;KACR,CAAC;WACK;;;CAIV,MAAM,0BAAkF,EACvF,aACA,QACA,uBAAuB,EAAE,EACzB,GAAG,SAGF;EACD,IAAI;AAEJ,MAAI,uBAAuB,WAC1B,oBAAmB;OACb;AACN,eAAY,kBAAkB,OAAO,cAAc,CAAC;AACpD,sBAAmB,MAAM,YAAY,MAAM,EAAE,QAAQ,MAAM,CAAC;;EAG7D,MAAM,EAAE,cAAc,MAAM,OAAO,gBAAgB,iBAAiB;AAEpE,SAAO,KAAK,mBAAmB;GAC9B,aAAa;GACb,YAAY,CAAC,WAAW,GAAG,qBAAqB;GAChD,GAAG;GACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvr.d.mts","names":[],"sources":["../../src/client/mvr.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"mvr.d.mts","names":[],"sources":["../../src/client/mvr.ts"],"mappings":";;;;KAuaY,sBAAA;EACX,QAAA,EAAU,MAAA;EACV,KAAA,EAAO,MAAA;AAAA"}
|
package/dist/client/mvr.mjs
CHANGED
|
@@ -91,14 +91,16 @@ var MvrClient = class {
|
|
|
91
91
|
}
|
|
92
92
|
return response.json();
|
|
93
93
|
}
|
|
94
|
-
async resolvePackage({ package: name }) {
|
|
94
|
+
async resolvePackage({ package: name, signal }) {
|
|
95
|
+
signal?.throwIfAborted();
|
|
95
96
|
if (!hasMvrName(name)) return { package: name };
|
|
96
|
-
return { package: await this.#mvrPackageDataLoader.load(name) };
|
|
97
|
+
return { package: await raceSignal(this.#mvrPackageDataLoader.load(name), signal) };
|
|
97
98
|
}
|
|
98
|
-
async resolveType({ type }) {
|
|
99
|
+
async resolveType({ type, signal }) {
|
|
100
|
+
signal?.throwIfAborted();
|
|
99
101
|
if (!hasMvrName(type)) return { type };
|
|
100
102
|
const mvrTypes = [...extractMvrTypes(type)];
|
|
101
|
-
const resolvedTypes = await this.#mvrTypeDataLoader.loadMany(mvrTypes);
|
|
103
|
+
const resolvedTypes = await raceSignal(this.#mvrTypeDataLoader.loadMany(mvrTypes), signal);
|
|
102
104
|
const typeMap = {};
|
|
103
105
|
for (let i = 0; i < mvrTypes.length; i++) {
|
|
104
106
|
const resolvedType = resolvedTypes[i];
|
|
@@ -107,11 +109,12 @@ var MvrClient = class {
|
|
|
107
109
|
}
|
|
108
110
|
return { type: replaceMvrNames(type, typeMap) };
|
|
109
111
|
}
|
|
110
|
-
async resolve({ types = [], packages = [] }) {
|
|
112
|
+
async resolve({ types = [], packages = [], signal }) {
|
|
113
|
+
signal?.throwIfAborted();
|
|
111
114
|
const mvrTypes = /* @__PURE__ */ new Set();
|
|
112
115
|
for (const type of types ?? []) extractMvrTypes(type, mvrTypes);
|
|
113
116
|
const typesArray = [...mvrTypes];
|
|
114
|
-
const [resolvedTypes, resolvedPackages] = await Promise.all([typesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [], packages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : []]);
|
|
117
|
+
const [resolvedTypes, resolvedPackages] = await raceSignal(Promise.all([typesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [], packages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : []]), signal);
|
|
115
118
|
const typeMap = { ...this.#overrides?.types };
|
|
116
119
|
for (const [i, type] of typesArray.entries()) {
|
|
117
120
|
const resolvedType = resolvedTypes[i];
|
|
@@ -171,6 +174,25 @@ function replaceMvrNames(tag, typeCache) {
|
|
|
171
174
|
function hasMvrName(nameOrType) {
|
|
172
175
|
return nameOrType.includes(NAME_SEPARATOR) || nameOrType.includes("@") || nameOrType.includes(".sui");
|
|
173
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Races a promise against an optional AbortSignal. MVR resolution batches lookups
|
|
179
|
+
* from independent callers into a single request via a shared DataLoader, so a
|
|
180
|
+
* caller's signal cannot cancel the shared network request without affecting other
|
|
181
|
+
* callers. Instead, this rejects the awaiting caller as soon as its signal aborts
|
|
182
|
+
* (the underlying request continues in the background).
|
|
183
|
+
*
|
|
184
|
+
* The same isolation applies to any shared/cached request (e.g. `cache.read`).
|
|
185
|
+
*/
|
|
186
|
+
function raceSignal(promise, signal) {
|
|
187
|
+
if (!signal) return promise;
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
const onAbort = () => reject(signal.reason);
|
|
190
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
191
|
+
promise.then(resolve, reject).finally(() => {
|
|
192
|
+
signal.removeEventListener("abort", onAbort);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
174
196
|
function isStructTag(type) {
|
|
175
197
|
return typeof type === "object" && "address" in type && "module" in type && "name" in type && "typeParams" in type;
|
|
176
198
|
}
|
|
@@ -249,5 +271,5 @@ function getNamesFromTypeList(types) {
|
|
|
249
271
|
}
|
|
250
272
|
|
|
251
273
|
//#endregion
|
|
252
|
-
export { MvrClient, findNamesInTransaction, hasMvrName, replaceNames };
|
|
274
|
+
export { MvrClient, findNamesInTransaction, hasMvrName, raceSignal, replaceNames };
|
|
253
275
|
//# sourceMappingURL=mvr.mjs.map
|
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}: SuiClientTypes.MvrResolvePackageOptions): Promise<SuiClientTypes.MvrResolvePackageResponse> {\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 this.#mvrPackageDataLoader.load(name);\n\t\treturn {\n\t\t\tpackage: resolved,\n\t\t};\n\t}\n\n\tasync resolveType({\n\t\ttype,\n\t}: SuiClientTypes.MvrResolveTypeOptions): Promise<SuiClientTypes.MvrResolveTypeResponse> {\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 this.#mvrTypeDataLoader.loadMany(mvrTypes);\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}: SuiClientTypes.MvrResolveOptions): Promise<SuiClientTypes.MvrResolveResponse> {\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 Promise.all([\n\t\t\ttypesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [],\n\t\t\tpackages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : [],\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\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,YAAY,EAAE,OAAO,KAAK,WAAW,IAAI,aAA+B;AACvE,QAAKA,QAAS;AACd,QAAKC,MAAO;AACZ,QAAKC,WAAY;AACjB,QAAKC,YAAa;GACjB,UAAU,WAAW;GACrB,OAAO,WAAW;GAClB;AAED,oBAAkB,MAAKA,UAAW;;CAGnC,KAAIC,uBAAwB;AAC3B,SAAO,MAAKJ,MAAO,SAAS,CAAC,yBAAyB,MAAKC,OAAQ,GAAG,QAAQ;GAC7E,MAAM,SAAS,IAAI,WAA2B,OAAO,aAAa;AACjE,QAAI,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ch"],"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\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,YAAY,EAAE,OAAO,KAAK,WAAW,IAAI,aAA+B;AACvE,QAAKA,QAAS;AACd,QAAKC,MAAO;AACZ,QAAKC,WAAY;AACjB,QAAKC,YAAa;GACjB,UAAU,WAAW;GACrB,OAAO,WAAW;GAClB;AAED,oBAAkB,MAAKA,UAAW;;CAGnC,KAAIC,uBAAwB;AAC3B,SAAO,MAAKJ,MAAO,SAAS,CAAC,yBAAyB,MAAKC,OAAQ,GAAG,QAAQ;GAC7E,MAAM,SAAS,IAAI,WAA2B,OAAO,aAAa;AACjE,QAAI,CAAC,MAAKA,IACT,OAAM,IAAI,MACT,4DAA4D,SAAS,KAAK,KAAK,CAAC,GAChF;IAEF,MAAM,WAAW,MAAM,MAAKI,gBAAiB,SAAS;AAEtD,WAAO,SAAS,KACd,QAAQ,SAAS,wBAAQ,IAAI,MAAM,8BAA8B,MAAM,CACxE;KACA;GACF,MAAM,YAAY,MAAKF,WAAY;AAEnC,OAAI,UACH,MAAK,MAAM,CAAC,KAAK,OAAO,OAAO,QAAQ,UAAU,CAChD,QAAO,MAAM,KAAK,GAAG;AAIvB,UAAO;IACN;;CAGH,KAAIG,oBAAqB;AACxB,SAAO,MAAKN,MAAO,SAAS,CAAC,sBAAsB,MAAKC,OAAQ,GAAG,QAAQ;GAC1E,MAAM,SAAS,IAAI,WAA2B,OAAO,UAAU;AAC9D,QAAI,CAAC,MAAKA,IACT,OAAM,IAAI,MACT,4DAA4D,MAA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AC3C,OAAI,CAAC,SAAS,MAAM,QAAQ,YAAY,MACvC,OAAM,IAAI,MAAM,iCAAiC,QAAQ,YAAY,OAAO;AAC7E,WAAQ,YAAY,OAAO,SAAS,MAAM,QAAQ,YAAY,MAAM;;EAGrE,MAAM,KAAK,QAAQ;AACnB,MAAI,CAAC,GAAI;EAET,MAAM,YAAY,GAAG,QAAQ,MAAM,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"}
|
|
@@ -184,6 +184,7 @@ function applyGrpcResolvedTransaction(transactionData, resolvedTransaction, opti
|
|
|
184
184
|
const resolved = grpcTransactionToTransactionData(resolvedTransaction);
|
|
185
185
|
if (options?.onlyTransactionKind) transactionData.applyResolvedData({
|
|
186
186
|
...resolved,
|
|
187
|
+
sender: null,
|
|
187
188
|
gasData: {
|
|
188
189
|
budget: null,
|
|
189
190
|
owner: null,
|