@0xobelisk/sui-client 1.1.6 → 1.1.7
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 +20 -15
- package/dist/dubhe.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -12
- package/dist/index.mjs.map +1 -1
- package/dist/libs/http/http.d.ts +2 -1
- package/dist/libs/suiIndexerClient/index.d.ts +6 -1
- package/dist/types/index.d.ts +9 -0
- package/package.json +9 -8
- package/src/dubhe.ts +3 -2
- package/src/index.ts +1 -0
- package/src/libs/http/errors.ts +5 -1
- package/src/libs/http/http.ts +3 -5
- package/src/libs/suiIndexerClient/index.ts +8 -2
- package/src/metadata/index.ts +2 -3
- package/src/types/index.ts +5 -0
package/dist/index.mjs
CHANGED
|
@@ -1089,6 +1089,11 @@ var parseValue = (value) => {
|
|
|
1089
1089
|
};
|
|
1090
1090
|
|
|
1091
1091
|
// src/libs/suiIndexerClient/index.ts
|
|
1092
|
+
var SubscriptionKind = /* @__PURE__ */ ((SubscriptionKind2) => {
|
|
1093
|
+
SubscriptionKind2["Event"] = "event";
|
|
1094
|
+
SubscriptionKind2["Schema"] = "schema";
|
|
1095
|
+
return SubscriptionKind2;
|
|
1096
|
+
})(SubscriptionKind || {});
|
|
1092
1097
|
var SuiIndexerClient = class {
|
|
1093
1098
|
constructor(http) {
|
|
1094
1099
|
this.http = http;
|
|
@@ -1262,8 +1267,8 @@ var SuiIndexerClient = class {
|
|
|
1262
1267
|
value: result
|
|
1263
1268
|
};
|
|
1264
1269
|
}
|
|
1265
|
-
async subscribe(
|
|
1266
|
-
return this.http.subscribe(
|
|
1270
|
+
async subscribe(types, handleData) {
|
|
1271
|
+
return this.http.subscribe(types, handleData);
|
|
1267
1272
|
}
|
|
1268
1273
|
};
|
|
1269
1274
|
|
|
@@ -1401,14 +1406,11 @@ var Http = class {
|
|
|
1401
1406
|
);
|
|
1402
1407
|
}
|
|
1403
1408
|
}
|
|
1404
|
-
async subscribe(
|
|
1409
|
+
async subscribe(types, handleData) {
|
|
1405
1410
|
const ws = createWebSocketClient(this.wsEndpoint);
|
|
1406
1411
|
ws.onopen = () => {
|
|
1407
1412
|
console.log("Connected to the WebSocket server");
|
|
1408
|
-
const subscribeMessage = JSON.stringify(
|
|
1409
|
-
type: "subscribe",
|
|
1410
|
-
names
|
|
1411
|
-
});
|
|
1413
|
+
const subscribeMessage = JSON.stringify(types);
|
|
1412
1414
|
ws.send(subscribeMessage);
|
|
1413
1415
|
};
|
|
1414
1416
|
ws.onmessage = (event) => {
|
|
@@ -2359,8 +2361,8 @@ var Dubhe = class {
|
|
|
2359
2361
|
});
|
|
2360
2362
|
return response;
|
|
2361
2363
|
}
|
|
2362
|
-
async subscribe(
|
|
2363
|
-
return this.suiIndexerClient.subscribe(
|
|
2364
|
+
async subscribe(types, handleData) {
|
|
2365
|
+
return this.suiIndexerClient.subscribe(types, handleData);
|
|
2364
2366
|
}
|
|
2365
2367
|
/**
|
|
2366
2368
|
* else:
|
|
@@ -2759,9 +2761,7 @@ async function loadMetadata(networkType, packageId, fullnodeUrls) {
|
|
|
2759
2761
|
fullnodeUrls = fullnodeUrls || [getFullnodeUrl(networkType)];
|
|
2760
2762
|
const suiInteractor = new SuiInteractor(fullnodeUrls);
|
|
2761
2763
|
if (packageId !== void 0) {
|
|
2762
|
-
const jsonData = await suiInteractor.getNormalizedMoveModulesByPackage(
|
|
2763
|
-
packageId
|
|
2764
|
-
);
|
|
2764
|
+
const jsonData = await suiInteractor.getNormalizedMoveModulesByPackage(packageId);
|
|
2765
2765
|
return jsonData;
|
|
2766
2766
|
} else {
|
|
2767
2767
|
console.error("please set your package id.");
|
|
@@ -2771,6 +2771,7 @@ export {
|
|
|
2771
2771
|
BcsType2 as BcsType,
|
|
2772
2772
|
Dubhe,
|
|
2773
2773
|
MultiSigClient,
|
|
2774
|
+
SubscriptionKind,
|
|
2774
2775
|
SuiAccountManager,
|
|
2775
2776
|
SuiContractFactory,
|
|
2776
2777
|
SuiTx,
|