@mysten/sui 1.44.0 → 1.45.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 +12 -0
- package/dist/cjs/transactions/Arguments.d.ts +2 -2
- package/dist/cjs/transactions/Transaction.d.ts +88 -88
- package/dist/cjs/transactions/TransactionData.d.ts +14 -7
- package/dist/cjs/transactions/TransactionData.js +93 -11
- package/dist/cjs/transactions/TransactionData.js.map +2 -2
- package/dist/cjs/transactions/data/internal.d.ts +107 -105
- package/dist/cjs/transactions/data/internal.js +6 -4
- package/dist/cjs/transactions/data/internal.js.map +2 -2
- package/dist/cjs/transactions/data/v1.d.ts +95 -92
- package/dist/cjs/transactions/data/v2.d.ts +15 -147
- package/dist/cjs/transactions/utils.d.ts +2 -1
- package/dist/cjs/transactions/utils.js +64 -1
- package/dist/cjs/transactions/utils.js.map +2 -2
- 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/esm/transactions/Arguments.d.ts +2 -2
- package/dist/esm/transactions/Transaction.d.ts +88 -88
- package/dist/esm/transactions/TransactionData.d.ts +14 -7
- package/dist/esm/transactions/TransactionData.js +94 -12
- package/dist/esm/transactions/TransactionData.js.map +2 -2
- package/dist/esm/transactions/data/internal.d.ts +107 -105
- package/dist/esm/transactions/data/internal.js +6 -4
- package/dist/esm/transactions/data/internal.js.map +2 -2
- package/dist/esm/transactions/data/v1.d.ts +95 -92
- package/dist/esm/transactions/data/v2.d.ts +15 -147
- package/dist/esm/transactions/utils.d.ts +2 -1
- package/dist/esm/transactions/utils.js +64 -1
- package/dist/esm/transactions/utils.js.map +2 -2
- 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/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/transactions/TransactionData.ts +137 -15
- package/src/transactions/data/internal.ts +21 -14
- package/src/transactions/utils.ts +70 -1
- package/src/version.ts +2 -2
|
@@ -2,60 +2,26 @@ import type { EnumInputShape } from '@mysten/bcs';
|
|
|
2
2
|
import type { GenericSchema, InferOutput } from 'valibot';
|
|
3
3
|
export declare const SerializedTransactionDataV2Schema: import("valibot").ObjectSchema<{
|
|
4
4
|
readonly version: import("valibot").LiteralSchema<2, undefined>;
|
|
5
|
-
readonly sender: import("valibot").NullishSchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>,
|
|
5
|
+
readonly sender: import("valibot").NullishSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>, undefined>;
|
|
6
6
|
readonly expiration: import("valibot").NullishSchema<GenericSchema<EnumInputShape<{
|
|
7
7
|
None: true;
|
|
8
8
|
Epoch: string | number;
|
|
9
|
-
}
|
|
10
|
-
None: true;
|
|
11
|
-
Epoch: string | number;
|
|
12
|
-
}>, import("valibot").BaseIssue<unknown>>, never>;
|
|
9
|
+
}>>, undefined>;
|
|
13
10
|
readonly gasData: import("valibot").ObjectSchema<{
|
|
14
|
-
readonly budget: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<[import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>,
|
|
15
|
-
readonly price: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<[import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>,
|
|
16
|
-
readonly owner: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>,
|
|
11
|
+
readonly budget: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>, undefined>;
|
|
12
|
+
readonly price: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>, undefined>;
|
|
13
|
+
readonly owner: import("valibot").NullableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>, undefined>;
|
|
17
14
|
readonly payment: import("valibot").NullableSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
18
|
-
readonly objectId: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>;
|
|
19
|
-
readonly version: import("valibot").SchemaWithPipe<[import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>;
|
|
15
|
+
readonly objectId: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, string>, import("valibot").CheckAction<string, undefined>]>;
|
|
16
|
+
readonly version: import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>]>], undefined>, import("valibot").CheckAction<string | number, "Invalid u64">]>;
|
|
20
17
|
readonly digest: import("valibot").StringSchema<undefined>;
|
|
21
|
-
}, undefined>, undefined>,
|
|
18
|
+
}, undefined>, undefined>, undefined>;
|
|
22
19
|
}, undefined>;
|
|
23
20
|
readonly inputs: import("valibot").ArraySchema<GenericSchema<EnumInputShape<{
|
|
24
21
|
Object: EnumInputShape<{
|
|
25
22
|
ImmOrOwnedObject: {
|
|
26
|
-
version: string | number;
|
|
27
23
|
objectId: string;
|
|
28
|
-
digest: string;
|
|
29
|
-
};
|
|
30
|
-
SharedObject: {
|
|
31
|
-
objectId: string;
|
|
32
|
-
initialSharedVersion: string | number;
|
|
33
|
-
mutable: boolean;
|
|
34
|
-
};
|
|
35
|
-
Receiving: {
|
|
36
24
|
version: string | number;
|
|
37
|
-
objectId: string;
|
|
38
|
-
digest: string;
|
|
39
|
-
};
|
|
40
|
-
}>;
|
|
41
|
-
Pure: {
|
|
42
|
-
bytes: string;
|
|
43
|
-
};
|
|
44
|
-
UnresolvedPure: {
|
|
45
|
-
value: unknown;
|
|
46
|
-
};
|
|
47
|
-
UnresolvedObject: {
|
|
48
|
-
objectId: string;
|
|
49
|
-
version?: string | number | null | undefined;
|
|
50
|
-
digest?: string | null | undefined;
|
|
51
|
-
initialSharedVersion?: string | number | null | undefined;
|
|
52
|
-
mutable?: boolean | null | undefined;
|
|
53
|
-
};
|
|
54
|
-
}>, EnumInputShape<{
|
|
55
|
-
Object: EnumInputShape<{
|
|
56
|
-
ImmOrOwnedObject: {
|
|
57
|
-
version: string | number;
|
|
58
|
-
objectId: string;
|
|
59
25
|
digest: string;
|
|
60
26
|
};
|
|
61
27
|
SharedObject: {
|
|
@@ -64,8 +30,8 @@ export declare const SerializedTransactionDataV2Schema: import("valibot").Object
|
|
|
64
30
|
mutable: boolean;
|
|
65
31
|
};
|
|
66
32
|
Receiving: {
|
|
67
|
-
version: string | number;
|
|
68
33
|
objectId: string;
|
|
34
|
+
version: string | number;
|
|
69
35
|
digest: string;
|
|
70
36
|
};
|
|
71
37
|
}>;
|
|
@@ -82,12 +48,12 @@ export declare const SerializedTransactionDataV2Schema: import("valibot").Object
|
|
|
82
48
|
initialSharedVersion?: string | number | null | undefined;
|
|
83
49
|
mutable?: boolean | null | undefined;
|
|
84
50
|
};
|
|
85
|
-
}
|
|
51
|
+
}>>, undefined>;
|
|
86
52
|
readonly commands: import("valibot").ArraySchema<GenericSchema<EnumInputShape<{
|
|
87
53
|
MoveCall: {
|
|
88
|
-
function: string;
|
|
89
|
-
module: string;
|
|
90
54
|
package: string;
|
|
55
|
+
module: string;
|
|
56
|
+
function: string;
|
|
91
57
|
typeArguments: string[];
|
|
92
58
|
arguments: EnumInputShape<{
|
|
93
59
|
GasCoin: true;
|
|
@@ -97,116 +63,18 @@ export declare const SerializedTransactionDataV2Schema: import("valibot").Object
|
|
|
97
63
|
}>[];
|
|
98
64
|
};
|
|
99
65
|
TransferObjects: {
|
|
100
|
-
address: EnumInputShape<{
|
|
101
|
-
GasCoin: true;
|
|
102
|
-
Input: number;
|
|
103
|
-
Result: number;
|
|
104
|
-
NestedResult: [number, number];
|
|
105
|
-
}>;
|
|
106
66
|
objects: EnumInputShape<{
|
|
107
67
|
GasCoin: true;
|
|
108
68
|
Input: number;
|
|
109
69
|
Result: number;
|
|
110
70
|
NestedResult: [number, number];
|
|
111
71
|
}>[];
|
|
112
|
-
};
|
|
113
|
-
SplitCoins: {
|
|
114
|
-
coin: EnumInputShape<{
|
|
115
|
-
GasCoin: true;
|
|
116
|
-
Input: number;
|
|
117
|
-
Result: number;
|
|
118
|
-
NestedResult: [number, number];
|
|
119
|
-
}>;
|
|
120
|
-
amounts: EnumInputShape<{
|
|
121
|
-
GasCoin: true;
|
|
122
|
-
Input: number;
|
|
123
|
-
Result: number;
|
|
124
|
-
NestedResult: [number, number];
|
|
125
|
-
}>[];
|
|
126
|
-
};
|
|
127
|
-
MergeCoins: {
|
|
128
|
-
destination: EnumInputShape<{
|
|
129
|
-
GasCoin: true;
|
|
130
|
-
Input: number;
|
|
131
|
-
Result: number;
|
|
132
|
-
NestedResult: [number, number];
|
|
133
|
-
}>;
|
|
134
|
-
sources: EnumInputShape<{
|
|
135
|
-
GasCoin: true;
|
|
136
|
-
Input: number;
|
|
137
|
-
Result: number;
|
|
138
|
-
NestedResult: [number, number];
|
|
139
|
-
}>[];
|
|
140
|
-
};
|
|
141
|
-
Publish: {
|
|
142
|
-
modules: string[];
|
|
143
|
-
dependencies: string[];
|
|
144
|
-
};
|
|
145
|
-
MakeMoveVec: {
|
|
146
|
-
type: string | null;
|
|
147
|
-
elements: EnumInputShape<{
|
|
148
|
-
GasCoin: true;
|
|
149
|
-
Input: number;
|
|
150
|
-
Result: number;
|
|
151
|
-
NestedResult: [number, number];
|
|
152
|
-
}>[];
|
|
153
|
-
};
|
|
154
|
-
Upgrade: {
|
|
155
|
-
package: string;
|
|
156
|
-
modules: string[];
|
|
157
|
-
dependencies: string[];
|
|
158
|
-
ticket: EnumInputShape<{
|
|
159
|
-
GasCoin: true;
|
|
160
|
-
Input: number;
|
|
161
|
-
Result: number;
|
|
162
|
-
NestedResult: [number, number];
|
|
163
|
-
}>;
|
|
164
|
-
};
|
|
165
|
-
$Intent: {
|
|
166
|
-
name: string;
|
|
167
|
-
inputs: {
|
|
168
|
-
[x: string]: EnumInputShape<{
|
|
169
|
-
GasCoin: true;
|
|
170
|
-
Input: number;
|
|
171
|
-
Result: number;
|
|
172
|
-
NestedResult: [number, number];
|
|
173
|
-
}> | EnumInputShape<{
|
|
174
|
-
GasCoin: true;
|
|
175
|
-
Input: number;
|
|
176
|
-
Result: number;
|
|
177
|
-
NestedResult: [number, number];
|
|
178
|
-
}>[];
|
|
179
|
-
};
|
|
180
|
-
data: {
|
|
181
|
-
[x: string]: unknown;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
}>, EnumInputShape<{
|
|
185
|
-
MoveCall: {
|
|
186
|
-
function: string;
|
|
187
|
-
module: string;
|
|
188
|
-
package: string;
|
|
189
|
-
typeArguments: string[];
|
|
190
|
-
arguments: EnumInputShape<{
|
|
191
|
-
GasCoin: true;
|
|
192
|
-
Input: number;
|
|
193
|
-
Result: number;
|
|
194
|
-
NestedResult: [number, number];
|
|
195
|
-
}>[];
|
|
196
|
-
};
|
|
197
|
-
TransferObjects: {
|
|
198
72
|
address: EnumInputShape<{
|
|
199
73
|
GasCoin: true;
|
|
200
74
|
Input: number;
|
|
201
75
|
Result: number;
|
|
202
76
|
NestedResult: [number, number];
|
|
203
77
|
}>;
|
|
204
|
-
objects: EnumInputShape<{
|
|
205
|
-
GasCoin: true;
|
|
206
|
-
Input: number;
|
|
207
|
-
Result: number;
|
|
208
|
-
NestedResult: [number, number];
|
|
209
|
-
}>[];
|
|
210
78
|
};
|
|
211
79
|
SplitCoins: {
|
|
212
80
|
coin: EnumInputShape<{
|
|
@@ -250,9 +118,9 @@ export declare const SerializedTransactionDataV2Schema: import("valibot").Object
|
|
|
250
118
|
}>[];
|
|
251
119
|
};
|
|
252
120
|
Upgrade: {
|
|
253
|
-
package: string;
|
|
254
121
|
modules: string[];
|
|
255
122
|
dependencies: string[];
|
|
123
|
+
package: string;
|
|
256
124
|
ticket: EnumInputShape<{
|
|
257
125
|
GasCoin: true;
|
|
258
126
|
Input: number;
|
|
@@ -279,7 +147,7 @@ export declare const SerializedTransactionDataV2Schema: import("valibot").Object
|
|
|
279
147
|
[x: string]: unknown;
|
|
280
148
|
};
|
|
281
149
|
};
|
|
282
|
-
}
|
|
283
|
-
readonly digest: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").StringSchema<undefined>,
|
|
150
|
+
}>>, undefined>;
|
|
151
|
+
readonly digest: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>, undefined>;
|
|
284
152
|
}, undefined>;
|
|
285
153
|
export type SerializedTransactionDataV2 = InferOutput<typeof SerializedTransactionDataV2Schema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SuiMoveNormalizedType } from '../client/index.js';
|
|
2
|
-
import type { Argument, CallArg } from './data/internal.js';
|
|
2
|
+
import type { Argument, CallArg, Command } from './data/internal.js';
|
|
3
3
|
export declare function extractMutableReference(normalizedType: SuiMoveNormalizedType): SuiMoveNormalizedType | undefined;
|
|
4
4
|
export declare function extractReference(normalizedType: SuiMoveNormalizedType): SuiMoveNormalizedType | undefined;
|
|
5
5
|
export declare function extractStructTag(normalizedType: SuiMoveNormalizedType): Extract<SuiMoveNormalizedType, {
|
|
@@ -7,3 +7,4 @@ export declare function extractStructTag(normalizedType: SuiMoveNormalizedType):
|
|
|
7
7
|
}> | undefined;
|
|
8
8
|
export declare function getIdFromCallArg(arg: string | CallArg): string | undefined;
|
|
9
9
|
export declare function isArgument(value: unknown): value is Argument;
|
|
10
|
+
export declare function remapCommandArguments(command: Command, inputMapping: Map<number, number>, commandMapping: Map<number, number>): void;
|
|
@@ -22,7 +22,8 @@ __export(utils_exports, {
|
|
|
22
22
|
extractReference: () => extractReference,
|
|
23
23
|
extractStructTag: () => extractStructTag,
|
|
24
24
|
getIdFromCallArg: () => getIdFromCallArg,
|
|
25
|
-
isArgument: () => isArgument
|
|
25
|
+
isArgument: () => isArgument,
|
|
26
|
+
remapCommandArguments: () => remapCommandArguments
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(utils_exports);
|
|
28
29
|
var import_valibot = require("valibot");
|
|
@@ -69,4 +70,66 @@ function getIdFromCallArg(arg) {
|
|
|
69
70
|
function isArgument(value) {
|
|
70
71
|
return (0, import_valibot.is)(import_internal.ArgumentSchema, value);
|
|
71
72
|
}
|
|
73
|
+
function remapCommandArguments(command, inputMapping, commandMapping) {
|
|
74
|
+
const remapArg = (arg) => {
|
|
75
|
+
switch (arg.$kind) {
|
|
76
|
+
case "Input": {
|
|
77
|
+
const newInputIndex = inputMapping.get(arg.Input);
|
|
78
|
+
if (newInputIndex === void 0) {
|
|
79
|
+
throw new Error(`Input ${arg.Input} not found in input mapping`);
|
|
80
|
+
}
|
|
81
|
+
return { ...arg, Input: newInputIndex };
|
|
82
|
+
}
|
|
83
|
+
case "Result": {
|
|
84
|
+
const newCommandIndex = commandMapping.get(arg.Result);
|
|
85
|
+
if (newCommandIndex !== void 0) {
|
|
86
|
+
return { ...arg, Result: newCommandIndex };
|
|
87
|
+
}
|
|
88
|
+
return arg;
|
|
89
|
+
}
|
|
90
|
+
case "NestedResult": {
|
|
91
|
+
const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
|
|
92
|
+
if (newCommandIndex !== void 0) {
|
|
93
|
+
return { ...arg, NestedResult: [newCommandIndex, arg.NestedResult[1]] };
|
|
94
|
+
}
|
|
95
|
+
return arg;
|
|
96
|
+
}
|
|
97
|
+
default:
|
|
98
|
+
return arg;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
switch (command.$kind) {
|
|
102
|
+
case "MoveCall":
|
|
103
|
+
command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
|
|
104
|
+
break;
|
|
105
|
+
case "TransferObjects":
|
|
106
|
+
command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
|
|
107
|
+
command.TransferObjects.address = remapArg(command.TransferObjects.address);
|
|
108
|
+
break;
|
|
109
|
+
case "SplitCoins":
|
|
110
|
+
command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
|
|
111
|
+
command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
|
|
112
|
+
break;
|
|
113
|
+
case "MergeCoins":
|
|
114
|
+
command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
|
|
115
|
+
command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
|
|
116
|
+
break;
|
|
117
|
+
case "MakeMoveVec":
|
|
118
|
+
command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
|
|
119
|
+
break;
|
|
120
|
+
case "Upgrade":
|
|
121
|
+
command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
|
|
122
|
+
break;
|
|
123
|
+
case "$Intent": {
|
|
124
|
+
const inputs = command.$Intent.inputs;
|
|
125
|
+
command.$Intent.inputs = {};
|
|
126
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
127
|
+
command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case "Publish":
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
72
135
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/transactions/utils.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { is } from 'valibot';\n\nimport type { SuiMoveNormalizedType } from '../client/index.js';\nimport { normalizeSuiAddress } from '../utils/sui-types.js';\nimport { ArgumentSchema } from './data/internal.js';\nimport type { Argument, CallArg } from './data/internal.js';\n\nexport function extractMutableReference(\n\tnormalizedType: SuiMoveNormalizedType,\n): SuiMoveNormalizedType | undefined {\n\treturn typeof normalizedType === 'object' && 'MutableReference' in normalizedType\n\t\t? normalizedType.MutableReference\n\t\t: undefined;\n}\n\nexport function extractReference(\n\tnormalizedType: SuiMoveNormalizedType,\n): SuiMoveNormalizedType | undefined {\n\treturn typeof normalizedType === 'object' && 'Reference' in normalizedType\n\t\t? normalizedType.Reference\n\t\t: undefined;\n}\n\nexport function extractStructTag(\n\tnormalizedType: SuiMoveNormalizedType,\n): Extract<SuiMoveNormalizedType, { Struct: unknown }> | undefined {\n\tif (typeof normalizedType === 'object' && 'Struct' in normalizedType) {\n\t\treturn normalizedType;\n\t}\n\n\tconst ref = extractReference(normalizedType);\n\tconst mutRef = extractMutableReference(normalizedType);\n\n\tif (typeof ref === 'object' && 'Struct' in ref) {\n\t\treturn ref;\n\t}\n\n\tif (typeof mutRef === 'object' && 'Struct' in mutRef) {\n\t\treturn mutRef;\n\t}\n\treturn undefined;\n}\n\nexport function getIdFromCallArg(arg: string | CallArg) {\n\tif (typeof arg === 'string') {\n\t\treturn normalizeSuiAddress(arg);\n\t}\n\n\tif (arg.Object) {\n\t\tif (arg.Object.ImmOrOwnedObject) {\n\t\t\treturn normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);\n\t\t}\n\n\t\tif (arg.Object.Receiving) {\n\t\t\treturn normalizeSuiAddress(arg.Object.Receiving.objectId);\n\t\t}\n\n\t\treturn normalizeSuiAddress(arg.Object.SharedObject.objectId);\n\t}\n\n\tif (arg.UnresolvedObject) {\n\t\treturn normalizeSuiAddress(arg.UnresolvedObject.objectId);\n\t}\n\n\treturn undefined;\n}\n\nexport function isArgument(value: unknown): value is Argument {\n\treturn is(ArgumentSchema, value);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmB;AAGnB,uBAAoC;AACpC,sBAA+B;AAGxB,SAAS,wBACf,gBACoC;AACpC,SAAO,OAAO,mBAAmB,YAAY,sBAAsB,iBAChE,eAAe,mBACf;AACJ;AAEO,SAAS,iBACf,gBACoC;AACpC,SAAO,OAAO,mBAAmB,YAAY,eAAe,iBACzD,eAAe,YACf;AACJ;AAEO,SAAS,iBACf,gBACkE;AAClE,MAAI,OAAO,mBAAmB,YAAY,YAAY,gBAAgB;AACrE,WAAO;AAAA,EACR;AAEA,QAAM,MAAM,iBAAiB,cAAc;AAC3C,QAAM,SAAS,wBAAwB,cAAc;AAErD,MAAI,OAAO,QAAQ,YAAY,YAAY,KAAK;AAC/C,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,WAAW,YAAY,YAAY,QAAQ;AACrD,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAEO,SAAS,iBAAiB,KAAuB;AACvD,MAAI,OAAO,QAAQ,UAAU;AAC5B,eAAO,sCAAoB,GAAG;AAAA,EAC/B;AAEA,MAAI,IAAI,QAAQ;AACf,QAAI,IAAI,OAAO,kBAAkB;AAChC,iBAAO,sCAAoB,IAAI,OAAO,iBAAiB,QAAQ;AAAA,IAChE;AAEA,QAAI,IAAI,OAAO,WAAW;AACzB,iBAAO,sCAAoB,IAAI,OAAO,UAAU,QAAQ;AAAA,IACzD;AAEA,eAAO,sCAAoB,IAAI,OAAO,aAAa,QAAQ;AAAA,EAC5D;AAEA,MAAI,IAAI,kBAAkB;AACzB,eAAO,sCAAoB,IAAI,iBAAiB,QAAQ;AAAA,EACzD;AAEA,SAAO;AACR;AAEO,SAAS,WAAW,OAAmC;AAC7D,aAAO,mBAAG,gCAAgB,KAAK;AAChC;",
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { is } from 'valibot';\n\nimport type { SuiMoveNormalizedType } from '../client/index.js';\nimport { normalizeSuiAddress } from '../utils/sui-types.js';\nimport { ArgumentSchema } from './data/internal.js';\nimport type { Argument, CallArg, Command } from './data/internal.js';\n\nexport function extractMutableReference(\n\tnormalizedType: SuiMoveNormalizedType,\n): SuiMoveNormalizedType | undefined {\n\treturn typeof normalizedType === 'object' && 'MutableReference' in normalizedType\n\t\t? normalizedType.MutableReference\n\t\t: undefined;\n}\n\nexport function extractReference(\n\tnormalizedType: SuiMoveNormalizedType,\n): SuiMoveNormalizedType | undefined {\n\treturn typeof normalizedType === 'object' && 'Reference' in normalizedType\n\t\t? normalizedType.Reference\n\t\t: undefined;\n}\n\nexport function extractStructTag(\n\tnormalizedType: SuiMoveNormalizedType,\n): Extract<SuiMoveNormalizedType, { Struct: unknown }> | undefined {\n\tif (typeof normalizedType === 'object' && 'Struct' in normalizedType) {\n\t\treturn normalizedType;\n\t}\n\n\tconst ref = extractReference(normalizedType);\n\tconst mutRef = extractMutableReference(normalizedType);\n\n\tif (typeof ref === 'object' && 'Struct' in ref) {\n\t\treturn ref;\n\t}\n\n\tif (typeof mutRef === 'object' && 'Struct' in mutRef) {\n\t\treturn mutRef;\n\t}\n\treturn undefined;\n}\n\nexport function getIdFromCallArg(arg: string | CallArg) {\n\tif (typeof arg === 'string') {\n\t\treturn normalizeSuiAddress(arg);\n\t}\n\n\tif (arg.Object) {\n\t\tif (arg.Object.ImmOrOwnedObject) {\n\t\t\treturn normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);\n\t\t}\n\n\t\tif (arg.Object.Receiving) {\n\t\t\treturn normalizeSuiAddress(arg.Object.Receiving.objectId);\n\t\t}\n\n\t\treturn normalizeSuiAddress(arg.Object.SharedObject.objectId);\n\t}\n\n\tif (arg.UnresolvedObject) {\n\t\treturn normalizeSuiAddress(arg.UnresolvedObject.objectId);\n\t}\n\n\treturn undefined;\n}\n\nexport function isArgument(value: unknown): value is Argument {\n\treturn is(ArgumentSchema, value);\n}\n\nexport function remapCommandArguments(\n\tcommand: Command,\n\tinputMapping: Map<number, number>,\n\tcommandMapping: Map<number, number>,\n) {\n\tconst remapArg = (arg: Argument): Argument => {\n\t\tswitch (arg.$kind) {\n\t\t\tcase 'Input': {\n\t\t\t\tconst newInputIndex = inputMapping.get(arg.Input);\n\t\t\t\tif (newInputIndex === undefined) {\n\t\t\t\t\tthrow new Error(`Input ${arg.Input} not found in input mapping`);\n\t\t\t\t}\n\t\t\t\treturn { ...arg, Input: newInputIndex };\n\t\t\t}\n\t\t\tcase 'Result': {\n\t\t\t\tconst newCommandIndex = commandMapping.get(arg.Result);\n\t\t\t\tif (newCommandIndex !== undefined) {\n\t\t\t\t\treturn { ...arg, Result: newCommandIndex };\n\t\t\t\t}\n\t\t\t\treturn arg;\n\t\t\t}\n\t\t\tcase 'NestedResult': {\n\t\t\t\tconst newCommandIndex = commandMapping.get(arg.NestedResult[0]);\n\t\t\t\tif (newCommandIndex !== undefined) {\n\t\t\t\t\treturn { ...arg, NestedResult: [newCommandIndex, arg.NestedResult[1]] };\n\t\t\t\t}\n\t\t\t\treturn arg;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn arg;\n\t\t}\n\t};\n\n\tswitch (command.$kind) {\n\t\tcase 'MoveCall':\n\t\t\tcommand.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);\n\t\t\tbreak;\n\t\tcase 'TransferObjects':\n\t\t\tcommand.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);\n\t\t\tcommand.TransferObjects.address = remapArg(command.TransferObjects.address);\n\t\t\tbreak;\n\t\tcase 'SplitCoins':\n\t\t\tcommand.SplitCoins.coin = remapArg(command.SplitCoins.coin);\n\t\t\tcommand.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);\n\t\t\tbreak;\n\t\tcase 'MergeCoins':\n\t\t\tcommand.MergeCoins.destination = remapArg(command.MergeCoins.destination);\n\t\t\tcommand.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);\n\t\t\tbreak;\n\t\tcase 'MakeMoveVec':\n\t\t\tcommand.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);\n\t\t\tbreak;\n\t\tcase 'Upgrade':\n\t\t\tcommand.Upgrade.ticket = remapArg(command.Upgrade.ticket);\n\t\t\tbreak;\n\t\tcase '$Intent': {\n\t\t\tconst inputs = command.$Intent.inputs;\n\t\t\tcommand.$Intent.inputs = {};\n\n\t\t\tfor (const [key, value] of Object.entries(inputs)) {\n\t\t\t\tcommand.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'Publish':\n\t\t\tbreak;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmB;AAGnB,uBAAoC;AACpC,sBAA+B;AAGxB,SAAS,wBACf,gBACoC;AACpC,SAAO,OA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,QAAQ,SAAS,CAAC;AAE1B,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,gBAAQ,QAAQ,OAAO,GAAG,IAAI,MAAM,QAAQ,KAAK,IAAI,MAAM,IAAI,QAAQ,IAAI,SAAS,KAAK;AAAA,MAC1F;AACA;AAAA,IACD;AAAA,IACA,KAAK;AACJ;AAAA,EACF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "1.
|
|
2
|
-
export declare const TARGETED_RPC_VERSION = "1.
|
|
1
|
+
export declare const PACKAGE_VERSION = "1.45.1";
|
|
2
|
+
export declare const TARGETED_RPC_VERSION = "1.62.0";
|
package/dist/cjs/version.js
CHANGED
|
@@ -22,6 +22,6 @@ __export(version_exports, {
|
|
|
22
22
|
TARGETED_RPC_VERSION: () => TARGETED_RPC_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const PACKAGE_VERSION = "1.
|
|
26
|
-
const TARGETED_RPC_VERSION = "1.
|
|
25
|
+
const PACKAGE_VERSION = "1.45.1";
|
|
26
|
+
const TARGETED_RPC_VERSION = "1.62.0";
|
|
27
27
|
//# sourceMappingURL=version.js.map
|
package/dist/cjs/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/version.ts"],
|
|
4
|
-
"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 = '1.
|
|
4
|
+
"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 = '1.45.1';\nexport const TARGETED_RPC_VERSION = '1.62.0';\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,8 +29,8 @@ export declare const Arguments: {
|
|
|
29
29
|
type?: "object";
|
|
30
30
|
};
|
|
31
31
|
objectRef: (args_0: {
|
|
32
|
-
version: string | number;
|
|
33
32
|
objectId: string;
|
|
33
|
+
version: string | number;
|
|
34
34
|
digest: string;
|
|
35
35
|
}) => (tx: Transaction) => {
|
|
36
36
|
$kind: "Input";
|
|
@@ -38,8 +38,8 @@ export declare const Arguments: {
|
|
|
38
38
|
type?: "object";
|
|
39
39
|
};
|
|
40
40
|
receivingRef: (args_0: {
|
|
41
|
-
version: string | number;
|
|
42
41
|
objectId: string;
|
|
42
|
+
version: string | number;
|
|
43
43
|
digest: string;
|
|
44
44
|
}) => (tx: Transaction) => {
|
|
45
45
|
$kind: "Input";
|