@0xobelisk/sui-client 0.5.23 → 0.5.25
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/LICENSE +1 -1
- package/README.md +18 -18
- package/dist/{obelisk.d.ts → dubhe.d.ts} +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/package.json +4 -4
- package/src/{obelisk.ts → dubhe.ts} +8 -8
- package/src/index.ts +1 -1
- package/src/metadata/index.ts +3 -2
- package/src/types/index.ts +4 -4
|
@@ -16,8 +16,8 @@ import { SuiInteractor } from './libs/suiInteractor';
|
|
|
16
16
|
import {
|
|
17
17
|
MapObjectStruct,
|
|
18
18
|
MoveStructType,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
DubheObjectContent,
|
|
20
|
+
SuiDubheReturnType,
|
|
21
21
|
} from './types';
|
|
22
22
|
import { SuiContractFactory } from './libs/suiContractFactory';
|
|
23
23
|
import {
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
FaucetNetworkType,
|
|
32
32
|
MapMoudleFuncQuery,
|
|
33
33
|
MapMoudleFuncTx,
|
|
34
|
-
|
|
34
|
+
DubheParams,
|
|
35
35
|
SuiTxArg,
|
|
36
36
|
// SuiTxArgument,
|
|
37
37
|
SuiObjectArg,
|
|
@@ -101,10 +101,10 @@ function createTx(
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* @class
|
|
104
|
+
* @class Dubhe
|
|
105
105
|
* @description This class is used to aggregate the tools that used to interact with SUI network.
|
|
106
106
|
*/
|
|
107
|
-
export class
|
|
107
|
+
export class Dubhe {
|
|
108
108
|
public accountManager: SuiAccountManager;
|
|
109
109
|
public suiInteractor: SuiInteractor;
|
|
110
110
|
public contractFactory: SuiContractFactory;
|
|
@@ -159,7 +159,7 @@ export class Obelisk {
|
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
* Support the following ways to init the
|
|
162
|
+
* Support the following ways to init the DubheClient:
|
|
163
163
|
* 1. mnemonics
|
|
164
164
|
* 2. secretKey (base64 or hex)
|
|
165
165
|
* If none of them is provided, will generate a random mnemonics with 24 words.
|
|
@@ -177,7 +177,7 @@ export class Obelisk {
|
|
|
177
177
|
fullnodeUrls,
|
|
178
178
|
packageId,
|
|
179
179
|
metadata,
|
|
180
|
-
}:
|
|
180
|
+
}: DubheParams = {}) {
|
|
181
181
|
// Init the account manager
|
|
182
182
|
this.accountManager = new SuiAccountManager({ mnemonics, secretKey });
|
|
183
183
|
// Init the rpc provider
|
|
@@ -824,7 +824,7 @@ export class Obelisk {
|
|
|
824
824
|
const worldObject = await this.getObject(worldId);
|
|
825
825
|
const newObjectContent = worldObject.content;
|
|
826
826
|
if (newObjectContent != null) {
|
|
827
|
-
const objectContent = newObjectContent as
|
|
827
|
+
const objectContent = newObjectContent as DubheObjectContent;
|
|
828
828
|
const objectFields = objectContent.fields as Record<string, any>;
|
|
829
829
|
return objectFields['schema_names'];
|
|
830
830
|
} else {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from '@mysten/sui/keypairs/ed25519';
|
|
|
6
6
|
export * from '@mysten/sui/keypairs/secp256k1';
|
|
7
7
|
export * from '@mysten/sui/keypairs/secp256r1';
|
|
8
8
|
export { bcs, BcsType } from '@mysten/bcs';
|
|
9
|
-
export {
|
|
9
|
+
export { Dubhe } from './dubhe';
|
|
10
10
|
export { SuiAccountManager } from './libs/suiAccountManager';
|
|
11
11
|
export { SuiTx } from './libs/suiTxBuilder';
|
|
12
12
|
export { MultiSigClient } from './libs/multiSig';
|
package/src/metadata/index.ts
CHANGED
|
@@ -6,10 +6,11 @@ import { NetworkType } from '../types';
|
|
|
6
6
|
|
|
7
7
|
export async function loadMetadata(
|
|
8
8
|
networkType: NetworkType,
|
|
9
|
-
packageId: string
|
|
9
|
+
packageId: string,
|
|
10
|
+
fullnodeUrls?: string[]
|
|
10
11
|
) {
|
|
11
12
|
// Init the rpc provider
|
|
12
|
-
|
|
13
|
+
fullnodeUrls = fullnodeUrls || [getFullnodeUrl(networkType)];
|
|
13
14
|
const suiInteractor = new SuiInteractor(fullnodeUrls);
|
|
14
15
|
if (packageId !== undefined) {
|
|
15
16
|
const jsonData = await suiInteractor.getNormalizedMoveModulesByPackage(
|
package/src/types/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { SuiMoveMoudleFuncType } from '../libs/suiContractFactory/types';
|
|
|
25
25
|
export const ObjectContentFields = record(string(), any());
|
|
26
26
|
export type ObjectContentFields = Infer<typeof ObjectContentFields>;
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type DubheObjectData = {
|
|
29
29
|
objectId: string;
|
|
30
30
|
objectType: string;
|
|
31
31
|
objectVersion: number;
|
|
@@ -33,14 +33,14 @@ export type ObeliskObjectData = {
|
|
|
33
33
|
objectFields: ObjectContentFields;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export type
|
|
36
|
+
export type DubheObjectContent = {
|
|
37
37
|
dataType: 'moveObject';
|
|
38
38
|
fields: MoveStruct;
|
|
39
39
|
hasPublicTransfer: boolean;
|
|
40
40
|
type: string;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type DubheParams = {
|
|
44
44
|
mnemonics?: string;
|
|
45
45
|
secretKey?: string;
|
|
46
46
|
fullnodeUrls?: string[];
|
|
@@ -275,6 +275,6 @@ export type ObjectContent = {
|
|
|
275
275
|
dataType: string;
|
|
276
276
|
};
|
|
277
277
|
|
|
278
|
-
export type
|
|
278
|
+
export type SuiDubheReturnType<T extends boolean> = T extends true
|
|
279
279
|
? SuiTransactionBlockResponse
|
|
280
280
|
: SuiTx;
|