@0xobelisk/sui-client 1.2.0-pre.16 → 1.2.0-pre.18
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 +6 -1
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- package/dist/index.mjs.map +1 -1
- package/dist/libs/http/http.d.ts +6 -1
- package/dist/libs/suiIndexerClient/index.d.ts +6 -1
- package/package.json +1 -1
- package/src/dubhe.ts +17 -5
- package/src/libs/http/http.ts +21 -6
- package/src/libs/suiIndexerClient/index.ts +12 -5
package/dist/dubhe.d.ts
CHANGED
|
@@ -127,7 +127,12 @@ export declare class Dubhe {
|
|
|
127
127
|
last_update_digest?: string;
|
|
128
128
|
value?: any;
|
|
129
129
|
}): Promise<StorageItemResponse<IndexerSchema> | undefined>;
|
|
130
|
-
subscribe(types
|
|
130
|
+
subscribe({ types, handleData, onOpen, onClose, }: {
|
|
131
|
+
types: SubscribableType[];
|
|
132
|
+
handleData: (data: any) => void;
|
|
133
|
+
onOpen?: () => void;
|
|
134
|
+
onClose?: () => void;
|
|
135
|
+
}): Promise<WebSocket>;
|
|
131
136
|
/**
|
|
132
137
|
* else:
|
|
133
138
|
* it will generate signer from the mnemonic with the given derivePathParams.
|
package/dist/index.js
CHANGED
|
@@ -1341,8 +1341,13 @@ var SuiIndexerClient = class {
|
|
|
1341
1341
|
value: result
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
async subscribe(
|
|
1345
|
-
|
|
1344
|
+
async subscribe({
|
|
1345
|
+
types,
|
|
1346
|
+
handleData,
|
|
1347
|
+
onOpen,
|
|
1348
|
+
onClose
|
|
1349
|
+
}) {
|
|
1350
|
+
return this.http.subscribe({ types, handleData, onOpen, onClose });
|
|
1346
1351
|
}
|
|
1347
1352
|
};
|
|
1348
1353
|
|
|
@@ -1480,10 +1485,17 @@ var Http = class {
|
|
|
1480
1485
|
);
|
|
1481
1486
|
}
|
|
1482
1487
|
}
|
|
1483
|
-
async subscribe(
|
|
1488
|
+
async subscribe({
|
|
1489
|
+
types,
|
|
1490
|
+
handleData,
|
|
1491
|
+
onOpen,
|
|
1492
|
+
onClose
|
|
1493
|
+
}) {
|
|
1484
1494
|
const ws = createWebSocketClient(this.wsEndpoint);
|
|
1485
1495
|
ws.onopen = () => {
|
|
1486
|
-
|
|
1496
|
+
if (onOpen) {
|
|
1497
|
+
onOpen();
|
|
1498
|
+
}
|
|
1487
1499
|
const subscribeMessage = JSON.stringify(types);
|
|
1488
1500
|
ws.send(subscribeMessage);
|
|
1489
1501
|
};
|
|
@@ -1491,7 +1503,9 @@ var Http = class {
|
|
|
1491
1503
|
handleData(JSON.parse(event.data.toString()));
|
|
1492
1504
|
};
|
|
1493
1505
|
ws.onclose = () => {
|
|
1494
|
-
|
|
1506
|
+
if (onClose) {
|
|
1507
|
+
onClose();
|
|
1508
|
+
}
|
|
1495
1509
|
};
|
|
1496
1510
|
ws.onerror = (error) => {
|
|
1497
1511
|
console.error(`WebSocket error:`, error);
|
|
@@ -2526,8 +2540,18 @@ var Dubhe = class {
|
|
|
2526
2540
|
});
|
|
2527
2541
|
return response;
|
|
2528
2542
|
}
|
|
2529
|
-
async subscribe(
|
|
2530
|
-
|
|
2543
|
+
async subscribe({
|
|
2544
|
+
types,
|
|
2545
|
+
handleData,
|
|
2546
|
+
onOpen,
|
|
2547
|
+
onClose
|
|
2548
|
+
}) {
|
|
2549
|
+
return this.suiIndexerClient.subscribe({
|
|
2550
|
+
types,
|
|
2551
|
+
handleData,
|
|
2552
|
+
onOpen,
|
|
2553
|
+
onClose
|
|
2554
|
+
});
|
|
2531
2555
|
}
|
|
2532
2556
|
/**
|
|
2533
2557
|
* else:
|