@scallop-io/sui-kit 2.0.1 → 2.2.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.
- package/README.md +6 -6
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +69 -69
- package/dist/index.d.ts +69 -69
- package/dist/index.js +7 -7
- package/package.json +164 -161
- package/src/index.ts +11 -11
- package/src/libs/multiSig/client.ts +35 -35
- package/src/libs/multiSig/index.ts +1 -1
- package/src/libs/multiSig/publickey.ts +8 -8
- package/src/libs/suiAccountManager/crypto.ts +4 -4
- package/src/libs/suiAccountManager/index.ts +82 -82
- package/src/libs/suiAccountManager/keypair.ts +13 -13
- package/src/libs/suiAccountManager/util.ts +20 -20
- package/src/libs/suiInteractor/index.ts +6 -6
- package/src/libs/suiInteractor/suiInteractor.ts +279 -272
- package/src/libs/suiInteractor/util.ts +6 -6
- package/src/libs/suiModel/index.ts +2 -2
- package/src/libs/suiModel/suiOwnedObject.ts +57 -57
- package/src/libs/suiModel/suiSharedObject.ts +27 -27
- package/src/libs/suiTxBuilder/index.ts +303 -302
- package/src/libs/suiTxBuilder/util.ts +185 -183
- package/src/suiKit.ts +422 -410
- package/src/types/index.ts +71 -76
package/src/types/index.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
+
import type { SerializedBcs } from "@mysten/bcs";
|
|
2
|
+
import type { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
|
|
1
3
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import type {
|
|
9
|
-
import type { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';
|
|
10
|
-
import { SuiTxBlock } from 'src/libs/suiTxBuilder/index.js';
|
|
4
|
+
Argument,
|
|
5
|
+
Inputs,
|
|
6
|
+
Transaction,
|
|
7
|
+
TransactionArgument,
|
|
8
|
+
TransactionObjectArgument,
|
|
9
|
+
} from "@mysten/sui/transactions";
|
|
10
|
+
import type { SuiTxBlock } from "src/libs/suiTxBuilder/index.js";
|
|
11
11
|
|
|
12
12
|
export type SuiKitParams = (AccountManagerParams & {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
faucetUrl?: string;
|
|
14
|
+
networkType?: NetworkType;
|
|
15
15
|
}) &
|
|
16
|
-
|
|
16
|
+
Partial<SuiInteractorParams>;
|
|
17
17
|
|
|
18
18
|
export type SuiInteractorParams =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
| {
|
|
20
|
+
fullnodeUrls: string[];
|
|
21
|
+
network?: NetworkType;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
suiClients: ClientWithCoreApi[];
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
-
export type NetworkType =
|
|
27
|
+
export type NetworkType = "testnet" | "mainnet" | "devnet" | "localnet";
|
|
28
28
|
|
|
29
29
|
export type AccountManagerParams = {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
mnemonics?: string;
|
|
31
|
+
secretKey?: string;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export type DerivePathParams = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
accountIndex?: number;
|
|
36
|
+
isExternal?: boolean;
|
|
37
|
+
addressIndex?: number;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
type TransactionBlockType = InstanceType<typeof Transaction>;
|
|
41
41
|
|
|
42
42
|
export type PureCallArg = {
|
|
43
|
-
|
|
43
|
+
Pure: number[];
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
type SharedObjectRef = {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
/** Hex code as string representing the object id */
|
|
48
|
+
objectId: string;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/** The version the object was shared at */
|
|
51
|
+
initialSharedVersion: number | string;
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/** Whether reference is mutable */
|
|
54
|
+
mutable: boolean;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
type SuiObjectRef = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
/** Base64 string representing the object digest */
|
|
59
|
+
objectId: string;
|
|
60
|
+
/** Object version */
|
|
61
|
+
version: number | string;
|
|
62
|
+
/** Hex code as string representing the object id */
|
|
63
|
+
digest: string;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* An object argument.
|
|
68
68
|
*/
|
|
69
69
|
type ObjectArg =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
| { ImmOrOwnedObject: SuiObjectRef }
|
|
71
|
+
| { SharedObject: SharedObjectRef }
|
|
72
|
+
| { Receiving: SuiObjectRef };
|
|
73
73
|
|
|
74
74
|
export type ObjectCallArg = {
|
|
75
|
-
|
|
75
|
+
Object: ObjectArg;
|
|
76
76
|
};
|
|
77
|
-
export type TransactionType = Parameters<TransactionBlockType[
|
|
77
|
+
export type TransactionType = Parameters<TransactionBlockType["add"]>;
|
|
78
78
|
|
|
79
79
|
export type TransactionPureArgument = Extract<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
Argument,
|
|
81
|
+
{
|
|
82
|
+
$kind: "Input";
|
|
83
|
+
type?: "pure";
|
|
84
|
+
}
|
|
85
85
|
>;
|
|
86
86
|
|
|
87
87
|
export type SuiTxArg = TransactionArgument | SerializedBcs<any>;
|
|
@@ -89,44 +89,39 @@ export type SuiAddressArg = Argument | SerializedBcs<any> | string;
|
|
|
89
89
|
export type SuiAmountsArg = SuiTxArg | number | bigint;
|
|
90
90
|
|
|
91
91
|
export type SuiObjectArg =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
| TransactionObjectArgument
|
|
93
|
+
| string
|
|
94
|
+
| Parameters<typeof Inputs.ObjectRef>[0]
|
|
95
|
+
| Parameters<typeof Inputs.SharedObjectRef>[0]
|
|
96
|
+
| ObjectCallArg;
|
|
97
97
|
|
|
98
98
|
export type SuiVecTxArg =
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
| { value: SuiTxArg[]; vecType: SuiInputTypes }
|
|
100
|
+
| SuiTxArg[];
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* These are the basics types that can be used in the SUI
|
|
104
104
|
*/
|
|
105
105
|
export type SuiBasicTypes =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
export type SuiInputTypes =
|
|
116
|
-
|
|
117
|
-
// Transaction result type from SDK v2
|
|
118
|
-
export type SuiTransactionResult<
|
|
119
|
-
Include extends SuiClientTypes.TransactionInclude = {},
|
|
120
|
-
> = SuiClientTypes.TransactionResult<Include>;
|
|
106
|
+
| "address"
|
|
107
|
+
| "bool"
|
|
108
|
+
| "u8"
|
|
109
|
+
| "u16"
|
|
110
|
+
| "u32"
|
|
111
|
+
| "u64"
|
|
112
|
+
| "u128"
|
|
113
|
+
| "u256";
|
|
114
|
+
|
|
115
|
+
export type SuiInputTypes = "object" | SuiBasicTypes;
|
|
121
116
|
|
|
122
117
|
// Full transaction response with all includes enabled
|
|
123
118
|
export type SuiTransactionBlockResponse = SuiClientTypes.TransactionResult<{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
balanceChanges: true;
|
|
120
|
+
effects: true;
|
|
121
|
+
events: true;
|
|
122
|
+
objectTypes: true;
|
|
128
123
|
}>;
|
|
129
124
|
|
|
130
125
|
export type SuiKitReturnType<T extends boolean> = T extends true
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
? SuiTransactionBlockResponse
|
|
127
|
+
: SuiTxBlock;
|