@0xobelisk/sui-client 0.5.17 → 0.5.19
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/dist/index.d.ts +9 -8
- package/dist/index.js +309 -208
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -201
- package/dist/index.mjs.map +1 -1
- package/dist/libs/multiSig/client.d.ts +2 -2
- package/dist/libs/multiSig/publickey.d.ts +1 -1
- package/dist/libs/suiAccountManager/index.d.ts +1 -1
- package/dist/libs/suiAccountManager/keypair.d.ts +1 -1
- package/dist/libs/suiContractFactory/index.d.ts +1 -1
- package/dist/libs/suiContractFactory/types.d.ts +1 -1
- package/dist/libs/suiInteractor/suiInteractor.d.ts +5 -5
- package/dist/libs/suiModel/suiOwnedObject.d.ts +2 -2
- package/dist/libs/suiModel/suiSharedObject.d.ts +1 -1
- package/dist/libs/suiTxBuilder/index.d.ts +365 -160
- package/dist/libs/suiTxBuilder/util.d.ts +8 -17
- package/dist/metadata/index.d.ts +1 -1
- package/dist/obelisk.d.ts +16 -12
- package/dist/types/index.d.ts +65 -15
- package/package.json +11 -8
- package/src/index.ts +9 -8
- package/src/libs/multiSig/client.ts +2 -2
- package/src/libs/multiSig/publickey.ts +3 -3
- package/src/libs/suiAccountManager/index.ts +2 -2
- package/src/libs/suiAccountManager/keypair.ts +1 -1
- package/src/libs/suiAccountManager/util.ts +1 -1
- package/src/libs/suiContractFactory/index.ts +1 -1
- package/src/libs/suiContractFactory/types.ts +1 -1
- package/src/libs/suiInteractor/index.ts +0 -1
- package/src/libs/suiInteractor/suiInteractor.ts +4 -4
- package/src/libs/suiModel/suiOwnedObject.ts +5 -3
- package/src/libs/suiModel/suiSharedObject.ts +4 -2
- package/src/libs/suiTxBuilder/index.ts +120 -108
- package/src/libs/suiTxBuilder/util.ts +55 -48
- package/src/metadata/index.ts +2 -3
- package/src/obelisk.ts +199 -90
- package/src/types/index.ts +82 -44
package/src/types/index.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import type { Infer } from 'superstruct';
|
|
2
2
|
import { any, record, string } from 'superstruct';
|
|
3
|
-
import type { SerializedBcs } from '@mysten/bcs';
|
|
4
|
-
import type { TransactionArgument } from '@mysten/sui
|
|
3
|
+
import type { BcsType, SerializedBcs } from '@mysten/bcs';
|
|
4
|
+
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
5
5
|
import type {
|
|
6
|
-
|
|
6
|
+
Transaction,
|
|
7
7
|
TransactionObjectArgument,
|
|
8
8
|
TransactionResult,
|
|
9
|
-
|
|
9
|
+
ObjectRef,
|
|
10
|
+
Argument,
|
|
11
|
+
Inputs,
|
|
12
|
+
} from '@mysten/sui/transactions';
|
|
10
13
|
import type {
|
|
11
|
-
SuiObjectRef,
|
|
12
14
|
SuiMoveNormalizedModules,
|
|
13
15
|
DevInspectResults,
|
|
14
16
|
SuiTransactionBlockResponse,
|
|
15
17
|
DisplayFieldsResponse,
|
|
18
|
+
SuiMoveNormalizedType,
|
|
16
19
|
MoveStruct,
|
|
17
|
-
} from '@mysten/sui
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
+
} from '@mysten/sui/client';
|
|
21
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
22
|
+
import { bcs as BCS } from '@mysten/bcs';
|
|
20
23
|
|
|
21
24
|
import { SuiMoveMoudleFuncType } from '../libs/suiContractFactory/types';
|
|
22
25
|
|
|
@@ -71,26 +74,6 @@ export type SchemaValueType = {
|
|
|
71
74
|
};
|
|
72
75
|
};
|
|
73
76
|
|
|
74
|
-
// export type SuiTxArgument =
|
|
75
|
-
// | {
|
|
76
|
-
// kind: 'Input';
|
|
77
|
-
// index: number;
|
|
78
|
-
// type?: 'object' | 'pure' | undefined;
|
|
79
|
-
// value?: any;
|
|
80
|
-
// }
|
|
81
|
-
// | {
|
|
82
|
-
// kind: 'GasCoin';
|
|
83
|
-
// }
|
|
84
|
-
// | {
|
|
85
|
-
// kind: 'Result';
|
|
86
|
-
// index: number;
|
|
87
|
-
// }
|
|
88
|
-
// | {
|
|
89
|
-
// kind: 'NestedResult';
|
|
90
|
-
// index: number;
|
|
91
|
-
// resultIndex: number;
|
|
92
|
-
// };
|
|
93
|
-
|
|
94
77
|
export type SchemaContentType = {
|
|
95
78
|
type: string;
|
|
96
79
|
fields: SchemaValueType;
|
|
@@ -104,7 +87,7 @@ export interface MessageMeta {
|
|
|
104
87
|
|
|
105
88
|
export interface ContractQuery extends MessageMeta {
|
|
106
89
|
(
|
|
107
|
-
tx:
|
|
90
|
+
tx: Transaction,
|
|
108
91
|
params: (TransactionArgument | SerializedBcs<any>)[],
|
|
109
92
|
typeArguments?: string[],
|
|
110
93
|
isRaw?: boolean
|
|
@@ -113,7 +96,7 @@ export interface ContractQuery extends MessageMeta {
|
|
|
113
96
|
|
|
114
97
|
export interface ContractTx extends MessageMeta {
|
|
115
98
|
(
|
|
116
|
-
tx:
|
|
99
|
+
tx: Transaction,
|
|
117
100
|
params: (TransactionArgument | SerializedBcs<any>)[],
|
|
118
101
|
typeArguments?: string[],
|
|
119
102
|
isRaw?: boolean
|
|
@@ -126,6 +109,36 @@ export type MapMessageQuery = Record<string, ContractQuery>;
|
|
|
126
109
|
export type MapMoudleFuncTx = Record<string, MapMessageTx>;
|
|
127
110
|
export type MapMoudleFuncQuery = Record<string, MapMessageQuery>;
|
|
128
111
|
|
|
112
|
+
type MoveStructType = {
|
|
113
|
+
struct: Record<
|
|
114
|
+
string,
|
|
115
|
+
{
|
|
116
|
+
fields: {
|
|
117
|
+
type: SuiMoveNormalizedType;
|
|
118
|
+
name: string;
|
|
119
|
+
}[];
|
|
120
|
+
abilities: {
|
|
121
|
+
abilities: string[];
|
|
122
|
+
};
|
|
123
|
+
typeParameters: {
|
|
124
|
+
constraints: {
|
|
125
|
+
abilities: string[];
|
|
126
|
+
};
|
|
127
|
+
isPhantom: boolean;
|
|
128
|
+
}[];
|
|
129
|
+
}
|
|
130
|
+
>;
|
|
131
|
+
bcs: BcsType<
|
|
132
|
+
{
|
|
133
|
+
[x: string]: any;
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
[x: string]: any;
|
|
137
|
+
}
|
|
138
|
+
>;
|
|
139
|
+
};
|
|
140
|
+
export type MapMoudleStruct = Record<string, MoveStructType>;
|
|
141
|
+
|
|
129
142
|
export type MapMoudleFuncTest = Record<string, Record<string, string>>;
|
|
130
143
|
export type MapMoudleFuncQueryTest = Record<string, Record<string, string>>;
|
|
131
144
|
|
|
@@ -160,11 +173,20 @@ export type ObjectData = {
|
|
|
160
173
|
objectDisplay: DisplayFieldsResponse;
|
|
161
174
|
objectFields: ObjectContentFields;
|
|
162
175
|
};
|
|
163
|
-
type TransactionBlockType = InstanceType<typeof
|
|
176
|
+
type TransactionBlockType = InstanceType<typeof Transaction>;
|
|
164
177
|
|
|
165
178
|
export type PureCallArg = {
|
|
166
179
|
Pure: number[];
|
|
167
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* An object argument.
|
|
184
|
+
*/
|
|
185
|
+
type ObjectArg =
|
|
186
|
+
| { ImmOrOwnedObject: SuiObjectRef }
|
|
187
|
+
| { SharedObject: SharedObjectRef }
|
|
188
|
+
| { Receiving: SuiObjectRef };
|
|
189
|
+
|
|
168
190
|
export type ObjectCallArg = {
|
|
169
191
|
Object: ObjectArg;
|
|
170
192
|
};
|
|
@@ -172,10 +194,10 @@ export type ObjectCallArg = {
|
|
|
172
194
|
export type TransactionType = Parameters<TransactionBlockType['add']>;
|
|
173
195
|
|
|
174
196
|
export type TransactionPureArgument = Extract<
|
|
175
|
-
|
|
197
|
+
Argument,
|
|
176
198
|
{
|
|
177
|
-
kind: 'Input';
|
|
178
|
-
type
|
|
199
|
+
$kind: 'Input';
|
|
200
|
+
type?: 'pure';
|
|
179
201
|
}
|
|
180
202
|
>;
|
|
181
203
|
|
|
@@ -193,25 +215,42 @@ export type EntityData = {
|
|
|
193
215
|
key: string;
|
|
194
216
|
};
|
|
195
217
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
218
|
+
type SharedObjectRef = {
|
|
219
|
+
/** Hex code as string representing the object id */
|
|
220
|
+
objectId: string;
|
|
221
|
+
|
|
222
|
+
/** The version the object was shared at */
|
|
223
|
+
initialSharedVersion: number | string;
|
|
224
|
+
|
|
225
|
+
/** Whether reference is mutable */
|
|
226
|
+
mutable: boolean;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
type SuiObjectRef = {
|
|
230
|
+
/** Base64 string representing the object digest */
|
|
231
|
+
objectId: string;
|
|
232
|
+
/** Object version */
|
|
233
|
+
version: number | string;
|
|
234
|
+
/** Hex code as string representing the object id */
|
|
235
|
+
digest: string;
|
|
236
|
+
};
|
|
201
237
|
|
|
202
|
-
export type SuiTxArg =
|
|
238
|
+
export type SuiTxArg = TransactionArgument | SerializedBcs<any>;
|
|
239
|
+
export type SuiAddressArg = Argument | SerializedBcs<any> | string;
|
|
240
|
+
export type SuiAmountsArg = SuiTxArg | number | bigint;
|
|
203
241
|
|
|
204
242
|
export type SuiObjectArg =
|
|
205
243
|
| TransactionObjectArgument
|
|
206
244
|
| string
|
|
207
|
-
|
|
|
208
|
-
|
|
|
245
|
+
| Parameters<typeof Inputs.ObjectRef>[0]
|
|
246
|
+
| Parameters<typeof Inputs.SharedObjectRef>[0]
|
|
209
247
|
| ObjectCallArg;
|
|
210
248
|
|
|
211
249
|
export type SuiVecTxArg =
|
|
212
250
|
| { value: SuiTxArg[]; vecType: SuiInputTypes }
|
|
213
251
|
| SuiTxArg[];
|
|
214
252
|
|
|
253
|
+
export type DryTxReturnValues = Array<[Uint8Array, string]>;
|
|
215
254
|
/**
|
|
216
255
|
* These are the basics types that can be used in the SUI
|
|
217
256
|
*/
|
|
@@ -223,8 +262,7 @@ export type SuiBasicTypes =
|
|
|
223
262
|
| 'u32'
|
|
224
263
|
| 'u64'
|
|
225
264
|
| 'u128'
|
|
226
|
-
| 'u256'
|
|
227
|
-
| 'signer';
|
|
265
|
+
| 'u256';
|
|
228
266
|
|
|
229
267
|
export type SuiInputTypes = 'object' | SuiBasicTypes;
|
|
230
268
|
|