@scallop-io/sui-kit 1.4.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +32 -0
  3. package/dist/index.d.cts +747 -0
  4. package/dist/index.d.ts +745 -6
  5. package/dist/index.js +13 -29
  6. package/package.json +14 -13
  7. package/src/index.ts +10 -6
  8. package/src/libs/multiSig/client.ts +1 -1
  9. package/src/libs/multiSig/index.ts +1 -1
  10. package/src/libs/suiAccountManager/index.ts +7 -4
  11. package/src/libs/suiAccountManager/keypair.ts +1 -1
  12. package/src/libs/suiInteractor/index.ts +7 -1
  13. package/src/libs/suiInteractor/suiInteractor.ts +150 -71
  14. package/src/libs/suiModel/index.ts +2 -2
  15. package/src/libs/suiModel/suiOwnedObject.ts +17 -8
  16. package/src/libs/suiTxBuilder/index.ts +24 -13
  17. package/src/libs/suiTxBuilder/util.ts +40 -5
  18. package/src/suiKit.ts +62 -32
  19. package/src/types/index.ts +17 -3
  20. package/dist/index.mjs +0 -15
  21. package/dist/libs/multiSig/client.d.ts +0 -15
  22. package/dist/libs/multiSig/index.d.ts +0 -1
  23. package/dist/libs/multiSig/publickey.d.ts +0 -2
  24. package/dist/libs/suiAccountManager/crypto.d.ts +0 -1
  25. package/dist/libs/suiAccountManager/index.d.ts +0 -39
  26. package/dist/libs/suiAccountManager/keypair.d.ts +0 -21
  27. package/dist/libs/suiAccountManager/util.d.ts +0 -29
  28. package/dist/libs/suiInteractor/index.d.ts +0 -1
  29. package/dist/libs/suiInteractor/suiInteractor.d.ts +0 -39
  30. package/dist/libs/suiInteractor/util.d.ts +0 -2
  31. package/dist/libs/suiModel/index.d.ts +0 -2
  32. package/dist/libs/suiModel/suiOwnedObject.d.ts +0 -24
  33. package/dist/libs/suiModel/suiSharedObject.d.ts +0 -11
  34. package/dist/libs/suiTxBuilder/index.d.ts +0 -637
  35. package/dist/libs/suiTxBuilder/util.d.ts +0 -43
  36. package/dist/suiKit.d.ts +0 -128
  37. package/dist/types/index.d.ts +0 -76
package/dist/index.d.ts CHANGED
@@ -1,8 +1,747 @@
1
1
  export * from '@mysten/sui/utils';
2
+ import * as _mysten_sui_transactions from '@mysten/sui/transactions';
3
+ import { Transaction, TransactionObjectInput, Argument, TransactionArgument, TransactionObjectArgument, Inputs, CallArg } from '@mysten/sui/transactions';
2
4
  export * from '@mysten/sui/transactions';
3
- export { SuiKit } from './suiKit';
4
- export { SuiAccountManager } from './libs/suiAccountManager';
5
- export { SuiTxBlock } from './libs/suiTxBuilder';
6
- export { MultiSigClient } from './libs/multiSig';
7
- export { SuiInteractor } from './libs/suiInteractor';
8
- export type * from './types';
5
+ import * as _mysten_sui_cryptography from '@mysten/sui/cryptography';
6
+ import { Keypair, PublicKey } from '@mysten/sui/cryptography';
7
+ import * as _mysten_bcs from '@mysten/bcs';
8
+ import { SerializedBcs } from '@mysten/bcs';
9
+ import * as _mysten_sui_client from '@mysten/sui/client';
10
+ import { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';
11
+ import { bcs } from '@mysten/sui/bcs';
12
+ import * as _mysten_sui_keypairs_ed25519 from '@mysten/sui/keypairs/ed25519';
13
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
14
+ import { MultiSigPublicKey } from '@mysten/sui/multisig';
15
+
16
+ interface SuiObjectRef$1 {
17
+ objectId: string;
18
+ version: number | string;
19
+ digest: string;
20
+ }
21
+ declare class SuiTxBlock {
22
+ txBlock: Transaction;
23
+ constructor(transaction?: Transaction);
24
+ get gas(): {
25
+ $kind: "GasCoin";
26
+ GasCoin: true;
27
+ };
28
+ getData(): {
29
+ version: 2;
30
+ sender?: string | null | undefined;
31
+ expiration?: _mysten_bcs.EnumOutputShapeWithKeys<{
32
+ None: true;
33
+ Epoch: string | number;
34
+ ValidDuring: {
35
+ minEpoch: string | number | null;
36
+ maxEpoch: string | number | null;
37
+ minTimestamp: string | number | null;
38
+ maxTimestamp: string | number | null;
39
+ chain: string;
40
+ nonce: number;
41
+ };
42
+ }, "None" | "Epoch" | "ValidDuring"> | null | undefined;
43
+ gasData: {
44
+ budget: string | number | null;
45
+ price: string | number | null;
46
+ owner: string | null;
47
+ payment: {
48
+ objectId: string;
49
+ version: string | number;
50
+ digest: string;
51
+ }[] | null;
52
+ };
53
+ inputs: _mysten_bcs.EnumOutputShapeWithKeys<{
54
+ Object: _mysten_bcs.EnumOutputShapeWithKeys<{
55
+ ImmOrOwnedObject: {
56
+ objectId: string;
57
+ version: string | number;
58
+ digest: string;
59
+ };
60
+ SharedObject: {
61
+ objectId: string;
62
+ initialSharedVersion: string | number;
63
+ mutable: boolean;
64
+ };
65
+ Receiving: {
66
+ objectId: string;
67
+ version: string | number;
68
+ digest: string;
69
+ };
70
+ }, "ImmOrOwnedObject" | "SharedObject" | "Receiving">;
71
+ Pure: {
72
+ bytes: string;
73
+ };
74
+ UnresolvedPure: {
75
+ value: unknown;
76
+ };
77
+ UnresolvedObject: {
78
+ objectId: string;
79
+ version?: string | number | null | undefined;
80
+ digest?: string | null | undefined;
81
+ initialSharedVersion?: string | number | null | undefined;
82
+ mutable?: boolean | null | undefined;
83
+ };
84
+ FundsWithdrawal: {
85
+ reservation: {
86
+ MaxAmountU64: string | number;
87
+ $kind: "MaxAmountU64";
88
+ };
89
+ typeArg: {
90
+ Balance: string;
91
+ $kind: "Balance";
92
+ };
93
+ withdrawFrom: _mysten_bcs.EnumOutputShapeWithKeys<{
94
+ Sender: true;
95
+ Sponsor: true;
96
+ }, "Sender" | "Sponsor">;
97
+ };
98
+ }, "Pure" | "Object" | "FundsWithdrawal" | "UnresolvedPure" | "UnresolvedObject">[];
99
+ commands: _mysten_bcs.EnumOutputShapeWithKeys<{
100
+ MoveCall: {
101
+ package: string;
102
+ module: string;
103
+ function: string;
104
+ typeArguments: string[];
105
+ arguments: ({
106
+ GasCoin: true;
107
+ $kind: "GasCoin";
108
+ } | {
109
+ Input: number;
110
+ type?: "object" | "pure" | "withdrawal" | undefined;
111
+ $kind: "Input";
112
+ } | {
113
+ Result: number;
114
+ $kind: "Result";
115
+ } | {
116
+ NestedResult: [number, number];
117
+ $kind: "NestedResult";
118
+ })[];
119
+ _argumentTypes?: {
120
+ reference: "mutable" | "unknown" | "immutable" | null;
121
+ body: _mysten_sui_client.SuiClientTypes.OpenSignatureBody;
122
+ }[] | null | undefined;
123
+ };
124
+ TransferObjects: {
125
+ objects: ({
126
+ GasCoin: true;
127
+ $kind: "GasCoin";
128
+ } | {
129
+ Input: number;
130
+ type?: "object" | "pure" | "withdrawal" | undefined;
131
+ $kind: "Input";
132
+ } | {
133
+ Result: number;
134
+ $kind: "Result";
135
+ } | {
136
+ NestedResult: [number, number];
137
+ $kind: "NestedResult";
138
+ })[];
139
+ address: {
140
+ GasCoin: true;
141
+ $kind: "GasCoin";
142
+ } | {
143
+ Input: number;
144
+ type?: "object" | "pure" | "withdrawal" | undefined;
145
+ $kind: "Input";
146
+ } | {
147
+ Result: number;
148
+ $kind: "Result";
149
+ } | {
150
+ NestedResult: [number, number];
151
+ $kind: "NestedResult";
152
+ };
153
+ };
154
+ SplitCoins: {
155
+ coin: {
156
+ GasCoin: true;
157
+ $kind: "GasCoin";
158
+ } | {
159
+ Input: number;
160
+ type?: "object" | "pure" | "withdrawal" | undefined;
161
+ $kind: "Input";
162
+ } | {
163
+ Result: number;
164
+ $kind: "Result";
165
+ } | {
166
+ NestedResult: [number, number];
167
+ $kind: "NestedResult";
168
+ };
169
+ amounts: ({
170
+ GasCoin: true;
171
+ $kind: "GasCoin";
172
+ } | {
173
+ Input: number;
174
+ type?: "object" | "pure" | "withdrawal" | undefined;
175
+ $kind: "Input";
176
+ } | {
177
+ Result: number;
178
+ $kind: "Result";
179
+ } | {
180
+ NestedResult: [number, number];
181
+ $kind: "NestedResult";
182
+ })[];
183
+ };
184
+ MergeCoins: {
185
+ destination: {
186
+ GasCoin: true;
187
+ $kind: "GasCoin";
188
+ } | {
189
+ Input: number;
190
+ type?: "object" | "pure" | "withdrawal" | undefined;
191
+ $kind: "Input";
192
+ } | {
193
+ Result: number;
194
+ $kind: "Result";
195
+ } | {
196
+ NestedResult: [number, number];
197
+ $kind: "NestedResult";
198
+ };
199
+ sources: ({
200
+ GasCoin: true;
201
+ $kind: "GasCoin";
202
+ } | {
203
+ Input: number;
204
+ type?: "object" | "pure" | "withdrawal" | undefined;
205
+ $kind: "Input";
206
+ } | {
207
+ Result: number;
208
+ $kind: "Result";
209
+ } | {
210
+ NestedResult: [number, number];
211
+ $kind: "NestedResult";
212
+ })[];
213
+ };
214
+ Publish: {
215
+ modules: string[];
216
+ dependencies: string[];
217
+ };
218
+ MakeMoveVec: {
219
+ type: string | null;
220
+ elements: ({
221
+ GasCoin: true;
222
+ $kind: "GasCoin";
223
+ } | {
224
+ Input: number;
225
+ type?: "object" | "pure" | "withdrawal" | undefined;
226
+ $kind: "Input";
227
+ } | {
228
+ Result: number;
229
+ $kind: "Result";
230
+ } | {
231
+ NestedResult: [number, number];
232
+ $kind: "NestedResult";
233
+ })[];
234
+ };
235
+ Upgrade: {
236
+ modules: string[];
237
+ dependencies: string[];
238
+ package: string;
239
+ ticket: {
240
+ GasCoin: true;
241
+ $kind: "GasCoin";
242
+ } | {
243
+ Input: number;
244
+ type?: "object" | "pure" | "withdrawal" | undefined;
245
+ $kind: "Input";
246
+ } | {
247
+ Result: number;
248
+ $kind: "Result";
249
+ } | {
250
+ NestedResult: [number, number];
251
+ $kind: "NestedResult";
252
+ };
253
+ };
254
+ $Intent: {
255
+ name: string;
256
+ inputs: {
257
+ [x: string]: {
258
+ GasCoin: true;
259
+ $kind: "GasCoin";
260
+ } | {
261
+ Input: number;
262
+ type?: "object" | "pure" | "withdrawal" | undefined;
263
+ $kind: "Input";
264
+ } | {
265
+ Result: number;
266
+ $kind: "Result";
267
+ } | {
268
+ NestedResult: [number, number];
269
+ $kind: "NestedResult";
270
+ } | ({
271
+ GasCoin: true;
272
+ $kind: "GasCoin";
273
+ } | {
274
+ Input: number;
275
+ type?: "object" | "pure" | "withdrawal" | undefined;
276
+ $kind: "Input";
277
+ } | {
278
+ Result: number;
279
+ $kind: "Result";
280
+ } | {
281
+ NestedResult: [number, number];
282
+ $kind: "NestedResult";
283
+ })[];
284
+ };
285
+ data: {
286
+ [x: string]: unknown;
287
+ };
288
+ };
289
+ }, "MoveCall" | "TransferObjects" | "SplitCoins" | "MergeCoins" | "Publish" | "MakeMoveVec" | "Upgrade" | "$Intent">[];
290
+ };
291
+ address(value: string): {
292
+ GasCoin: true;
293
+ $kind: "GasCoin";
294
+ } | {
295
+ Input: number;
296
+ type?: "object" | "pure" | "withdrawal" | undefined;
297
+ $kind: "Input";
298
+ } | {
299
+ Result: number;
300
+ $kind: "Result";
301
+ } | {
302
+ NestedResult: [number, number];
303
+ $kind: "NestedResult";
304
+ };
305
+ get pure(): typeof this$1.txBlock.pure;
306
+ object(value: string | TransactionObjectInput): {
307
+ $kind: "Input";
308
+ Input: number;
309
+ type?: "object";
310
+ };
311
+ objectRef(ref: SuiObjectRef$1): {
312
+ $kind: "Input";
313
+ Input: number;
314
+ type?: "object";
315
+ };
316
+ sharedObjectRef(ref: typeof bcs.SharedObjectRef.$inferType): {
317
+ $kind: "Input";
318
+ Input: number;
319
+ type?: "object";
320
+ };
321
+ setSender(sender: string): void;
322
+ setSenderIfNotSet(sender: string): void;
323
+ setExpiration(expiration?: Parameters<typeof this$1.txBlock.setExpiration>[0]): void;
324
+ setGasPrice(price: number | bigint): void;
325
+ setGasBudget(budget: number | bigint): void;
326
+ setGasOwner(owner: string): void;
327
+ setGasPayment(payments: SuiObjectRef$1[]): void;
328
+ /**
329
+ * @deprecated Use toJSON instead.
330
+ * For synchronous serialization, you can use `getData()`
331
+ * */
332
+ serialize(): string;
333
+ toJSON(): Promise<string>;
334
+ sign(params: {
335
+ signer: Keypair;
336
+ client?: ClientWithCoreApi;
337
+ onlyTransactionKind?: boolean;
338
+ }): Promise<_mysten_sui_cryptography.SignatureWithBytes>;
339
+ build(params?: {
340
+ client?: ClientWithCoreApi;
341
+ onlyTransactionKind?: boolean;
342
+ }): Promise<any>;
343
+ getDigest(params?: {
344
+ client?: ClientWithCoreApi;
345
+ }): Promise<string>;
346
+ add(...args: Parameters<typeof this$1.txBlock.add>): void | ({
347
+ Result: number;
348
+ $kind: "Result";
349
+ } | readonly {
350
+ NestedResult: [number, number];
351
+ $kind: "NestedResult";
352
+ }[]);
353
+ publish({ modules, dependencies, }: {
354
+ modules: number[][] | string[];
355
+ dependencies: string[];
356
+ }): _mysten_sui_transactions.TransactionResult;
357
+ upgrade(...args: Parameters<typeof this$1.txBlock.upgrade>): _mysten_sui_transactions.TransactionResult;
358
+ makeMoveVec(...args: Parameters<typeof this$1.txBlock.makeMoveVec>): _mysten_sui_transactions.TransactionResult;
359
+ transferObjects(objects: SuiObjectArg[], address: SuiAddressArg): _mysten_sui_transactions.TransactionResult;
360
+ splitCoins(coin: SuiObjectArg, amounts: SuiAmountsArg[]): {
361
+ NestedResult: [number, number];
362
+ $kind: "NestedResult";
363
+ }[];
364
+ mergeCoins(destination: SuiObjectArg, sources: SuiObjectArg[]): _mysten_sui_transactions.TransactionResult;
365
+ /**
366
+ * @description Move call
367
+ * @param target `${string}::${string}::${string}`, e.g. `0x3::sui_system::request_add_stake`
368
+ * @param args the arguments of the move call, such as `['0x1', '0x2']`
369
+ * @param typeArgs the type arguments of the move call, such as `['0x2::sui::SUI']`
370
+ */
371
+ moveCall(target: string, args?: (SuiTxArg | SuiVecTxArg)[], typeArgs?: string[]): _mysten_sui_transactions.TransactionResult;
372
+ transferSuiToMany(recipients: SuiAddressArg[], amounts: SuiAmountsArg[]): this;
373
+ transferSui(address: SuiAddressArg, amount: SuiAmountsArg): this;
374
+ takeAmountFromCoins(coins: SuiObjectArg[], amount: SuiAmountsArg): _mysten_sui_transactions.TransactionObjectArgument[];
375
+ splitSUIFromGas(amounts: SuiAmountsArg[]): {
376
+ Result: number;
377
+ $kind: "Result";
378
+ } & {
379
+ NestedResult: [number, number];
380
+ $kind: "NestedResult";
381
+ }[];
382
+ splitMultiCoins(coins: SuiObjectArg[], amounts: SuiAmountsArg[]): {
383
+ splitedCoins: {
384
+ Result: number;
385
+ $kind: "Result";
386
+ } & {
387
+ NestedResult: [number, number];
388
+ $kind: "NestedResult";
389
+ }[];
390
+ mergedCoin: _mysten_sui_transactions.TransactionObjectArgument;
391
+ };
392
+ transferCoinToMany(coins: SuiObjectArg[], sender: SuiAddressArg, recipients: SuiAddressArg[], amounts: SuiAmountsArg[]): this;
393
+ transferCoin(coins: SuiObjectArg[], sender: SuiAddressArg, recipient: SuiAddressArg, amount: SuiAmountsArg): this;
394
+ stakeSui(amount: SuiAmountsArg, validatorAddr: SuiAddressArg): _mysten_sui_transactions.TransactionResult;
395
+ }
396
+
397
+ type SuiKitParams = (AccountManagerParams & {
398
+ faucetUrl?: string;
399
+ networkType?: NetworkType;
400
+ }) & Partial<SuiInteractorParams>;
401
+ type SuiInteractorParams = {
402
+ fullnodeUrls: string[];
403
+ network?: NetworkType;
404
+ } | {
405
+ suiClients: ClientWithCoreApi[];
406
+ };
407
+ type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
408
+ type AccountManagerParams = {
409
+ mnemonics?: string;
410
+ secretKey?: string;
411
+ };
412
+ type DerivePathParams = {
413
+ accountIndex?: number;
414
+ isExternal?: boolean;
415
+ addressIndex?: number;
416
+ };
417
+ type TransactionBlockType = InstanceType<typeof Transaction>;
418
+ type PureCallArg = {
419
+ Pure: number[];
420
+ };
421
+ type SharedObjectRef = {
422
+ /** Hex code as string representing the object id */
423
+ objectId: string;
424
+ /** The version the object was shared at */
425
+ initialSharedVersion: number | string;
426
+ /** Whether reference is mutable */
427
+ mutable: boolean;
428
+ };
429
+ type SuiObjectRef = {
430
+ /** Base64 string representing the object digest */
431
+ objectId: string;
432
+ /** Object version */
433
+ version: number | string;
434
+ /** Hex code as string representing the object id */
435
+ digest: string;
436
+ };
437
+ /**
438
+ * An object argument.
439
+ */
440
+ type ObjectArg = {
441
+ ImmOrOwnedObject: SuiObjectRef;
442
+ } | {
443
+ SharedObject: SharedObjectRef;
444
+ } | {
445
+ Receiving: SuiObjectRef;
446
+ };
447
+ type ObjectCallArg = {
448
+ Object: ObjectArg;
449
+ };
450
+ type TransactionType = Parameters<TransactionBlockType['add']>;
451
+ type TransactionPureArgument = Extract<Argument, {
452
+ $kind: 'Input';
453
+ type?: 'pure';
454
+ }>;
455
+ type SuiTxArg = TransactionArgument | SerializedBcs<any>;
456
+ type SuiAddressArg = Argument | SerializedBcs<any> | string;
457
+ type SuiAmountsArg = SuiTxArg | number | bigint;
458
+ type SuiObjectArg = TransactionObjectArgument | string | Parameters<typeof Inputs.ObjectRef>[0] | Parameters<typeof Inputs.SharedObjectRef>[0] | ObjectCallArg;
459
+ type SuiVecTxArg = {
460
+ value: SuiTxArg[];
461
+ vecType: SuiInputTypes;
462
+ } | SuiTxArg[];
463
+ /**
464
+ * These are the basics types that can be used in the SUI
465
+ */
466
+ type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
467
+ type SuiInputTypes = 'object' | SuiBasicTypes;
468
+ type SuiTransactionResult<Include extends SuiClientTypes.TransactionInclude = {}> = SuiClientTypes.TransactionResult<Include>;
469
+ type SuiTransactionBlockResponse = SuiClientTypes.TransactionResult<{
470
+ balanceChanges: true;
471
+ effects: true;
472
+ events: true;
473
+ objectTypes: true;
474
+ }>;
475
+ type SuiKitReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : SuiTxBlock;
476
+
477
+ type TransactionResultWithEffects = SuiClientTypes.TransactionResult<{
478
+ effects: true;
479
+ }>;
480
+ declare class SuiOwnedObject {
481
+ readonly objectId: string;
482
+ version?: string;
483
+ digest?: string;
484
+ constructor(param: {
485
+ objectId: string;
486
+ version?: string;
487
+ digest?: string;
488
+ });
489
+ /**
490
+ * Check if the object is fully initialized.
491
+ * So that when it's used as an input, it won't be necessary to fetch from fullnode again.
492
+ * Which can save time when sending transactions.
493
+ */
494
+ isFullObject(): boolean;
495
+ asCallArg(): CallArg | string;
496
+ /**
497
+ * Update object version & digest based on the transaction response.
498
+ * @param txResponse
499
+ */
500
+ updateFromTxResponse(txResponse: TransactionResultWithEffects): void;
501
+ }
502
+
503
+ declare class SuiSharedObject {
504
+ readonly objectId: string;
505
+ initialSharedVersion?: string;
506
+ constructor(param: {
507
+ objectId: string;
508
+ initialSharedVersion?: string;
509
+ mutable?: boolean;
510
+ });
511
+ asCallArg(mutable?: boolean): CallArg | string;
512
+ }
513
+
514
+ declare function getFullnodeUrl(network: NetworkType): string;
515
+ type SuiObjectData = SuiClientTypes.Object<{
516
+ content: true;
517
+ json: true;
518
+ }>;
519
+ type SuiObjectDataOptions = SuiClientTypes.ObjectInclude;
520
+ type SimulateTransactionResponse = SuiClientTypes.SimulateTransactionResult<{
521
+ effects: true;
522
+ events: true;
523
+ balanceChanges: true;
524
+ commandResults: true;
525
+ }>;
526
+ /**
527
+ * Encapsulates all functions that interact with the sui sdk
528
+ */
529
+ declare class SuiInteractor {
530
+ private clients;
531
+ currentClient: ClientWithCoreApi;
532
+ private fullNodes;
533
+ private network;
534
+ constructor(params: Partial<SuiInteractorParams>);
535
+ switchToNextClient(): void;
536
+ switchFullNodes(fullNodes: string[], network?: NetworkType): void;
537
+ get currentFullNode(): string;
538
+ sendTx(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiClientTypes.TransactionResult<{
539
+ balanceChanges: true;
540
+ effects: true;
541
+ events: true;
542
+ objectTypes: true;
543
+ }>>;
544
+ dryRunTx(transactionBlock: Uint8Array): Promise<SimulateTransactionResponse>;
545
+ getObjects(ids: string[], options?: {
546
+ include?: SuiObjectDataOptions;
547
+ batchSize?: number;
548
+ switchClientDelay?: number;
549
+ }): Promise<SuiObjectData[]>;
550
+ getObject(id: string, options?: {
551
+ include?: SuiObjectDataOptions;
552
+ }): Promise<SuiObjectData>;
553
+ /**
554
+ * @description Update objects in a batch
555
+ * @param suiObjects
556
+ */
557
+ updateObjects(suiObjects: (SuiOwnedObject | SuiSharedObject)[]): Promise<void>;
558
+ /**
559
+ * @description Select coins that add up to the given amount.
560
+ * @param addr the address of the owner
561
+ * @param amount the amount that is needed for the coin
562
+ * @param coinType the coin type, default is '0x2::SUI::SUI'
563
+ */
564
+ selectCoins(addr: string, amount: number, coinType?: string): Promise<{
565
+ objectId: string;
566
+ digest: string;
567
+ version: string;
568
+ balance: string;
569
+ }[]>;
570
+ }
571
+
572
+ declare class SuiAccountManager {
573
+ private mnemonics;
574
+ private secretKey;
575
+ currentKeyPair: Ed25519Keypair;
576
+ currentAddress: string;
577
+ /**
578
+ * Support the following ways to init the SuiToolkit:
579
+ * 1. mnemonics
580
+ * 2. secretKey (base64 or hex)
581
+ * If none of them is provided, will generate a random mnemonics with 24 words.
582
+ *
583
+ * @param mnemonics, 12 or 24 mnemonics words, separated by space
584
+ * @param secretKey, base64 or hex string or Bech32 string, when mnemonics is provided, secretKey will be ignored
585
+ */
586
+ constructor({ mnemonics, secretKey }?: AccountManagerParams);
587
+ /**
588
+ * Check if the secretKey starts with bench32 format
589
+ */
590
+ parseSecretKey(secretKey: string): Ed25519Keypair;
591
+ /**
592
+ * if derivePathParams is not provided or mnemonics is empty, it will return the currentKeyPair.
593
+ * else:
594
+ * it will generate keyPair from the mnemonic with the given derivePathParams.
595
+ */
596
+ getKeyPair(derivePathParams?: DerivePathParams): Ed25519Keypair;
597
+ /**
598
+ * if derivePathParams is not provided or mnemonics is empty, it will return the currentAddress.
599
+ * else:
600
+ * it will generate address from the mnemonic with the given derivePathParams.
601
+ */
602
+ getAddress(derivePathParams?: DerivePathParams): string;
603
+ /**
604
+ * Switch the current account with the given derivePathParams.
605
+ * This is only useful when the mnemonics is provided. For secretKey mode, it will always use the same account.
606
+ */
607
+ switchAccount(derivePathParams: DerivePathParams): void;
608
+ }
609
+
610
+ /**
611
+ * @class SuiKit
612
+ * @description This class is used to aggregate the tools that used to interact with SUI network.
613
+ */
614
+ declare class SuiKit {
615
+ accountManager: SuiAccountManager;
616
+ suiInteractor: SuiInteractor;
617
+ /**
618
+ * Support the following ways to init the SuiToolkit:
619
+ * 1. mnemonics
620
+ * 2. secretKey (base64 or hex)
621
+ * If none of them is provided, will generate a random mnemonics with 24 words.
622
+ *
623
+ * @param mnemonics, 12 or 24 mnemonics words, separated by space
624
+ * @param secretKey, base64 or hex string or bech32, when mnemonics is provided, secretKey will be ignored
625
+ * @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'mainnet'
626
+ * @param fullnodeUrls, the fullnode url, default is the preconfig fullnode url for the given network type
627
+ */
628
+ constructor(params: SuiKitParams);
629
+ /**
630
+ * Create SuiTxBlock with sender set to the current signer
631
+ * @returns SuiTxBlock with sender set to the current signer
632
+ */
633
+ createTxBlock(): SuiTxBlock;
634
+ /**
635
+ * if derivePathParams is not provided or mnemonics is empty, it will return the keypair.
636
+ * else:
637
+ * it will generate signer from the mnemonic with the given derivePathParams.
638
+ * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
639
+ */
640
+ getKeypair(derivePathParams?: DerivePathParams): _mysten_sui_keypairs_ed25519.Ed25519Keypair;
641
+ /**
642
+ * @description Switch the current account with the given derivePathParams
643
+ * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
644
+ */
645
+ switchAccount(derivePathParams: DerivePathParams): void;
646
+ /**
647
+ * @description Get the address of the account for the given derivePathParams
648
+ * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
649
+ */
650
+ getAddress(derivePathParams?: DerivePathParams): string;
651
+ get currentAddress(): string;
652
+ getBalance(coinType?: string, derivePathParams?: DerivePathParams): Promise<_mysten_sui_client.SuiClientTypes.Balance>;
653
+ get client(): _mysten_sui_client.ClientWithCoreApi;
654
+ getObjects(objectIds: string[], options?: {
655
+ include?: SuiObjectDataOptions;
656
+ batchSize?: number;
657
+ switchClientDelay?: number;
658
+ }): Promise<SuiObjectData[]>;
659
+ /**
660
+ * @description Update objects in a batch
661
+ * @param suiObjects
662
+ */
663
+ updateObjects(suiObjects: (SuiSharedObject | SuiOwnedObject)[]): Promise<void>;
664
+ signTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<_mysten_sui_cryptography.SignatureWithBytes>;
665
+ signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
666
+ dryRunTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<SimulateTransactionResponse>;
667
+ /**
668
+ * Transfer the given amount of SUI to the recipient
669
+ * @param recipient
670
+ * @param amount
671
+ * @param derivePathParams
672
+ */
673
+ transferSui(recipient: string, amount: number, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
674
+ transferSui<S extends boolean>(recipient: string, amount: number, sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
675
+ /**
676
+ * Transfer to mutliple recipients
677
+ * @param recipients the recipients addresses
678
+ * @param amounts the amounts of SUI to transfer to each recipient, the length of amounts should be the same as the length of recipients
679
+ * @param derivePathParams
680
+ */
681
+ transferSuiToMany(recipients: string[], amounts: number[], derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
682
+ transferSuiToMany<S extends boolean>(recipients: string[], amounts: number[], sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
683
+ /**
684
+ * Transfer the given amounts of coin to multiple recipients
685
+ * @param recipients the list of recipient address
686
+ * @param amounts the amounts to transfer for each recipient
687
+ * @param coinType any custom coin type but not SUI
688
+ * @param derivePathParams the derive path params for the current signer
689
+ */
690
+ transferCoinToMany(recipients: string[], amounts: number[], coinType: string, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
691
+ transferCoinToMany<S extends boolean>(recipients: string[], amounts: number[], coinType: string, sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
692
+ transferCoin(recipient: string, amount: number, coinType: string, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
693
+ transferCoin<S extends boolean>(recipient: string, amount: number, coinType: string, sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
694
+ transferObjects(objects: SuiObjectArg[], recipient: string, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
695
+ transferObjects<S extends boolean>(objects: SuiObjectArg[], recipient: string, sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
696
+ moveCall(callParams: {
697
+ target: string;
698
+ arguments?: (SuiTxArg | SuiVecTxArg)[];
699
+ typeArguments?: string[];
700
+ derivePathParams?: DerivePathParams;
701
+ }): Promise<SuiTransactionBlockResponse>;
702
+ /**
703
+ * Select coins with the given amount and coin type, the total amount is greater than or equal to the given amount
704
+ * @param amount
705
+ * @param coinType
706
+ * @param owner
707
+ */
708
+ selectCoinsWithAmount(amount: number, coinType: string, owner?: string): Promise<{
709
+ objectId: string;
710
+ digest: string;
711
+ version: string;
712
+ balance: string;
713
+ }[]>;
714
+ /**
715
+ * stake the given amount of SUI to the validator
716
+ * @param amount the amount of SUI to stake
717
+ * @param validatorAddr the validator address
718
+ * @param sign whether to sign and send the transaction, default is true
719
+ * @param derivePathParams the derive path params for the current signer
720
+ */
721
+ stakeSui(amount: number, validatorAddr: string, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
722
+ stakeSui<S extends boolean>(amount: number, validatorAddr: string, sign?: S, derivePathParams?: DerivePathParams): Promise<SuiKitReturnType<S>>;
723
+ /**
724
+ * Execute the transaction with on-chain data but without really submitting. Useful for querying the effects of a transaction.
725
+ * Since the transaction is not submitted, its gas cost is not charged.
726
+ * @param tx the transaction to execute
727
+ * @param derivePathParams the derive path params
728
+ * @returns the effects and events of the transaction, such as object changes, gas cost, event emitted.
729
+ */
730
+ inspectTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<SimulateTransactionResponse>;
731
+ }
732
+
733
+ type PublicKeyWeightPair = {
734
+ publicKey: PublicKey;
735
+ weight: number;
736
+ };
737
+ declare class MultiSigClient {
738
+ readonly pksWeightPairs: PublicKeyWeightPair[];
739
+ readonly threshold: number;
740
+ readonly multiSigPublicKey: MultiSigPublicKey;
741
+ constructor(pks: PublicKeyWeightPair[], threshold: number);
742
+ static fromRawEd25519PublicKeys(rawPublicKeys: string[], weights: number[], threshold: number): MultiSigClient;
743
+ multiSigAddress(): string;
744
+ combinePartialSigs(sigs: string[]): string;
745
+ }
746
+
747
+ export { type AccountManagerParams, type DerivePathParams, MultiSigClient, type NetworkType, type ObjectCallArg, type PureCallArg, type SimulateTransactionResponse, SuiAccountManager, type SuiAddressArg, type SuiAmountsArg, type SuiBasicTypes, type SuiInputTypes, SuiInteractor, type SuiInteractorParams, SuiKit, type SuiKitParams, type SuiKitReturnType, type SuiObjectArg, type SuiTransactionBlockResponse, type SuiTransactionResult, type SuiTxArg, SuiTxBlock, type SuiVecTxArg, type TransactionPureArgument, type TransactionType, getFullnodeUrl };