@0xobelisk/sui-client 0.5.2 → 0.5.4

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 (47) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +343 -238
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +331 -245
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/libs/multiSig/client.d.ts +15 -0
  7. package/dist/libs/multiSig/index.d.ts +1 -0
  8. package/dist/libs/multiSig/publickey.d.ts +2 -0
  9. package/dist/libs/suiAccountManager/crypto.d.ts +1 -0
  10. package/dist/libs/suiAccountManager/index.d.ts +1 -1
  11. package/dist/libs/suiAccountManager/keypair.d.ts +1 -1
  12. package/dist/libs/suiAccountManager/util.d.ts +29 -0
  13. package/dist/libs/suiContractFactory/index.d.ts +20 -0
  14. package/dist/libs/suiContractFactory/types.d.ts +49 -0
  15. package/dist/libs/suiInteractor/index.d.ts +0 -1
  16. package/dist/libs/suiInteractor/suiInteractor.d.ts +17 -177
  17. package/dist/libs/suiInteractor/util.d.ts +1 -0
  18. package/dist/libs/suiModel/index.d.ts +2 -0
  19. package/dist/libs/suiModel/suiOwnedObject.d.ts +24 -0
  20. package/dist/libs/suiModel/suiSharedObject.d.ts +11 -0
  21. package/dist/libs/suiTxBuilder/index.d.ts +178 -374
  22. package/dist/libs/suiTxBuilder/util.d.ts +41 -59
  23. package/dist/metadata/index.d.ts +2 -33
  24. package/dist/obelisk.d.ts +20 -2454
  25. package/dist/types/index.d.ts +29 -7
  26. package/dist/utils/index.d.ts +3 -0
  27. package/package.json +22 -19
  28. package/src/index.ts +3 -1
  29. package/src/libs/multiSig/client.ts +44 -0
  30. package/src/libs/multiSig/index.ts +1 -0
  31. package/src/libs/multiSig/publickey.ts +11 -0
  32. package/src/libs/suiAccountManager/index.ts +1 -1
  33. package/src/libs/suiAccountManager/keypair.ts +1 -1
  34. package/src/libs/suiAccountManager/util.ts +1 -1
  35. package/src/libs/suiContractFactory/index.ts +1 -1
  36. package/src/libs/suiContractFactory/types.ts +2 -2
  37. package/src/libs/suiInteractor/index.ts +1 -1
  38. package/src/libs/suiInteractor/suiInteractor.ts +106 -111
  39. package/src/libs/suiModel/suiOwnedObject.ts +5 -10
  40. package/src/libs/suiModel/suiSharedObject.ts +4 -7
  41. package/src/libs/suiTxBuilder/index.ts +146 -100
  42. package/src/libs/suiTxBuilder/util.ts +145 -31
  43. package/src/metadata/index.ts +5 -3
  44. package/src/obelisk.ts +52 -37
  45. package/src/types/index.ts +54 -25
  46. package/dist/libs/suiInteractor/defaultConfig.d.ts +0 -10
  47. package/src/libs/suiInteractor/defaultConfig.ts +0 -32
@@ -1,5 +1,7 @@
1
- import { SuiTransactionBlockResponse, JsonRpcProvider, DynamicFieldName, SuiAddress } from '@mysten/sui.js';
2
- import { FaucetNetworkType, NetworkType, ObjectData } from '../../types';
1
+ import { SuiClient } from '@mysten/sui.js/client';
2
+ import type { SuiTransactionBlockResponse, SuiObjectDataOptions, SuiObjectData } from '@mysten/sui.js/client';
3
+ import type * as RpcTypes from '@mysten/sui.js/dist/cjs/client/types/generated';
4
+ import { FaucetNetworkType, NetworkType } from '../../types';
3
5
  import { SuiOwnedObject, SuiSharedObject } from '../suiModel';
4
6
  /**
5
7
  * `SuiTransactionSender` is used to send transaction with a given gas coin.
@@ -7,183 +9,21 @@ import { SuiOwnedObject, SuiSharedObject } from '../suiModel';
7
9
  * and update the gas coin after the transaction.
8
10
  */
9
11
  export declare class SuiInteractor {
10
- readonly providers: JsonRpcProvider[];
11
- currentProvider: JsonRpcProvider;
12
+ readonly clients: SuiClient[];
13
+ currentClient: SuiClient;
14
+ readonly fullNodes: string[];
15
+ currentFullNode: string;
12
16
  network?: NetworkType;
13
17
  constructor(fullNodeUrls: string[], network?: NetworkType);
14
- switchToNextProvider(): void;
18
+ switchToNextClient(): void;
15
19
  sendTx(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
16
- getObjects(ids: string[]): Promise<ObjectData[]>;
17
- getObject(id: string): Promise<ObjectData>;
18
- getDynamicFieldObject(parentId: string, name: string | DynamicFieldName): Promise<{
19
- data?: {
20
- objectId: string;
21
- version: string;
22
- digest: string;
23
- type?: string | null | undefined;
24
- bcs?: {
25
- type: string;
26
- version: string;
27
- hasPublicTransfer: boolean;
28
- dataType: "moveObject";
29
- bcsBytes: string;
30
- } | {
31
- id: string;
32
- dataType: "package";
33
- moduleMap: Record<string, string>;
34
- } | null | undefined;
35
- owner?: {
36
- AddressOwner: string;
37
- } | {
38
- ObjectOwner: string;
39
- } | {
40
- Shared: {
41
- initial_shared_version: string | null;
42
- };
43
- } | "Immutable" | null | undefined;
44
- storageRebate?: string | null | undefined;
45
- previousTransaction?: string | null | undefined;
46
- content?: {
47
- type: string;
48
- fields: Record<string, any>;
49
- hasPublicTransfer: boolean;
50
- dataType: "moveObject";
51
- } | {
52
- disassembled: Record<string, unknown>;
53
- dataType: "package";
54
- } | null | undefined;
55
- display?: Record<string, string> | {
56
- data?: Record<string, string> | null | undefined;
57
- error?: {
58
- code: string;
59
- version?: string | undefined;
60
- digest?: string | undefined;
61
- error?: string | undefined;
62
- object_id?: string | undefined;
63
- parent_object_id?: string | undefined;
64
- } | null | undefined;
65
- } | null | undefined;
66
- } | null | undefined;
67
- error?: {
68
- code: string;
69
- version?: string | undefined;
70
- digest?: string | undefined;
71
- error?: string | undefined;
72
- object_id?: string | undefined;
73
- parent_object_id?: string | undefined;
74
- } | null | undefined;
75
- }>;
76
- getDynamicFields(parentId: string, cursor?: string, limit?: number): Promise<{
77
- data: {
78
- type: "DynamicField" | "DynamicObject";
79
- objectType: string;
80
- objectId: string;
81
- version: number;
82
- digest: string;
83
- name: {
84
- type: string;
85
- value?: any;
86
- };
87
- bcsName: string;
88
- }[];
89
- nextCursor: string | null;
90
- hasNextPage: boolean;
91
- }>;
92
- getOwnedObjects(owner: SuiAddress, cursor?: string, limit?: number): Promise<{
93
- data: {
94
- data?: {
95
- objectId: string;
96
- version: string;
97
- digest: string;
98
- type?: string | null | undefined;
99
- bcs?: {
100
- type: string;
101
- version: string;
102
- hasPublicTransfer: boolean;
103
- dataType: "moveObject";
104
- bcsBytes: string;
105
- } | {
106
- id: string;
107
- dataType: "package";
108
- moduleMap: Record<string, string>;
109
- } | null | undefined;
110
- owner?: "Immutable" | {
111
- AddressOwner: string;
112
- } | {
113
- ObjectOwner: string;
114
- } | {
115
- Shared: {
116
- initial_shared_version: string | null;
117
- };
118
- } | null | undefined;
119
- storageRebate?: string | null | undefined;
120
- previousTransaction?: string | null | undefined;
121
- content?: {
122
- type: string;
123
- fields: Record<string, any>;
124
- hasPublicTransfer: boolean;
125
- dataType: "moveObject";
126
- } | {
127
- disassembled: Record<string, unknown>;
128
- dataType: "package";
129
- } | null | undefined;
130
- display?: Record<string, string> | {
131
- data?: Record<string, string> | null | undefined;
132
- error?: {
133
- code: string;
134
- version?: string | undefined;
135
- digest?: string | undefined;
136
- error?: string | undefined;
137
- object_id?: string | undefined;
138
- parent_object_id?: string | undefined;
139
- } | null | undefined;
140
- } | null | undefined;
141
- } | null | undefined;
142
- error?: {
143
- code: string;
144
- version?: string | undefined;
145
- digest?: string | undefined;
146
- error?: string | undefined;
147
- object_id?: string | undefined;
148
- parent_object_id?: string | undefined;
149
- } | null | undefined;
150
- }[];
151
- hasNextPage: boolean;
152
- nextCursor?: string | null | undefined;
153
- }>;
154
- getNormalizedMoveModulesByPackage(packageId: string): Promise<Record<string, {
155
- address: string;
156
- name: string;
157
- fileFormatVersion: number;
158
- friends: {
159
- address: string;
160
- name: string;
161
- }[];
162
- structs: Record<string, {
163
- fields: {
164
- type: import("@mysten/sui.js").SuiMoveNormalizedType;
165
- name: string;
166
- }[];
167
- abilities: {
168
- abilities: string[];
169
- };
170
- typeParameters: {
171
- constraints: {
172
- abilities: string[];
173
- };
174
- isPhantom: boolean;
175
- }[];
176
- }>;
177
- exposedFunctions: Record<string, {
178
- visibility: "Private" | "Public" | "Friend";
179
- isEntry: boolean;
180
- typeParameters: {
181
- abilities: string[];
182
- }[];
183
- parameters: import("@mysten/sui.js").SuiMoveNormalizedType[];
184
- return: import("@mysten/sui.js").SuiMoveNormalizedType[];
185
- }>;
186
- }>>;
20
+ getObjects(ids: string[], options?: SuiObjectDataOptions): Promise<SuiObjectData[]>;
21
+ getObject(id: string): Promise<SuiObjectData>;
22
+ getDynamicFieldObject(parentId: string, name: RpcTypes.DynamicFieldName): Promise<RpcTypes.SuiObjectResponse>;
23
+ getDynamicFields(parentId: string, cursor?: string, limit?: number): Promise<import("@mysten/sui.js/client").DynamicFieldPage>;
24
+ getTxDetails(digest: string): Promise<SuiTransactionBlockResponse>;
25
+ getOwnedObjects(owner: string, cursor?: string, limit?: number): Promise<RpcTypes.PaginatedObjectsResponse>;
26
+ getNormalizedMoveModulesByPackage(packageId: string): Promise<import("@mysten/sui.js/client").SuiMoveNormalizedModules>;
187
27
  /**
188
28
  * @description Update objects in a batch
189
29
  * @param suiObjects
@@ -200,5 +40,5 @@ export declare class SuiInteractor {
200
40
  digest: string;
201
41
  version: string;
202
42
  }[]>;
203
- requestFaucet(address: SuiAddress, network: FaucetNetworkType): Promise<void>;
43
+ requestFaucet(address: string, network: FaucetNetworkType): Promise<void>;
204
44
  }
@@ -0,0 +1 @@
1
+ export declare const delay: (ms: number) => Promise<unknown>;
@@ -0,0 +1,2 @@
1
+ export { SuiOwnedObject } from './suiOwnedObject';
2
+ export { SuiSharedObject } from './suiSharedObject';
@@ -0,0 +1,24 @@
1
+ import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client';
2
+ import type { CallArg } from '@mysten/sui.js/bcs';
3
+ export declare class SuiOwnedObject {
4
+ readonly objectId: string;
5
+ version?: string;
6
+ digest?: string;
7
+ constructor(param: {
8
+ objectId: string;
9
+ version?: string;
10
+ digest?: string;
11
+ });
12
+ /**
13
+ * Check if the object is fully initialized.
14
+ * So that when it's used as an input, it won't be necessary to fetch from fullnode again.
15
+ * Which can save time when sending transactions.
16
+ */
17
+ isFullObject(): boolean;
18
+ asCallArg(): CallArg | string;
19
+ /**
20
+ * Update object version & digest based on the transaction response.
21
+ * @param txResponse
22
+ */
23
+ updateFromTxResponse(txResponse: SuiTransactionBlockResponse): void;
24
+ }
@@ -0,0 +1,11 @@
1
+ import type { CallArg } from '@mysten/sui.js/bcs';
2
+ export declare class SuiSharedObject {
3
+ readonly objectId: string;
4
+ initialSharedVersion?: string;
5
+ constructor(param: {
6
+ objectId: string;
7
+ initialSharedVersion?: string;
8
+ mutable?: boolean;
9
+ });
10
+ asCallArg(mutable?: boolean): CallArg | string;
11
+ }