@0xobelisk/sui-client 0.5.27 → 0.5.29
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/README.md +89 -196
- package/dist/dubhe.d.ts +1 -2
- package/dist/errors/index.d.ts +7 -0
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -3
- package/dist/index.mjs.map +1 -1
- package/dist/libs/suiTxBuilder/index.d.ts +6 -6
- package/dist/libs/suiTxBuilder/util.d.ts +1 -1
- package/dist/types/index.d.ts +14 -2
- package/package.json +1 -1
- package/src/dubhe.ts +28 -17
- package/src/errors/index.ts +31 -0
- package/src/types/index.ts +24 -12
package/dist/index.mjs
CHANGED
|
@@ -913,6 +913,31 @@ function numberToAddressHex(num) {
|
|
|
913
913
|
|
|
914
914
|
// src/dubhe.ts
|
|
915
915
|
import { bcs as bcs2, fromHEX as fromHEX2, toHEX } from "@mysten/bcs";
|
|
916
|
+
|
|
917
|
+
// src/errors/index.ts
|
|
918
|
+
var ContractDataParsingError = class extends Error {
|
|
919
|
+
constructor(dryResult) {
|
|
920
|
+
const error = dryResult?.effects?.status?.error || "";
|
|
921
|
+
const functionMatch = error ? error.match(/function_name: Some\("([^"]+)"\)/) : null;
|
|
922
|
+
const moduleMatch = error ? error.match(/address: ([a-fA-F0-9]+)/) : null;
|
|
923
|
+
const functionName = functionMatch ? functionMatch[1] : "unknown";
|
|
924
|
+
const moduleAddress = moduleMatch ? "0x" + moduleMatch[1] : "unknown";
|
|
925
|
+
const errorMessage = dryResult.error ? dryResult.error : "UNKNOWN_ERROR";
|
|
926
|
+
const message = [
|
|
927
|
+
`
|
|
928
|
+
- Function: ${functionName}`,
|
|
929
|
+
`- Module Address: ${moduleAddress}`,
|
|
930
|
+
`- Error Message: ${errorMessage}`
|
|
931
|
+
].join("\n");
|
|
932
|
+
super(message);
|
|
933
|
+
this.errorType = "ContractDataParsingError";
|
|
934
|
+
this.functionName = functionName;
|
|
935
|
+
this.moduleAddress = moduleAddress;
|
|
936
|
+
this.errorMessage = errorMessage;
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// src/dubhe.ts
|
|
916
941
|
function isUndefined(value) {
|
|
917
942
|
return value === void 0;
|
|
918
943
|
}
|
|
@@ -923,7 +948,12 @@ function withMeta(meta, creator) {
|
|
|
923
948
|
function createQuery(meta, fn) {
|
|
924
949
|
return withMeta(
|
|
925
950
|
meta,
|
|
926
|
-
async (
|
|
951
|
+
async ({
|
|
952
|
+
tx,
|
|
953
|
+
params,
|
|
954
|
+
typeArguments,
|
|
955
|
+
isRaw
|
|
956
|
+
}) => {
|
|
927
957
|
const result = await fn(tx, params, typeArguments, isRaw);
|
|
928
958
|
return result;
|
|
929
959
|
}
|
|
@@ -932,7 +962,12 @@ function createQuery(meta, fn) {
|
|
|
932
962
|
function createTx(meta, fn) {
|
|
933
963
|
return withMeta(
|
|
934
964
|
meta,
|
|
935
|
-
async (
|
|
965
|
+
async ({
|
|
966
|
+
tx,
|
|
967
|
+
params,
|
|
968
|
+
typeArguments,
|
|
969
|
+
isRaw
|
|
970
|
+
}) => {
|
|
936
971
|
return await fn(tx, params, typeArguments, isRaw);
|
|
937
972
|
}
|
|
938
973
|
);
|
|
@@ -1343,7 +1378,7 @@ var Dubhe = class {
|
|
|
1343
1378
|
}
|
|
1344
1379
|
return returnValues;
|
|
1345
1380
|
} else {
|
|
1346
|
-
|
|
1381
|
+
throw new ContractDataParsingError(dryResult);
|
|
1347
1382
|
}
|
|
1348
1383
|
}
|
|
1349
1384
|
/**
|