@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.
@@ -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
- fields: {
123
- type: SuiMoveNormalizedType;
124
- name: string;
125
- }[];
126
- abilities: {
127
- abilities: string[];
128
- };
129
- typeParameters: {
130
- constraints: {
131
- abilities: string[];
132
- };
133
- isPhantom: boolean;
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: MoveStructValueType;
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
 
@@ -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
+ }