@mysten/sui 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +20 -20
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/mvr.mjs +3 -0
- package/dist/client/mvr.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/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/transaction_execution_service.client.d.mts +4 -4
- package/dist/transactions/Transaction.d.mts +9 -9
- package/dist/transactions/data/internal.d.mts +109 -109
- package/dist/transactions/data/internal.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/utils/format.d.mts +5 -1
- package/dist/utils/format.d.mts.map +1 -1
- package/dist/utils/format.mjs +19 -1
- package/dist/utils/format.mjs.map +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +2 -2
- package/dist/version.mjs +2 -2
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/docs/llms-index.md +5 -5
- package/docs/utils/index.md +7 -0
- package/package.json +1 -1
- package/src/client/mvr.ts +12 -0
- package/src/utils/format.ts +36 -0
- package/src/utils/index.ts +1 -1
- package/src/version.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mysten/sui.js
|
|
2
2
|
|
|
3
|
+
## 2.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6adc085: Add `parseToUnits` and `parseToMist` balance parsing utilities using pure bigint
|
|
8
|
+
arithmetic.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- b1bf49a: Fix `extractMvrTypes` and `replaceMvrNames` to handle vector and primitive type
|
|
13
|
+
parameters. Previously, these functions passed all string type parameters directly to
|
|
14
|
+
`parseStructTag`, which produced corrupted results for vector types (e.g.,
|
|
15
|
+
`vector<@mvr/demo::baz::Qux>`) and threw on primitives (e.g., `u8`). Vector types are now
|
|
16
|
+
unwrapped and recursed into, and primitive types are passed through unchanged.
|
|
17
|
+
|
|
3
18
|
## 2.15.0
|
|
4
19
|
|
|
5
20
|
### Minor 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_bcs810 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_bcs810.BcsStruct<{
|
|
8
|
+
intent: _mysten_bcs810.BcsStruct<{
|
|
9
|
+
scope: _mysten_bcs810.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_bcs810.BcsEnum<{
|
|
16
16
|
V0: null;
|
|
17
17
|
}, "IntentVersion">;
|
|
18
|
-
appId:
|
|
18
|
+
appId: _mysten_bcs810.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":"mvr.d.mts","names":[],"sources":["../../src/client/mvr.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"mvr.d.mts","names":[],"sources":["../../src/client/mvr.ts"],"mappings":";;;;KAsYY,sBAAA;EACX,QAAA,EAAU,MAAA;EACV,KAAA,EAAO,MAAA;AAAA"}
|
package/dist/client/mvr.mjs
CHANGED
|
@@ -147,6 +147,7 @@ function validateOverrides(overrides) {
|
|
|
147
147
|
*/
|
|
148
148
|
function extractMvrTypes(type, types = /* @__PURE__ */ new Set()) {
|
|
149
149
|
if (typeof type === "string" && !hasMvrName(type)) return types;
|
|
150
|
+
if (typeof type === "string" && type.startsWith("vector<") && type.endsWith(">")) return extractMvrTypes(type.slice(7, -1), types);
|
|
150
151
|
const tag = isStructTag(type) ? type : parseStructTag(type);
|
|
151
152
|
if (hasMvrName(tag.address)) types.add(`${tag.address}::${tag.module}::${tag.name}`);
|
|
152
153
|
for (const param of tag.typeParams) extractMvrTypes(param, types);
|
|
@@ -157,6 +158,8 @@ function extractMvrTypes(type, types = /* @__PURE__ */ new Set()) {
|
|
|
157
158
|
* based on the supplied type cache.
|
|
158
159
|
*/
|
|
159
160
|
function replaceMvrNames(tag, typeCache) {
|
|
161
|
+
if (typeof tag === "string" && !tag.includes("::")) return tag;
|
|
162
|
+
if (typeof tag === "string" && tag.startsWith("vector<") && tag.endsWith(">")) return `vector<${replaceMvrNames(tag.slice(7, -1), typeCache)}>`;
|
|
160
163
|
const type = isStructTag(tag) ? tag : parseStructTag(tag);
|
|
161
164
|
const cacheHit = typeCache[`${type.address}::${type.module}::${type.name}`];
|
|
162
165
|
return normalizeStructTag({
|
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\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\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 (!isValidN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,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}: 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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K,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,6 +1,6 @@
|
|
|
1
1
|
import { BatchGetObjectsRequest, BatchGetObjectsResponse, BatchGetTransactionsRequest, BatchGetTransactionsResponse, GetCheckpointRequest, GetCheckpointResponse, GetEpochRequest, GetEpochResponse, GetObjectRequest, GetObjectResponse, GetServiceInfoRequest, GetServiceInfoResponse, GetTransactionRequest, GetTransactionResponse } from "./ledger_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/rpc/v2/ledger_service.client.d.ts
|
|
@@ -45,9 +45,9 @@ interface ILedgerServiceClient {
|
|
|
45
45
|
declare class LedgerServiceClient implements ILedgerServiceClient, ServiceInfo {
|
|
46
46
|
private readonly _transport;
|
|
47
47
|
typeName: string;
|
|
48
|
-
methods:
|
|
48
|
+
methods: _protobuf_ts_runtime_rpc1.MethodInfo<any, any>[];
|
|
49
49
|
options: {
|
|
50
|
-
[extensionName: string]:
|
|
50
|
+
[extensionName: string]: _protobuf_ts_runtime1.JsonValue;
|
|
51
51
|
};
|
|
52
52
|
constructor(_transport: RpcTransport);
|
|
53
53
|
/**
|
|
@@ -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_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/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_rpc3.MethodInfo<any, any>[];
|
|
25
25
|
options: {
|
|
26
|
-
[extensionName: string]:
|
|
26
|
+
[extensionName: string]: _protobuf_ts_runtime3.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_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/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_rpc5.MethodInfo<any, any>[];
|
|
39
39
|
options: {
|
|
40
|
-
[extensionName: string]:
|
|
40
|
+
[extensionName: string]: _protobuf_ts_runtime5.JsonValue;
|
|
41
41
|
};
|
|
42
42
|
constructor(_transport: RpcTransport);
|
|
43
43
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecuteTransactionRequest, ExecuteTransactionResponse, SimulateTransactionRequest, SimulateTransactionResponse } from "./transaction_execution_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime0 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc0 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/transaction_execution_service.client.d.ts
|
|
@@ -23,9 +23,9 @@ interface ITransactionExecutionServiceClient {
|
|
|
23
23
|
declare class TransactionExecutionServiceClient implements ITransactionExecutionServiceClient, ServiceInfo {
|
|
24
24
|
private readonly _transport;
|
|
25
25
|
typeName: string;
|
|
26
|
-
methods:
|
|
26
|
+
methods: _protobuf_ts_runtime_rpc0.MethodInfo<any, any>[];
|
|
27
27
|
options: {
|
|
28
|
-
[extensionName: string]:
|
|
28
|
+
[extensionName: string]: _protobuf_ts_runtime0.JsonValue;
|
|
29
29
|
};
|
|
30
30
|
constructor(_transport: RpcTransport);
|
|
31
31
|
/**
|
|
@@ -8,7 +8,7 @@ import { createPure } from "./pure.mjs";
|
|
|
8
8
|
import { SignatureWithBytes, Signer } from "../cryptography/keypair.mjs";
|
|
9
9
|
import "../cryptography/index.mjs";
|
|
10
10
|
import { ClientWithCoreApi } from "../client/core.mjs";
|
|
11
|
-
import * as
|
|
11
|
+
import * as _mysten_bcs1113 from "@mysten/bcs";
|
|
12
12
|
import { SerializedBcs } from "@mysten/bcs";
|
|
13
13
|
import { InferInput } from "valibot";
|
|
14
14
|
|
|
@@ -77,7 +77,7 @@ declare class Transaction {
|
|
|
77
77
|
getData(): {
|
|
78
78
|
version: 2;
|
|
79
79
|
sender?: string | null | undefined;
|
|
80
|
-
expiration?:
|
|
80
|
+
expiration?: _mysten_bcs1113.EnumOutputShapeWithKeys<{
|
|
81
81
|
None: true;
|
|
82
82
|
Epoch: string | number;
|
|
83
83
|
ValidDuring: {
|
|
@@ -88,7 +88,7 @@ declare class Transaction {
|
|
|
88
88
|
chain: string;
|
|
89
89
|
nonce: number;
|
|
90
90
|
};
|
|
91
|
-
}, "
|
|
91
|
+
}, "Epoch" | "None" | "ValidDuring"> | null | undefined;
|
|
92
92
|
gasData: {
|
|
93
93
|
budget: string | number | null;
|
|
94
94
|
price: string | number | null;
|
|
@@ -99,8 +99,8 @@ declare class Transaction {
|
|
|
99
99
|
digest: string;
|
|
100
100
|
}[] | null;
|
|
101
101
|
};
|
|
102
|
-
inputs:
|
|
103
|
-
Object:
|
|
102
|
+
inputs: _mysten_bcs1113.EnumOutputShapeWithKeys<{
|
|
103
|
+
Object: _mysten_bcs1113.EnumOutputShapeWithKeys<{
|
|
104
104
|
ImmOrOwnedObject: {
|
|
105
105
|
objectId: string;
|
|
106
106
|
version: string | number;
|
|
@@ -116,7 +116,7 @@ declare class Transaction {
|
|
|
116
116
|
version: string | number;
|
|
117
117
|
digest: string;
|
|
118
118
|
};
|
|
119
|
-
}, "
|
|
119
|
+
}, "Receiving" | "ImmOrOwnedObject" | "SharedObject">;
|
|
120
120
|
Pure: {
|
|
121
121
|
bytes: string;
|
|
122
122
|
};
|
|
@@ -139,13 +139,13 @@ declare class Transaction {
|
|
|
139
139
|
Balance: string;
|
|
140
140
|
$kind: "Balance";
|
|
141
141
|
};
|
|
142
|
-
withdrawFrom:
|
|
142
|
+
withdrawFrom: _mysten_bcs1113.EnumOutputShapeWithKeys<{
|
|
143
143
|
Sender: true;
|
|
144
144
|
Sponsor: true;
|
|
145
145
|
}, "Sender" | "Sponsor">;
|
|
146
146
|
};
|
|
147
|
-
}, "
|
|
148
|
-
commands:
|
|
147
|
+
}, "Object" | "Pure" | "FundsWithdrawal" | "UnresolvedPure" | "UnresolvedObject">[];
|
|
148
|
+
commands: _mysten_bcs1113.EnumOutputShapeWithKeys<{
|
|
149
149
|
MoveCall: {
|
|
150
150
|
package: string;
|
|
151
151
|
module: string;
|