@mysten/sui 2.5.0 → 2.5.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 +7 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/cryptography/signature.d.mts +14 -14
- 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/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.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/keypairs/ed25519/keypair.d.mts +3 -1
- package/dist/keypairs/ed25519/keypair.d.mts.map +1 -1
- package/dist/keypairs/ed25519/keypair.mjs +5 -1
- package/dist/keypairs/ed25519/keypair.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +6 -6
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/executor/parallel.mjs +1 -1
- package/dist/transactions/executor/parallel.mjs.map +1 -1
- package/dist/version.mjs +2 -2
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/package.json +1 -1
- package/src/keypairs/ed25519/keypair.ts +5 -1
- package/src/transactions/executor/parallel.ts +0 -1
- package/src/version.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/bcs/bcs.d.mts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { TypeTag as TypeTag$1 } from "./types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_bcs830 from "@mysten/bcs";
|
|
3
3
|
import { BcsType } from "@mysten/bcs";
|
|
4
4
|
|
|
5
5
|
//#region src/bcs/bcs.d.ts
|
|
6
6
|
|
|
7
7
|
declare const TypeTag: BcsType<string, string | TypeTag$1, string>;
|
|
8
|
-
declare function IntentMessage<T extends BcsType<any>>(T: T):
|
|
9
|
-
intent:
|
|
10
|
-
scope:
|
|
8
|
+
declare function IntentMessage<T extends BcsType<any>>(T: T): _mysten_bcs830.BcsStruct<{
|
|
9
|
+
intent: _mysten_bcs830.BcsStruct<{
|
|
10
|
+
scope: _mysten_bcs830.BcsEnum<{
|
|
11
11
|
TransactionData: null;
|
|
12
12
|
TransactionEffects: null;
|
|
13
13
|
CheckpointSummary: null;
|
|
14
14
|
PersonalMessage: null;
|
|
15
15
|
}, "IntentScope">;
|
|
16
|
-
version:
|
|
16
|
+
version: _mysten_bcs830.BcsEnum<{
|
|
17
17
|
V0: null;
|
|
18
18
|
}, "IntentVersion">;
|
|
19
|
-
appId:
|
|
19
|
+
appId: _mysten_bcs830.BcsEnum<{
|
|
20
20
|
Sui: null;
|
|
21
21
|
}, "AppId">;
|
|
22
22
|
}, string>;
|
|
@@ -26,6 +26,20 @@ declare function toSerializedSignature({
|
|
|
26
26
|
* Decodes a serialized signature into its constituent components: the signature scheme, the actual signature, and the public key
|
|
27
27
|
*/
|
|
28
28
|
declare function parseSerializedSignature(serializedSignature: string): {
|
|
29
|
+
signatureScheme: "Passkey";
|
|
30
|
+
serializedSignature: string;
|
|
31
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
32
|
+
authenticatorData: Uint8Array<ArrayBufferLike>;
|
|
33
|
+
clientDataJson: string;
|
|
34
|
+
userSignature: Uint8Array<ArrayBuffer>;
|
|
35
|
+
publicKey: Uint8Array<ArrayBuffer>;
|
|
36
|
+
} | {
|
|
37
|
+
serializedSignature: string;
|
|
38
|
+
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
|
|
39
|
+
signature: Uint8Array<ArrayBuffer>;
|
|
40
|
+
publicKey: Uint8Array<ArrayBuffer>;
|
|
41
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
42
|
+
} | {
|
|
29
43
|
serializedSignature: string;
|
|
30
44
|
signatureScheme: "ZkLogin";
|
|
31
45
|
zkLogin: {
|
|
@@ -49,20 +63,6 @@ declare function parseSerializedSignature(serializedSignature: string): {
|
|
|
49
63
|
};
|
|
50
64
|
signature: Uint8Array<ArrayBufferLike>;
|
|
51
65
|
publicKey: Uint8Array<ArrayBuffer>;
|
|
52
|
-
} | {
|
|
53
|
-
signatureScheme: "Passkey";
|
|
54
|
-
serializedSignature: string;
|
|
55
|
-
signature: Uint8Array<ArrayBufferLike>;
|
|
56
|
-
authenticatorData: Uint8Array<ArrayBufferLike>;
|
|
57
|
-
clientDataJson: string;
|
|
58
|
-
userSignature: Uint8Array<ArrayBuffer>;
|
|
59
|
-
publicKey: Uint8Array<ArrayBuffer>;
|
|
60
|
-
} | {
|
|
61
|
-
serializedSignature: string;
|
|
62
|
-
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
|
|
63
|
-
signature: Uint8Array<ArrayBuffer>;
|
|
64
|
-
publicKey: Uint8Array<ArrayBuffer>;
|
|
65
|
-
bytes: Uint8Array<ArrayBuffer>;
|
|
66
66
|
} | {
|
|
67
67
|
serializedSignature: string;
|
|
68
68
|
signatureScheme: "MultiSig";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BatchGetObjectsRequest, BatchGetObjectsResponse, BatchGetTransactionsRequest, BatchGetTransactionsResponse, GetCheckpointRequest, GetCheckpointResponse, GetEpochRequest, GetEpochResponse, GetObjectRequest, GetObjectResponse, GetServiceInfoRequest, GetServiceInfoResponse, GetTransactionRequest, GetTransactionResponse } from "./ledger_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime4 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc4 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts
|
|
@@ -46,9 +46,9 @@ interface ILedgerServiceClient {
|
|
|
46
46
|
declare class LedgerServiceClient implements ILedgerServiceClient, ServiceInfo {
|
|
47
47
|
private readonly _transport;
|
|
48
48
|
typeName: string;
|
|
49
|
-
methods:
|
|
49
|
+
methods: _protobuf_ts_runtime_rpc4.MethodInfo<any, any>[];
|
|
50
50
|
options: {
|
|
51
|
-
[extensionName: string]:
|
|
51
|
+
[extensionName: string]: _protobuf_ts_runtime4.JsonValue;
|
|
52
52
|
};
|
|
53
53
|
constructor(_transport: RpcTransport);
|
|
54
54
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetDatatypeRequest, GetDatatypeResponse, GetFunctionRequest, GetFunctionResponse, GetPackageRequest, GetPackageResponse, ListPackageVersionsRequest, ListPackageVersionsResponse } from "./move_package_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime5 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc5 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts
|
|
@@ -32,9 +32,9 @@ interface IMovePackageServiceClient {
|
|
|
32
32
|
declare class MovePackageServiceClient implements IMovePackageServiceClient, ServiceInfo {
|
|
33
33
|
private readonly _transport;
|
|
34
34
|
typeName: string;
|
|
35
|
-
methods:
|
|
35
|
+
methods: _protobuf_ts_runtime_rpc5.MethodInfo<any, any>[];
|
|
36
36
|
options: {
|
|
37
|
-
[extensionName: string]:
|
|
37
|
+
[extensionName: string]: _protobuf_ts_runtime5.JsonValue;
|
|
38
38
|
};
|
|
39
39
|
constructor(_transport: RpcTransport);
|
|
40
40
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VerifySignatureRequest, VerifySignatureResponse } from "./signature_verification_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime3 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc3 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts
|
|
@@ -22,9 +22,9 @@ interface ISignatureVerificationServiceClient {
|
|
|
22
22
|
declare class SignatureVerificationServiceClient implements ISignatureVerificationServiceClient, ServiceInfo {
|
|
23
23
|
private readonly _transport;
|
|
24
24
|
typeName: string;
|
|
25
|
-
methods:
|
|
25
|
+
methods: _protobuf_ts_runtime_rpc3.MethodInfo<any, any>[];
|
|
26
26
|
options: {
|
|
27
|
-
[extensionName: string]:
|
|
27
|
+
[extensionName: string]: _protobuf_ts_runtime3.JsonValue;
|
|
28
28
|
};
|
|
29
29
|
constructor(_transport: RpcTransport);
|
|
30
30
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetBalanceRequest, GetBalanceResponse, GetCoinInfoRequest, GetCoinInfoResponse, ListBalancesRequest, ListBalancesResponse, ListDynamicFieldsRequest, ListDynamicFieldsResponse, ListOwnedObjectsRequest, ListOwnedObjectsResponse } from "./state_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime1 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc1 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/state_service.client.d.ts
|
|
@@ -36,9 +36,9 @@ interface IStateServiceClient {
|
|
|
36
36
|
declare class StateServiceClient implements IStateServiceClient, ServiceInfo {
|
|
37
37
|
private readonly _transport;
|
|
38
38
|
typeName: string;
|
|
39
|
-
methods:
|
|
39
|
+
methods: _protobuf_ts_runtime_rpc1.MethodInfo<any, any>[];
|
|
40
40
|
options: {
|
|
41
|
-
[extensionName: string]:
|
|
41
|
+
[extensionName: string]: _protobuf_ts_runtime1.JsonValue;
|
|
42
42
|
};
|
|
43
43
|
constructor(_transport: RpcTransport);
|
|
44
44
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SubscribeCheckpointsRequest, SubscribeCheckpointsResponse } from "./subscription_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime2 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc2 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServerStreamingCall, ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts
|
|
@@ -32,9 +32,9 @@ interface ISubscriptionServiceClient {
|
|
|
32
32
|
declare class SubscriptionServiceClient implements ISubscriptionServiceClient, ServiceInfo {
|
|
33
33
|
private readonly _transport;
|
|
34
34
|
typeName: string;
|
|
35
|
-
methods:
|
|
35
|
+
methods: _protobuf_ts_runtime_rpc2.MethodInfo<any, any>[];
|
|
36
36
|
options: {
|
|
37
|
-
[extensionName: string]:
|
|
37
|
+
[extensionName: string]: _protobuf_ts_runtime2.JsonValue;
|
|
38
38
|
};
|
|
39
39
|
constructor(_transport: RpcTransport);
|
|
40
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.mts","names":[],"sources":["../../../../../../src/grpc/proto/sui/rpc/v2/transaction.ts"],"sourcesCont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;;cAgBxC,uBAAqB;cAE5B,8BAAA,SAAuC,YAAY;;;;;;cAgD5C,2BAAyB;cAEhC,6BAAA,SAAsC,YAAY;;;;;;cAyB3C,0BAAwB;cAE/B,8BAAA,SAAuC,YAAY;;;;;;cAiB5C,2BAAyB;cAEhC,6BAAA,SAAsC,YAAY;;;;;;cA2B3C,0BAAwB;cAE/B,sCAAA,SAA+C,YAAY;;;;;;cAWpD,mCAAiC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecuteTransactionRequest, ExecuteTransactionResponse, SimulateTransactionRequest, SimulateTransactionResponse } from "./transaction_execution_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime0 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc0 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts
|
|
@@ -24,9 +24,9 @@ interface ITransactionExecutionServiceClient {
|
|
|
24
24
|
declare class TransactionExecutionServiceClient implements ITransactionExecutionServiceClient, ServiceInfo {
|
|
25
25
|
private readonly _transport;
|
|
26
26
|
typeName: string;
|
|
27
|
-
methods:
|
|
27
|
+
methods: _protobuf_ts_runtime_rpc0.MethodInfo<any, any>[];
|
|
28
28
|
options: {
|
|
29
|
-
[extensionName: string]:
|
|
29
|
+
[extensionName: string]: _protobuf_ts_runtime0.JsonValue;
|
|
30
30
|
};
|
|
31
31
|
constructor(_transport: RpcTransport);
|
|
32
32
|
/**
|
|
@@ -71,8 +71,10 @@ declare class Ed25519Keypair extends Keypair {
|
|
|
71
71
|
*
|
|
72
72
|
* If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
|
|
73
73
|
* be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
|
|
74
|
+
*
|
|
75
|
+
* @param seed - The seed as a hex string or Uint8Array.
|
|
74
76
|
*/
|
|
75
|
-
static deriveKeypairFromSeed(
|
|
77
|
+
static deriveKeypairFromSeed(seed: string | Uint8Array, path?: string): Ed25519Keypair;
|
|
76
78
|
}
|
|
77
79
|
//#endregion
|
|
78
80
|
export { DEFAULT_ED25519_DERIVATION_PATH, Ed25519Keypair, Ed25519KeypairData };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.d.mts","names":[],"sources":["../../../src/keypairs/ed25519/keypair.ts"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"keypair.d.mts","names":[],"sources":["../../../src/keypairs/ed25519/keypair.ts"],"sourcesContent":[],"mappings":";;;;;cAiBa,+BAAA;;AAAb;AAOA;AAQA;;AA4BiB,UApCA,kBAAA,CAoCA;EAOG,SAAA,EA1CR,UA0CQ;EAmBP,SAAA,EA5DD,UA4DC;;;;;AAuDe,cA7Gf,cAAA,SAAuB,OAAA,CA6GR;EAAA,QAAA,OAAA;EAW6B;;;;;;wBA/GlC;;;;kBAmBN;;;;qBAOG;;;;;;;;;;;kCAmBP;;MAET;;;;kBAoCa;;;;;;;;aAiBC,aAAU,QAAA,WAAA;;;;;;;;0DAW6B;;;;;;;;;8CAoBZ,4BAA4B"}
|
|
@@ -2,6 +2,7 @@ import { isValidHardenedPath, mnemonicToSeedHex } from "../../cryptography/mnemo
|
|
|
2
2
|
import { Keypair, PRIVATE_KEY_SIZE, decodeSuiPrivateKey, encodeSuiPrivateKey } from "../../cryptography/keypair.mjs";
|
|
3
3
|
import { derivePath } from "./ed25519-hd-key.mjs";
|
|
4
4
|
import { Ed25519PublicKey } from "./publickey.mjs";
|
|
5
|
+
import { toHex } from "@mysten/bcs";
|
|
5
6
|
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
6
7
|
|
|
7
8
|
//#region src/keypairs/ed25519/keypair.ts
|
|
@@ -111,10 +112,13 @@ var Ed25519Keypair = class Ed25519Keypair extends Keypair {
|
|
|
111
112
|
*
|
|
112
113
|
* If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
|
|
113
114
|
* be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
|
|
115
|
+
*
|
|
116
|
+
* @param seed - The seed as a hex string or Uint8Array.
|
|
114
117
|
*/
|
|
115
|
-
static deriveKeypairFromSeed(
|
|
118
|
+
static deriveKeypairFromSeed(seed, path) {
|
|
116
119
|
if (path == null) path = DEFAULT_ED25519_DERIVATION_PATH;
|
|
117
120
|
if (!isValidHardenedPath(path)) throw new Error("Invalid derivation path");
|
|
121
|
+
const seedHex = typeof seed === "string" ? seed : toHex(seed);
|
|
118
122
|
const { key } = derivePath(path, seedHex);
|
|
119
123
|
return Ed25519Keypair.fromSecretKey(key);
|
|
120
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.mjs","names":[],"sources":["../../../src/keypairs/ed25519/keypair.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from '@noble/curves/ed25519.js';\n\nimport {\n\tdecodeSuiPrivateKey,\n\tencodeSuiPrivateKey,\n\tKeypair,\n\tPRIVATE_KEY_SIZE,\n} from '../../cryptography/keypair.js';\nimport { isValidHardenedPath, mnemonicToSeedHex } from '../../cryptography/mnemonics.js';\nimport type { SignatureScheme } from '../../cryptography/signature-scheme.js';\nimport { derivePath } from './ed25519-hd-key.js';\nimport { Ed25519PublicKey } from './publickey.js';\n\nexport const DEFAULT_ED25519_DERIVATION_PATH = \"m/44'/784'/0'/0'/0'\";\n\n/**\n * Ed25519 Keypair data. The publickey is the 32-byte public key and\n * the secretkey is 64-byte, where the first 32 bytes is the secret\n * key and the last 32 bytes is the public key.\n */\nexport interface Ed25519KeypairData {\n\tpublicKey: Uint8Array;\n\tsecretKey: Uint8Array;\n}\n\n/**\n * An Ed25519 Keypair used for signing transactions.\n */\nexport class Ed25519Keypair extends Keypair {\n\tprivate keypair: Ed25519KeypairData;\n\n\t/**\n\t * Create a new Ed25519 keypair instance.\n\t * Generate random keypair if no {@link Ed25519Keypair} is provided.\n\t *\n\t * @param keypair Ed25519 keypair\n\t */\n\tconstructor(keypair?: Ed25519KeypairData) {\n\t\tsuper();\n\t\tif (keypair) {\n\t\t\tthis.keypair = {\n\t\t\t\tpublicKey: keypair.publicKey,\n\t\t\t\tsecretKey: keypair.secretKey.slice(0, 32),\n\t\t\t};\n\t\t} else {\n\t\t\tconst privateKey = ed25519.utils.randomSecretKey();\n\t\t\tthis.keypair = {\n\t\t\t\tpublicKey: ed25519.getPublicKey(privateKey),\n\t\t\t\tsecretKey: privateKey,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Get the key scheme of the keypair ED25519\n\t */\n\tgetKeyScheme(): SignatureScheme {\n\t\treturn 'ED25519';\n\t}\n\n\t/**\n\t * Generate a new random Ed25519 keypair\n\t */\n\tstatic generate(): Ed25519Keypair {\n\t\tconst secretKey = ed25519.utils.randomSecretKey();\n\t\treturn new Ed25519Keypair({\n\t\t\tpublicKey: ed25519.getPublicKey(secretKey),\n\t\t\tsecretKey,\n\t\t});\n\t}\n\n\t/**\n\t * Create a Ed25519 keypair from a raw secret key byte array, also known as seed.\n\t * This is NOT the private scalar which is result of hashing and bit clamping of\n\t * the raw secret key.\n\t *\n\t * @throws error if the provided secret key is invalid and validation is not skipped.\n\t *\n\t * @param secretKey secret key as a byte array or Bech32 secret key string\n\t * @param options: skip secret key validation\n\t */\n\tstatic fromSecretKey(\n\t\tsecretKey: Uint8Array | string,\n\t\toptions?: { skipValidation?: boolean },\n\t): Ed25519Keypair {\n\t\tif (typeof secretKey === 'string') {\n\t\t\tconst decoded = decodeSuiPrivateKey(secretKey);\n\n\t\t\tif (decoded.scheme !== 'ED25519') {\n\t\t\t\tthrow new Error(`Expected a ED25519 keypair, got ${decoded.scheme}`);\n\t\t\t}\n\n\t\t\treturn this.fromSecretKey(decoded.secretKey, options);\n\t\t}\n\n\t\tconst secretKeyLength = secretKey.length;\n\t\tif (secretKeyLength !== PRIVATE_KEY_SIZE) {\n\t\t\tthrow new Error(\n\t\t\t\t`Wrong secretKey size. Expected ${PRIVATE_KEY_SIZE} bytes, got ${secretKeyLength}.`,\n\t\t\t);\n\t\t}\n\t\tconst keypair = {\n\t\t\tpublicKey: ed25519.getPublicKey(secretKey),\n\t\t\tsecretKey,\n\t\t};\n\n\t\tif (!options || !options.skipValidation) {\n\t\t\tconst encoder = new TextEncoder();\n\t\t\tconst signData = encoder.encode('sui validation');\n\t\t\tconst signature = ed25519.sign(signData, secretKey);\n\t\t\tif (!ed25519.verify(signature, signData, keypair.publicKey)) {\n\t\t\t\tthrow new Error('provided secretKey is invalid');\n\t\t\t}\n\t\t}\n\t\treturn new Ed25519Keypair(keypair);\n\t}\n\n\t/**\n\t * The public key for this Ed25519 keypair\n\t */\n\tgetPublicKey(): Ed25519PublicKey {\n\t\treturn new Ed25519PublicKey(this.keypair.publicKey);\n\t}\n\n\t/**\n\t * The Bech32 secret key string for this Ed25519 keypair\n\t */\n\tgetSecretKey(): string {\n\t\treturn encodeSuiPrivateKey(\n\t\t\tthis.keypair.secretKey.slice(0, PRIVATE_KEY_SIZE),\n\t\t\tthis.getKeyScheme(),\n\t\t);\n\t}\n\n\t/**\n\t * Return the signature for the provided data using Ed25519.\n\t */\n\tasync sign(data: Uint8Array) {\n\t\treturn ed25519.sign(data, this.keypair.secretKey) as Uint8Array<ArrayBuffer>;\n\t}\n\n\t/**\n\t * Derive Ed25519 keypair from mnemonics and path. The mnemonics must be normalized\n\t * and validated against the english wordlist.\n\t *\n\t * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must\n\t * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.\n\t */\n\tstatic deriveKeypair(mnemonics: string, path?: string): Ed25519Keypair {\n\t\tif (path == null) {\n\t\t\tpath = DEFAULT_ED25519_DERIVATION_PATH;\n\t\t}\n\t\tif (!isValidHardenedPath(path)) {\n\t\t\tthrow new Error('Invalid derivation path');\n\t\t}\n\t\tconst { key } = derivePath(path, mnemonicToSeedHex(mnemonics));\n\n\t\treturn Ed25519Keypair.fromSecretKey(key);\n\t}\n\n\t/**\n\t * Derive Ed25519 keypair from mnemonicSeed and path.\n\t *\n\t * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must\n\t * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.\n\t */\n\tstatic deriveKeypairFromSeed(
|
|
1
|
+
{"version":3,"file":"keypair.mjs","names":[],"sources":["../../../src/keypairs/ed25519/keypair.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toHex } from '@mysten/bcs';\nimport { ed25519 } from '@noble/curves/ed25519.js';\n\nimport {\n\tdecodeSuiPrivateKey,\n\tencodeSuiPrivateKey,\n\tKeypair,\n\tPRIVATE_KEY_SIZE,\n} from '../../cryptography/keypair.js';\nimport { isValidHardenedPath, mnemonicToSeedHex } from '../../cryptography/mnemonics.js';\nimport type { SignatureScheme } from '../../cryptography/signature-scheme.js';\nimport { derivePath } from './ed25519-hd-key.js';\nimport { Ed25519PublicKey } from './publickey.js';\n\nexport const DEFAULT_ED25519_DERIVATION_PATH = \"m/44'/784'/0'/0'/0'\";\n\n/**\n * Ed25519 Keypair data. The publickey is the 32-byte public key and\n * the secretkey is 64-byte, where the first 32 bytes is the secret\n * key and the last 32 bytes is the public key.\n */\nexport interface Ed25519KeypairData {\n\tpublicKey: Uint8Array;\n\tsecretKey: Uint8Array;\n}\n\n/**\n * An Ed25519 Keypair used for signing transactions.\n */\nexport class Ed25519Keypair extends Keypair {\n\tprivate keypair: Ed25519KeypairData;\n\n\t/**\n\t * Create a new Ed25519 keypair instance.\n\t * Generate random keypair if no {@link Ed25519Keypair} is provided.\n\t *\n\t * @param keypair Ed25519 keypair\n\t */\n\tconstructor(keypair?: Ed25519KeypairData) {\n\t\tsuper();\n\t\tif (keypair) {\n\t\t\tthis.keypair = {\n\t\t\t\tpublicKey: keypair.publicKey,\n\t\t\t\tsecretKey: keypair.secretKey.slice(0, 32),\n\t\t\t};\n\t\t} else {\n\t\t\tconst privateKey = ed25519.utils.randomSecretKey();\n\t\t\tthis.keypair = {\n\t\t\t\tpublicKey: ed25519.getPublicKey(privateKey),\n\t\t\t\tsecretKey: privateKey,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Get the key scheme of the keypair ED25519\n\t */\n\tgetKeyScheme(): SignatureScheme {\n\t\treturn 'ED25519';\n\t}\n\n\t/**\n\t * Generate a new random Ed25519 keypair\n\t */\n\tstatic generate(): Ed25519Keypair {\n\t\tconst secretKey = ed25519.utils.randomSecretKey();\n\t\treturn new Ed25519Keypair({\n\t\t\tpublicKey: ed25519.getPublicKey(secretKey),\n\t\t\tsecretKey,\n\t\t});\n\t}\n\n\t/**\n\t * Create a Ed25519 keypair from a raw secret key byte array, also known as seed.\n\t * This is NOT the private scalar which is result of hashing and bit clamping of\n\t * the raw secret key.\n\t *\n\t * @throws error if the provided secret key is invalid and validation is not skipped.\n\t *\n\t * @param secretKey secret key as a byte array or Bech32 secret key string\n\t * @param options: skip secret key validation\n\t */\n\tstatic fromSecretKey(\n\t\tsecretKey: Uint8Array | string,\n\t\toptions?: { skipValidation?: boolean },\n\t): Ed25519Keypair {\n\t\tif (typeof secretKey === 'string') {\n\t\t\tconst decoded = decodeSuiPrivateKey(secretKey);\n\n\t\t\tif (decoded.scheme !== 'ED25519') {\n\t\t\t\tthrow new Error(`Expected a ED25519 keypair, got ${decoded.scheme}`);\n\t\t\t}\n\n\t\t\treturn this.fromSecretKey(decoded.secretKey, options);\n\t\t}\n\n\t\tconst secretKeyLength = secretKey.length;\n\t\tif (secretKeyLength !== PRIVATE_KEY_SIZE) {\n\t\t\tthrow new Error(\n\t\t\t\t`Wrong secretKey size. Expected ${PRIVATE_KEY_SIZE} bytes, got ${secretKeyLength}.`,\n\t\t\t);\n\t\t}\n\t\tconst keypair = {\n\t\t\tpublicKey: ed25519.getPublicKey(secretKey),\n\t\t\tsecretKey,\n\t\t};\n\n\t\tif (!options || !options.skipValidation) {\n\t\t\tconst encoder = new TextEncoder();\n\t\t\tconst signData = encoder.encode('sui validation');\n\t\t\tconst signature = ed25519.sign(signData, secretKey);\n\t\t\tif (!ed25519.verify(signature, signData, keypair.publicKey)) {\n\t\t\t\tthrow new Error('provided secretKey is invalid');\n\t\t\t}\n\t\t}\n\t\treturn new Ed25519Keypair(keypair);\n\t}\n\n\t/**\n\t * The public key for this Ed25519 keypair\n\t */\n\tgetPublicKey(): Ed25519PublicKey {\n\t\treturn new Ed25519PublicKey(this.keypair.publicKey);\n\t}\n\n\t/**\n\t * The Bech32 secret key string for this Ed25519 keypair\n\t */\n\tgetSecretKey(): string {\n\t\treturn encodeSuiPrivateKey(\n\t\t\tthis.keypair.secretKey.slice(0, PRIVATE_KEY_SIZE),\n\t\t\tthis.getKeyScheme(),\n\t\t);\n\t}\n\n\t/**\n\t * Return the signature for the provided data using Ed25519.\n\t */\n\tasync sign(data: Uint8Array) {\n\t\treturn ed25519.sign(data, this.keypair.secretKey) as Uint8Array<ArrayBuffer>;\n\t}\n\n\t/**\n\t * Derive Ed25519 keypair from mnemonics and path. The mnemonics must be normalized\n\t * and validated against the english wordlist.\n\t *\n\t * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must\n\t * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.\n\t */\n\tstatic deriveKeypair(mnemonics: string, path?: string): Ed25519Keypair {\n\t\tif (path == null) {\n\t\t\tpath = DEFAULT_ED25519_DERIVATION_PATH;\n\t\t}\n\t\tif (!isValidHardenedPath(path)) {\n\t\t\tthrow new Error('Invalid derivation path');\n\t\t}\n\t\tconst { key } = derivePath(path, mnemonicToSeedHex(mnemonics));\n\n\t\treturn Ed25519Keypair.fromSecretKey(key);\n\t}\n\n\t/**\n\t * Derive Ed25519 keypair from mnemonicSeed and path.\n\t *\n\t * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must\n\t * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.\n\t *\n\t * @param seed - The seed as a hex string or Uint8Array.\n\t */\n\tstatic deriveKeypairFromSeed(seed: string | Uint8Array, path?: string): Ed25519Keypair {\n\t\tif (path == null) {\n\t\t\tpath = DEFAULT_ED25519_DERIVATION_PATH;\n\t\t}\n\t\tif (!isValidHardenedPath(path)) {\n\t\t\tthrow new Error('Invalid derivation path');\n\t\t}\n\t\tconst seedHex = typeof seed === 'string' ? seed : toHex(seed);\n\t\tconst { key } = derivePath(path, seedHex);\n\n\t\treturn Ed25519Keypair.fromSecretKey(key);\n\t}\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,kCAAkC;;;;AAe/C,IAAa,iBAAb,MAAa,uBAAuB,QAAQ;;;;;;;CAS3C,YAAY,SAA8B;AACzC,SAAO;AACP,MAAI,QACH,MAAK,UAAU;GACd,WAAW,QAAQ;GACnB,WAAW,QAAQ,UAAU,MAAM,GAAG,GAAG;GACzC;OACK;GACN,MAAM,aAAa,QAAQ,MAAM,iBAAiB;AAClD,QAAK,UAAU;IACd,WAAW,QAAQ,aAAa,WAAW;IAC3C,WAAW;IACX;;;;;;CAOH,eAAgC;AAC/B,SAAO;;;;;CAMR,OAAO,WAA2B;EACjC,MAAM,YAAY,QAAQ,MAAM,iBAAiB;AACjD,SAAO,IAAI,eAAe;GACzB,WAAW,QAAQ,aAAa,UAAU;GAC1C;GACA,CAAC;;;;;;;;;;;;CAaH,OAAO,cACN,WACA,SACiB;AACjB,MAAI,OAAO,cAAc,UAAU;GAClC,MAAM,UAAU,oBAAoB,UAAU;AAE9C,OAAI,QAAQ,WAAW,UACtB,OAAM,IAAI,MAAM,mCAAmC,QAAQ,SAAS;AAGrE,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8,7 +8,7 @@ import { createPure } from "./pure.mjs";
|
|
|
8
8
|
import { SignatureWithBytes, Signer } from "../cryptography/keypair.mjs";
|
|
9
9
|
import "../cryptography/index.mjs";
|
|
10
10
|
import { ClientWithCoreApi } from "../client/core.mjs";
|
|
11
|
-
import * as
|
|
11
|
+
import * as _mysten_bcs810 from "@mysten/bcs";
|
|
12
12
|
import { SerializedBcs } from "@mysten/bcs";
|
|
13
13
|
import { InferInput } from "valibot";
|
|
14
14
|
|
|
@@ -77,7 +77,7 @@ declare class Transaction {
|
|
|
77
77
|
getData(): {
|
|
78
78
|
version: 2;
|
|
79
79
|
sender?: string | null | undefined;
|
|
80
|
-
expiration?:
|
|
80
|
+
expiration?: _mysten_bcs810.EnumOutputShapeWithKeys<{
|
|
81
81
|
None: true;
|
|
82
82
|
Epoch: string | number;
|
|
83
83
|
ValidDuring: {
|
|
@@ -99,8 +99,8 @@ declare class Transaction {
|
|
|
99
99
|
digest: string;
|
|
100
100
|
}[] | null;
|
|
101
101
|
};
|
|
102
|
-
inputs:
|
|
103
|
-
Object:
|
|
102
|
+
inputs: _mysten_bcs810.EnumOutputShapeWithKeys<{
|
|
103
|
+
Object: _mysten_bcs810.EnumOutputShapeWithKeys<{
|
|
104
104
|
ImmOrOwnedObject: {
|
|
105
105
|
objectId: string;
|
|
106
106
|
version: string | number;
|
|
@@ -139,13 +139,13 @@ declare class Transaction {
|
|
|
139
139
|
Balance: string;
|
|
140
140
|
$kind: "Balance";
|
|
141
141
|
};
|
|
142
|
-
withdrawFrom:
|
|
142
|
+
withdrawFrom: _mysten_bcs810.EnumOutputShapeWithKeys<{
|
|
143
143
|
Sender: true;
|
|
144
144
|
Sponsor: true;
|
|
145
145
|
}, "Sender" | "Sponsor">;
|
|
146
146
|
};
|
|
147
147
|
}, "Object" | "Pure" | "FundsWithdrawal" | "UnresolvedPure" | "UnresolvedObject">[];
|
|
148
|
-
commands:
|
|
148
|
+
commands: _mysten_bcs810.EnumOutputShapeWithKeys<{
|
|
149
149
|
MoveCall: {
|
|
150
150
|
package: string;
|
|
151
151
|
module: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.d.mts","names":[],"sources":["../../src/transactions/Transaction.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;KAoCY,yBAAA,GACT,QAAQ,kBAAkB;;;WAEtB,gBACC,QAAQ,kBAAkB;EAJtB,KAAA,EAAA,OAAA;EACiB,IAAA,CAAA,EAAA,MAAA;CAAlB,CAAA,CAAA,GAIR,qBAJQ,CAIc,yBAJd,CAAA;AAAR,KAMS,iBAAA,GAAoB,OAN7B,CAMqC,QANrC,EAAA;EAEI,MAAA,EAAA,OAAA;CAC2B,CAAA,GAIjC,OAJiC,CAIzB,QAJyB,EAAA;EAAlB,YAAA,EAAA,OAAA;CAAR,CAAA,EAAA;AACiB,KAKb,yBAAA,GACT,OANsB,CAMd,QANc,EAAA;EAAtB,MAAA,EAAA,OAAA;CAAqB,CAAA,GAAA,SAOZ,OAPY,CAOJ,QAPI,EAAA;EAEZ,YAAA,EAAA,OAAiB;CAAW,CAAA,EAAA;AAAR,KAOpB,qBAPoB,CAAA,UAQrB,yBARqB,GAAA,IAAA,GAQc,yBARd,GAAA,IAAA,CAAA,GAAA,CAAA,EAAA,EASvB,WATuB,EAAA,GASP,OATO,CASC,CATD,GAAA,IAAA,CAAA;cA0E1B,iBAzEG,EAAA,KAAA;UA2EC,WAAA,SAAoB,uBA3E7B,CAAA;EAAO,MAAA,EA4EC,MA5ED;AAER;AACW,iBA4EK,aAAA,CA5EL,GAAA,EAAA,OAAA,CAAA,EAAA,GAAA,IA4EyC,eA5EzC;AAAR,KAgFS,sBAAA,GAhFT,MAAA,GAgF2C,OAhF3C,GAgFqD,yBAhFrD;KAqFE,eAAA,GApFe;EAAR,OAAA,EAAA,EAAA,OAAA;CAAO;AAEnB;;;AAES,cAuFI,WAAA,CAvFJ;EAAwB,CAAA,OAAA;EAAR,CAqNnB,iBAAA,CArNm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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA5mBtD,kBAAkB,WAAW;;;;;;;;;;UA0CjC,kBACA;;;;;;;;;qBA2CW,mBAAmB;;;;;;;;;wBAQhB,mBAAmB;;;;;;;;;2BAQhB,mBAAmB;;;;;;gBAsB9B,kBAAkB,IAAI;uBACf,4BAA4B,sBAAsB,qBAC1D,gBAAgB,IAC1B;gBACW,yDACU,sBAAsB,KAC3C;oCAwGqB,sBAAsB,wDACtC,6CAA6C,UAU8B,QACjF;;qBAGY,UAAU,QAAQ;;;0BAIlB,8CACH,wCAAqC;;;;;;;MAS6C;;;;aAWnF;;;;;;YAMD;MACR;;eAWW;;;;;;iBAOI,sBAAsB;;;;iBAKtB,sBAAsB;;MAElC;4BASO,gDACD,sBAAsB,8BAA2B;;;;;eAe/C;;MAEX;;;;;;;;;;;;;;;;;;;;;;;;mBA8CqB,8BAAmC;;gBAmBrC,cAAc,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2DrB,0BAA+B,QAAQ,WAAW;;;aAW5D;MAER;mCAsJoC,8BAA2B"}
|
|
@@ -140,7 +140,7 @@ var ParallelTransactionExecutor = class {
|
|
|
140
140
|
if (gasCoin && gasUsed && gasObject) {
|
|
141
141
|
const coin = gasCoin;
|
|
142
142
|
if ((gasObject.outputOwner?.AddressOwner ?? gasObject.outputOwner?.ObjectOwner) === this.#signer.toSuiAddress()) {
|
|
143
|
-
const totalUsed = BigInt(gasUsed.computationCost) + BigInt(gasUsed.storageCost)
|
|
143
|
+
const totalUsed = BigInt(gasUsed.computationCost) + BigInt(gasUsed.storageCost) - BigInt(gasUsed.storageRebate);
|
|
144
144
|
const remainingBalance = coin.balance - totalUsed;
|
|
145
145
|
let usesGasCoin = false;
|
|
146
146
|
new TransactionDataBuilder(transaction.getData()).mapArguments((arg) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.mjs","names":["#signer","#client","#gasMode","#coinBatchSize","#initialCoinBalance","#minimumCoinBalance","#sourceCoins","#defaultGasBudget","#maxPoolSize","#cache","#executeQueue","#epochInfo","#updateCache","#waitForLastDigest","#getUsedObjects","#execute","#objectIdQueues","#buildQueue","#getGasPrice","#pendingTransactions","#getValidDuringExpiration","#getGasCoin","#coinPool","#lastDigest","#cacheLock","#refillCoinPool","#ensureEpochInfo","#epochInfoPromise","#fetchEpochInfo"],"sources":["../../../src/transactions/executor/parallel.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { promiseWithResolvers } from '@mysten/utils';\nimport type { SuiObjectRef } from '../../bcs/types.js';\nimport type { ClientWithCoreApi } from '../../client/core.js';\nimport { coreClientResolveTransactionPlugin } from '../../client/core-resolver.js';\nimport type { SuiClientTypes } from '../../client/types.js';\nimport type { Signer } from '../../cryptography/index.js';\nimport type { ObjectCacheOptions } from '../ObjectCache.js';\nimport { Transaction } from '../Transaction.js';\nimport { TransactionDataBuilder } from '../TransactionData.js';\nimport { CachingTransactionExecutor } from './caching.js';\nimport { ParallelQueue, SerialQueue } from './queue.js';\n\nconst PARALLEL_EXECUTOR_DEFAULTS = {\n\tcoinBatchSize: 20,\n\tinitialCoinBalance: 200_000_000n,\n\tminimumCoinBalance: 50_000_000n,\n\tmaxPoolSize: 50,\n} satisfies Partial<ParallelTransactionExecutorCoinOptions>;\n\nconst EPOCH_BOUNDARY_WINDOW = 60_000;\n\ninterface ParallelTransactionExecutorBaseOptions extends Omit<ObjectCacheOptions, 'address'> {\n\tclient: ClientWithCoreApi;\n\tsigner: Signer;\n\t/** The gasBudget to use if the transaction has not defined it's own gasBudget, defaults to `minimumCoinBalance` */\n\tdefaultGasBudget?: bigint;\n\t/** The maximum number of transactions that can be execute in parallel, this also determines the maximum number of gas coins that will be created */\n\tmaxPoolSize?: number;\n}\n\nexport interface ParallelTransactionExecutorCoinOptions extends ParallelTransactionExecutorBaseOptions {\n\t/** Gas mode - use owned coins for gas payments (default) */\n\tgasMode?: 'coins';\n\t/** The number of coins to create in a batch when refilling the gas pool */\n\tcoinBatchSize?: number;\n\t/** The initial balance of each coin created for the gas pool */\n\tinitialCoinBalance?: bigint;\n\t/** The minimum balance of a coin that can be reused for future transactions. If the gasCoin is below this value, it will be used when refilling the gasPool */\n\tminimumCoinBalance?: bigint;\n\t/** An initial list of coins used to fund the gas pool, uses all owned SUI coins by default */\n\tsourceCoins?: string[];\n}\n\nexport interface ParallelTransactionExecutorAddressBalanceOptions extends ParallelTransactionExecutorBaseOptions {\n\t/** Gas mode - use address balance for gas payments instead of owned coins */\n\tgasMode: 'addressBalance';\n}\n\n/** Options for ParallelTransactionExecutor - discriminated union based on gasMode */\nexport type ParallelTransactionExecutorOptions =\n\t| ParallelTransactionExecutorCoinOptions\n\t| ParallelTransactionExecutorAddressBalanceOptions;\n\ninterface CoinWithBalance {\n\tid: string;\n\tversion: string;\n\tdigest: string;\n\tbalance: bigint;\n}\nexport class ParallelTransactionExecutor {\n\t#signer: Signer;\n\t#client: ClientWithCoreApi;\n\t#gasMode: 'coins' | 'addressBalance';\n\t#coinBatchSize: number;\n\t#initialCoinBalance: bigint;\n\t#minimumCoinBalance: bigint;\n\t#defaultGasBudget: bigint;\n\t#maxPoolSize: number;\n\t#sourceCoins: Map<string, SuiObjectRef | null> | null;\n\t#coinPool: CoinWithBalance[] = [];\n\t#cache: CachingTransactionExecutor;\n\t#objectIdQueues = new Map<string, (() => void)[]>();\n\t#buildQueue = new SerialQueue();\n\t#executeQueue: ParallelQueue;\n\t#lastDigest: string | null = null;\n\t#cacheLock: Promise<void> | null = null;\n\t#pendingTransactions = 0;\n\t#epochInfo: null | {\n\t\tepoch: string;\n\t\tprice: bigint;\n\t\texpiration: number;\n\t\tchainIdentifier: string;\n\t} = null;\n\t#epochInfoPromise: Promise<void> | null = null;\n\n\tconstructor(options: ParallelTransactionExecutorOptions) {\n\t\tthis.#signer = options.signer;\n\t\tthis.#client = options.client;\n\t\tthis.#gasMode = options.gasMode ?? 'coins';\n\n\t\tif (this.#gasMode === 'coins') {\n\t\t\tconst coinOptions = options as ParallelTransactionExecutorCoinOptions;\n\t\t\tthis.#coinBatchSize = coinOptions.coinBatchSize ?? PARALLEL_EXECUTOR_DEFAULTS.coinBatchSize;\n\t\t\tthis.#initialCoinBalance =\n\t\t\t\tcoinOptions.initialCoinBalance ?? PARALLEL_EXECUTOR_DEFAULTS.initialCoinBalance;\n\t\t\tthis.#minimumCoinBalance =\n\t\t\t\tcoinOptions.minimumCoinBalance ?? PARALLEL_EXECUTOR_DEFAULTS.minimumCoinBalance;\n\t\t\tthis.#sourceCoins = coinOptions.sourceCoins\n\t\t\t\t? new Map(coinOptions.sourceCoins.map((id) => [id, null]))\n\t\t\t\t: null;\n\t\t} else {\n\t\t\tthis.#coinBatchSize = 0;\n\t\t\tthis.#initialCoinBalance = 0n;\n\t\t\tthis.#minimumCoinBalance = PARALLEL_EXECUTOR_DEFAULTS.minimumCoinBalance;\n\t\t\tthis.#sourceCoins = null;\n\t\t}\n\n\t\tthis.#defaultGasBudget = options.defaultGasBudget ?? this.#minimumCoinBalance;\n\t\tthis.#maxPoolSize = options.maxPoolSize ?? PARALLEL_EXECUTOR_DEFAULTS.maxPoolSize;\n\t\tthis.#cache = new CachingTransactionExecutor({\n\t\t\tclient: options.client,\n\t\t\tcache: options.cache,\n\t\t});\n\t\tthis.#executeQueue = new ParallelQueue(this.#maxPoolSize);\n\t}\n\n\tresetCache() {\n\t\tthis.#epochInfo = null;\n\t\treturn this.#updateCache(() => this.#cache.reset());\n\t}\n\n\tasync waitForLastTransaction() {\n\t\tawait this.#updateCache(() => this.#waitForLastDigest());\n\t}\n\n\tasync executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\ttransaction: Transaction,\n\t\tinclude?: Include,\n\t\tadditionalSignatures: string[] = [],\n\t): Promise<SuiClientTypes.TransactionResult<Include & { effects: true }>> {\n\t\tconst { promise, resolve, reject } =\n\t\t\tpromiseWithResolvers<SuiClientTypes.TransactionResult<Include & { effects: true }>>();\n\t\tconst usedObjects = await this.#getUsedObjects(transaction);\n\n\t\tconst execute = () => {\n\t\t\tthis.#executeQueue.runTask(() => {\n\t\t\t\tconst promise = this.#execute(transaction, usedObjects, include, additionalSignatures);\n\n\t\t\t\treturn promise.then(resolve, reject);\n\t\t\t});\n\t\t};\n\n\t\tconst conflicts = new Set<string>();\n\n\t\tusedObjects.forEach((objectId) => {\n\t\t\tconst queue = this.#objectIdQueues.get(objectId);\n\t\t\tif (queue) {\n\t\t\t\tconflicts.add(objectId);\n\t\t\t\tthis.#objectIdQueues.get(objectId)!.push(() => {\n\t\t\t\t\tconflicts.delete(objectId);\n\t\t\t\t\tif (conflicts.size === 0) {\n\t\t\t\t\t\texecute();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#objectIdQueues.set(objectId, []);\n\t\t\t}\n\t\t});\n\n\t\tif (conflicts.size === 0) {\n\t\t\texecute();\n\t\t}\n\n\t\treturn promise;\n\t}\n\n\tasync #getUsedObjects(transaction: Transaction) {\n\t\tconst usedObjects = new Set<string>();\n\t\tlet serialized = false;\n\n\t\ttransaction.addSerializationPlugin(async (blockData, _options, next) => {\n\t\t\tawait next();\n\n\t\t\tif (serialized) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tserialized = true;\n\n\t\t\tblockData.inputs.forEach((input) => {\n\t\t\t\tif (input.Object?.ImmOrOwnedObject?.objectId) {\n\t\t\t\t\tusedObjects.add(input.Object.ImmOrOwnedObject.objectId);\n\t\t\t\t} else if (input.Object?.Receiving?.objectId) {\n\t\t\t\t\tusedObjects.add(input.Object.Receiving.objectId);\n\t\t\t\t} else if (\n\t\t\t\t\tinput.UnresolvedObject?.objectId &&\n\t\t\t\t\t!input.UnresolvedObject.initialSharedVersion\n\t\t\t\t) {\n\t\t\t\t\tusedObjects.add(input.UnresolvedObject.objectId);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tawait transaction.prepareForSerialization({ client: this.#client });\n\n\t\treturn usedObjects;\n\t}\n\n\tasync #execute<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\ttransaction: Transaction,\n\t\tusedObjects: Set<string>,\n\t\tinclude?: Include,\n\t\tadditionalSignatures: string[] = [],\n\t): Promise<SuiClientTypes.TransactionResult<Include & { effects: true }>> {\n\t\tlet gasCoin: CoinWithBalance | null = null;\n\t\ttry {\n\t\t\ttransaction.setSenderIfNotSet(this.#signer.toSuiAddress());\n\n\t\t\tawait this.#buildQueue.runTask(async () => {\n\t\t\t\tconst data = transaction.getData();\n\n\t\t\t\tif (!data.gasData.price) {\n\t\t\t\t\ttransaction.setGasPrice(await this.#getGasPrice());\n\t\t\t\t}\n\n\t\t\t\ttransaction.setGasBudgetIfNotSet(this.#defaultGasBudget);\n\n\t\t\t\tawait this.#updateCache();\n\t\t\t\tthis.#pendingTransactions++;\n\n\t\t\t\tif (this.#gasMode === 'addressBalance') {\n\t\t\t\t\t// Address balance mode: use empty gas payment with ValidDuring expiration\n\t\t\t\t\ttransaction.setGasPayment([]);\n\t\t\t\t\ttransaction.setExpiration(await this.#getValidDuringExpiration());\n\t\t\t\t} else {\n\t\t\t\t\t// Coin mode: use gas coin from pool\n\t\t\t\t\tgasCoin = await this.#getGasCoin();\n\t\t\t\t\ttransaction.setGasPayment([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tobjectId: gasCoin.id,\n\t\t\t\t\t\t\tversion: gasCoin.version,\n\t\t\t\t\t\t\tdigest: gasCoin.digest,\n\t\t\t\t\t\t},\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\t// Resolve cached references\n\t\t\t\tawait this.#cache.buildTransaction({ transaction, onlyTransactionKind: true });\n\t\t\t});\n\n\t\t\tconst bytes = await transaction.build({ client: this.#client });\n\n\t\t\tconst { signature } = await this.#signer.signTransaction(bytes);\n\n\t\t\tconst results = await this.#cache.executeTransaction({\n\t\t\t\ttransaction: bytes,\n\t\t\t\tsignatures: [signature, ...additionalSignatures],\n\t\t\t\tinclude,\n\t\t\t});\n\n\t\t\tconst tx = results.$kind === 'Transaction' ? results.Transaction : results.FailedTransaction;\n\t\t\tconst effects = tx.effects!;\n\t\t\tconst gasObject = effects.gasObject;\n\t\t\tconst gasUsed = effects.gasUsed;\n\n\t\t\tif (gasCoin && gasUsed && gasObject) {\n\t\t\t\tconst coin = gasCoin as CoinWithBalance;\n\t\t\t\tconst gasOwner = gasObject.outputOwner?.AddressOwner ?? gasObject.outputOwner?.ObjectOwner;\n\n\t\t\t\tif (gasOwner === this.#signer.toSuiAddress()) {\n\t\t\t\t\tconst totalUsed =\n\t\t\t\t\t\tBigInt(gasUsed.computationCost) +\n\t\t\t\t\t\tBigInt(gasUsed.storageCost) +\n\t\t\t\t\t\tBigInt(gasUsed.storageCost) -\n\t\t\t\t\t\tBigInt(gasUsed.storageRebate);\n\t\t\t\t\tconst remainingBalance = coin.balance - totalUsed;\n\n\t\t\t\t\tlet usesGasCoin = false;\n\t\t\t\t\tnew TransactionDataBuilder(transaction.getData()).mapArguments((arg) => {\n\t\t\t\t\t\tif (arg.$kind === 'GasCoin') {\n\t\t\t\t\t\t\tusesGasCoin = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn arg;\n\t\t\t\t\t});\n\n\t\t\t\t\tconst gasRef = {\n\t\t\t\t\t\tobjectId: gasObject.objectId,\n\t\t\t\t\t\tversion: gasObject.outputVersion!,\n\t\t\t\t\t\tdigest: gasObject.outputDigest!,\n\t\t\t\t\t};\n\n\t\t\t\t\tif (!usesGasCoin && remainingBalance >= this.#minimumCoinBalance) {\n\t\t\t\t\t\tthis.#coinPool.push({\n\t\t\t\t\t\t\tid: gasRef.objectId,\n\t\t\t\t\t\t\tversion: gasRef.version,\n\t\t\t\t\t\t\tdigest: gasRef.digest,\n\t\t\t\t\t\t\tbalance: remainingBalance,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.#sourceCoins) {\n\t\t\t\t\t\t\tthis.#sourceCoins = new Map();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.#sourceCoins.set(gasRef.objectId, gasRef);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#lastDigest = tx.digest;\n\n\t\t\treturn results as SuiClientTypes.TransactionResult<Include & { effects: true }>;\n\t\t} catch (error) {\n\t\t\tif (gasCoin) {\n\t\t\t\tif (!this.#sourceCoins) {\n\t\t\t\t\tthis.#sourceCoins = new Map();\n\t\t\t\t}\n\n\t\t\t\tthis.#sourceCoins.set((gasCoin as CoinWithBalance).id, null);\n\t\t\t}\n\n\t\t\tawait this.#updateCache(async () => {\n\t\t\t\tawait Promise.all([\n\t\t\t\t\tthis.#cache.cache.deleteObjects([...usedObjects]),\n\t\t\t\t\tthis.#waitForLastDigest(),\n\t\t\t\t]);\n\t\t\t});\n\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tusedObjects.forEach((objectId) => {\n\t\t\t\tconst queue = this.#objectIdQueues.get(objectId);\n\t\t\t\tif (queue && queue.length > 0) {\n\t\t\t\t\tqueue.shift()!();\n\t\t\t\t} else if (queue) {\n\t\t\t\t\tthis.#objectIdQueues.delete(objectId);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#pendingTransactions--;\n\t\t}\n\t}\n\n\t/** Helper for synchronizing cache updates, by ensuring only one update happens at a time. This can also be used to wait for any pending cache updates */\n\tasync #updateCache(fn?: () => Promise<void>) {\n\t\tif (this.#cacheLock) {\n\t\t\tawait this.#cacheLock;\n\t\t}\n\n\t\tthis.#cacheLock =\n\t\t\tfn?.().then(\n\t\t\t\t() => {\n\t\t\t\t\tthis.#cacheLock = null;\n\t\t\t\t},\n\t\t\t\t() => {},\n\t\t\t) ?? null;\n\t}\n\n\tasync #waitForLastDigest() {\n\t\tconst digest = this.#lastDigest;\n\t\tif (digest) {\n\t\t\tthis.#lastDigest = null;\n\t\t\tawait this.#client.core.waitForTransaction({ digest });\n\t\t}\n\t}\n\n\tasync #getGasCoin() {\n\t\tif (this.#coinPool.length === 0 && this.#pendingTransactions <= this.#maxPoolSize) {\n\t\t\tawait this.#refillCoinPool();\n\t\t}\n\n\t\tif (this.#coinPool.length === 0) {\n\t\t\tthrow new Error('No coins available');\n\t\t}\n\n\t\tconst coin = this.#coinPool.shift()!;\n\t\treturn coin;\n\t}\n\n\tasync #getGasPrice(): Promise<bigint> {\n\t\tawait this.#ensureEpochInfo();\n\t\treturn this.#epochInfo!.price;\n\t}\n\n\tasync #getValidDuringExpiration() {\n\t\tawait this.#ensureEpochInfo();\n\t\tconst currentEpoch = BigInt(this.#epochInfo!.epoch);\n\t\treturn {\n\t\t\tValidDuring: {\n\t\t\t\tminEpoch: String(currentEpoch),\n\t\t\t\tmaxEpoch: String(currentEpoch + 1n),\n\t\t\t\tminTimestamp: null,\n\t\t\t\tmaxTimestamp: null,\n\t\t\t\tchain: this.#epochInfo!.chainIdentifier,\n\t\t\t\tnonce: (Math.random() * 0x100000000) >>> 0,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync #ensureEpochInfo(): Promise<void> {\n\t\tif (this.#epochInfo && this.#epochInfo.expiration - EPOCH_BOUNDARY_WINDOW - Date.now() > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.#epochInfoPromise) {\n\t\t\tawait this.#epochInfoPromise;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#epochInfoPromise = this.#fetchEpochInfo();\n\t\ttry {\n\t\t\tawait this.#epochInfoPromise;\n\t\t} finally {\n\t\t\tthis.#epochInfoPromise = null;\n\t\t}\n\t}\n\n\tasync #fetchEpochInfo(): Promise<void> {\n\t\tconst [{ systemState }, { chainIdentifier }] = await Promise.all([\n\t\t\tthis.#client.core.getCurrentSystemState(),\n\t\t\tthis.#client.core.getChainIdentifier(),\n\t\t]);\n\n\t\tthis.#epochInfo = {\n\t\t\tepoch: systemState.epoch,\n\t\t\tprice: BigInt(systemState.referenceGasPrice),\n\t\t\texpiration:\n\t\t\t\tNumber(systemState.epochStartTimestampMs) + Number(systemState.parameters.epochDurationMs),\n\t\t\tchainIdentifier,\n\t\t};\n\t}\n\n\tasync #refillCoinPool() {\n\t\tconst batchSize = Math.min(\n\t\t\tthis.#coinBatchSize,\n\t\t\tthis.#maxPoolSize - (this.#coinPool.length + this.#pendingTransactions) + 1,\n\t\t);\n\n\t\tif (batchSize === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst txb = new Transaction();\n\t\tconst address = this.#signer.toSuiAddress();\n\t\ttxb.setSender(address);\n\n\t\tif (this.#sourceCoins) {\n\t\t\tconst refs = [];\n\t\t\tconst ids = [];\n\t\t\tfor (const [id, ref] of this.#sourceCoins) {\n\t\t\t\tif (ref) {\n\t\t\t\t\trefs.push(ref);\n\t\t\t\t} else {\n\t\t\t\t\tids.push(id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ids.length > 0) {\n\t\t\t\tconst { objects } = await this.#client.core.getObjects({\n\t\t\t\t\tobjectIds: ids,\n\t\t\t\t});\n\t\t\t\trefs.push(\n\t\t\t\t\t...objects\n\t\t\t\t\t\t.filter((obj): obj is SuiClientTypes.Object => !(obj instanceof Error))\n\t\t\t\t\t\t.map((obj) => ({\n\t\t\t\t\t\t\tobjectId: obj.objectId,\n\t\t\t\t\t\t\tversion: obj.version,\n\t\t\t\t\t\t\tdigest: obj.digest,\n\t\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttxb.setGasPayment(refs);\n\t\t\tthis.#sourceCoins = new Map();\n\t\t}\n\n\t\tconst amounts = new Array(batchSize).fill(this.#initialCoinBalance);\n\t\tconst splitResults = txb.splitCoins(txb.gas, amounts);\n\t\tconst coinResults = [];\n\t\tfor (let i = 0; i < amounts.length; i++) {\n\t\t\tcoinResults.push(splitResults[i]);\n\t\t}\n\t\ttxb.transferObjects(coinResults, address);\n\n\t\tawait this.waitForLastTransaction();\n\n\t\ttxb.addBuildPlugin(coreClientResolveTransactionPlugin);\n\t\tconst bytes = await txb.build({ client: this.#client });\n\t\tconst { signature } = await this.#signer.signTransaction(bytes);\n\n\t\tconst result = await this.#client.core.executeTransaction({\n\t\t\ttransaction: bytes,\n\t\t\tsignatures: [signature],\n\t\t\tinclude: { effects: true },\n\t\t});\n\n\t\tconst tx = result.$kind === 'Transaction' ? result.Transaction : result.FailedTransaction;\n\t\tconst effects = tx.effects!;\n\n\t\teffects.changedObjects.forEach((changedObj) => {\n\t\t\tif (\n\t\t\t\tchangedObj.objectId === effects.gasObject?.objectId ||\n\t\t\t\tchangedObj.outputState !== 'ObjectWrite'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.#coinPool.push({\n\t\t\t\tid: changedObj.objectId,\n\t\t\t\tversion: changedObj.outputVersion!,\n\t\t\t\tdigest: changedObj.outputDigest!,\n\t\t\t\tbalance: BigInt(this.#initialCoinBalance),\n\t\t\t});\n\t\t});\n\n\t\tif (!this.#sourceCoins) {\n\t\t\tthis.#sourceCoins = new Map();\n\t\t}\n\n\t\tconst gasObject = effects.gasObject!;\n\t\tthis.#sourceCoins!.set(gasObject.objectId, {\n\t\t\tobjectId: gasObject.objectId,\n\t\t\tversion: gasObject.outputVersion!,\n\t\t\tdigest: gasObject.outputDigest!,\n\t\t});\n\n\t\tawait this.#client.core.waitForTransaction({ digest: tx.digest });\n\t}\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,6BAA6B;CAClC,eAAe;CACf,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb;AAED,MAAM,wBAAwB;AAwC9B,IAAa,8BAAb,MAAyC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,YAA+B,EAAE;CACjC;CACA,kCAAkB,IAAI,KAA6B;CACnD,cAAc,IAAI,aAAa;CAC/B;CACA,cAA6B;CAC7B,aAAmC;CACnC,uBAAuB;CACvB,aAKI;CACJ,oBAA0C;CAE1C,YA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K;EAG9B,MAAM,YAAY,QAAQ;AAC1B,QAAKA,YAAc,IAAI,UAAU,UAAU;GAC1C,UAAU,UAAU;GACpB,SAAS,UAAU;GACnB,QAAQ,UAAU;GAClB,CAAC;AAEF,QAAM,MAAKL,OAAQ,KAAK,mBAAmB,EAAE,QAAQ,GAAG,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"parallel.mjs","names":["#signer","#client","#gasMode","#coinBatchSize","#initialCoinBalance","#minimumCoinBalance","#sourceCoins","#defaultGasBudget","#maxPoolSize","#cache","#executeQueue","#epochInfo","#updateCache","#waitForLastDigest","#getUsedObjects","#execute","#objectIdQueues","#buildQueue","#getGasPrice","#pendingTransactions","#getValidDuringExpiration","#getGasCoin","#coinPool","#lastDigest","#cacheLock","#refillCoinPool","#ensureEpochInfo","#epochInfoPromise","#fetchEpochInfo"],"sources":["../../../src/transactions/executor/parallel.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { promiseWithResolvers } from '@mysten/utils';\nimport type { SuiObjectRef } from '../../bcs/types.js';\nimport type { ClientWithCoreApi } from '../../client/core.js';\nimport { coreClientResolveTransactionPlugin } from '../../client/core-resolver.js';\nimport type { SuiClientTypes } from '../../client/types.js';\nimport type { Signer } from '../../cryptography/index.js';\nimport type { ObjectCacheOptions } from '../ObjectCache.js';\nimport { Transaction } from '../Transaction.js';\nimport { TransactionDataBuilder } from '../TransactionData.js';\nimport { CachingTransactionExecutor } from './caching.js';\nimport { ParallelQueue, SerialQueue } from './queue.js';\n\nconst PARALLEL_EXECUTOR_DEFAULTS = {\n\tcoinBatchSize: 20,\n\tinitialCoinBalance: 200_000_000n,\n\tminimumCoinBalance: 50_000_000n,\n\tmaxPoolSize: 50,\n} satisfies Partial<ParallelTransactionExecutorCoinOptions>;\n\nconst EPOCH_BOUNDARY_WINDOW = 60_000;\n\ninterface ParallelTransactionExecutorBaseOptions extends Omit<ObjectCacheOptions, 'address'> {\n\tclient: ClientWithCoreApi;\n\tsigner: Signer;\n\t/** The gasBudget to use if the transaction has not defined it's own gasBudget, defaults to `minimumCoinBalance` */\n\tdefaultGasBudget?: bigint;\n\t/** The maximum number of transactions that can be execute in parallel, this also determines the maximum number of gas coins that will be created */\n\tmaxPoolSize?: number;\n}\n\nexport interface ParallelTransactionExecutorCoinOptions extends ParallelTransactionExecutorBaseOptions {\n\t/** Gas mode - use owned coins for gas payments (default) */\n\tgasMode?: 'coins';\n\t/** The number of coins to create in a batch when refilling the gas pool */\n\tcoinBatchSize?: number;\n\t/** The initial balance of each coin created for the gas pool */\n\tinitialCoinBalance?: bigint;\n\t/** The minimum balance of a coin that can be reused for future transactions. If the gasCoin is below this value, it will be used when refilling the gasPool */\n\tminimumCoinBalance?: bigint;\n\t/** An initial list of coins used to fund the gas pool, uses all owned SUI coins by default */\n\tsourceCoins?: string[];\n}\n\nexport interface ParallelTransactionExecutorAddressBalanceOptions extends ParallelTransactionExecutorBaseOptions {\n\t/** Gas mode - use address balance for gas payments instead of owned coins */\n\tgasMode: 'addressBalance';\n}\n\n/** Options for ParallelTransactionExecutor - discriminated union based on gasMode */\nexport type ParallelTransactionExecutorOptions =\n\t| ParallelTransactionExecutorCoinOptions\n\t| ParallelTransactionExecutorAddressBalanceOptions;\n\ninterface CoinWithBalance {\n\tid: string;\n\tversion: string;\n\tdigest: string;\n\tbalance: bigint;\n}\nexport class ParallelTransactionExecutor {\n\t#signer: Signer;\n\t#client: ClientWithCoreApi;\n\t#gasMode: 'coins' | 'addressBalance';\n\t#coinBatchSize: number;\n\t#initialCoinBalance: bigint;\n\t#minimumCoinBalance: bigint;\n\t#defaultGasBudget: bigint;\n\t#maxPoolSize: number;\n\t#sourceCoins: Map<string, SuiObjectRef | null> | null;\n\t#coinPool: CoinWithBalance[] = [];\n\t#cache: CachingTransactionExecutor;\n\t#objectIdQueues = new Map<string, (() => void)[]>();\n\t#buildQueue = new SerialQueue();\n\t#executeQueue: ParallelQueue;\n\t#lastDigest: string | null = null;\n\t#cacheLock: Promise<void> | null = null;\n\t#pendingTransactions = 0;\n\t#epochInfo: null | {\n\t\tepoch: string;\n\t\tprice: bigint;\n\t\texpiration: number;\n\t\tchainIdentifier: string;\n\t} = null;\n\t#epochInfoPromise: Promise<void> | null = null;\n\n\tconstructor(options: ParallelTransactionExecutorOptions) {\n\t\tthis.#signer = options.signer;\n\t\tthis.#client = options.client;\n\t\tthis.#gasMode = options.gasMode ?? 'coins';\n\n\t\tif (this.#gasMode === 'coins') {\n\t\t\tconst coinOptions = options as ParallelTransactionExecutorCoinOptions;\n\t\t\tthis.#coinBatchSize = coinOptions.coinBatchSize ?? PARALLEL_EXECUTOR_DEFAULTS.coinBatchSize;\n\t\t\tthis.#initialCoinBalance =\n\t\t\t\tcoinOptions.initialCoinBalance ?? PARALLEL_EXECUTOR_DEFAULTS.initialCoinBalance;\n\t\t\tthis.#minimumCoinBalance =\n\t\t\t\tcoinOptions.minimumCoinBalance ?? PARALLEL_EXECUTOR_DEFAULTS.minimumCoinBalance;\n\t\t\tthis.#sourceCoins = coinOptions.sourceCoins\n\t\t\t\t? new Map(coinOptions.sourceCoins.map((id) => [id, null]))\n\t\t\t\t: null;\n\t\t} else {\n\t\t\tthis.#coinBatchSize = 0;\n\t\t\tthis.#initialCoinBalance = 0n;\n\t\t\tthis.#minimumCoinBalance = PARALLEL_EXECUTOR_DEFAULTS.minimumCoinBalance;\n\t\t\tthis.#sourceCoins = null;\n\t\t}\n\n\t\tthis.#defaultGasBudget = options.defaultGasBudget ?? this.#minimumCoinBalance;\n\t\tthis.#maxPoolSize = options.maxPoolSize ?? PARALLEL_EXECUTOR_DEFAULTS.maxPoolSize;\n\t\tthis.#cache = new CachingTransactionExecutor({\n\t\t\tclient: options.client,\n\t\t\tcache: options.cache,\n\t\t});\n\t\tthis.#executeQueue = new ParallelQueue(this.#maxPoolSize);\n\t}\n\n\tresetCache() {\n\t\tthis.#epochInfo = null;\n\t\treturn this.#updateCache(() => this.#cache.reset());\n\t}\n\n\tasync waitForLastTransaction() {\n\t\tawait this.#updateCache(() => this.#waitForLastDigest());\n\t}\n\n\tasync executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\ttransaction: Transaction,\n\t\tinclude?: Include,\n\t\tadditionalSignatures: string[] = [],\n\t): Promise<SuiClientTypes.TransactionResult<Include & { effects: true }>> {\n\t\tconst { promise, resolve, reject } =\n\t\t\tpromiseWithResolvers<SuiClientTypes.TransactionResult<Include & { effects: true }>>();\n\t\tconst usedObjects = await this.#getUsedObjects(transaction);\n\n\t\tconst execute = () => {\n\t\t\tthis.#executeQueue.runTask(() => {\n\t\t\t\tconst promise = this.#execute(transaction, usedObjects, include, additionalSignatures);\n\n\t\t\t\treturn promise.then(resolve, reject);\n\t\t\t});\n\t\t};\n\n\t\tconst conflicts = new Set<string>();\n\n\t\tusedObjects.forEach((objectId) => {\n\t\t\tconst queue = this.#objectIdQueues.get(objectId);\n\t\t\tif (queue) {\n\t\t\t\tconflicts.add(objectId);\n\t\t\t\tthis.#objectIdQueues.get(objectId)!.push(() => {\n\t\t\t\t\tconflicts.delete(objectId);\n\t\t\t\t\tif (conflicts.size === 0) {\n\t\t\t\t\t\texecute();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#objectIdQueues.set(objectId, []);\n\t\t\t}\n\t\t});\n\n\t\tif (conflicts.size === 0) {\n\t\t\texecute();\n\t\t}\n\n\t\treturn promise;\n\t}\n\n\tasync #getUsedObjects(transaction: Transaction) {\n\t\tconst usedObjects = new Set<string>();\n\t\tlet serialized = false;\n\n\t\ttransaction.addSerializationPlugin(async (blockData, _options, next) => {\n\t\t\tawait next();\n\n\t\t\tif (serialized) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tserialized = true;\n\n\t\t\tblockData.inputs.forEach((input) => {\n\t\t\t\tif (input.Object?.ImmOrOwnedObject?.objectId) {\n\t\t\t\t\tusedObjects.add(input.Object.ImmOrOwnedObject.objectId);\n\t\t\t\t} else if (input.Object?.Receiving?.objectId) {\n\t\t\t\t\tusedObjects.add(input.Object.Receiving.objectId);\n\t\t\t\t} else if (\n\t\t\t\t\tinput.UnresolvedObject?.objectId &&\n\t\t\t\t\t!input.UnresolvedObject.initialSharedVersion\n\t\t\t\t) {\n\t\t\t\t\tusedObjects.add(input.UnresolvedObject.objectId);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tawait transaction.prepareForSerialization({ client: this.#client });\n\n\t\treturn usedObjects;\n\t}\n\n\tasync #execute<Include extends SuiClientTypes.TransactionInclude = {}>(\n\t\ttransaction: Transaction,\n\t\tusedObjects: Set<string>,\n\t\tinclude?: Include,\n\t\tadditionalSignatures: string[] = [],\n\t): Promise<SuiClientTypes.TransactionResult<Include & { effects: true }>> {\n\t\tlet gasCoin: CoinWithBalance | null = null;\n\t\ttry {\n\t\t\ttransaction.setSenderIfNotSet(this.#signer.toSuiAddress());\n\n\t\t\tawait this.#buildQueue.runTask(async () => {\n\t\t\t\tconst data = transaction.getData();\n\n\t\t\t\tif (!data.gasData.price) {\n\t\t\t\t\ttransaction.setGasPrice(await this.#getGasPrice());\n\t\t\t\t}\n\n\t\t\t\ttransaction.setGasBudgetIfNotSet(this.#defaultGasBudget);\n\n\t\t\t\tawait this.#updateCache();\n\t\t\t\tthis.#pendingTransactions++;\n\n\t\t\t\tif (this.#gasMode === 'addressBalance') {\n\t\t\t\t\t// Address balance mode: use empty gas payment with ValidDuring expiration\n\t\t\t\t\ttransaction.setGasPayment([]);\n\t\t\t\t\ttransaction.setExpiration(await this.#getValidDuringExpiration());\n\t\t\t\t} else {\n\t\t\t\t\t// Coin mode: use gas coin from pool\n\t\t\t\t\tgasCoin = await this.#getGasCoin();\n\t\t\t\t\ttransaction.setGasPayment([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tobjectId: gasCoin.id,\n\t\t\t\t\t\t\tversion: gasCoin.version,\n\t\t\t\t\t\t\tdigest: gasCoin.digest,\n\t\t\t\t\t\t},\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\t// Resolve cached references\n\t\t\t\tawait this.#cache.buildTransaction({ transaction, onlyTransactionKind: true });\n\t\t\t});\n\n\t\t\tconst bytes = await transaction.build({ client: this.#client });\n\n\t\t\tconst { signature } = await this.#signer.signTransaction(bytes);\n\n\t\t\tconst results = await this.#cache.executeTransaction({\n\t\t\t\ttransaction: bytes,\n\t\t\t\tsignatures: [signature, ...additionalSignatures],\n\t\t\t\tinclude,\n\t\t\t});\n\n\t\t\tconst tx = results.$kind === 'Transaction' ? results.Transaction : results.FailedTransaction;\n\t\t\tconst effects = tx.effects!;\n\t\t\tconst gasObject = effects.gasObject;\n\t\t\tconst gasUsed = effects.gasUsed;\n\n\t\t\tif (gasCoin && gasUsed && gasObject) {\n\t\t\t\tconst coin = gasCoin as CoinWithBalance;\n\t\t\t\tconst gasOwner = gasObject.outputOwner?.AddressOwner ?? gasObject.outputOwner?.ObjectOwner;\n\n\t\t\t\tif (gasOwner === this.#signer.toSuiAddress()) {\n\t\t\t\t\tconst totalUsed =\n\t\t\t\t\t\tBigInt(gasUsed.computationCost) +\n\t\t\t\t\t\tBigInt(gasUsed.storageCost) -\n\t\t\t\t\t\tBigInt(gasUsed.storageRebate);\n\t\t\t\t\tconst remainingBalance = coin.balance - totalUsed;\n\n\t\t\t\t\tlet usesGasCoin = false;\n\t\t\t\t\tnew TransactionDataBuilder(transaction.getData()).mapArguments((arg) => {\n\t\t\t\t\t\tif (arg.$kind === 'GasCoin') {\n\t\t\t\t\t\t\tusesGasCoin = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn arg;\n\t\t\t\t\t});\n\n\t\t\t\t\tconst gasRef = {\n\t\t\t\t\t\tobjectId: gasObject.objectId,\n\t\t\t\t\t\tversion: gasObject.outputVersion!,\n\t\t\t\t\t\tdigest: gasObject.outputDigest!,\n\t\t\t\t\t};\n\n\t\t\t\t\tif (!usesGasCoin && remainingBalance >= this.#minimumCoinBalance) {\n\t\t\t\t\t\tthis.#coinPool.push({\n\t\t\t\t\t\t\tid: gasRef.objectId,\n\t\t\t\t\t\t\tversion: gasRef.version,\n\t\t\t\t\t\t\tdigest: gasRef.digest,\n\t\t\t\t\t\t\tbalance: remainingBalance,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.#sourceCoins) {\n\t\t\t\t\t\t\tthis.#sourceCoins = new Map();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.#sourceCoins.set(gasRef.objectId, gasRef);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.#lastDigest = tx.digest;\n\n\t\t\treturn results as SuiClientTypes.TransactionResult<Include & { effects: true }>;\n\t\t} catch (error) {\n\t\t\tif (gasCoin) {\n\t\t\t\tif (!this.#sourceCoins) {\n\t\t\t\t\tthis.#sourceCoins = new Map();\n\t\t\t\t}\n\n\t\t\t\tthis.#sourceCoins.set((gasCoin as CoinWithBalance).id, null);\n\t\t\t}\n\n\t\t\tawait this.#updateCache(async () => {\n\t\t\t\tawait Promise.all([\n\t\t\t\t\tthis.#cache.cache.deleteObjects([...usedObjects]),\n\t\t\t\t\tthis.#waitForLastDigest(),\n\t\t\t\t]);\n\t\t\t});\n\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tusedObjects.forEach((objectId) => {\n\t\t\t\tconst queue = this.#objectIdQueues.get(objectId);\n\t\t\t\tif (queue && queue.length > 0) {\n\t\t\t\t\tqueue.shift()!();\n\t\t\t\t} else if (queue) {\n\t\t\t\t\tthis.#objectIdQueues.delete(objectId);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#pendingTransactions--;\n\t\t}\n\t}\n\n\t/** Helper for synchronizing cache updates, by ensuring only one update happens at a time. This can also be used to wait for any pending cache updates */\n\tasync #updateCache(fn?: () => Promise<void>) {\n\t\tif (this.#cacheLock) {\n\t\t\tawait this.#cacheLock;\n\t\t}\n\n\t\tthis.#cacheLock =\n\t\t\tfn?.().then(\n\t\t\t\t() => {\n\t\t\t\t\tthis.#cacheLock = null;\n\t\t\t\t},\n\t\t\t\t() => {},\n\t\t\t) ?? null;\n\t}\n\n\tasync #waitForLastDigest() {\n\t\tconst digest = this.#lastDigest;\n\t\tif (digest) {\n\t\t\tthis.#lastDigest = null;\n\t\t\tawait this.#client.core.waitForTransaction({ digest });\n\t\t}\n\t}\n\n\tasync #getGasCoin() {\n\t\tif (this.#coinPool.length === 0 && this.#pendingTransactions <= this.#maxPoolSize) {\n\t\t\tawait this.#refillCoinPool();\n\t\t}\n\n\t\tif (this.#coinPool.length === 0) {\n\t\t\tthrow new Error('No coins available');\n\t\t}\n\n\t\tconst coin = this.#coinPool.shift()!;\n\t\treturn coin;\n\t}\n\n\tasync #getGasPrice(): Promise<bigint> {\n\t\tawait this.#ensureEpochInfo();\n\t\treturn this.#epochInfo!.price;\n\t}\n\n\tasync #getValidDuringExpiration() {\n\t\tawait this.#ensureEpochInfo();\n\t\tconst currentEpoch = BigInt(this.#epochInfo!.epoch);\n\t\treturn {\n\t\t\tValidDuring: {\n\t\t\t\tminEpoch: String(currentEpoch),\n\t\t\t\tmaxEpoch: String(currentEpoch + 1n),\n\t\t\t\tminTimestamp: null,\n\t\t\t\tmaxTimestamp: null,\n\t\t\t\tchain: this.#epochInfo!.chainIdentifier,\n\t\t\t\tnonce: (Math.random() * 0x100000000) >>> 0,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync #ensureEpochInfo(): Promise<void> {\n\t\tif (this.#epochInfo && this.#epochInfo.expiration - EPOCH_BOUNDARY_WINDOW - Date.now() > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.#epochInfoPromise) {\n\t\t\tawait this.#epochInfoPromise;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#epochInfoPromise = this.#fetchEpochInfo();\n\t\ttry {\n\t\t\tawait this.#epochInfoPromise;\n\t\t} finally {\n\t\t\tthis.#epochInfoPromise = null;\n\t\t}\n\t}\n\n\tasync #fetchEpochInfo(): Promise<void> {\n\t\tconst [{ systemState }, { chainIdentifier }] = await Promise.all([\n\t\t\tthis.#client.core.getCurrentSystemState(),\n\t\t\tthis.#client.core.getChainIdentifier(),\n\t\t]);\n\n\t\tthis.#epochInfo = {\n\t\t\tepoch: systemState.epoch,\n\t\t\tprice: BigInt(systemState.referenceGasPrice),\n\t\t\texpiration:\n\t\t\t\tNumber(systemState.epochStartTimestampMs) + Number(systemState.parameters.epochDurationMs),\n\t\t\tchainIdentifier,\n\t\t};\n\t}\n\n\tasync #refillCoinPool() {\n\t\tconst batchSize = Math.min(\n\t\t\tthis.#coinBatchSize,\n\t\t\tthis.#maxPoolSize - (this.#coinPool.length + this.#pendingTransactions) + 1,\n\t\t);\n\n\t\tif (batchSize === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst txb = new Transaction();\n\t\tconst address = this.#signer.toSuiAddress();\n\t\ttxb.setSender(address);\n\n\t\tif (this.#sourceCoins) {\n\t\t\tconst refs = [];\n\t\t\tconst ids = [];\n\t\t\tfor (const [id, ref] of this.#sourceCoins) {\n\t\t\t\tif (ref) {\n\t\t\t\t\trefs.push(ref);\n\t\t\t\t} else {\n\t\t\t\t\tids.push(id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ids.length > 0) {\n\t\t\t\tconst { objects } = await this.#client.core.getObjects({\n\t\t\t\t\tobjectIds: ids,\n\t\t\t\t});\n\t\t\t\trefs.push(\n\t\t\t\t\t...objects\n\t\t\t\t\t\t.filter((obj): obj is SuiClientTypes.Object => !(obj instanceof Error))\n\t\t\t\t\t\t.map((obj) => ({\n\t\t\t\t\t\t\tobjectId: obj.objectId,\n\t\t\t\t\t\t\tversion: obj.version,\n\t\t\t\t\t\t\tdigest: obj.digest,\n\t\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttxb.setGasPayment(refs);\n\t\t\tthis.#sourceCoins = new Map();\n\t\t}\n\n\t\tconst amounts = new Array(batchSize).fill(this.#initialCoinBalance);\n\t\tconst splitResults = txb.splitCoins(txb.gas, amounts);\n\t\tconst coinResults = [];\n\t\tfor (let i = 0; i < amounts.length; i++) {\n\t\t\tcoinResults.push(splitResults[i]);\n\t\t}\n\t\ttxb.transferObjects(coinResults, address);\n\n\t\tawait this.waitForLastTransaction();\n\n\t\ttxb.addBuildPlugin(coreClientResolveTransactionPlugin);\n\t\tconst bytes = await txb.build({ client: this.#client });\n\t\tconst { signature } = await this.#signer.signTransaction(bytes);\n\n\t\tconst result = await this.#client.core.executeTransaction({\n\t\t\ttransaction: bytes,\n\t\t\tsignatures: [signature],\n\t\t\tinclude: { effects: true },\n\t\t});\n\n\t\tconst tx = result.$kind === 'Transaction' ? result.Transaction : result.FailedTransaction;\n\t\tconst effects = tx.effects!;\n\n\t\teffects.changedObjects.forEach((changedObj) => {\n\t\t\tif (\n\t\t\t\tchangedObj.objectId === effects.gasObject?.objectId ||\n\t\t\t\tchangedObj.outputState !== 'ObjectWrite'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.#coinPool.push({\n\t\t\t\tid: changedObj.objectId,\n\t\t\t\tversion: changedObj.outputVersion!,\n\t\t\t\tdigest: changedObj.outputDigest!,\n\t\t\t\tbalance: BigInt(this.#initialCoinBalance),\n\t\t\t});\n\t\t});\n\n\t\tif (!this.#sourceCoins) {\n\t\t\tthis.#sourceCoins = new Map();\n\t\t}\n\n\t\tconst gasObject = effects.gasObject!;\n\t\tthis.#sourceCoins!.set(gasObject.objectId, {\n\t\t\tobjectId: gasObject.objectId,\n\t\t\tversion: gasObject.outputVersion!,\n\t\t\tdigest: gasObject.outputDigest!,\n\t\t});\n\n\t\tawait this.#client.core.waitForTransaction({ digest: tx.digest });\n\t}\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,6BAA6B;CAClC,eAAe;CACf,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb;AAED,MAAM,wBAAwB;AAwC9B,IAAa,8B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B;AAGD,SAAKqB,SAAU,KAAK;IACnB,IAAI,WAAW;IACf,SAAS,WAAW;IACpB,QAAQ,WAAW;IACnB,SAAS,OAAO,MAAKlB,mBAAoB;IACzC,CAAC;IACD;AAEF,MAAI,CAAC,MAAKE,YACT,OAAKA,8BAAe,IAAI,KAAK;EAG9B,MAAM,YAAY,QAAQ;AAC1B,QAAKA,YAAc,IAAI,UAAU,UAAU;GAC1C,UAAU,UAAU;GACpB,SAAS,UAAU;GACnB,QAAQ,UAAU;GAClB,CAAC;AAEF,QAAM,MAAKL,OAAQ,KAAK,mBAAmB,EAAE,QAAQ,GAAG,QAAQ,CAAC"}
|
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 = '2.5.
|
|
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 = '2.5.1';\nexport const TARGETED_RPC_VERSION = '1.68.0';\n"],"mappings":";AAKA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB"}
|
package/dist/zklogin/bcs.d.mts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _mysten_bcs817 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_bcs817.BcsStruct<{
|
|
6
|
+
inputs: _mysten_bcs817.BcsStruct<{
|
|
7
|
+
proofPoints: _mysten_bcs817.BcsStruct<{
|
|
8
|
+
a: _mysten_bcs817.BcsType<string[], Iterable<string> & {
|
|
9
9
|
length: number;
|
|
10
10
|
}, string>;
|
|
11
|
-
b:
|
|
11
|
+
b: _mysten_bcs817.BcsType<string[][], Iterable<Iterable<string> & {
|
|
12
12
|
length: number;
|
|
13
13
|
}> & {
|
|
14
14
|
length: number;
|
|
15
15
|
}, string>;
|
|
16
|
-
c:
|
|
16
|
+
c: _mysten_bcs817.BcsType<string[], Iterable<string> & {
|
|
17
17
|
length: number;
|
|
18
18
|
}, string>;
|
|
19
19
|
}, string>;
|
|
20
|
-
issBase64Details:
|
|
21
|
-
value:
|
|
22
|
-
indexMod4:
|
|
20
|
+
issBase64Details: _mysten_bcs817.BcsStruct<{
|
|
21
|
+
value: _mysten_bcs817.BcsType<string, string, "string">;
|
|
22
|
+
indexMod4: _mysten_bcs817.BcsType<number, number, "u8">;
|
|
23
23
|
}, string>;
|
|
24
|
-
headerBase64:
|
|
25
|
-
addressSeed:
|
|
24
|
+
headerBase64: _mysten_bcs817.BcsType<string, string, "string">;
|
|
25
|
+
addressSeed: _mysten_bcs817.BcsType<string, string, "string">;
|
|
26
26
|
}, string>;
|
|
27
|
-
maxEpoch:
|
|
28
|
-
userSignature:
|
|
27
|
+
maxEpoch: _mysten_bcs817.BcsType<string, string | number | bigint, "u64">;
|
|
28
|
+
userSignature: _mysten_bcs817.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
29
29
|
}, string>;
|
|
30
30
|
type ZkLoginSignature = InferBcsInput<typeof zkLoginSignature>;
|
|
31
31
|
type ZkLoginSignatureInputs = ZkLoginSignature['inputs'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { toHex } from '@mysten/bcs';
|
|
4
5
|
import { ed25519 } from '@noble/curves/ed25519.js';
|
|
5
6
|
|
|
6
7
|
import {
|
|
@@ -166,14 +167,17 @@ export class Ed25519Keypair extends Keypair {
|
|
|
166
167
|
*
|
|
167
168
|
* If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
|
|
168
169
|
* be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
|
|
170
|
+
*
|
|
171
|
+
* @param seed - The seed as a hex string or Uint8Array.
|
|
169
172
|
*/
|
|
170
|
-
static deriveKeypairFromSeed(
|
|
173
|
+
static deriveKeypairFromSeed(seed: string | Uint8Array, path?: string): Ed25519Keypair {
|
|
171
174
|
if (path == null) {
|
|
172
175
|
path = DEFAULT_ED25519_DERIVATION_PATH;
|
|
173
176
|
}
|
|
174
177
|
if (!isValidHardenedPath(path)) {
|
|
175
178
|
throw new Error('Invalid derivation path');
|
|
176
179
|
}
|
|
180
|
+
const seedHex = typeof seed === 'string' ? seed : toHex(seed);
|
|
177
181
|
const { key } = derivePath(path, seedHex);
|
|
178
182
|
|
|
179
183
|
return Ed25519Keypair.fromSecretKey(key);
|
|
@@ -262,7 +262,6 @@ export class ParallelTransactionExecutor {
|
|
|
262
262
|
if (gasOwner === this.#signer.toSuiAddress()) {
|
|
263
263
|
const totalUsed =
|
|
264
264
|
BigInt(gasUsed.computationCost) +
|
|
265
|
-
BigInt(gasUsed.storageCost) +
|
|
266
265
|
BigInt(gasUsed.storageCost) -
|
|
267
266
|
BigInt(gasUsed.storageRebate);
|
|
268
267
|
const remainingBalance = coin.balance - totalUsed;
|
package/src/version.ts
CHANGED