@mysten/sui 2.16.2 → 2.16.3
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/bcs/bcs.d.mts +6 -6
- package/dist/bcs/index.d.mts +20 -20
- package/dist/client/core-resolver.mjs +21 -12
- package/dist/client/core-resolver.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/grpc/proto/sui/rpc/v2/ledger_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/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/transactions/Transaction.d.mts +10 -10
- package/dist/transactions/data/internal.d.mts +109 -109
- package/dist/transactions/data/internal.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/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/bcs.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/client/core-resolver.ts +48 -13
- package/src/version.ts +1 -1
package/dist/zklogin/bcs.d.mts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _mysten_bcs810 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_bcs810.BcsStruct<{
|
|
6
|
+
inputs: _mysten_bcs810.BcsStruct<{
|
|
7
|
+
proofPoints: _mysten_bcs810.BcsStruct<{
|
|
8
|
+
a: _mysten_bcs810.BcsType<string[], Iterable<string> & {
|
|
9
9
|
length: number;
|
|
10
10
|
}, string>;
|
|
11
|
-
b:
|
|
11
|
+
b: _mysten_bcs810.BcsType<string[][], Iterable<Iterable<string> & {
|
|
12
12
|
length: number;
|
|
13
13
|
}> & {
|
|
14
14
|
length: number;
|
|
15
15
|
}, string>;
|
|
16
|
-
c:
|
|
16
|
+
c: _mysten_bcs810.BcsType<string[], Iterable<string> & {
|
|
17
17
|
length: number;
|
|
18
18
|
}, string>;
|
|
19
19
|
}, string>;
|
|
20
|
-
issBase64Details:
|
|
21
|
-
value:
|
|
22
|
-
indexMod4:
|
|
20
|
+
issBase64Details: _mysten_bcs810.BcsStruct<{
|
|
21
|
+
value: _mysten_bcs810.BcsType<string, string, "string">;
|
|
22
|
+
indexMod4: _mysten_bcs810.BcsType<number, number, "u8">;
|
|
23
23
|
}, string>;
|
|
24
|
-
headerBase64:
|
|
25
|
-
addressSeed:
|
|
24
|
+
headerBase64: _mysten_bcs810.BcsType<string, string, "string">;
|
|
25
|
+
addressSeed: _mysten_bcs810.BcsType<string, string, "string">;
|
|
26
26
|
}, string>;
|
|
27
|
-
maxEpoch:
|
|
28
|
-
userSignature:
|
|
27
|
+
maxEpoch: _mysten_bcs810.BcsType<string, string | number | bigint, "u64">;
|
|
28
|
+
userSignature: _mysten_bcs810.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
29
29
|
}, string>;
|
|
30
30
|
type ZkLoginSignature = InferBcsInput<typeof zkLoginSignature>;
|
|
31
31
|
type ZkLoginSignatureInputs = ZkLoginSignature['inputs'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/zklogin/bcs.ts"],"mappings":";;;;cAMa,gBAAA,
|
|
1
|
+
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/zklogin/bcs.ts"],"mappings":";;;;cAMa,gBAAA,iBAAgB,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAkBjB,gBAAA,GAAmB,aAAA,QAAqB,gBAAA;AAAA,KACxC,sBAAA,GAAyB,gBAAA"}
|
package/package.json
CHANGED
|
@@ -84,7 +84,18 @@ export async function coreClientResolveTransactionPlugin(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
// `setGasBudget` simulates with `payment: []` whenever it has to compute a
|
|
88
|
+
// budget (i.e. one wasn't preset). The validator's replay-protection check
|
|
89
|
+
// then requires either a `ValidDuring` expiration or at least one
|
|
90
|
+
// "address-owned" input — an `ImmOrOwnedMoveObject` whose owner is
|
|
91
|
+
// `AddressOwner`, which we can't tell from `Immutable` without owner info we
|
|
92
|
+
// don't track. Provide a simulate-only `ValidDuring` whenever we'll actually
|
|
93
|
+
// simulate and one isn't user-set.
|
|
94
|
+
const needsSimulateExpiration =
|
|
95
|
+
!options.onlyTransactionKind && !transactionData.expiration && !transactionData.gasData.budget;
|
|
96
|
+
const needsSystemState =
|
|
97
|
+
needsGasPrice || (needsPayment && usesGasCoin) || needsSimulateExpiration;
|
|
98
|
+
const needsChainId = (needsPayment && usesGasCoin) || needsSimulateExpiration;
|
|
88
99
|
const [, systemStateResult, balanceResult, coinsResult, chainIdResult] = await Promise.all([
|
|
89
100
|
normalizeInputs(transactionData, client),
|
|
90
101
|
needsSystemState ? client.core.getCurrentSystemState() : null,
|
|
@@ -92,19 +103,25 @@ export async function coreClientResolveTransactionPlugin(
|
|
|
92
103
|
needsPayment && gasPayer
|
|
93
104
|
? client.core.listCoins({ owner: gasPayer, coinType: SUI_TYPE_ARG })
|
|
94
105
|
: null,
|
|
95
|
-
|
|
106
|
+
needsChainId ? client.core.getChainIdentifier() : null,
|
|
96
107
|
]);
|
|
97
108
|
|
|
98
109
|
await resolveObjectReferences(transactionData, client);
|
|
99
110
|
|
|
100
111
|
if (!options.onlyTransactionKind) {
|
|
101
112
|
const systemState = systemStateResult?.systemState ?? null;
|
|
113
|
+
const chainIdentifier = chainIdResult?.chainIdentifier ?? null;
|
|
102
114
|
|
|
103
115
|
if (systemState && !transactionData.gasData.price) {
|
|
104
116
|
transactionData.gasData.price = systemState.referenceGasPrice;
|
|
105
117
|
}
|
|
106
118
|
|
|
107
|
-
|
|
119
|
+
const simulateExpiration =
|
|
120
|
+
needsSimulateExpiration && systemState && chainIdentifier
|
|
121
|
+
? buildValidDuringExpiration(systemState, chainIdentifier)
|
|
122
|
+
: undefined;
|
|
123
|
+
|
|
124
|
+
await setGasBudget(transactionData, client, simulateExpiration);
|
|
108
125
|
|
|
109
126
|
if (needsPayment) {
|
|
110
127
|
if (!balanceResult || !coinsResult) {
|
|
@@ -119,25 +136,24 @@ export async function coreClientResolveTransactionPlugin(
|
|
|
119
136
|
usesGasCoin,
|
|
120
137
|
withdrawals,
|
|
121
138
|
gasPayer: gasPayer!,
|
|
122
|
-
chainIdentifier
|
|
139
|
+
chainIdentifier,
|
|
123
140
|
epoch: systemState?.epoch ?? null,
|
|
124
141
|
});
|
|
125
142
|
}
|
|
126
143
|
|
|
127
144
|
if (!transactionData.expiration && transactionData.gasData.payment?.length === 0) {
|
|
128
|
-
await setExpiration(
|
|
129
|
-
transactionData,
|
|
130
|
-
client,
|
|
131
|
-
systemState,
|
|
132
|
-
chainIdResult?.chainIdentifier ?? null,
|
|
133
|
-
);
|
|
145
|
+
await setExpiration(transactionData, client, systemState, chainIdentifier);
|
|
134
146
|
}
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
return await next();
|
|
138
150
|
}
|
|
139
151
|
|
|
140
|
-
async function setGasBudget(
|
|
152
|
+
async function setGasBudget(
|
|
153
|
+
transactionData: TransactionDataBuilder,
|
|
154
|
+
client: ClientWithCoreApi,
|
|
155
|
+
simulateExpiration?: ValidDuringExpiration,
|
|
156
|
+
) {
|
|
141
157
|
if (transactionData.gasData.budget) {
|
|
142
158
|
return;
|
|
143
159
|
}
|
|
@@ -149,6 +165,7 @@ async function setGasBudget(transactionData: TransactionDataBuilder, client: Cli
|
|
|
149
165
|
budget: String(MAX_GAS),
|
|
150
166
|
payment: [],
|
|
151
167
|
},
|
|
168
|
+
...(simulateExpiration && { expiration: simulateExpiration }),
|
|
152
169
|
},
|
|
153
170
|
}),
|
|
154
171
|
include: { effects: true },
|
|
@@ -243,9 +260,27 @@ async function setExpiration(
|
|
|
243
260
|
existingChainIdentifier ?? client.core.getChainIdentifier().then((r) => r.chainIdentifier),
|
|
244
261
|
systemState ?? client.core.getCurrentSystemState().then((r) => r.systemState),
|
|
245
262
|
]);
|
|
246
|
-
|
|
263
|
+
transactionData.expiration = buildValidDuringExpiration(resolvedSystemState, chainIdentifier);
|
|
264
|
+
}
|
|
247
265
|
|
|
248
|
-
|
|
266
|
+
type ValidDuringExpiration = {
|
|
267
|
+
$kind: 'ValidDuring';
|
|
268
|
+
ValidDuring: {
|
|
269
|
+
minEpoch: string;
|
|
270
|
+
maxEpoch: string;
|
|
271
|
+
minTimestamp: null;
|
|
272
|
+
maxTimestamp: null;
|
|
273
|
+
chain: string;
|
|
274
|
+
nonce: number;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
function buildValidDuringExpiration(
|
|
279
|
+
systemState: SystemStateData,
|
|
280
|
+
chainIdentifier: string,
|
|
281
|
+
): ValidDuringExpiration {
|
|
282
|
+
const currentEpoch = BigInt(systemState.epoch);
|
|
283
|
+
return {
|
|
249
284
|
$kind: 'ValidDuring',
|
|
250
285
|
ValidDuring: {
|
|
251
286
|
minEpoch: String(currentEpoch),
|
package/src/version.ts
CHANGED