@0xobelisk/sui-client 1.1.9 → 1.1.10

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 CHANGED
@@ -27,6 +27,7 @@ export declare class Dubhe {
27
27
  contractFactory: SuiContractFactory;
28
28
  packageId: string | undefined;
29
29
  metadata: SuiMoveNormalizedModules | undefined;
30
+ projectName: string | undefined;
30
31
  /**
31
32
  * Support the following ways to init the DubheClient:
32
33
  * 1. mnemonics
@@ -44,16 +45,18 @@ export declare class Dubhe {
44
45
  get tx(): MapMoudleFuncTx;
45
46
  get object(): MapObjectStruct;
46
47
  view(dryResult: DevInspectResults): any[];
47
- state({ tx, schema, params, }: {
48
+ state({ tx, schema, params, customModuleName, }: {
48
49
  tx: Transaction;
49
50
  schema: string;
50
51
  params: any[];
52
+ customModuleName?: string;
51
53
  }): Promise<any[] | undefined>;
52
- parseState({ schema, objectId, storageType, params, }: {
54
+ parseState({ schema, objectId, storageType, params, customModuleName, }: {
53
55
  schema: string;
54
56
  objectId: string;
55
57
  storageType: string;
56
58
  params: any[];
59
+ customModuleName?: string;
57
60
  }): Promise<any[] | undefined>;
58
61
  getTransactions({ first, after, sender, digest, checkpoint, orderBy, }: {
59
62
  first?: number;
package/dist/index.js CHANGED
@@ -2024,6 +2024,10 @@ var Dubhe = class {
2024
2024
  (moudlevalue) => {
2025
2025
  const data = moudlevalue;
2026
2026
  const moduleName = data.name;
2027
+ const itemModuleName = moduleName;
2028
+ if (itemModuleName.endsWith("_genesis")) {
2029
+ this.projectName = itemModuleName.replace("_genesis", "");
2030
+ }
2027
2031
  const objMoudleId = `${this.packageId}::${moduleName}`;
2028
2032
  if (data.enums) {
2029
2033
  Object.entries(data.enums).forEach(([enumName, enumType]) => {
@@ -2224,9 +2228,13 @@ var Dubhe = class {
2224
2228
  async state({
2225
2229
  tx,
2226
2230
  schema,
2227
- params
2231
+ params,
2232
+ customModuleName
2228
2233
  }) {
2229
- const moduleName = `schema`;
2234
+ if (!this.metadata) {
2235
+ throw new Error("Metadata is not loaded");
2236
+ }
2237
+ const moduleName = `${customModuleName ?? this.projectName}_schema`;
2230
2238
  const functionName = `get_${schema}`;
2231
2239
  let queryResponse = void 0;
2232
2240
  try {
@@ -2246,7 +2254,8 @@ var Dubhe = class {
2246
2254
  schema,
2247
2255
  objectId,
2248
2256
  storageType,
2249
- params
2257
+ params,
2258
+ customModuleName
2250
2259
  }) {
2251
2260
  const tx = new import_transactions3.Transaction();
2252
2261
  const schemaObject = tx.object(objectId);
@@ -2286,7 +2295,8 @@ var Dubhe = class {
2286
2295
  return this.state({
2287
2296
  tx,
2288
2297
  schema,
2289
- params: processedParams
2298
+ params: processedParams,
2299
+ customModuleName
2290
2300
  });
2291
2301
  }
2292
2302
  async getTransactions({