@0xobelisk/sui-client 1.2.0-pre.15 → 1.2.0-pre.17
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 +11 -2
- package/dist/index.js +82 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -14
- package/dist/index.mjs.map +1 -1
- package/dist/libs/http/http.d.ts +6 -1
- package/dist/libs/suiIndexerClient/index.d.ts +16 -2
- package/package.json +1 -1
- package/src/dubhe.ts +29 -5
- package/src/libs/http/http.ts +21 -6
- package/src/libs/suiIndexerClient/index.ts +62 -9
package/dist/dubhe.d.ts
CHANGED
|
@@ -58,13 +58,17 @@ export declare class Dubhe {
|
|
|
58
58
|
params: any[];
|
|
59
59
|
customModuleName?: string;
|
|
60
60
|
}): Promise<any[] | undefined>;
|
|
61
|
-
getTransactions({ first, after, sender, digest, checkpoint, orderBy, }: {
|
|
61
|
+
getTransactions({ first, after, sender, digest, checkpoint, packageId, module, functionName, orderBy, showEvent, }: {
|
|
62
62
|
first?: number;
|
|
63
63
|
after?: string;
|
|
64
64
|
sender?: string;
|
|
65
65
|
digest?: string;
|
|
66
66
|
checkpoint?: number;
|
|
67
|
+
packageId?: string;
|
|
68
|
+
module?: string;
|
|
69
|
+
functionName?: string[];
|
|
67
70
|
orderBy?: string[];
|
|
71
|
+
showEvent?: boolean;
|
|
68
72
|
}): Promise<ConnectionResponse<IndexerTransaction>>;
|
|
69
73
|
getTransaction(digest: string): Promise<IndexerTransaction | undefined>;
|
|
70
74
|
/**
|
|
@@ -123,7 +127,12 @@ export declare class Dubhe {
|
|
|
123
127
|
last_update_digest?: string;
|
|
124
128
|
value?: any;
|
|
125
129
|
}): Promise<StorageItemResponse<IndexerSchema> | undefined>;
|
|
126
|
-
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>;
|
|
127
136
|
/**
|
|
128
137
|
* else:
|
|
129
138
|
* it will generate signer from the mnemonic with the given derivePathParams.
|
package/dist/index.js
CHANGED
|
@@ -1130,8 +1130,30 @@ var SuiIndexerClient = class {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
async getTransactions(params) {
|
|
1132
1132
|
const query = `
|
|
1133
|
-
query GetTransactions(
|
|
1134
|
-
|
|
1133
|
+
query GetTransactions(
|
|
1134
|
+
$first: Int,
|
|
1135
|
+
$after: String,
|
|
1136
|
+
$sender: String,
|
|
1137
|
+
$digest: String,
|
|
1138
|
+
$checkpoint: Int,
|
|
1139
|
+
$packageId: String,
|
|
1140
|
+
$module: String,
|
|
1141
|
+
$functionName: [String!],
|
|
1142
|
+
$orderBy: [TransactionOrderField!],
|
|
1143
|
+
$showEvent: Boolean!
|
|
1144
|
+
) {
|
|
1145
|
+
transactions(
|
|
1146
|
+
first: $first,
|
|
1147
|
+
after: $after,
|
|
1148
|
+
sender: $sender,
|
|
1149
|
+
digest: $digest,
|
|
1150
|
+
checkpoint: $checkpoint,
|
|
1151
|
+
packageId: $packageId,
|
|
1152
|
+
module: $module,
|
|
1153
|
+
functionName: $functionName,
|
|
1154
|
+
orderBy: $orderBy,
|
|
1155
|
+
showEvent: $showEvent
|
|
1156
|
+
) {
|
|
1135
1157
|
edges {
|
|
1136
1158
|
cursor
|
|
1137
1159
|
node {
|
|
@@ -1139,7 +1161,20 @@ var SuiIndexerClient = class {
|
|
|
1139
1161
|
checkpoint
|
|
1140
1162
|
digest
|
|
1141
1163
|
sender
|
|
1164
|
+
package
|
|
1165
|
+
module
|
|
1166
|
+
function
|
|
1167
|
+
arguments
|
|
1142
1168
|
created_at
|
|
1169
|
+
events @include(if: $showEvent) {
|
|
1170
|
+
id
|
|
1171
|
+
checkpoint
|
|
1172
|
+
digest
|
|
1173
|
+
name
|
|
1174
|
+
sender
|
|
1175
|
+
value
|
|
1176
|
+
created_at
|
|
1177
|
+
}
|
|
1143
1178
|
}
|
|
1144
1179
|
}
|
|
1145
1180
|
pageInfo {
|
|
@@ -1150,13 +1185,14 @@ var SuiIndexerClient = class {
|
|
|
1150
1185
|
}
|
|
1151
1186
|
}
|
|
1152
1187
|
`;
|
|
1153
|
-
const response = await this.fetchGraphql(query, params);
|
|
1188
|
+
const response = await this.fetchGraphql(query, { ...params, showEvent: params?.showEvent ?? false });
|
|
1154
1189
|
return response.transactions;
|
|
1155
1190
|
}
|
|
1156
|
-
async getTransaction(digest) {
|
|
1191
|
+
async getTransaction(digest, showEvent) {
|
|
1157
1192
|
const response = await this.getTransactions({
|
|
1158
1193
|
first: 1,
|
|
1159
|
-
digest
|
|
1194
|
+
digest,
|
|
1195
|
+
showEvent
|
|
1160
1196
|
});
|
|
1161
1197
|
return response.edges[0]?.node;
|
|
1162
1198
|
}
|
|
@@ -1305,8 +1341,13 @@ var SuiIndexerClient = class {
|
|
|
1305
1341
|
value: result
|
|
1306
1342
|
};
|
|
1307
1343
|
}
|
|
1308
|
-
async subscribe(
|
|
1309
|
-
|
|
1344
|
+
async subscribe({
|
|
1345
|
+
types,
|
|
1346
|
+
handleData,
|
|
1347
|
+
onOpen,
|
|
1348
|
+
onClose
|
|
1349
|
+
}) {
|
|
1350
|
+
return this.http.subscribe({ types, handleData, onOpen, onClose });
|
|
1310
1351
|
}
|
|
1311
1352
|
};
|
|
1312
1353
|
|
|
@@ -1444,10 +1485,17 @@ var Http = class {
|
|
|
1444
1485
|
);
|
|
1445
1486
|
}
|
|
1446
1487
|
}
|
|
1447
|
-
async subscribe(
|
|
1488
|
+
async subscribe({
|
|
1489
|
+
types,
|
|
1490
|
+
handleData,
|
|
1491
|
+
onOpen,
|
|
1492
|
+
onClose
|
|
1493
|
+
}) {
|
|
1448
1494
|
const ws = createWebSocketClient(this.wsEndpoint);
|
|
1449
1495
|
ws.onopen = () => {
|
|
1450
|
-
|
|
1496
|
+
if (onOpen) {
|
|
1497
|
+
onOpen();
|
|
1498
|
+
}
|
|
1451
1499
|
const subscribeMessage = JSON.stringify(types);
|
|
1452
1500
|
ws.send(subscribeMessage);
|
|
1453
1501
|
};
|
|
@@ -1455,7 +1503,9 @@ var Http = class {
|
|
|
1455
1503
|
handleData(JSON.parse(event.data.toString()));
|
|
1456
1504
|
};
|
|
1457
1505
|
ws.onclose = () => {
|
|
1458
|
-
|
|
1506
|
+
if (onClose) {
|
|
1507
|
+
onClose();
|
|
1508
|
+
}
|
|
1459
1509
|
};
|
|
1460
1510
|
ws.onerror = (error) => {
|
|
1461
1511
|
console.error(`WebSocket error:`, error);
|
|
@@ -2309,7 +2359,11 @@ var Dubhe = class {
|
|
|
2309
2359
|
sender,
|
|
2310
2360
|
digest,
|
|
2311
2361
|
checkpoint,
|
|
2312
|
-
|
|
2362
|
+
packageId,
|
|
2363
|
+
module: module2,
|
|
2364
|
+
functionName,
|
|
2365
|
+
orderBy,
|
|
2366
|
+
showEvent
|
|
2313
2367
|
}) {
|
|
2314
2368
|
return await this.suiIndexerClient.getTransactions({
|
|
2315
2369
|
first,
|
|
@@ -2317,7 +2371,11 @@ var Dubhe = class {
|
|
|
2317
2371
|
sender,
|
|
2318
2372
|
digest,
|
|
2319
2373
|
checkpoint,
|
|
2320
|
-
|
|
2374
|
+
packageId,
|
|
2375
|
+
module: module2,
|
|
2376
|
+
functionName,
|
|
2377
|
+
orderBy,
|
|
2378
|
+
showEvent
|
|
2321
2379
|
});
|
|
2322
2380
|
}
|
|
2323
2381
|
async getTransaction(digest) {
|
|
@@ -2482,8 +2540,18 @@ var Dubhe = class {
|
|
|
2482
2540
|
});
|
|
2483
2541
|
return response;
|
|
2484
2542
|
}
|
|
2485
|
-
async subscribe(
|
|
2486
|
-
|
|
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
|
+
});
|
|
2487
2555
|
}
|
|
2488
2556
|
/**
|
|
2489
2557
|
* else:
|