@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/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui TypeScript API",
|
|
5
5
|
"homepage": "https://sdk.mystenlabs.com",
|
|
6
|
-
"version": "2.20.
|
|
6
|
+
"version": "2.20.4",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
"graphql": "^16.14.2",
|
|
169
169
|
"poseidon-lite": "0.2.1",
|
|
170
170
|
"valibot": "^1.4.1",
|
|
171
|
-
"@mysten/
|
|
172
|
-
"@mysten/
|
|
171
|
+
"@mysten/utils": "^0.4.0",
|
|
172
|
+
"@mysten/bcs": "^2.1.0"
|
|
173
173
|
},
|
|
174
174
|
"scripts": {
|
|
175
175
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
package/src/client/core.ts
CHANGED
package/src/client/mvr.ts
CHANGED
|
@@ -185,13 +185,15 @@ export class MvrClient implements SuiClientTypes.MvrMethods {
|
|
|
185
185
|
|
|
186
186
|
async resolvePackage({
|
|
187
187
|
package: name,
|
|
188
|
+
signal,
|
|
188
189
|
}: SuiClientTypes.MvrResolvePackageOptions): Promise<SuiClientTypes.MvrResolvePackageResponse> {
|
|
190
|
+
signal?.throwIfAborted();
|
|
189
191
|
if (!hasMvrName(name)) {
|
|
190
192
|
return {
|
|
191
193
|
package: name,
|
|
192
194
|
};
|
|
193
195
|
}
|
|
194
|
-
const resolved = await this.#mvrPackageDataLoader.load(name);
|
|
196
|
+
const resolved = await raceSignal(this.#mvrPackageDataLoader.load(name), signal);
|
|
195
197
|
return {
|
|
196
198
|
package: resolved,
|
|
197
199
|
};
|
|
@@ -199,7 +201,9 @@ export class MvrClient implements SuiClientTypes.MvrMethods {
|
|
|
199
201
|
|
|
200
202
|
async resolveType({
|
|
201
203
|
type,
|
|
204
|
+
signal,
|
|
202
205
|
}: SuiClientTypes.MvrResolveTypeOptions): Promise<SuiClientTypes.MvrResolveTypeResponse> {
|
|
206
|
+
signal?.throwIfAborted();
|
|
203
207
|
if (!hasMvrName(type)) {
|
|
204
208
|
return {
|
|
205
209
|
type,
|
|
@@ -207,7 +211,7 @@ export class MvrClient implements SuiClientTypes.MvrMethods {
|
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
const mvrTypes = [...extractMvrTypes(type)];
|
|
210
|
-
const resolvedTypes = await this.#mvrTypeDataLoader.loadMany(mvrTypes);
|
|
214
|
+
const resolvedTypes = await raceSignal(this.#mvrTypeDataLoader.loadMany(mvrTypes), signal);
|
|
211
215
|
|
|
212
216
|
const typeMap: Record<string, string> = {};
|
|
213
217
|
|
|
@@ -227,7 +231,9 @@ export class MvrClient implements SuiClientTypes.MvrMethods {
|
|
|
227
231
|
async resolve({
|
|
228
232
|
types = [],
|
|
229
233
|
packages = [],
|
|
234
|
+
signal,
|
|
230
235
|
}: SuiClientTypes.MvrResolveOptions): Promise<SuiClientTypes.MvrResolveResponse> {
|
|
236
|
+
signal?.throwIfAborted();
|
|
231
237
|
const mvrTypes = new Set<string>();
|
|
232
238
|
|
|
233
239
|
for (const type of types ?? []) {
|
|
@@ -235,10 +241,13 @@ export class MvrClient implements SuiClientTypes.MvrMethods {
|
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
const typesArray = [...mvrTypes];
|
|
238
|
-
const [resolvedTypes, resolvedPackages] = await
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
const [resolvedTypes, resolvedPackages] = await raceSignal(
|
|
245
|
+
Promise.all([
|
|
246
|
+
typesArray.length > 0 ? this.#mvrTypeDataLoader.loadMany(typesArray) : [],
|
|
247
|
+
packages.length > 0 ? this.#mvrPackageDataLoader.loadMany(packages) : [],
|
|
248
|
+
]),
|
|
249
|
+
signal,
|
|
250
|
+
);
|
|
242
251
|
|
|
243
252
|
const typeMap: Record<string, string> = {
|
|
244
253
|
...this.#overrides?.types,
|
|
@@ -378,6 +387,30 @@ export function hasMvrName(nameOrType: string) {
|
|
|
378
387
|
);
|
|
379
388
|
}
|
|
380
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Races a promise against an optional AbortSignal. MVR resolution batches lookups
|
|
392
|
+
* from independent callers into a single request via a shared DataLoader, so a
|
|
393
|
+
* caller's signal cannot cancel the shared network request without affecting other
|
|
394
|
+
* callers. Instead, this rejects the awaiting caller as soon as its signal aborts
|
|
395
|
+
* (the underlying request continues in the background).
|
|
396
|
+
*
|
|
397
|
+
* The same isolation applies to any shared/cached request (e.g. `cache.read`).
|
|
398
|
+
*/
|
|
399
|
+
export function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {
|
|
400
|
+
if (!signal) {
|
|
401
|
+
return promise;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return new Promise<T>((resolve, reject) => {
|
|
405
|
+
const onAbort = () => reject(signal.reason);
|
|
406
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
407
|
+
|
|
408
|
+
promise.then(resolve, reject).finally(() => {
|
|
409
|
+
signal.removeEventListener('abort', onAbort);
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
381
414
|
function isStructTag(type: string | StructTag): type is StructTag {
|
|
382
415
|
return (
|
|
383
416
|
typeof type === 'object' &&
|
package/src/graphql/core.ts
CHANGED
|
@@ -740,6 +740,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
740
740
|
doGasSelection:
|
|
741
741
|
!options.onlyTransactionKind &&
|
|
742
742
|
(snapshot.gasData.budget == null || snapshot.gasData.payment == null),
|
|
743
|
+
checksEnabled: !options.onlyTransactionKind,
|
|
743
744
|
},
|
|
744
745
|
});
|
|
745
746
|
|
|
@@ -767,6 +768,7 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
767
768
|
if (options.onlyTransactionKind) {
|
|
768
769
|
transactionData.applyResolvedData({
|
|
769
770
|
...resolved,
|
|
771
|
+
sender: null,
|
|
770
772
|
gasData: {
|
|
771
773
|
budget: null,
|
|
772
774
|
owner: null,
|