@mysten/sui 1.43.1 → 1.44.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 +13 -0
- package/dist/cjs/experimental/core.d.ts +1 -0
- package/dist/cjs/experimental/core.js.map +2 -2
- package/dist/cjs/experimental/types.d.ts +6 -8
- package/dist/cjs/experimental/types.js.map +1 -1
- package/dist/cjs/graphql/core.d.ts +1 -1
- package/dist/cjs/graphql/core.js +81 -78
- package/dist/cjs/graphql/core.js.map +2 -2
- package/dist/cjs/graphql/generated/latest/tada-env.d.ts +3870 -5429
- package/dist/cjs/graphql/generated/latest/tada-env.js +3958 -5702
- package/dist/cjs/graphql/generated/latest/tada-env.js.map +2 -2
- package/dist/cjs/graphql/generated/queries.d.ts +2485 -3397
- package/dist/cjs/graphql/generated/queries.js +137 -172
- package/dist/cjs/graphql/generated/queries.js.map +3 -3
- package/dist/cjs/graphql/types.d.ts +1 -0
- package/dist/cjs/graphql/types.js.map +1 -1
- package/dist/cjs/grpc/client.d.ts +2 -0
- package/dist/cjs/grpc/client.js +2 -0
- package/dist/cjs/grpc/client.js.map +2 -2
- package/dist/cjs/grpc/core.d.ts +1 -0
- package/dist/cjs/grpc/core.js +10 -0
- package/dist/cjs/grpc/core.js.map +2 -2
- package/dist/cjs/jsonRpc/core.d.ts +1 -1
- package/dist/cjs/jsonRpc/core.js +7 -2
- package/dist/cjs/jsonRpc/core.js.map +2 -2
- package/dist/cjs/transactions/Transaction.js +2 -2
- package/dist/cjs/transactions/Transaction.js.map +1 -1
- package/dist/cjs/version.d.ts +2 -2
- package/dist/cjs/version.js +2 -2
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/zklogin/publickey.js +1 -1
- package/dist/cjs/zklogin/publickey.js.map +1 -1
- package/dist/esm/experimental/core.d.ts +1 -0
- package/dist/esm/experimental/core.js.map +2 -2
- package/dist/esm/experimental/types.d.ts +6 -8
- package/dist/esm/graphql/core.d.ts +1 -1
- package/dist/esm/graphql/core.js +85 -82
- package/dist/esm/graphql/core.js.map +2 -2
- package/dist/esm/graphql/generated/latest/tada-env.d.ts +3870 -5429
- package/dist/esm/graphql/generated/latest/tada-env.js +3958 -5702
- package/dist/esm/graphql/generated/latest/tada-env.js.map +2 -2
- package/dist/esm/graphql/generated/queries.d.ts +2485 -3397
- package/dist/esm/graphql/generated/queries.js +137 -172
- package/dist/esm/graphql/generated/queries.js.map +3 -3
- package/dist/esm/graphql/types.d.ts +1 -0
- package/dist/esm/grpc/client.d.ts +2 -0
- package/dist/esm/grpc/client.js +2 -0
- package/dist/esm/grpc/client.js.map +2 -2
- package/dist/esm/grpc/core.d.ts +1 -0
- package/dist/esm/grpc/core.js +10 -0
- package/dist/esm/grpc/core.js.map +2 -2
- package/dist/esm/jsonRpc/core.d.ts +1 -1
- package/dist/esm/jsonRpc/core.js +7 -2
- package/dist/esm/jsonRpc/core.js.map +2 -2
- package/dist/esm/transactions/Transaction.js +2 -2
- package/dist/esm/transactions/Transaction.js.map +1 -1
- package/dist/esm/version.d.ts +2 -2
- package/dist/esm/version.js +2 -2
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/zklogin/publickey.js +1 -1
- package/dist/esm/zklogin/publickey.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/experimental/core.ts +4 -0
- package/src/experimental/types.ts +8 -10
- package/src/graphql/core.ts +95 -95
- package/src/graphql/generated/latest/schema.graphql +2139 -2671
- package/src/graphql/generated/latest/tada-env.ts +3958 -5702
- package/src/graphql/generated/queries.ts +2344 -3281
- package/src/graphql/queries/getAllBalances.graphql +0 -1
- package/src/graphql/queries/getBalance.graphql +2 -3
- package/src/graphql/queries/getCoins.graphql +9 -4
- package/src/graphql/queries/getDynamicFields.graphql +1 -1
- package/src/graphql/queries/nameService.graphql +2 -10
- package/src/graphql/queries/objects.graphql +11 -22
- package/src/graphql/queries/transactions.graphql +16 -12
- package/src/graphql/queries/verifyZkLoginSignature.graphql +2 -2
- package/src/graphql/types.ts +1 -0
- package/src/grpc/client.ts +3 -0
- package/src/grpc/core.ts +16 -0
- package/src/jsonRpc/core.ts +9 -4
- package/src/transactions/Transaction.ts +2 -2
- package/src/version.ts +2 -2
- package/src/zklogin/publickey.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": "1.
|
|
6
|
+
"version": "1.44.0",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"graphql": "^16.11.0",
|
|
161
161
|
"poseidon-lite": "0.2.1",
|
|
162
162
|
"valibot": "^0.36.0",
|
|
163
|
-
"@mysten/bcs": "1.9.
|
|
163
|
+
"@mysten/bcs": "1.9.2",
|
|
164
164
|
"@mysten/utils": "0.2.0"
|
|
165
165
|
},
|
|
166
166
|
"scripts": {
|
package/src/experimental/core.ts
CHANGED
|
@@ -105,6 +105,10 @@ export abstract class Experimental_CoreClient
|
|
|
105
105
|
options: Experimental_SuiClientTypes.GetMoveFunctionOptions,
|
|
106
106
|
): Promise<Experimental_SuiClientTypes.GetMoveFunctionResponse>;
|
|
107
107
|
|
|
108
|
+
abstract defaultNameServiceName(
|
|
109
|
+
options: Experimental_SuiClientTypes.DefaultNameServiceNameOptions,
|
|
110
|
+
): Promise<Experimental_SuiClientTypes.DefaultNameServiceNameResponse>;
|
|
111
|
+
|
|
108
112
|
async getDynamicField(
|
|
109
113
|
options: Experimental_SuiClientTypes.GetDynamicFieldOptions,
|
|
110
114
|
): Promise<Experimental_SuiClientTypes.GetDynamicFieldResponse> {
|
|
@@ -269,22 +269,20 @@ export namespace Experimental_SuiClientTypes {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/** Name service methods */
|
|
272
|
-
export interface
|
|
272
|
+
export interface DefaultNameServiceNameOptions extends CoreClientMethodOptions {
|
|
273
273
|
address: string;
|
|
274
|
-
cursor?: string | null | undefined;
|
|
275
|
-
limit?: number | null | undefined;
|
|
276
274
|
}
|
|
277
275
|
|
|
278
|
-
export interface
|
|
279
|
-
data:
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
export interface DefaultNameServiceNameResponse {
|
|
277
|
+
data: {
|
|
278
|
+
name: string | null;
|
|
279
|
+
};
|
|
282
280
|
}
|
|
283
281
|
|
|
284
282
|
export interface TransportMethods {
|
|
285
|
-
|
|
286
|
-
options:
|
|
287
|
-
) => Promise<
|
|
283
|
+
defaultNameServiceName: (
|
|
284
|
+
options: DefaultNameServiceNameOptions,
|
|
285
|
+
) => Promise<DefaultNameServiceNameResponse>;
|
|
288
286
|
}
|
|
289
287
|
|
|
290
288
|
/** MVR methods */
|
package/src/graphql/core.ts
CHANGED
|
@@ -6,12 +6,11 @@ import type { Experimental_SuiClientTypes } from '../experimental/types.js';
|
|
|
6
6
|
import type { GraphQLQueryOptions, SuiGraphQLClient } from './client.js';
|
|
7
7
|
import type {
|
|
8
8
|
Object_Owner_FieldsFragment,
|
|
9
|
-
Object_FieldsFragment,
|
|
10
9
|
Transaction_FieldsFragment,
|
|
11
10
|
} from './generated/queries.js';
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
DefaultSuinsNameDocument,
|
|
13
|
+
ExecuteTransactionDocument,
|
|
15
14
|
GetAllBalancesDocument,
|
|
16
15
|
GetBalanceDocument,
|
|
17
16
|
GetCoinsDocument,
|
|
@@ -21,12 +20,12 @@ import {
|
|
|
21
20
|
GetReferenceGasPriceDocument,
|
|
22
21
|
GetTransactionBlockDocument,
|
|
23
22
|
MultiGetObjectsDocument,
|
|
24
|
-
|
|
23
|
+
SimulateTransactionDocument,
|
|
25
24
|
VerifyZkLoginSignatureDocument,
|
|
26
25
|
ZkLoginIntentScope,
|
|
27
26
|
} from './generated/queries.js';
|
|
28
27
|
import { ObjectError } from '../experimental/errors.js';
|
|
29
|
-
import { fromBase64, toBase64 } from '@mysten/utils';
|
|
28
|
+
import { chunk, fromBase64, toBase64 } from '@mysten/utils';
|
|
30
29
|
import { normalizeStructTag, normalizeSuiAddress } from '../utils/sui-types.js';
|
|
31
30
|
import { deriveDynamicFieldID } from '../utils/dynamic-fields.js';
|
|
32
31
|
import {
|
|
@@ -73,54 +72,50 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
73
72
|
async getObjects(
|
|
74
73
|
options: Experimental_SuiClientTypes.GetObjectsOptions,
|
|
75
74
|
): Promise<Experimental_SuiClientTypes.GetObjectsResponse> {
|
|
76
|
-
const
|
|
75
|
+
const batches = chunk(options.objectIds, 50);
|
|
76
|
+
const results: Experimental_SuiClientTypes.GetObjectsResponse['objects'] = [];
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
while (hasNextPage) {
|
|
82
|
-
const objectsPage = await this.#graphqlQuery(
|
|
78
|
+
for (const batch of batches) {
|
|
79
|
+
const page = await this.#graphqlQuery(
|
|
83
80
|
{
|
|
84
81
|
query: MultiGetObjectsDocument,
|
|
85
82
|
variables: {
|
|
86
|
-
|
|
87
|
-
cursor,
|
|
83
|
+
objectKeys: batch.map((address) => ({ address })),
|
|
88
84
|
},
|
|
89
85
|
},
|
|
90
|
-
(result) => result.
|
|
86
|
+
(result) => result.multiGetObjects,
|
|
87
|
+
);
|
|
88
|
+
results.push(
|
|
89
|
+
...batch
|
|
90
|
+
.map((id) => normalizeSuiAddress(id))
|
|
91
|
+
.map(
|
|
92
|
+
(id) =>
|
|
93
|
+
page.find((obj) => obj?.address === id) ??
|
|
94
|
+
new ObjectError('notFound', `Object ${id} not found`),
|
|
95
|
+
)
|
|
96
|
+
.map((obj) => {
|
|
97
|
+
if (obj instanceof ObjectError) {
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
id: obj.address,
|
|
102
|
+
version: obj.version?.toString()!,
|
|
103
|
+
digest: obj.digest!,
|
|
104
|
+
owner: mapOwner(obj.owner!),
|
|
105
|
+
type: obj.asMoveObject?.contents?.type?.repr!,
|
|
106
|
+
content: Promise.resolve(
|
|
107
|
+
obj.asMoveObject?.contents?.bcs
|
|
108
|
+
? fromBase64(obj.asMoveObject.contents.bcs)
|
|
109
|
+
: new Uint8Array(),
|
|
110
|
+
),
|
|
111
|
+
previousTransaction: obj.previousTransaction?.digest ?? null,
|
|
112
|
+
};
|
|
113
|
+
}),
|
|
91
114
|
);
|
|
92
|
-
|
|
93
|
-
objects.push(...objectsPage.nodes);
|
|
94
|
-
hasNextPage = objectsPage.pageInfo.hasNextPage;
|
|
95
|
-
cursor = (objectsPage.pageInfo.endCursor ?? null) as string | null;
|
|
96
115
|
}
|
|
97
116
|
|
|
98
117
|
return {
|
|
99
|
-
objects:
|
|
100
|
-
.map((id) => normalizeSuiAddress(id))
|
|
101
|
-
.map(
|
|
102
|
-
(id) =>
|
|
103
|
-
objects.find((obj) => obj.address === id) ??
|
|
104
|
-
new ObjectError('notFound', `Object ${id} not found`),
|
|
105
|
-
)
|
|
106
|
-
.map((obj) => {
|
|
107
|
-
if (obj instanceof ObjectError) {
|
|
108
|
-
return obj;
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
id: obj.address,
|
|
112
|
-
version: obj.version.toString(),
|
|
113
|
-
digest: obj.digest!,
|
|
114
|
-
owner: mapOwner(obj.owner!),
|
|
115
|
-
type: obj.asMoveObject?.contents?.type?.repr!,
|
|
116
|
-
content: Promise.resolve(
|
|
117
|
-
obj.asMoveObject?.contents?.bcs
|
|
118
|
-
? fromBase64(obj.asMoveObject.contents.bcs)
|
|
119
|
-
: new Uint8Array(),
|
|
120
|
-
),
|
|
121
|
-
previousTransaction: obj.previousTransactionBlock?.digest ?? null,
|
|
122
|
-
};
|
|
123
|
-
}),
|
|
118
|
+
objects: results,
|
|
124
119
|
};
|
|
125
120
|
}
|
|
126
121
|
async getOwnedObjects(
|
|
@@ -144,14 +139,14 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
144
139
|
return {
|
|
145
140
|
objects: objects.nodes.map((obj) => ({
|
|
146
141
|
id: obj.address,
|
|
147
|
-
version: obj.version
|
|
142
|
+
version: obj.version?.toString()!,
|
|
148
143
|
digest: obj.digest!,
|
|
149
144
|
owner: mapOwner(obj.owner!),
|
|
150
145
|
type: obj.contents?.type?.repr!,
|
|
151
146
|
content: Promise.resolve(
|
|
152
147
|
obj.contents?.bcs ? fromBase64(obj.contents.bcs) : new Uint8Array(),
|
|
153
148
|
),
|
|
154
|
-
previousTransaction: obj.
|
|
149
|
+
previousTransaction: obj.previousTransaction?.digest ?? null,
|
|
155
150
|
})),
|
|
156
151
|
hasNextPage: objects.pageInfo.hasNextPage,
|
|
157
152
|
cursor: objects.pageInfo.endCursor ?? null,
|
|
@@ -167,10 +162,10 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
167
162
|
owner: options.address,
|
|
168
163
|
cursor: options.cursor,
|
|
169
164
|
first: options.limit,
|
|
170
|
-
type: (await this.mvr.resolveType({ type: options.coinType })).type
|
|
165
|
+
type: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: options.coinType })).type}>`,
|
|
171
166
|
},
|
|
172
167
|
},
|
|
173
|
-
(result) => result.address?.
|
|
168
|
+
(result) => result.address?.objects,
|
|
174
169
|
);
|
|
175
170
|
|
|
176
171
|
return {
|
|
@@ -178,15 +173,15 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
178
173
|
hasNextPage: coins.pageInfo.hasNextPage,
|
|
179
174
|
objects: coins.nodes.map((coin) => ({
|
|
180
175
|
id: coin.address,
|
|
181
|
-
version: coin.version
|
|
176
|
+
version: coin.version?.toString()!,
|
|
182
177
|
digest: coin.digest!,
|
|
183
178
|
owner: mapOwner(coin.owner!),
|
|
184
179
|
type: coin.contents?.type?.repr!,
|
|
185
|
-
balance: coin.
|
|
180
|
+
balance: (coin.contents?.json as { balance: string })?.balance,
|
|
186
181
|
content: Promise.resolve(
|
|
187
182
|
coin.contents?.bcs ? fromBase64(coin.contents.bcs) : new Uint8Array(),
|
|
188
183
|
),
|
|
189
|
-
previousTransaction: coin.
|
|
184
|
+
previousTransaction: coin.previousTransaction?.digest ?? null,
|
|
190
185
|
})),
|
|
191
186
|
};
|
|
192
187
|
}
|
|
@@ -207,7 +202,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
207
202
|
|
|
208
203
|
return {
|
|
209
204
|
balance: {
|
|
210
|
-
coinType: result.coinType
|
|
205
|
+
coinType: result.coinType?.repr!,
|
|
211
206
|
balance: result.totalBalance!,
|
|
212
207
|
},
|
|
213
208
|
};
|
|
@@ -227,7 +222,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
227
222
|
cursor: balances.pageInfo.endCursor ?? null,
|
|
228
223
|
hasNextPage: balances.pageInfo.hasNextPage,
|
|
229
224
|
balances: balances.nodes.map((balance) => ({
|
|
230
|
-
coinType: balance.coinType
|
|
225
|
+
coinType: balance.coinType?.repr!,
|
|
231
226
|
balance: balance.totalBalance!,
|
|
232
227
|
})),
|
|
233
228
|
};
|
|
@@ -240,7 +235,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
240
235
|
query: GetTransactionBlockDocument,
|
|
241
236
|
variables: { digest: options.digest },
|
|
242
237
|
},
|
|
243
|
-
(result) => result.
|
|
238
|
+
(result) => result.transaction,
|
|
244
239
|
);
|
|
245
240
|
|
|
246
241
|
return {
|
|
@@ -252,10 +247,13 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
252
247
|
): Promise<Experimental_SuiClientTypes.ExecuteTransactionResponse> {
|
|
253
248
|
const result = await this.#graphqlQuery(
|
|
254
249
|
{
|
|
255
|
-
query:
|
|
256
|
-
variables: {
|
|
250
|
+
query: ExecuteTransactionDocument,
|
|
251
|
+
variables: {
|
|
252
|
+
transactionDataBcs: toBase64(options.transaction),
|
|
253
|
+
signatures: options.signatures,
|
|
254
|
+
},
|
|
257
255
|
},
|
|
258
|
-
(result) => result.
|
|
256
|
+
(result) => result.executeTransaction,
|
|
259
257
|
);
|
|
260
258
|
|
|
261
259
|
if (result.errors) {
|
|
@@ -266,7 +264,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
266
264
|
}
|
|
267
265
|
|
|
268
266
|
return {
|
|
269
|
-
transaction: parseTransaction(result.effects
|
|
267
|
+
transaction: parseTransaction(result.effects?.transaction!),
|
|
270
268
|
};
|
|
271
269
|
}
|
|
272
270
|
async dryRunTransaction(
|
|
@@ -274,10 +272,16 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
274
272
|
): Promise<Experimental_SuiClientTypes.DryRunTransactionResponse> {
|
|
275
273
|
const result = await this.#graphqlQuery(
|
|
276
274
|
{
|
|
277
|
-
query:
|
|
278
|
-
variables: {
|
|
275
|
+
query: SimulateTransactionDocument,
|
|
276
|
+
variables: {
|
|
277
|
+
transaction: {
|
|
278
|
+
bcs: {
|
|
279
|
+
value: toBase64(options.transaction),
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
279
283
|
},
|
|
280
|
-
(result) => result.
|
|
284
|
+
(result) => result.simulateTransaction,
|
|
281
285
|
);
|
|
282
286
|
|
|
283
287
|
if (result.error) {
|
|
@@ -285,7 +289,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
285
289
|
}
|
|
286
290
|
|
|
287
291
|
return {
|
|
288
|
-
transaction: parseTransaction(result.transaction!),
|
|
292
|
+
transaction: parseTransaction(result.effects?.transaction!),
|
|
289
293
|
};
|
|
290
294
|
}
|
|
291
295
|
async getReferenceGasPrice(): Promise<Experimental_SuiClientTypes.GetReferenceGasPriceResponse> {
|
|
@@ -309,7 +313,7 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
309
313
|
query: GetDynamicFieldsDocument,
|
|
310
314
|
variables: { parentId: options.parentId },
|
|
311
315
|
},
|
|
312
|
-
(result) => result.
|
|
316
|
+
(result) => result.address?.dynamicFields,
|
|
313
317
|
);
|
|
314
318
|
|
|
315
319
|
return {
|
|
@@ -317,20 +321,20 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
317
321
|
const valueType =
|
|
318
322
|
dynamicField.value?.__typename === 'MoveObject'
|
|
319
323
|
? dynamicField.value.contents?.type?.repr!
|
|
320
|
-
: dynamicField.value?.type
|
|
324
|
+
: dynamicField.value?.type?.repr!;
|
|
321
325
|
return {
|
|
322
326
|
id: deriveDynamicFieldID(
|
|
323
327
|
options.parentId,
|
|
324
|
-
dynamicField.name?.type
|
|
328
|
+
dynamicField.name?.type?.repr!,
|
|
325
329
|
fromBase64(dynamicField.name?.bcs!),
|
|
326
330
|
),
|
|
327
331
|
type: normalizeStructTag(
|
|
328
332
|
dynamicField.value?.__typename === 'MoveObject'
|
|
329
|
-
? `0x2::dynamic_field::Field<0x2::dynamic_object_field::Wrapper<${dynamicField.name?.type
|
|
330
|
-
: `0x2::dynamic_field::Field<${dynamicField.name?.type
|
|
333
|
+
? `0x2::dynamic_field::Field<0x2::dynamic_object_field::Wrapper<${dynamicField.name?.type?.repr}>,0x2::object::ID>`
|
|
334
|
+
: `0x2::dynamic_field::Field<${dynamicField.name?.type?.repr},${valueType}>`,
|
|
331
335
|
),
|
|
332
336
|
name: {
|
|
333
|
-
type: dynamicField.name?.type
|
|
337
|
+
type: dynamicField.name?.type?.repr!,
|
|
334
338
|
bcs: fromBase64(dynamicField.name?.bcs!),
|
|
335
339
|
},
|
|
336
340
|
valueType,
|
|
@@ -359,35 +363,31 @@ export class GraphQLCoreClient extends Experimental_CoreClient {
|
|
|
359
363
|
author: options.author,
|
|
360
364
|
},
|
|
361
365
|
},
|
|
362
|
-
(result) => result.
|
|
366
|
+
(result) => result.verifyZkLoginSignature,
|
|
363
367
|
);
|
|
364
368
|
|
|
365
369
|
return {
|
|
366
|
-
success: result.success,
|
|
367
|
-
errors: result.
|
|
370
|
+
success: result.success ?? false,
|
|
371
|
+
errors: result.error ? [result.error] : [],
|
|
368
372
|
};
|
|
369
373
|
}
|
|
370
374
|
|
|
371
|
-
async
|
|
372
|
-
options: Experimental_SuiClientTypes.
|
|
373
|
-
): Promise<Experimental_SuiClientTypes.
|
|
374
|
-
const
|
|
375
|
+
async defaultNameServiceName(
|
|
376
|
+
options: Experimental_SuiClientTypes.DefaultNameServiceNameOptions,
|
|
377
|
+
): Promise<Experimental_SuiClientTypes.DefaultNameServiceNameResponse> {
|
|
378
|
+
const name = await this.#graphqlQuery(
|
|
375
379
|
{
|
|
376
|
-
query:
|
|
380
|
+
query: DefaultSuinsNameDocument,
|
|
377
381
|
signal: options.signal,
|
|
378
382
|
variables: {
|
|
379
383
|
address: options.address,
|
|
380
|
-
cursor: options.cursor,
|
|
381
|
-
limit: options.limit,
|
|
382
384
|
},
|
|
383
385
|
},
|
|
384
|
-
(result) => result.address?.
|
|
386
|
+
(result) => result.address?.defaultSuinsName ?? null,
|
|
385
387
|
);
|
|
386
388
|
|
|
387
389
|
return {
|
|
388
|
-
|
|
389
|
-
nextCursor: suinsRegistrations.pageInfo.endCursor ?? null,
|
|
390
|
-
data: suinsRegistrations.nodes.map((node) => node.domain) ?? [],
|
|
390
|
+
data: { name: name },
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
|
|
@@ -489,19 +489,19 @@ class GraphQLResponseError extends Error {
|
|
|
489
489
|
function mapOwner(owner: Object_Owner_FieldsFragment): Experimental_SuiClientTypes.ObjectOwner {
|
|
490
490
|
switch (owner.__typename) {
|
|
491
491
|
case 'AddressOwner':
|
|
492
|
-
return { $kind: 'AddressOwner', AddressOwner: owner.
|
|
492
|
+
return { $kind: 'AddressOwner', AddressOwner: owner.address?.address! };
|
|
493
493
|
case 'ConsensusAddressOwner':
|
|
494
494
|
return {
|
|
495
495
|
$kind: 'ConsensusAddressOwner',
|
|
496
496
|
ConsensusAddressOwner: {
|
|
497
|
-
owner: owner
|
|
497
|
+
owner: owner?.address?.address!,
|
|
498
498
|
startVersion: String(owner.startVersion),
|
|
499
499
|
},
|
|
500
500
|
};
|
|
501
|
+
case 'ObjectOwner':
|
|
502
|
+
return { $kind: 'ObjectOwner', ObjectOwner: owner.address?.address! };
|
|
501
503
|
case 'Immutable':
|
|
502
504
|
return { $kind: 'Immutable', Immutable: true };
|
|
503
|
-
case 'Parent':
|
|
504
|
-
return { $kind: 'ObjectOwner', ObjectOwner: owner.parent?.address };
|
|
505
505
|
case 'Shared':
|
|
506
506
|
return {
|
|
507
507
|
$kind: 'Shared',
|
|
@@ -515,9 +515,9 @@ function parseTransaction(
|
|
|
515
515
|
): Experimental_SuiClientTypes.TransactionResponse {
|
|
516
516
|
const objectTypes: Record<string, string> = {};
|
|
517
517
|
|
|
518
|
-
transaction.effects?.unchangedConsensusObjects
|
|
518
|
+
transaction.effects?.unchangedConsensusObjects?.nodes.forEach((node) => {
|
|
519
519
|
if (node.__typename === 'ConsensusObjectRead') {
|
|
520
|
-
const type = node.object?.asMoveObject?.contents?.type
|
|
520
|
+
const type = node.object?.asMoveObject?.contents?.type?.repr;
|
|
521
521
|
const address = node.object?.asMoveObject?.address;
|
|
522
522
|
|
|
523
523
|
if (type && address) {
|
|
@@ -526,30 +526,30 @@ function parseTransaction(
|
|
|
526
526
|
}
|
|
527
527
|
});
|
|
528
528
|
|
|
529
|
-
transaction.effects?.objectChanges
|
|
529
|
+
transaction.effects?.objectChanges?.nodes.forEach((node) => {
|
|
530
530
|
const address = node.address;
|
|
531
531
|
const type =
|
|
532
|
-
node.inputState?.asMoveObject?.contents?.type
|
|
533
|
-
node.outputState?.asMoveObject?.contents?.type
|
|
532
|
+
node.inputState?.asMoveObject?.contents?.type?.repr ??
|
|
533
|
+
node.outputState?.asMoveObject?.contents?.type?.repr;
|
|
534
534
|
|
|
535
535
|
if (address && type) {
|
|
536
536
|
objectTypes[address] = type;
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
|
|
540
|
-
if (transaction.effects?.balanceChanges
|
|
540
|
+
if (transaction.effects?.balanceChanges?.pageInfo.hasNextPage) {
|
|
541
541
|
throw new Error('Pagination for balance changes is not supported');
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
return {
|
|
545
545
|
digest: transaction.digest!,
|
|
546
|
-
effects: parseTransactionEffectsBcs(fromBase64(transaction.effects?.
|
|
546
|
+
effects: parseTransactionEffectsBcs(fromBase64(transaction.effects?.effectsBcs!)),
|
|
547
547
|
epoch: transaction.effects?.epoch?.epochId?.toString() ?? null,
|
|
548
548
|
objectTypes: Promise.resolve(objectTypes),
|
|
549
|
-
transaction: parseTransactionBcs(fromBase64(transaction.
|
|
550
|
-
signatures: transaction.signatures
|
|
549
|
+
transaction: parseTransactionBcs(fromBase64(transaction.transactionBcs!)),
|
|
550
|
+
signatures: transaction.signatures.map((sig) => sig.signatureBytes!),
|
|
551
551
|
balanceChanges:
|
|
552
|
-
transaction.effects?.balanceChanges
|
|
552
|
+
transaction.effects?.balanceChanges?.nodes.map((change) => ({
|
|
553
553
|
coinType: change?.coinType?.repr!,
|
|
554
554
|
address: change.owner?.address!,
|
|
555
555
|
amount: change.amount!,
|