@0xobelisk/sui-client 1.0.4 → 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/index.js CHANGED
@@ -1019,6 +1019,12 @@ function numberToAddressHex(num) {
1019
1019
  const paddedHex = "0x" + hex.padStart(64, "0");
1020
1020
  return paddedHex;
1021
1021
  }
1022
+ function normalizePackageId(input) {
1023
+ const withPrefix = input.startsWith("0x") ? input : "0x" + input;
1024
+ const withoutPrefix = withPrefix.slice(2);
1025
+ const normalized = withoutPrefix.replace(/^0+/, "");
1026
+ return "0x" + normalized;
1027
+ }
1022
1028
 
1023
1029
  // src/dubhe.ts
1024
1030
  var import_bcs3 = require("@mysten/bcs");
@@ -1586,7 +1592,7 @@ var Dubhe = class {
1586
1592
  this.accountManager = new SuiAccountManager({ mnemonics, secretKey });
1587
1593
  fullnodeUrls = fullnodeUrls || [(0, import_client2.getFullnodeUrl)(networkType ?? "mainnet")];
1588
1594
  this.suiInteractor = new SuiInteractor(fullnodeUrls, networkType);
1589
- this.packageId = packageId;
1595
+ this.packageId = packageId ? normalizePackageId(packageId) : void 0;
1590
1596
  if (metadata !== void 0) {
1591
1597
  this.metadata = metadata;
1592
1598
  const maxLoopNum = 5;