@0xobelisk/client 0.3.0 → 0.3.2
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 -0
- package/dist/index.js +68 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -108
- package/dist/index.mjs.map +1 -1
- package/dist/libs/suiAccountManager/index.d.ts +35 -0
- package/dist/libs/suiAccountManager/keypair.d.ts +21 -0
- package/dist/libs/suiInteractor/defaultConfig.d.ts +10 -0
- package/dist/libs/suiInteractor/index.d.ts +2 -0
- package/dist/libs/suiInteractor/suiInteractor.d.ts +205 -0
- package/dist/libs/suiTxBuilder/index.d.ts +544 -0
- package/dist/libs/suiTxBuilder/util.d.ts +76 -0
- package/dist/metadata/index.d.ts +34 -0
- package/dist/obelisk.d.ts +2566 -0
- package/dist/types/index.d.ts +141 -0
- package/package.json +1 -1
- package/src/obelisk.ts +92 -151
- package/src/types/index.ts +13 -6
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { SuiTransactionBlockResponse, JsonRpcProvider, DynamicFieldName, SuiAddress } from '@mysten/sui.js';
|
|
2
|
+
import { FaucetNetworkType, NetworkType, ObjectData, EntityData } from 'src/types';
|
|
3
|
+
import { SuiOwnedObject, SuiSharedObject } from '../suiModel';
|
|
4
|
+
/**
|
|
5
|
+
* `SuiTransactionSender` is used to send transaction with a given gas coin.
|
|
6
|
+
* It always uses the gas coin to pay for the gas,
|
|
7
|
+
* and update the gas coin after the transaction.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SuiInteractor {
|
|
10
|
+
readonly providers: JsonRpcProvider[];
|
|
11
|
+
currentProvider: JsonRpcProvider;
|
|
12
|
+
network?: NetworkType;
|
|
13
|
+
constructor(fullNodeUrls: string[], network?: NetworkType);
|
|
14
|
+
switchToNextProvider(): void;
|
|
15
|
+
sendTx(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
|
|
16
|
+
getObjects(ids: string[]): Promise<ObjectData[]>;
|
|
17
|
+
getObject(id: string): Promise<ObjectData>;
|
|
18
|
+
getEntitiesObjects(ids: string[]): Promise<EntityData[]>;
|
|
19
|
+
getDynamicFieldObject(parentId: string, name: string | DynamicFieldName): Promise<{
|
|
20
|
+
data?: {
|
|
21
|
+
objectId: string;
|
|
22
|
+
version: string;
|
|
23
|
+
digest: string;
|
|
24
|
+
type?: string | null | undefined;
|
|
25
|
+
bcs?: {
|
|
26
|
+
type: string;
|
|
27
|
+
version: string;
|
|
28
|
+
hasPublicTransfer: boolean;
|
|
29
|
+
dataType: "moveObject";
|
|
30
|
+
bcsBytes: string;
|
|
31
|
+
} | {
|
|
32
|
+
id: string;
|
|
33
|
+
dataType: "package";
|
|
34
|
+
moduleMap: Record<string, string>;
|
|
35
|
+
} | null | undefined;
|
|
36
|
+
owner?: {
|
|
37
|
+
AddressOwner: string;
|
|
38
|
+
} | {
|
|
39
|
+
ObjectOwner: string;
|
|
40
|
+
} | {
|
|
41
|
+
Shared: {
|
|
42
|
+
initial_shared_version: string | null;
|
|
43
|
+
};
|
|
44
|
+
} | "Immutable" | null | undefined;
|
|
45
|
+
storageRebate?: string | null | undefined;
|
|
46
|
+
previousTransaction?: string | null | undefined;
|
|
47
|
+
content?: {
|
|
48
|
+
type: string;
|
|
49
|
+
fields: Record<string, any>;
|
|
50
|
+
hasPublicTransfer: boolean;
|
|
51
|
+
dataType: "moveObject";
|
|
52
|
+
} | {
|
|
53
|
+
disassembled: Record<string, unknown>;
|
|
54
|
+
dataType: "package";
|
|
55
|
+
} | null | undefined;
|
|
56
|
+
display?: Record<string, string> | {
|
|
57
|
+
data?: Record<string, string> | null | undefined;
|
|
58
|
+
error?: {
|
|
59
|
+
code: string;
|
|
60
|
+
version?: string | undefined;
|
|
61
|
+
digest?: string | undefined;
|
|
62
|
+
error?: string | undefined;
|
|
63
|
+
object_id?: string | undefined;
|
|
64
|
+
parent_object_id?: string | undefined;
|
|
65
|
+
} | null | undefined;
|
|
66
|
+
} | null | undefined;
|
|
67
|
+
} | null | undefined;
|
|
68
|
+
error?: {
|
|
69
|
+
code: string;
|
|
70
|
+
version?: string | undefined;
|
|
71
|
+
digest?: string | undefined;
|
|
72
|
+
error?: string | undefined;
|
|
73
|
+
object_id?: string | undefined;
|
|
74
|
+
parent_object_id?: string | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
getDynamicFields(parentId: string, cursor?: string, limit?: number): Promise<{
|
|
78
|
+
data: {
|
|
79
|
+
type: "DynamicField" | "DynamicObject";
|
|
80
|
+
objectType: string;
|
|
81
|
+
objectId: string;
|
|
82
|
+
version: number;
|
|
83
|
+
digest: string;
|
|
84
|
+
name: {
|
|
85
|
+
type: string;
|
|
86
|
+
value?: any;
|
|
87
|
+
};
|
|
88
|
+
bcsName: string;
|
|
89
|
+
}[];
|
|
90
|
+
nextCursor: string | null;
|
|
91
|
+
hasNextPage: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
getOwnedObjects(owner: SuiAddress, cursor?: string, limit?: number): Promise<{
|
|
94
|
+
data: {
|
|
95
|
+
data?: {
|
|
96
|
+
objectId: string;
|
|
97
|
+
version: string;
|
|
98
|
+
digest: string;
|
|
99
|
+
type?: string | null | undefined;
|
|
100
|
+
bcs?: {
|
|
101
|
+
type: string;
|
|
102
|
+
version: string;
|
|
103
|
+
hasPublicTransfer: boolean;
|
|
104
|
+
dataType: "moveObject";
|
|
105
|
+
bcsBytes: string;
|
|
106
|
+
} | {
|
|
107
|
+
id: string;
|
|
108
|
+
dataType: "package";
|
|
109
|
+
moduleMap: Record<string, string>;
|
|
110
|
+
} | null | undefined;
|
|
111
|
+
owner?: "Immutable" | {
|
|
112
|
+
AddressOwner: string;
|
|
113
|
+
} | {
|
|
114
|
+
ObjectOwner: string;
|
|
115
|
+
} | {
|
|
116
|
+
Shared: {
|
|
117
|
+
initial_shared_version: string | null;
|
|
118
|
+
};
|
|
119
|
+
} | null | undefined;
|
|
120
|
+
storageRebate?: string | null | undefined;
|
|
121
|
+
previousTransaction?: string | null | undefined;
|
|
122
|
+
content?: {
|
|
123
|
+
type: string;
|
|
124
|
+
fields: Record<string, any>;
|
|
125
|
+
hasPublicTransfer: boolean;
|
|
126
|
+
dataType: "moveObject";
|
|
127
|
+
} | {
|
|
128
|
+
disassembled: Record<string, unknown>;
|
|
129
|
+
dataType: "package";
|
|
130
|
+
} | null | undefined;
|
|
131
|
+
display?: Record<string, string> | {
|
|
132
|
+
data?: Record<string, string> | null | undefined;
|
|
133
|
+
error?: {
|
|
134
|
+
code: string;
|
|
135
|
+
version?: string | undefined;
|
|
136
|
+
digest?: string | undefined;
|
|
137
|
+
error?: string | undefined;
|
|
138
|
+
object_id?: string | undefined;
|
|
139
|
+
parent_object_id?: string | undefined;
|
|
140
|
+
} | null | undefined;
|
|
141
|
+
} | null | undefined;
|
|
142
|
+
} | null | undefined;
|
|
143
|
+
error?: {
|
|
144
|
+
code: string;
|
|
145
|
+
version?: string | undefined;
|
|
146
|
+
digest?: string | undefined;
|
|
147
|
+
error?: string | undefined;
|
|
148
|
+
object_id?: string | undefined;
|
|
149
|
+
parent_object_id?: string | undefined;
|
|
150
|
+
} | null | undefined;
|
|
151
|
+
}[];
|
|
152
|
+
hasNextPage: boolean;
|
|
153
|
+
nextCursor?: string | null | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
getNormalizedMoveModulesByPackage(packageId: string): Promise<Record<string, {
|
|
156
|
+
address: string;
|
|
157
|
+
name: string;
|
|
158
|
+
fileFormatVersion: number;
|
|
159
|
+
friends: {
|
|
160
|
+
address: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}[];
|
|
163
|
+
structs: Record<string, {
|
|
164
|
+
fields: {
|
|
165
|
+
type: import("@mysten/sui.js").SuiMoveNormalizedType;
|
|
166
|
+
name: string;
|
|
167
|
+
}[];
|
|
168
|
+
abilities: {
|
|
169
|
+
abilities: string[];
|
|
170
|
+
};
|
|
171
|
+
typeParameters: {
|
|
172
|
+
constraints: {
|
|
173
|
+
abilities: string[];
|
|
174
|
+
};
|
|
175
|
+
isPhantom: boolean;
|
|
176
|
+
}[];
|
|
177
|
+
}>;
|
|
178
|
+
exposedFunctions: Record<string, {
|
|
179
|
+
visibility: "Private" | "Public" | "Friend";
|
|
180
|
+
isEntry: boolean;
|
|
181
|
+
typeParameters: {
|
|
182
|
+
abilities: string[];
|
|
183
|
+
}[];
|
|
184
|
+
parameters: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
185
|
+
return: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
186
|
+
}>;
|
|
187
|
+
}>>;
|
|
188
|
+
/**
|
|
189
|
+
* @description Update objects in a batch
|
|
190
|
+
* @param suiObjects
|
|
191
|
+
*/
|
|
192
|
+
updateObjects(suiObjects: (SuiOwnedObject | SuiSharedObject)[]): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* @description Select coins that add up to the given amount.
|
|
195
|
+
* @param addr the address of the owner
|
|
196
|
+
* @param amount the amount that is needed for the coin
|
|
197
|
+
* @param coinType the coin type, default is '0x2::SUI::SUI'
|
|
198
|
+
*/
|
|
199
|
+
selectCoins(addr: string, amount: number, coinType?: string): Promise<{
|
|
200
|
+
objectId: string;
|
|
201
|
+
digest: string;
|
|
202
|
+
version: string;
|
|
203
|
+
}[]>;
|
|
204
|
+
requestFaucet(address: SuiAddress, network: FaucetNetworkType): Promise<void>;
|
|
205
|
+
}
|