@mysten/sui 1.32.0 → 1.34.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 +19 -0
- package/dist/cjs/client/client.d.ts +13 -12
- package/dist/cjs/client/client.js +189 -48
- package/dist/cjs/client/client.js.map +3 -3
- package/dist/cjs/experimental/cache.d.ts +1 -0
- package/dist/cjs/experimental/cache.js +9 -0
- package/dist/cjs/experimental/cache.js.map +2 -2
- package/dist/cjs/experimental/client.d.ts +2 -1
- package/dist/cjs/experimental/client.js +2 -1
- package/dist/cjs/experimental/client.js.map +2 -2
- package/dist/cjs/experimental/core.d.ts +6 -0
- package/dist/cjs/experimental/core.js +9 -2
- package/dist/cjs/experimental/core.js.map +2 -2
- package/dist/cjs/experimental/index.d.ts +2 -2
- package/dist/cjs/experimental/index.js.map +2 -2
- package/dist/cjs/experimental/mvr.d.ts +42 -0
- package/dist/cjs/experimental/mvr.js +355 -0
- package/dist/cjs/experimental/mvr.js.map +7 -0
- package/dist/cjs/experimental/transports/graphql.d.ts +4 -1
- package/dist/cjs/experimental/transports/graphql.js +5 -2
- package/dist/cjs/experimental/transports/graphql.js.map +2 -2
- package/dist/cjs/experimental/transports/json-rpc-resolver.d.ts +1 -1
- package/dist/cjs/experimental/transports/json-rpc-resolver.js +2 -2
- package/dist/cjs/experimental/transports/json-rpc-resolver.js.map +2 -2
- package/dist/cjs/experimental/transports/jsonRPC.d.ts +4 -1
- package/dist/cjs/experimental/transports/jsonRPC.js +15 -11
- package/dist/cjs/experimental/transports/jsonRPC.js.map +3 -3
- package/dist/cjs/experimental/transports/utils.js +2 -2
- package/dist/cjs/experimental/transports/utils.js.map +2 -2
- package/dist/cjs/experimental/types.d.ts +42 -0
- package/dist/cjs/experimental/types.js.map +1 -1
- package/dist/cjs/graphql/client.d.ts +2 -1
- package/dist/cjs/graphql/client.js +6 -2
- package/dist/cjs/graphql/client.js.map +2 -2
- package/dist/cjs/transactions/index.d.ts +4 -1
- package/dist/cjs/transactions/index.js +2 -2
- package/dist/cjs/transactions/index.js.map +3 -3
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +4 -3
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +38 -90
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +3 -3
- package/dist/cjs/transactions/resolve.js +8 -4
- package/dist/cjs/transactions/resolve.js.map +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/client/client.d.ts +13 -12
- package/dist/esm/client/client.js +188 -47
- package/dist/esm/client/client.js.map +2 -2
- package/dist/esm/experimental/cache.d.ts +1 -0
- package/dist/esm/experimental/cache.js +9 -0
- package/dist/esm/experimental/cache.js.map +2 -2
- package/dist/esm/experimental/client.d.ts +2 -1
- package/dist/esm/experimental/client.js +2 -1
- package/dist/esm/experimental/client.js.map +2 -2
- package/dist/esm/experimental/core.d.ts +6 -0
- package/dist/esm/experimental/core.js +9 -2
- package/dist/esm/experimental/core.js.map +2 -2
- package/dist/esm/experimental/index.d.ts +2 -2
- package/dist/esm/experimental/index.js.map +2 -2
- package/dist/esm/experimental/mvr.d.ts +42 -0
- package/dist/esm/experimental/mvr.js +340 -0
- package/dist/esm/experimental/mvr.js.map +7 -0
- package/dist/esm/experimental/transports/graphql.d.ts +4 -1
- package/dist/esm/experimental/transports/graphql.js +5 -2
- package/dist/esm/experimental/transports/graphql.js.map +2 -2
- package/dist/esm/experimental/transports/json-rpc-resolver.d.ts +1 -1
- package/dist/esm/experimental/transports/json-rpc-resolver.js +2 -2
- package/dist/esm/experimental/transports/json-rpc-resolver.js.map +2 -2
- package/dist/esm/experimental/transports/jsonRPC.d.ts +4 -1
- package/dist/esm/experimental/transports/jsonRPC.js +13 -9
- package/dist/esm/experimental/transports/jsonRPC.js.map +3 -3
- package/dist/esm/experimental/transports/utils.js +1 -1
- package/dist/esm/experimental/transports/utils.js.map +1 -1
- package/dist/esm/experimental/types.d.ts +42 -0
- package/dist/esm/graphql/client.d.ts +2 -1
- package/dist/esm/graphql/client.js +6 -2
- package/dist/esm/graphql/client.js.map +2 -2
- package/dist/esm/transactions/index.d.ts +4 -1
- package/dist/esm/transactions/index.js.map +2 -2
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +4 -3
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +37 -95
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js.map +3 -3
- package/dist/esm/transactions/resolve.js +8 -4
- package/dist/esm/transactions/resolve.js.map +2 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/client/client.ts +239 -60
- package/src/experimental/cache.ts +14 -0
- package/src/experimental/client.ts +3 -1
- package/src/experimental/core.ts +18 -0
- package/src/experimental/index.ts +2 -1
- package/src/experimental/mvr.ts +477 -0
- package/src/experimental/transports/graphql.ts +8 -2
- package/src/experimental/transports/json-rpc-resolver.ts +1 -1
- package/src/experimental/transports/jsonRPC.ts +13 -6
- package/src/experimental/transports/utils.ts +1 -1
- package/src/experimental/types.ts +58 -0
- package/src/graphql/client.ts +7 -1
- package/src/transactions/index.ts +5 -1
- package/src/transactions/plugins/NamedPackagesPlugin.ts +46 -120
- package/src/transactions/resolve.ts +12 -5
- package/src/version.ts +1 -1
- package/dist/cjs/transactions/plugins/utils.d.ts +0 -31
- package/dist/cjs/transactions/plugins/utils.js +0 -144
- package/dist/cjs/transactions/plugins/utils.js.map +0 -7
- package/dist/esm/transactions/plugins/utils.d.ts +0 -31
- package/dist/esm/transactions/plugins/utils.js +0 -124
- package/dist/esm/transactions/plugins/utils.js.map +0 -7
- package/src/transactions/plugins/utils.ts +0 -215
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @mysten/sui.js
|
|
2
2
|
|
|
3
|
+
## 1.34.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3fb7a83: Fix transaction resolution when transactions are built with clients from older SDK
|
|
8
|
+
versions
|
|
9
|
+
|
|
10
|
+
## 1.33.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- a00522b: Add mvr APIs to core client
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [a00522b]
|
|
19
|
+
- @mysten/utils@0.1.0
|
|
20
|
+
- @mysten/bcs@1.6.3
|
|
21
|
+
|
|
3
22
|
## 1.32.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@ import type { Signer } from '../cryptography/index.js';
|
|
|
2
2
|
import { Experimental_BaseClient } from '../experimental/client.js';
|
|
3
3
|
import { JSONRpcTransport } from '../experimental/transports/jsonRPC.js';
|
|
4
4
|
import type { Experimental_SuiClientTypes, SelfRegisteringClientExtension } from '../experimental/types.js';
|
|
5
|
-
import type { Transaction } from '../transactions/
|
|
5
|
+
import type { Transaction } from '../transactions/Transaction.js';
|
|
6
6
|
import type { SuiTransport } from './http-transport.js';
|
|
7
7
|
import type { AddressMetrics, AllEpochsAddressMetrics, Checkpoint, CheckpointPage, CoinBalance, CoinMetadata, CoinSupply, CommitteeInfo, DelegatedStake, DevInspectResults, DevInspectTransactionBlockParams, DryRunTransactionBlockParams, DryRunTransactionBlockResponse, DynamicFieldPage, EpochInfo, EpochMetricsPage, EpochPage, ExecuteTransactionBlockParams, GetAllBalancesParams, GetAllCoinsParams, GetBalanceParams, GetCheckpointParams, GetCheckpointsParams, GetCoinMetadataParams, GetCoinsParams, GetCommitteeInfoParams, GetDynamicFieldObjectParams, GetDynamicFieldsParams, GetLatestCheckpointSequenceNumberParams, GetLatestSuiSystemStateParams, GetMoveFunctionArgTypesParams, GetNormalizedMoveFunctionParams, GetNormalizedMoveModuleParams, GetNormalizedMoveModulesByPackageParams, GetNormalizedMoveStructParams, GetObjectParams, GetOwnedObjectsParams, GetProtocolConfigParams, GetReferenceGasPriceParams, GetStakesByIdsParams, GetStakesParams, GetTotalSupplyParams, GetTransactionBlockParams, MoveCallMetrics, MultiGetObjectsParams, MultiGetTransactionBlocksParams, NetworkMetrics, ObjectRead, Order, PaginatedCoins, PaginatedEvents, PaginatedObjectsResponse, PaginatedTransactionResponse, ProtocolConfig, QueryEventsParams, QueryTransactionBlocksParams, ResolvedNameServiceNames, ResolveNameServiceAddressParams, ResolveNameServiceNamesParams, SubscribeEventParams, SubscribeTransactionParams, SuiEvent, SuiMoveFunctionArgType, SuiMoveNormalizedFunction, SuiMoveNormalizedModule, SuiMoveNormalizedModules, SuiMoveNormalizedStruct, SuiObjectResponse, SuiSystemStateSummary, SuiTransactionBlockResponse, TransactionEffects, TryGetPastObjectParams, Unsubscribe, ValidatorsApy, VerifyZkLoginSignatureParams, ZkLoginVerifyResult } from './types/index.js';
|
|
8
8
|
export interface PaginationArguments<Cursor> {
|
|
@@ -20,6 +20,7 @@ export interface OrderArguments {
|
|
|
20
20
|
*/
|
|
21
21
|
export type SuiClientOptions = NetworkOrTransport & {
|
|
22
22
|
network?: Experimental_SuiClientTypes.Network;
|
|
23
|
+
mvr?: Experimental_SuiClientTypes.MvrOptions;
|
|
23
24
|
};
|
|
24
25
|
type NetworkOrTransport = {
|
|
25
26
|
url: string;
|
|
@@ -47,7 +48,7 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
47
48
|
/**
|
|
48
49
|
* Get all Coin<`coin_type`> objects owned by an address.
|
|
49
50
|
*/
|
|
50
|
-
getCoins(
|
|
51
|
+
getCoins({ coinType, owner, cursor, limit, signal, }: GetCoinsParams): Promise<PaginatedCoins>;
|
|
51
52
|
/**
|
|
52
53
|
* Get all Coin objects owned by an address.
|
|
53
54
|
*/
|
|
@@ -55,7 +56,7 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
55
56
|
/**
|
|
56
57
|
* Get the total coin balance for one coin type, owned by the address owner.
|
|
57
58
|
*/
|
|
58
|
-
getBalance(
|
|
59
|
+
getBalance({ owner, coinType, signal }: GetBalanceParams): Promise<CoinBalance>;
|
|
59
60
|
/**
|
|
60
61
|
* Get the total coin balance for all coin types, owned by the address owner.
|
|
61
62
|
*/
|
|
@@ -63,11 +64,11 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
63
64
|
/**
|
|
64
65
|
* Fetch CoinMetadata for a given coin type
|
|
65
66
|
*/
|
|
66
|
-
getCoinMetadata(
|
|
67
|
+
getCoinMetadata({ coinType, signal }: GetCoinMetadataParams): Promise<CoinMetadata | null>;
|
|
67
68
|
/**
|
|
68
69
|
* Fetch total supply for a coin
|
|
69
70
|
*/
|
|
70
|
-
getTotalSupply(
|
|
71
|
+
getTotalSupply({ coinType, signal }: GetTotalSupplyParams): Promise<CoinSupply>;
|
|
71
72
|
/**
|
|
72
73
|
* Invoke any RPC method
|
|
73
74
|
* @param method the method to be invoked
|
|
@@ -79,24 +80,24 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
79
80
|
/**
|
|
80
81
|
* Get Move function argument types like read, write and full access
|
|
81
82
|
*/
|
|
82
|
-
getMoveFunctionArgTypes(
|
|
83
|
+
getMoveFunctionArgTypes({ package: pkg, module, function: fn, signal, }: GetMoveFunctionArgTypesParams): Promise<SuiMoveFunctionArgType[]>;
|
|
83
84
|
/**
|
|
84
85
|
* Get a map from module name to
|
|
85
86
|
* structured representations of Move modules
|
|
86
87
|
*/
|
|
87
|
-
getNormalizedMoveModulesByPackage(
|
|
88
|
+
getNormalizedMoveModulesByPackage({ package: pkg, signal, }: GetNormalizedMoveModulesByPackageParams): Promise<SuiMoveNormalizedModules>;
|
|
88
89
|
/**
|
|
89
90
|
* Get a structured representation of Move module
|
|
90
91
|
*/
|
|
91
|
-
getNormalizedMoveModule(
|
|
92
|
+
getNormalizedMoveModule({ package: pkg, module, signal, }: GetNormalizedMoveModuleParams): Promise<SuiMoveNormalizedModule>;
|
|
92
93
|
/**
|
|
93
94
|
* Get a structured representation of Move function
|
|
94
95
|
*/
|
|
95
|
-
getNormalizedMoveFunction(
|
|
96
|
+
getNormalizedMoveFunction({ package: pkg, module, function: fn, signal, }: GetNormalizedMoveFunctionParams): Promise<SuiMoveNormalizedFunction>;
|
|
96
97
|
/**
|
|
97
98
|
* Get a structured representation of Move struct
|
|
98
99
|
*/
|
|
99
|
-
getNormalizedMoveStruct(
|
|
100
|
+
getNormalizedMoveStruct({ package: pkg, module, struct, signal, }: GetNormalizedMoveStructParams): Promise<SuiMoveNormalizedStruct>;
|
|
100
101
|
/**
|
|
101
102
|
* Get all objects owned by an address
|
|
102
103
|
*/
|
|
@@ -113,7 +114,7 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
113
114
|
/**
|
|
114
115
|
* Get transaction blocks for a given query criteria
|
|
115
116
|
*/
|
|
116
|
-
queryTransactionBlocks(
|
|
117
|
+
queryTransactionBlocks({ filter, options, cursor, limit, order, signal, }: QueryTransactionBlocksParams): Promise<PaginatedTransactionResponse>;
|
|
117
118
|
getTransactionBlock(input: GetTransactionBlockParams): Promise<SuiTransactionBlockResponse>;
|
|
118
119
|
multiGetTransactionBlocks(input: MultiGetTransactionBlocksParams): Promise<SuiTransactionBlockResponse[]>;
|
|
119
120
|
executeTransactionBlock({ transactionBlock, signature, options, requestType, signal, }: ExecuteTransactionBlockParams): Promise<SuiTransactionBlockResponse>;
|
|
@@ -146,7 +147,7 @@ export declare class SuiClient extends Experimental_BaseClient implements SelfRe
|
|
|
146
147
|
/**
|
|
147
148
|
* Get events for a given query criteria
|
|
148
149
|
*/
|
|
149
|
-
queryEvents(
|
|
150
|
+
queryEvents({ query, cursor, limit, order, signal, }: QueryEventsParams): Promise<PaginatedEvents>;
|
|
150
151
|
/**
|
|
151
152
|
* Subscribe to get notifications whenever an event matching the filter occurs
|
|
152
153
|
*
|
|
@@ -25,10 +25,12 @@ module.exports = __toCommonJS(client_exports);
|
|
|
25
25
|
var import_bcs = require("@mysten/bcs");
|
|
26
26
|
var import_client = require("../experimental/client.js");
|
|
27
27
|
var import_jsonRPC = require("../experimental/transports/jsonRPC.js");
|
|
28
|
-
var
|
|
28
|
+
var import_Transaction = require("../transactions/Transaction.js");
|
|
29
29
|
var import_sui_types = require("../utils/sui-types.js");
|
|
30
30
|
var import_suins = require("../utils/suins.js");
|
|
31
31
|
var import_http_transport = require("./http-transport.js");
|
|
32
|
+
var import_move_registry = require("../utils/move-registry.js");
|
|
33
|
+
var import_mvr = require("../experimental/mvr.js");
|
|
32
34
|
const SUI_CLIENT_BRAND = Symbol.for("@mysten/SuiClient");
|
|
33
35
|
function isSuiClient(client) {
|
|
34
36
|
return typeof client === "object" && client !== null && client[SUI_CLIENT_BRAND] === true;
|
|
@@ -41,9 +43,12 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
41
43
|
*/
|
|
42
44
|
constructor(options) {
|
|
43
45
|
super({ network: options.network ?? "unknown" });
|
|
44
|
-
this.core = new import_jsonRPC.JSONRpcTransport(this);
|
|
45
46
|
this.jsonRpc = this;
|
|
46
47
|
this.transport = options.transport ?? new import_http_transport.SuiHTTPTransport({ url: options.url });
|
|
48
|
+
this.core = new import_jsonRPC.JSONRpcTransport({
|
|
49
|
+
jsonRpcClient: this,
|
|
50
|
+
mvr: options.mvr
|
|
51
|
+
});
|
|
47
52
|
}
|
|
48
53
|
get [SUI_CLIENT_BRAND]() {
|
|
49
54
|
return true;
|
|
@@ -59,14 +64,25 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
59
64
|
/**
|
|
60
65
|
* Get all Coin<`coin_type`> objects owned by an address.
|
|
61
66
|
*/
|
|
62
|
-
async getCoins(
|
|
63
|
-
|
|
67
|
+
async getCoins({
|
|
68
|
+
coinType,
|
|
69
|
+
owner,
|
|
70
|
+
cursor,
|
|
71
|
+
limit,
|
|
72
|
+
signal
|
|
73
|
+
}) {
|
|
74
|
+
if (!owner || !(0, import_sui_types.isValidSuiAddress)((0, import_sui_types.normalizeSuiAddress)(owner))) {
|
|
64
75
|
throw new Error("Invalid Sui address");
|
|
65
76
|
}
|
|
77
|
+
if (coinType && (0, import_mvr.hasMvrName)(coinType)) {
|
|
78
|
+
coinType = (await this.core.mvr.resolveType({
|
|
79
|
+
type: coinType
|
|
80
|
+
})).type;
|
|
81
|
+
}
|
|
66
82
|
return await this.transport.request({
|
|
67
83
|
method: "suix_getCoins",
|
|
68
|
-
params: [
|
|
69
|
-
signal
|
|
84
|
+
params: [owner, coinType, cursor, limit],
|
|
85
|
+
signal
|
|
70
86
|
});
|
|
71
87
|
}
|
|
72
88
|
/**
|
|
@@ -85,14 +101,19 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
85
101
|
/**
|
|
86
102
|
* Get the total coin balance for one coin type, owned by the address owner.
|
|
87
103
|
*/
|
|
88
|
-
async getBalance(
|
|
89
|
-
if (!
|
|
104
|
+
async getBalance({ owner, coinType, signal }) {
|
|
105
|
+
if (!owner || !(0, import_sui_types.isValidSuiAddress)((0, import_sui_types.normalizeSuiAddress)(owner))) {
|
|
90
106
|
throw new Error("Invalid Sui address");
|
|
91
107
|
}
|
|
108
|
+
if (coinType && (0, import_mvr.hasMvrName)(coinType)) {
|
|
109
|
+
coinType = (await this.core.mvr.resolveType({
|
|
110
|
+
type: coinType
|
|
111
|
+
})).type;
|
|
112
|
+
}
|
|
92
113
|
return await this.transport.request({
|
|
93
114
|
method: "suix_getBalance",
|
|
94
|
-
params: [
|
|
95
|
-
signal
|
|
115
|
+
params: [owner, coinType],
|
|
116
|
+
signal
|
|
96
117
|
});
|
|
97
118
|
}
|
|
98
119
|
/**
|
|
@@ -111,21 +132,31 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
111
132
|
/**
|
|
112
133
|
* Fetch CoinMetadata for a given coin type
|
|
113
134
|
*/
|
|
114
|
-
async getCoinMetadata(
|
|
135
|
+
async getCoinMetadata({ coinType, signal }) {
|
|
136
|
+
if (coinType && (0, import_mvr.hasMvrName)(coinType)) {
|
|
137
|
+
coinType = (await this.core.mvr.resolveType({
|
|
138
|
+
type: coinType
|
|
139
|
+
})).type;
|
|
140
|
+
}
|
|
115
141
|
return await this.transport.request({
|
|
116
142
|
method: "suix_getCoinMetadata",
|
|
117
|
-
params: [
|
|
118
|
-
signal
|
|
143
|
+
params: [coinType],
|
|
144
|
+
signal
|
|
119
145
|
});
|
|
120
146
|
}
|
|
121
147
|
/**
|
|
122
148
|
* Fetch total supply for a coin
|
|
123
149
|
*/
|
|
124
|
-
async getTotalSupply(
|
|
150
|
+
async getTotalSupply({ coinType, signal }) {
|
|
151
|
+
if (coinType && (0, import_mvr.hasMvrName)(coinType)) {
|
|
152
|
+
coinType = (await this.core.mvr.resolveType({
|
|
153
|
+
type: coinType
|
|
154
|
+
})).type;
|
|
155
|
+
}
|
|
125
156
|
return await this.transport.request({
|
|
126
157
|
method: "suix_getTotalSupply",
|
|
127
|
-
params: [
|
|
128
|
-
signal
|
|
158
|
+
params: [coinType],
|
|
159
|
+
signal
|
|
129
160
|
});
|
|
130
161
|
}
|
|
131
162
|
/**
|
|
@@ -139,52 +170,99 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
139
170
|
/**
|
|
140
171
|
* Get Move function argument types like read, write and full access
|
|
141
172
|
*/
|
|
142
|
-
async getMoveFunctionArgTypes(
|
|
173
|
+
async getMoveFunctionArgTypes({
|
|
174
|
+
package: pkg,
|
|
175
|
+
module: module2,
|
|
176
|
+
function: fn,
|
|
177
|
+
signal
|
|
178
|
+
}) {
|
|
179
|
+
if (pkg && (0, import_move_registry.isValidNamedPackage)(pkg)) {
|
|
180
|
+
pkg = (await this.core.mvr.resolvePackage({
|
|
181
|
+
package: pkg
|
|
182
|
+
})).package;
|
|
183
|
+
}
|
|
143
184
|
return await this.transport.request({
|
|
144
185
|
method: "sui_getMoveFunctionArgTypes",
|
|
145
|
-
params: [
|
|
146
|
-
signal
|
|
186
|
+
params: [pkg, module2, fn],
|
|
187
|
+
signal
|
|
147
188
|
});
|
|
148
189
|
}
|
|
149
190
|
/**
|
|
150
191
|
* Get a map from module name to
|
|
151
192
|
* structured representations of Move modules
|
|
152
193
|
*/
|
|
153
|
-
async getNormalizedMoveModulesByPackage(
|
|
194
|
+
async getNormalizedMoveModulesByPackage({
|
|
195
|
+
package: pkg,
|
|
196
|
+
signal
|
|
197
|
+
}) {
|
|
198
|
+
if (pkg && (0, import_move_registry.isValidNamedPackage)(pkg)) {
|
|
199
|
+
pkg = (await this.core.mvr.resolvePackage({
|
|
200
|
+
package: pkg
|
|
201
|
+
})).package;
|
|
202
|
+
}
|
|
154
203
|
return await this.transport.request({
|
|
155
204
|
method: "sui_getNormalizedMoveModulesByPackage",
|
|
156
|
-
params: [
|
|
157
|
-
signal
|
|
205
|
+
params: [pkg],
|
|
206
|
+
signal
|
|
158
207
|
});
|
|
159
208
|
}
|
|
160
209
|
/**
|
|
161
210
|
* Get a structured representation of Move module
|
|
162
211
|
*/
|
|
163
|
-
async getNormalizedMoveModule(
|
|
212
|
+
async getNormalizedMoveModule({
|
|
213
|
+
package: pkg,
|
|
214
|
+
module: module2,
|
|
215
|
+
signal
|
|
216
|
+
}) {
|
|
217
|
+
if (pkg && (0, import_move_registry.isValidNamedPackage)(pkg)) {
|
|
218
|
+
pkg = (await this.core.mvr.resolvePackage({
|
|
219
|
+
package: pkg
|
|
220
|
+
})).package;
|
|
221
|
+
}
|
|
164
222
|
return await this.transport.request({
|
|
165
223
|
method: "sui_getNormalizedMoveModule",
|
|
166
|
-
params: [
|
|
167
|
-
signal
|
|
224
|
+
params: [pkg, module2],
|
|
225
|
+
signal
|
|
168
226
|
});
|
|
169
227
|
}
|
|
170
228
|
/**
|
|
171
229
|
* Get a structured representation of Move function
|
|
172
230
|
*/
|
|
173
|
-
async getNormalizedMoveFunction(
|
|
231
|
+
async getNormalizedMoveFunction({
|
|
232
|
+
package: pkg,
|
|
233
|
+
module: module2,
|
|
234
|
+
function: fn,
|
|
235
|
+
signal
|
|
236
|
+
}) {
|
|
237
|
+
if (pkg && (0, import_move_registry.isValidNamedPackage)(pkg)) {
|
|
238
|
+
pkg = (await this.core.mvr.resolvePackage({
|
|
239
|
+
package: pkg
|
|
240
|
+
})).package;
|
|
241
|
+
}
|
|
174
242
|
return await this.transport.request({
|
|
175
243
|
method: "sui_getNormalizedMoveFunction",
|
|
176
|
-
params: [
|
|
177
|
-
signal
|
|
244
|
+
params: [pkg, module2, fn],
|
|
245
|
+
signal
|
|
178
246
|
});
|
|
179
247
|
}
|
|
180
248
|
/**
|
|
181
249
|
* Get a structured representation of Move struct
|
|
182
250
|
*/
|
|
183
|
-
async getNormalizedMoveStruct(
|
|
251
|
+
async getNormalizedMoveStruct({
|
|
252
|
+
package: pkg,
|
|
253
|
+
module: module2,
|
|
254
|
+
struct,
|
|
255
|
+
signal
|
|
256
|
+
}) {
|
|
257
|
+
if (pkg && (0, import_move_registry.isValidNamedPackage)(pkg)) {
|
|
258
|
+
pkg = (await this.core.mvr.resolvePackage({
|
|
259
|
+
package: pkg
|
|
260
|
+
})).package;
|
|
261
|
+
}
|
|
184
262
|
return await this.transport.request({
|
|
185
263
|
method: "sui_getNormalizedMoveStruct",
|
|
186
|
-
params: [
|
|
187
|
-
signal
|
|
264
|
+
params: [pkg, module2, struct],
|
|
265
|
+
signal
|
|
188
266
|
});
|
|
189
267
|
}
|
|
190
268
|
/**
|
|
@@ -194,12 +272,27 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
194
272
|
if (!input.owner || !(0, import_sui_types.isValidSuiAddress)((0, import_sui_types.normalizeSuiAddress)(input.owner))) {
|
|
195
273
|
throw new Error("Invalid Sui address");
|
|
196
274
|
}
|
|
275
|
+
const filter = input.filter ? {
|
|
276
|
+
...input.filter
|
|
277
|
+
} : void 0;
|
|
278
|
+
if (filter && "MoveModule" in filter && (0, import_move_registry.isValidNamedPackage)(filter.MoveModule.package)) {
|
|
279
|
+
filter.MoveModule = {
|
|
280
|
+
module: filter.MoveModule.module,
|
|
281
|
+
package: (await this.core.mvr.resolvePackage({
|
|
282
|
+
package: filter.MoveModule.package
|
|
283
|
+
})).package
|
|
284
|
+
};
|
|
285
|
+
} else if (filter && "StructType" in filter && (0, import_mvr.hasMvrName)(filter.StructType)) {
|
|
286
|
+
filter.StructType = (await this.core.mvr.resolveType({
|
|
287
|
+
type: filter.StructType
|
|
288
|
+
})).type;
|
|
289
|
+
}
|
|
197
290
|
return await this.transport.request({
|
|
198
291
|
method: "suix_getOwnedObjects",
|
|
199
292
|
params: [
|
|
200
293
|
input.owner,
|
|
201
294
|
{
|
|
202
|
-
filter
|
|
295
|
+
filter,
|
|
203
296
|
options: input.options
|
|
204
297
|
},
|
|
205
298
|
input.cursor,
|
|
@@ -250,19 +343,36 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
250
343
|
/**
|
|
251
344
|
* Get transaction blocks for a given query criteria
|
|
252
345
|
*/
|
|
253
|
-
async queryTransactionBlocks(
|
|
346
|
+
async queryTransactionBlocks({
|
|
347
|
+
filter,
|
|
348
|
+
options,
|
|
349
|
+
cursor,
|
|
350
|
+
limit,
|
|
351
|
+
order,
|
|
352
|
+
signal
|
|
353
|
+
}) {
|
|
354
|
+
if (filter && "MoveFunction" in filter && (0, import_move_registry.isValidNamedPackage)(filter.MoveFunction.package)) {
|
|
355
|
+
filter = {
|
|
356
|
+
...filter,
|
|
357
|
+
MoveFunction: {
|
|
358
|
+
package: (await this.core.mvr.resolvePackage({
|
|
359
|
+
package: filter.MoveFunction.package
|
|
360
|
+
})).package
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
254
364
|
return await this.transport.request({
|
|
255
365
|
method: "suix_queryTransactionBlocks",
|
|
256
366
|
params: [
|
|
257
367
|
{
|
|
258
|
-
filter
|
|
259
|
-
options
|
|
368
|
+
filter,
|
|
369
|
+
options
|
|
260
370
|
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
(
|
|
371
|
+
cursor,
|
|
372
|
+
limit,
|
|
373
|
+
(order || "descending") === "descending"
|
|
264
374
|
],
|
|
265
|
-
signal
|
|
375
|
+
signal
|
|
266
376
|
});
|
|
267
377
|
}
|
|
268
378
|
async getTransactionBlock(input) {
|
|
@@ -401,16 +511,47 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
401
511
|
/**
|
|
402
512
|
* Get events for a given query criteria
|
|
403
513
|
*/
|
|
404
|
-
async queryEvents(
|
|
514
|
+
async queryEvents({
|
|
515
|
+
query,
|
|
516
|
+
cursor,
|
|
517
|
+
limit,
|
|
518
|
+
order,
|
|
519
|
+
signal
|
|
520
|
+
}) {
|
|
521
|
+
if (query && "MoveEventType" in query && (0, import_mvr.hasMvrName)(query.MoveEventType)) {
|
|
522
|
+
query = {
|
|
523
|
+
...query,
|
|
524
|
+
MoveEventType: (await this.core.mvr.resolveType({
|
|
525
|
+
type: query.MoveEventType
|
|
526
|
+
})).type
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
if (query && "MoveEventModule" in query && (0, import_move_registry.isValidNamedPackage)(query.MoveEventModule.package)) {
|
|
530
|
+
query = {
|
|
531
|
+
...query,
|
|
532
|
+
MoveEventModule: {
|
|
533
|
+
module: query.MoveEventModule.module,
|
|
534
|
+
package: (await this.core.mvr.resolvePackage({
|
|
535
|
+
package: query.MoveEventModule.package
|
|
536
|
+
})).package
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
if ("MoveModule" in query && (0, import_move_registry.isValidNamedPackage)(query.MoveModule.package)) {
|
|
541
|
+
query = {
|
|
542
|
+
...query,
|
|
543
|
+
MoveModule: {
|
|
544
|
+
module: query.MoveModule.module,
|
|
545
|
+
package: (await this.core.mvr.resolvePackage({
|
|
546
|
+
package: query.MoveModule.package
|
|
547
|
+
})).package
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
405
551
|
return await this.transport.request({
|
|
406
552
|
method: "suix_queryEvents",
|
|
407
|
-
params: [
|
|
408
|
-
|
|
409
|
-
input.cursor,
|
|
410
|
-
input.limit,
|
|
411
|
-
(input.order || "descending") === "descending"
|
|
412
|
-
],
|
|
413
|
-
signal: input.signal
|
|
553
|
+
params: [query, cursor, limit, (order || "descending") === "descending"],
|
|
554
|
+
signal
|
|
414
555
|
});
|
|
415
556
|
}
|
|
416
557
|
/**
|
|
@@ -446,7 +587,7 @@ class SuiClient extends import_client.Experimental_BaseClient {
|
|
|
446
587
|
*/
|
|
447
588
|
async devInspectTransactionBlock(input) {
|
|
448
589
|
let devInspectTxBytes;
|
|
449
|
-
if ((0,
|
|
590
|
+
if ((0, import_Transaction.isTransaction)(input.transactionBlock)) {
|
|
450
591
|
input.transactionBlock.setSenderIfNotSet(input.sender);
|
|
451
592
|
devInspectTxBytes = (0, import_bcs.toBase64)(
|
|
452
593
|
await input.transactionBlock.build({
|