@0xobelisk/sui-client 1.0.3 → 1.0.5
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/dubhe.d.ts +15 -6
- package/dist/index.js +378 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +378 -44
- package/dist/index.mjs.map +1 -1
- 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 +5 -0
- package/dist/libs/suiTxBuilder/index.d.ts +15 -3
- package/dist/types/index.d.ts +7 -17
- package/dist/utils/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/dubhe.ts +395 -50
- package/src/libs/suiInteractor/defaultConfig.ts +63 -0
- package/src/libs/suiInteractor/index.ts +2 -0
- package/src/libs/suiInteractor/suiInteractor.ts +26 -0
- package/src/types/index.ts +24 -16
- package/src/utils/index.ts +7 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NetworkType } from 'src/types';
|
|
2
|
+
export interface NetworkConfig {
|
|
3
|
+
fullNode: string;
|
|
4
|
+
graphql?: string;
|
|
5
|
+
network: string;
|
|
6
|
+
txExplorer: string;
|
|
7
|
+
accountExplorer: string;
|
|
8
|
+
explorer: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const getDefaultURL: (networkType?: NetworkType) => NetworkConfig;
|
|
@@ -17,6 +17,11 @@ export declare class SuiInteractor {
|
|
|
17
17
|
constructor(fullNodeUrls: string[], network?: NetworkType);
|
|
18
18
|
switchToNextClient(): void;
|
|
19
19
|
sendTx(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
|
|
20
|
+
waitForTransaction({ digest, timeout, pollInterval, }: {
|
|
21
|
+
digest: string;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
pollInterval?: number;
|
|
24
|
+
}): Promise<SuiTransactionBlockResponse>;
|
|
20
25
|
getObjects(ids: string[], options?: SuiObjectDataOptions): Promise<SuiObjectData[]>;
|
|
21
26
|
getObject(id: string): Promise<SuiObjectData>;
|
|
22
27
|
getDynamicFieldObject(parentId: string, name: RpcTypes.DynamicFieldName): Promise<RpcTypes.SuiObjectResponse>;
|
|
@@ -47,7 +47,7 @@ export declare class SuiTx {
|
|
|
47
47
|
resultIndex: number;
|
|
48
48
|
})[];
|
|
49
49
|
kind: "MoveCall";
|
|
50
|
-
target:
|
|
50
|
+
target: import("valibot").GenericSchema<`${string}::${string}::${string}`>;
|
|
51
51
|
} | {
|
|
52
52
|
address: {
|
|
53
53
|
kind: "Input";
|
|
@@ -336,9 +336,21 @@ export declare class SuiTx {
|
|
|
336
336
|
transferSuiToMany(recipients: SuiAddressArg[], amounts: (SuiTxArg | number | bigint)[]): this;
|
|
337
337
|
transferSui(address: SuiAddressArg, amount: SuiTxArg | number | bigint): this;
|
|
338
338
|
takeAmountFromCoins(coins: SuiObjectArg[], amount: SuiTxArg | number | bigint): TransactionObjectArgument[];
|
|
339
|
-
splitSUIFromGas(amounts: SuiAmountsArg[]):
|
|
339
|
+
splitSUIFromGas(amounts: SuiAmountsArg[]): {
|
|
340
|
+
$kind: "Result";
|
|
341
|
+
Result: number;
|
|
342
|
+
} & {
|
|
343
|
+
$kind: "NestedResult";
|
|
344
|
+
NestedResult: [number, number];
|
|
345
|
+
}[];
|
|
340
346
|
splitMultiCoins(coins: SuiObjectArg[], amounts: SuiAmountsArg[]): {
|
|
341
|
-
splitedCoins:
|
|
347
|
+
splitedCoins: {
|
|
348
|
+
$kind: "Result";
|
|
349
|
+
Result: number;
|
|
350
|
+
} & {
|
|
351
|
+
$kind: "NestedResult";
|
|
352
|
+
NestedResult: [number, number];
|
|
353
|
+
}[];
|
|
342
354
|
mergedCoin: TransactionObjectArgument;
|
|
343
355
|
};
|
|
344
356
|
transferCoinToMany(coins: SuiObjectArg[], sender: SuiAddressArg, recipients: SuiAddressArg[], amounts: SuiAmountsArg[]): this;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Infer } from 'superstruct';
|
|
|
2
2
|
import type { BcsType, SerializedBcs } from '@mysten/bcs';
|
|
3
3
|
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
4
4
|
import type { Transaction, TransactionObjectArgument, TransactionResult, Argument, Inputs } from '@mysten/sui/transactions';
|
|
5
|
-
import type { SuiMoveNormalizedModules, DevInspectResults, SuiTransactionBlockResponse, DisplayFieldsResponse,
|
|
5
|
+
import type { SuiMoveNormalizedModules, DevInspectResults, SuiTransactionBlockResponse, DisplayFieldsResponse, MoveStruct, SuiMoveNormalizedEnum, SuiMoveNormalizedStruct } from '@mysten/sui/client';
|
|
6
6
|
import { SuiTx } from '../libs/suiTxBuilder';
|
|
7
7
|
import { SuiMoveMoudleFuncType } from '../libs/suiContractFactory/types';
|
|
8
8
|
export declare const ObjectContentFields: import("superstruct").Struct<Record<string, any>, null>;
|
|
@@ -79,24 +79,14 @@ export type MapMessageTx = Record<string, ContractTx>;
|
|
|
79
79
|
export type MapMessageQuery = Record<string, ContractQuery>;
|
|
80
80
|
export type MapMoudleFuncTx = Record<string, MapMessageTx>;
|
|
81
81
|
export type MapMoudleFuncQuery = Record<string, MapMessageQuery>;
|
|
82
|
-
export type MoveStructValueType = {
|
|
83
|
-
fields: {
|
|
84
|
-
type: SuiMoveNormalizedType;
|
|
85
|
-
name: string;
|
|
86
|
-
}[];
|
|
87
|
-
abilities: {
|
|
88
|
-
abilities: string[];
|
|
89
|
-
};
|
|
90
|
-
typeParameters: {
|
|
91
|
-
constraints: {
|
|
92
|
-
abilities: string[];
|
|
93
|
-
};
|
|
94
|
-
isPhantom: boolean;
|
|
95
|
-
}[];
|
|
96
|
-
};
|
|
97
82
|
export type MoveStructType = {
|
|
98
83
|
objectId: string;
|
|
99
|
-
objectType:
|
|
84
|
+
objectType: SuiMoveNormalizedStruct;
|
|
85
|
+
objectName: string;
|
|
86
|
+
};
|
|
87
|
+
export type MoveEnumType = {
|
|
88
|
+
objectId: string;
|
|
89
|
+
objectType: SuiMoveNormalizedEnum;
|
|
100
90
|
objectName: string;
|
|
101
91
|
};
|
|
102
92
|
export type MapObjectStruct = Record<string, BcsType<any, any>>;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function capitalizeFirstLetter(input: string): string;
|
|
2
2
|
export declare function normalizeHexAddress(input: string): string | null;
|
|
3
3
|
export declare function numberToAddressHex(num: number): string;
|
|
4
|
+
export declare function normalizePackageId(input: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xobelisk/sui-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Tookit for interacting with move eps framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sui",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mysten/bcs": "^1.
|
|
41
|
-
"@mysten/sui": "^1.
|
|
40
|
+
"@mysten/bcs": "^1.2.1",
|
|
41
|
+
"@mysten/sui": "^1.19.0",
|
|
42
42
|
"@noble/curves": "^1.4.2",
|
|
43
43
|
"@noble/hashes": "^1.4.0",
|
|
44
44
|
"@scure/bip39": "^1.3.0",
|