@mysten/sui 3.0.0 → 3.0.1
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 +9 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.mjs +2 -2
- package/dist/client/transaction-data.d.mts +8 -3
- package/dist/client/transaction-data.d.mts.map +1 -1
- package/dist/client/transaction-data.mjs +9 -6
- package/dist/client/transaction-data.mjs.map +1 -1
- package/dist/client/utils.d.mts +1 -3
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +1 -5
- package/dist/client/utils.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/graphql/core.mjs +1 -1
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/move_package_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/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
- package/dist/transactions/Transaction.d.mts +7 -7
- package/dist/transactions/data/internal.d.mts +135 -135
- package/dist/transactions/data/internal.d.mts.map +1 -1
- package/dist/transactions/data/v1.d.mts +239 -239
- 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/dist/zklogin/bcs.d.mts +14 -14
- package/docs/clients/executing.md +1 -1
- package/docs/migrations/sui-3.0/index.md +1 -4
- package/package.json +3 -3
- package/src/client/index.ts +1 -2
- package/src/client/transaction-data.ts +25 -2
- package/src/client/utils.ts +0 -12
- package/src/version.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EnumInputShape } from "@mysten/bcs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as valibot0 from "valibot";
|
|
3
3
|
import { GenericSchema, InferOutput } from "valibot";
|
|
4
4
|
|
|
5
5
|
//#region src/transactions/data/v2.d.ts
|
|
6
|
-
declare const SerializedTransactionDataV2Schema:
|
|
7
|
-
readonly version:
|
|
8
|
-
readonly sender:
|
|
9
|
-
readonly expiration:
|
|
6
|
+
declare const SerializedTransactionDataV2Schema: valibot0.ObjectSchema<{
|
|
7
|
+
readonly version: valibot0.LiteralSchema<2, undefined>;
|
|
8
|
+
readonly sender: valibot0.NullishSchema<valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>, undefined>;
|
|
9
|
+
readonly expiration: valibot0.NullishSchema<GenericSchema<EnumInputShape<{
|
|
10
10
|
None: true;
|
|
11
11
|
Epoch: string | number;
|
|
12
12
|
ValidDuring: {
|
|
@@ -30,17 +30,17 @@ declare const SerializedTransactionDataV2Schema: valibot851.ObjectSchema<{
|
|
|
30
30
|
nonce: number;
|
|
31
31
|
};
|
|
32
32
|
}>>, undefined>;
|
|
33
|
-
readonly gasData:
|
|
34
|
-
readonly budget:
|
|
35
|
-
readonly price:
|
|
36
|
-
readonly owner:
|
|
37
|
-
readonly payment:
|
|
38
|
-
readonly objectId:
|
|
39
|
-
readonly version:
|
|
40
|
-
readonly digest:
|
|
33
|
+
readonly gasData: valibot0.ObjectSchema<{
|
|
34
|
+
readonly budget: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>, undefined>;
|
|
35
|
+
readonly price: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>, undefined>;
|
|
36
|
+
readonly owner: valibot0.NullableSchema<valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>, undefined>;
|
|
37
|
+
readonly payment: valibot0.NullableSchema<valibot0.ArraySchema<valibot0.ObjectSchema<{
|
|
38
|
+
readonly objectId: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<undefined>, valibot0.TransformAction<string, string>, valibot0.CheckAction<string, undefined>]>;
|
|
39
|
+
readonly version: valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.StringSchema<undefined>, valibot0.SchemaWithPipe<readonly [valibot0.NumberSchema<undefined>, valibot0.IntegerAction<number, undefined>]>], undefined>, valibot0.CheckAction<string | number, "Invalid u64">]>;
|
|
40
|
+
readonly digest: valibot0.StringSchema<undefined>;
|
|
41
41
|
}, undefined>, undefined>, undefined>;
|
|
42
42
|
}, undefined>;
|
|
43
|
-
readonly inputs:
|
|
43
|
+
readonly inputs: valibot0.ArraySchema<GenericSchema<EnumInputShape<{
|
|
44
44
|
Object: EnumInputShape<{
|
|
45
45
|
ImmOrOwnedObject: {
|
|
46
46
|
objectId: string;
|
|
@@ -90,7 +90,7 @@ declare const SerializedTransactionDataV2Schema: valibot851.ObjectSchema<{
|
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
}>>, undefined>;
|
|
93
|
-
readonly commands:
|
|
93
|
+
readonly commands: valibot0.ArraySchema<GenericSchema<EnumInputShape<{
|
|
94
94
|
MoveCall: {
|
|
95
95
|
package: string;
|
|
96
96
|
module: string;
|
|
@@ -189,7 +189,7 @@ declare const SerializedTransactionDataV2Schema: valibot851.ObjectSchema<{
|
|
|
189
189
|
};
|
|
190
190
|
};
|
|
191
191
|
}>>, undefined>;
|
|
192
|
-
readonly digest:
|
|
192
|
+
readonly digest: valibot0.OptionalSchema<valibot0.NullableSchema<valibot0.StringSchema<undefined>, undefined>, undefined>;
|
|
193
193
|
}, undefined>;
|
|
194
194
|
type SerializedTransactionDataV2 = InferOutput<typeof SerializedTransactionDataV2Schema>;
|
|
195
195
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.d.mts","names":[],"sources":["../../../src/transactions/data/v2.ts"],"mappings":";;;;;cAqJa,iCAAA,
|
|
1
|
+
{"version":3,"file":"v2.d.mts","names":[],"sources":["../../../src/transactions/data/v2.ts"],"mappings":";;;;;cAqJa,iCAAA,WAAiC,YAAA;EAAA,kBAQ5C,QAAA,CAAA,aAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEU,2BAAA,GAA8B,WAAA,QAAmB,iCAAA"}
|
package/dist/version.mjs
CHANGED
package/dist/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// This file is generated by genversion.mjs. Do not edit it directly.\n\nexport const PACKAGE_VERSION = '3.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// This file is generated by genversion.mjs. Do not edit it directly.\n\nexport const PACKAGE_VERSION = '3.0.1';\n"],"mappings":";AAKA,MAAa,kBAAkB"}
|
package/dist/zklogin/bcs.d.mts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _mysten_bcs1425 from "@mysten/bcs";
|
|
2
2
|
import { InferBcsInput } from "@mysten/bcs";
|
|
3
3
|
|
|
4
4
|
//#region src/zklogin/bcs.d.ts
|
|
5
|
-
declare const zkLoginSignature:
|
|
6
|
-
inputs:
|
|
7
|
-
proofPoints:
|
|
8
|
-
a:
|
|
5
|
+
declare const zkLoginSignature: _mysten_bcs1425.BcsStruct<{
|
|
6
|
+
inputs: _mysten_bcs1425.BcsStruct<{
|
|
7
|
+
proofPoints: _mysten_bcs1425.BcsStruct<{
|
|
8
|
+
a: _mysten_bcs1425.BcsType<string[], Iterable<string> & {
|
|
9
9
|
length: number;
|
|
10
10
|
}, string>;
|
|
11
|
-
b:
|
|
11
|
+
b: _mysten_bcs1425.BcsType<string[][], Iterable<Iterable<string> & {
|
|
12
12
|
length: number;
|
|
13
13
|
}> & {
|
|
14
14
|
length: number;
|
|
15
15
|
}, string>;
|
|
16
|
-
c:
|
|
16
|
+
c: _mysten_bcs1425.BcsType<string[], Iterable<string> & {
|
|
17
17
|
length: number;
|
|
18
18
|
}, string>;
|
|
19
19
|
}, string>;
|
|
20
|
-
issBase64Details:
|
|
21
|
-
value:
|
|
22
|
-
indexMod4:
|
|
20
|
+
issBase64Details: _mysten_bcs1425.BcsStruct<{
|
|
21
|
+
value: _mysten_bcs1425.BcsType<string, string, "string">;
|
|
22
|
+
indexMod4: _mysten_bcs1425.BcsType<number, number, "u8">;
|
|
23
23
|
}, string>;
|
|
24
|
-
headerBase64:
|
|
25
|
-
addressSeed:
|
|
24
|
+
headerBase64: _mysten_bcs1425.BcsType<string, string, "string">;
|
|
25
|
+
addressSeed: _mysten_bcs1425.BcsType<string, string, "string">;
|
|
26
26
|
}, string>;
|
|
27
|
-
maxEpoch:
|
|
28
|
-
userSignature:
|
|
27
|
+
maxEpoch: _mysten_bcs1425.BcsType<string, string | number | bigint, "u64">;
|
|
28
|
+
userSignature: _mysten_bcs1425.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
29
29
|
}, string>;
|
|
30
30
|
type ZkLoginSignature = InferBcsInput<typeof zkLoginSignature>;
|
|
31
31
|
type ZkLoginSignatureInputs = ZkLoginSignature['inputs'];
|
|
@@ -108,7 +108,7 @@ If the SDK does not recognize a transaction's kind, or cannot map one of its inp
|
|
|
108
108
|
`gasData`, and `expiration` are still set. Upgrade the SDK to read kinds added by newer network
|
|
109
109
|
versions.
|
|
110
110
|
|
|
111
|
-
To decode transaction bytes yourself, use `
|
|
111
|
+
To decode transaction bytes yourself, use `parseTransactionBcs` from `@mysten/sui/client`. It
|
|
112
112
|
returns the same shape, but throws on bytes that use a variant the SDK does not know.
|
|
113
113
|
|
|
114
114
|
## `waitForTransaction`
|
|
@@ -54,7 +54,7 @@ run on 3.0 or keep a 2.x copy of its own.
|
|
|
54
54
|
|
|
55
55
|
- **Transaction data (`include: { transaction: true }`) has a `kind`.** Inputs and commands carry
|
|
56
56
|
`$kind`, so narrow with `input.$kind === 'Pure'` rather than `'Pure' in input`. Decode transaction
|
|
57
|
-
bytes into this type with `
|
|
57
|
+
bytes into this type with `parseTransactionBcs`. See
|
|
58
58
|
[transaction data](/sui/clients/executing#transaction-data). It is no longer the builder's
|
|
59
59
|
serialized type, so to rebuild a `Transaction` from a query result, request
|
|
60
60
|
`include: { bcs: true }` and pass the result's `bcs` to `Transaction.from`.
|
|
@@ -77,9 +77,6 @@ run on 3.0 or keep a 2.x copy of its own.
|
|
|
77
77
|
`ConsensusObjectOperationNotAllowed` and `PackageIdDoesNotMatch` replace `InvalidBCSBytes`,
|
|
78
78
|
`InvalidUsageOfPureArg`, `SharedObjectOperationNotAllowed` and `PackageIDDoesNotMatch`.
|
|
79
79
|
- **`parseGrpcTransactionResponse` needs `transaction.sender` in the read mask.**
|
|
80
|
-
- **`parseTransactionBcs` returns the transaction builder's `TransactionData`** from
|
|
81
|
-
`@mysten/sui/transactions`, not `SuiClientTypes.TransactionData`. Use `parseTransactionDataBcs`
|
|
82
|
-
where you need the client type.
|
|
83
80
|
- **Building or serializing a transaction that calls `0x2::address_alias` throws.** Pass
|
|
84
81
|
`restrictedMoveCalls: []` to the client constructor, or to `build` or `toJSON`, to allow it. See
|
|
85
82
|
[Restricted Move calls](/sui/transactions/reference#restricted-move-calls).
|
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": "3.0.
|
|
6
|
+
"version": "3.0.1",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -173,8 +173,8 @@
|
|
|
173
173
|
"graphql": "^17.0.2",
|
|
174
174
|
"poseidon-lite": "0.3.0",
|
|
175
175
|
"valibot": "^1.4.2",
|
|
176
|
-
"@mysten/
|
|
177
|
-
"@mysten/
|
|
176
|
+
"@mysten/utils": "^0.4.2",
|
|
177
|
+
"@mysten/bcs": "^2.1.4"
|
|
178
178
|
},
|
|
179
179
|
"scripts": {
|
|
180
180
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
package/src/client/index.ts
CHANGED
|
@@ -8,10 +8,9 @@ import type { ClientWithExtensions, SuiClientTypes, SuiClientRegistration } from
|
|
|
8
8
|
export {
|
|
9
9
|
extractStatusFromEffectsBcs,
|
|
10
10
|
formatMoveAbortMessage,
|
|
11
|
-
parseTransactionBcs,
|
|
12
11
|
parseTransactionEffectsBcs,
|
|
13
12
|
} from './utils.js';
|
|
14
|
-
export { parseTransactionDataBcs } from './transaction-data.js';
|
|
13
|
+
export { parseTransactionBcs, parseTransactionDataBcs } from './transaction-data.js';
|
|
15
14
|
|
|
16
15
|
export {
|
|
17
16
|
BaseClient,
|
|
@@ -46,10 +46,33 @@ type HeaderInput = Omit<BuilderTransactionData, 'inputs' | 'commands' | 'digest'
|
|
|
46
46
|
const UNKNOWN_KIND = { $kind: 'Unknown', Unknown: true } as const;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Decode
|
|
50
|
-
*
|
|
49
|
+
* Decode transaction data from BCS. Unlike the transport mappers, which return `Unknown`, this
|
|
50
|
+
* throws on a transaction kind or variant this SDK version does not recognize.
|
|
51
51
|
*/
|
|
52
|
+
export function parseTransactionBcs(
|
|
53
|
+
bytes: Uint8Array,
|
|
54
|
+
onlyTransactionKind?: false,
|
|
55
|
+
): SuiClientTypes.TransactionData;
|
|
56
|
+
/** @deprecated Use `Transaction.fromKind(bytes).getData()` to decode transaction kind bytes. */
|
|
57
|
+
export function parseTransactionBcs(
|
|
58
|
+
bytes: Uint8Array,
|
|
59
|
+
onlyTransactionKind: true,
|
|
60
|
+
): BuilderTransactionData;
|
|
61
|
+
export function parseTransactionBcs(
|
|
62
|
+
bytes: Uint8Array,
|
|
63
|
+
onlyTransactionKind = false,
|
|
64
|
+
): SuiClientTypes.TransactionData | BuilderTransactionData {
|
|
65
|
+
return onlyTransactionKind
|
|
66
|
+
? TransactionDataBuilder.fromKindBytes(bytes).snapshot()
|
|
67
|
+
: decodeTransactionData(bytes);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @deprecated Use `parseTransactionBcs`. */
|
|
52
71
|
export function parseTransactionDataBcs(bytes: Uint8Array): SuiClientTypes.TransactionData {
|
|
72
|
+
return decodeTransactionData(bytes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function decodeTransactionData(bytes: Uint8Array): SuiClientTypes.TransactionData {
|
|
53
76
|
const data = bcs.TransactionData.parse(bytes).V1;
|
|
54
77
|
const programmable = data.kind.ProgrammableTransaction ?? data.kind.ProgrammableSystemTransaction;
|
|
55
78
|
const { kind: body, ...header } = normalizeProgrammable(
|
package/src/client/utils.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { fromBase64, toBase64 } from '@mysten/utils';
|
|
|
5
5
|
|
|
6
6
|
import { bcs } from '../bcs/index.js';
|
|
7
7
|
import { ExecutionStatus } from '../bcs/effects.js';
|
|
8
|
-
import { TransactionDataBuilder } from '../transactions/TransactionData.js';
|
|
9
8
|
import { MOCKED_GAS_OBJECT_ID } from '../utils/constants.js';
|
|
10
9
|
import { isValidSuiAddress, normalizeSuiAddress } from '../utils/sui-types.js';
|
|
11
10
|
import type { SuiClientTypes } from './types.js';
|
|
@@ -415,17 +414,6 @@ function parseBcsExecutionError(failure: {
|
|
|
415
414
|
}
|
|
416
415
|
}
|
|
417
416
|
|
|
418
|
-
export function parseTransactionBcs(
|
|
419
|
-
bytes: Uint8Array,
|
|
420
|
-
onlyTransactionKind = false,
|
|
421
|
-
): ReturnType<TransactionDataBuilder['snapshot']> {
|
|
422
|
-
return (
|
|
423
|
-
onlyTransactionKind
|
|
424
|
-
? TransactionDataBuilder.fromKindBytes(bytes)
|
|
425
|
-
: TransactionDataBuilder.fromBytes(bytes)
|
|
426
|
-
).snapshot();
|
|
427
|
-
}
|
|
428
|
-
|
|
429
417
|
/**
|
|
430
418
|
* Checks whether serialized transaction bytes have a gas payment explicitly set to an empty
|
|
431
419
|
* list, which indicates gas is paid from the sender's address balance. Returns false for
|
package/src/version.ts
CHANGED