@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 +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/dubhe.ts +6 -2
- package/src/utils/index.ts +7 -0
package/dist/index.mjs
CHANGED
|
@@ -986,6 +986,12 @@ function numberToAddressHex(num) {
|
|
|
986
986
|
const paddedHex = "0x" + hex.padStart(64, "0");
|
|
987
987
|
return paddedHex;
|
|
988
988
|
}
|
|
989
|
+
function normalizePackageId(input) {
|
|
990
|
+
const withPrefix = input.startsWith("0x") ? input : "0x" + input;
|
|
991
|
+
const withoutPrefix = withPrefix.slice(2);
|
|
992
|
+
const normalized = withoutPrefix.replace(/^0+/, "");
|
|
993
|
+
return "0x" + normalized;
|
|
994
|
+
}
|
|
989
995
|
|
|
990
996
|
// src/dubhe.ts
|
|
991
997
|
import { bcs as bcs2, fromHEX as fromHEX2, toHEX } from "@mysten/bcs";
|
|
@@ -1553,7 +1559,7 @@ var Dubhe = class {
|
|
|
1553
1559
|
this.accountManager = new SuiAccountManager({ mnemonics, secretKey });
|
|
1554
1560
|
fullnodeUrls = fullnodeUrls || [getFullnodeUrl(networkType ?? "mainnet")];
|
|
1555
1561
|
this.suiInteractor = new SuiInteractor(fullnodeUrls, networkType);
|
|
1556
|
-
this.packageId = packageId;
|
|
1562
|
+
this.packageId = packageId ? normalizePackageId(packageId) : void 0;
|
|
1557
1563
|
if (metadata !== void 0) {
|
|
1558
1564
|
this.metadata = metadata;
|
|
1559
1565
|
const maxLoopNum = 5;
|