@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
package/src/types/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type {
|
|
|
17
17
|
DisplayFieldsResponse,
|
|
18
18
|
SuiMoveNormalizedType,
|
|
19
19
|
MoveStruct,
|
|
20
|
+
SuiMoveNormalizedEnum,
|
|
21
|
+
SuiMoveNormalizedStruct,
|
|
20
22
|
} from '@mysten/sui/client';
|
|
21
23
|
import { SuiTx } from '../libs/suiTxBuilder';
|
|
22
24
|
|
|
@@ -118,24 +120,30 @@ export type MapMessageQuery = Record<string, ContractQuery>;
|
|
|
118
120
|
export type MapMoudleFuncTx = Record<string, MapMessageTx>;
|
|
119
121
|
export type MapMoudleFuncQuery = Record<string, MapMessageQuery>;
|
|
120
122
|
|
|
121
|
-
export type MoveStructValueType = {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
123
|
+
// export type MoveStructValueType = {
|
|
124
|
+
// fields: {
|
|
125
|
+
// type: SuiMoveNormalizedType;
|
|
126
|
+
// name: string;
|
|
127
|
+
// }[];
|
|
128
|
+
// abilities: {
|
|
129
|
+
// abilities: string[];
|
|
130
|
+
// };
|
|
131
|
+
// typeParameters: {
|
|
132
|
+
// constraints: {
|
|
133
|
+
// abilities: string[];
|
|
134
|
+
// };
|
|
135
|
+
// isPhantom: boolean;
|
|
136
|
+
// }[];
|
|
137
|
+
// };
|
|
136
138
|
export type MoveStructType = {
|
|
137
139
|
objectId: string;
|
|
138
|
-
objectType:
|
|
140
|
+
objectType: SuiMoveNormalizedStruct;
|
|
141
|
+
objectName: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type MoveEnumType = {
|
|
145
|
+
objectId: string;
|
|
146
|
+
objectType: SuiMoveNormalizedEnum;
|
|
139
147
|
objectName: string;
|
|
140
148
|
};
|
|
141
149
|
|
package/src/utils/index.ts
CHANGED
|
@@ -21,3 +21,10 @@ export function numberToAddressHex(num: number): string {
|
|
|
21
21
|
const paddedHex = '0x' + hex.padStart(64, '0');
|
|
22
22
|
return paddedHex;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
export function normalizePackageId(input: string): string {
|
|
26
|
+
const withPrefix = input.startsWith('0x') ? input : '0x' + input;
|
|
27
|
+
const withoutPrefix = withPrefix.slice(2);
|
|
28
|
+
const normalized = withoutPrefix.replace(/^0+/, '');
|
|
29
|
+
return '0x' + normalized;
|
|
30
|
+
}
|