@0xobelisk/sui-client 1.1.0 → 1.1.2
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 +21 -4
- package/dist/index.js +111 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -23
- package/dist/index.mjs.map +1 -1
- package/dist/libs/suiIndexerClient/index.d.ts +14 -2
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
- package/src/dubhe.ts +99 -31
- package/src/libs/suiIndexerClient/index.ts +56 -6
- package/src/types/index.ts +4 -0
|
@@ -67,6 +67,10 @@ export declare class SuiIndexerClient {
|
|
|
67
67
|
name?: string;
|
|
68
68
|
key1?: string;
|
|
69
69
|
key2?: string;
|
|
70
|
+
is_removed?: boolean;
|
|
71
|
+
last_update_checkpoint?: string;
|
|
72
|
+
last_update_digest?: string;
|
|
73
|
+
value?: any;
|
|
70
74
|
orderBy?: string[];
|
|
71
75
|
}): Promise<ConnectionResponse<IndexerSchema>>;
|
|
72
76
|
getEvents(params?: {
|
|
@@ -76,18 +80,26 @@ export declare class SuiIndexerClient {
|
|
|
76
80
|
checkpoint?: string;
|
|
77
81
|
orderBy?: string[];
|
|
78
82
|
}): Promise<ConnectionResponse<IndexerEvent>>;
|
|
79
|
-
getStorage({ name, key1, key2, first, after, orderBy, }: {
|
|
83
|
+
getStorage({ name, key1, key2, is_removed, last_update_checkpoint, last_update_digest, value, first, after, orderBy, }: {
|
|
80
84
|
name?: string;
|
|
81
85
|
key1?: string;
|
|
82
86
|
key2?: string;
|
|
87
|
+
is_removed?: boolean;
|
|
88
|
+
last_update_checkpoint?: string;
|
|
89
|
+
last_update_digest?: string;
|
|
90
|
+
value?: any;
|
|
83
91
|
first?: number;
|
|
84
92
|
after?: string;
|
|
85
93
|
orderBy?: string[];
|
|
86
94
|
}): Promise<StorageResponse<IndexerSchema>>;
|
|
87
|
-
getStorageItem({ name, key1, key2, }: {
|
|
95
|
+
getStorageItem({ name, key1, key2, is_removed, last_update_checkpoint, last_update_digest, value, }: {
|
|
88
96
|
name: string;
|
|
89
97
|
key1?: string;
|
|
90
98
|
key2?: string;
|
|
99
|
+
is_removed?: boolean;
|
|
100
|
+
last_update_checkpoint?: string;
|
|
101
|
+
last_update_digest?: string;
|
|
102
|
+
value?: any;
|
|
91
103
|
}): Promise<StorageItemResponse<IndexerSchema> | undefined>;
|
|
92
104
|
subscribe(names: string[], handleData: (data: any) => void): Promise<WebSocket>;
|
|
93
105
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -73,11 +73,13 @@ export interface ContractQuery extends MessageMeta {
|
|
|
73
73
|
}): Promise<DevInspectResults | TransactionResult>;
|
|
74
74
|
}
|
|
75
75
|
export interface ContractTx extends MessageMeta {
|
|
76
|
-
({ tx, params, typeArguments, isRaw, }: {
|
|
76
|
+
({ tx, params, typeArguments, isRaw, onSuccess, onError, }: {
|
|
77
77
|
tx: Transaction;
|
|
78
78
|
params?: (TransactionArgument | SerializedBcs<any>)[];
|
|
79
79
|
typeArguments?: string[];
|
|
80
80
|
isRaw?: boolean;
|
|
81
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
82
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
81
83
|
}): Promise<SuiTransactionBlockResponse | TransactionResult>;
|
|
82
84
|
}
|
|
83
85
|
export type MapMessageTx = Record<string, ContractTx>;
|
package/package.json
CHANGED
package/src/dubhe.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import keccak256 from 'keccak256';
|
|
2
|
-
import { getFullnodeUrl } from '@mysten/sui/client';
|
|
3
2
|
import { Transaction, TransactionResult } from '@mysten/sui/transactions';
|
|
4
3
|
import { BcsType, fromHex, SerializedBcs, toHex } from '@mysten/bcs';
|
|
5
4
|
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
@@ -14,18 +13,9 @@ import type {
|
|
|
14
13
|
import { SuiAccountManager } from './libs/suiAccountManager';
|
|
15
14
|
import { SuiTx } from './libs/suiTxBuilder';
|
|
16
15
|
import { SuiInteractor } from './libs/suiInteractor';
|
|
17
|
-
import {
|
|
18
|
-
MapObjectStruct,
|
|
19
|
-
MoveStructType,
|
|
20
|
-
DubheObjectContent,
|
|
21
|
-
SuiDubheReturnType,
|
|
22
|
-
MoveEnumType,
|
|
23
|
-
} from './types';
|
|
16
|
+
import { MapObjectStruct, MoveStructType, MoveEnumType } from './types';
|
|
24
17
|
import { SuiContractFactory } from './libs/suiContractFactory';
|
|
25
|
-
import {
|
|
26
|
-
SuiMoveMoudleFuncType,
|
|
27
|
-
SuiMoveMoudleValueType,
|
|
28
|
-
} from './libs/suiContractFactory/types';
|
|
18
|
+
import { SuiMoveMoudleFuncType } from './libs/suiContractFactory/types';
|
|
29
19
|
import { getDefaultURL, NetworkConfig } from './libs/suiInteractor';
|
|
30
20
|
import {
|
|
31
21
|
ContractQuery,
|
|
@@ -36,7 +26,6 @@ import {
|
|
|
36
26
|
MapMoudleFuncTx,
|
|
37
27
|
DubheParams,
|
|
38
28
|
SuiTxArg,
|
|
39
|
-
// SuiTxArgument,
|
|
40
29
|
SuiObjectArg,
|
|
41
30
|
SuiVecTxArg,
|
|
42
31
|
} from './types';
|
|
@@ -106,7 +95,9 @@ function createTx(
|
|
|
106
95
|
tx: Transaction,
|
|
107
96
|
params?: (TransactionArgument | SerializedBcs<any>)[],
|
|
108
97
|
typeArguments?: string[],
|
|
109
|
-
isRaw?: boolean
|
|
98
|
+
isRaw?: boolean,
|
|
99
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>,
|
|
100
|
+
onError?: (error: Error) => void | Promise<void>
|
|
110
101
|
) => Promise<SuiTransactionBlockResponse | TransactionResult>
|
|
111
102
|
): ContractTx {
|
|
112
103
|
return withMeta(
|
|
@@ -116,13 +107,17 @@ function createTx(
|
|
|
116
107
|
params,
|
|
117
108
|
typeArguments,
|
|
118
109
|
isRaw,
|
|
110
|
+
onSuccess,
|
|
111
|
+
onError,
|
|
119
112
|
}: {
|
|
120
113
|
tx: Transaction;
|
|
121
114
|
params?: (TransactionArgument | SerializedBcs<any>)[];
|
|
122
115
|
typeArguments?: string[];
|
|
123
116
|
isRaw?: boolean;
|
|
117
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
118
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
124
119
|
}): Promise<SuiTransactionBlockResponse | TransactionResult> => {
|
|
125
|
-
return await fn(tx, params, typeArguments, isRaw);
|
|
120
|
+
return await fn(tx, params, typeArguments, isRaw, onSuccess, onError);
|
|
126
121
|
}
|
|
127
122
|
);
|
|
128
123
|
}
|
|
@@ -357,8 +352,16 @@ export class Dubhe {
|
|
|
357
352
|
if (isUndefined(this.#tx[moduleName][funcName])) {
|
|
358
353
|
this.#tx[moduleName][funcName] = createTx(
|
|
359
354
|
meta,
|
|
360
|
-
(tx, p, typeArguments, isRaw) =>
|
|
361
|
-
this.#exec(
|
|
355
|
+
(tx, p, typeArguments, isRaw, onSuccess, onError) =>
|
|
356
|
+
this.#exec(
|
|
357
|
+
meta,
|
|
358
|
+
tx,
|
|
359
|
+
p,
|
|
360
|
+
typeArguments,
|
|
361
|
+
isRaw,
|
|
362
|
+
onSuccess,
|
|
363
|
+
onError
|
|
364
|
+
)
|
|
362
365
|
);
|
|
363
366
|
}
|
|
364
367
|
}
|
|
@@ -393,7 +396,9 @@ export class Dubhe {
|
|
|
393
396
|
tx: Transaction,
|
|
394
397
|
params?: (TransactionArgument | SerializedBcs<any>)[],
|
|
395
398
|
typeArguments?: string[],
|
|
396
|
-
isRaw?: boolean
|
|
399
|
+
isRaw?: boolean,
|
|
400
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>,
|
|
401
|
+
onError?: (error: Error) => void | Promise<void>
|
|
397
402
|
) => {
|
|
398
403
|
if (isRaw === true) {
|
|
399
404
|
return tx.moveCall({
|
|
@@ -408,7 +413,7 @@ export class Dubhe {
|
|
|
408
413
|
arguments: params,
|
|
409
414
|
typeArguments,
|
|
410
415
|
});
|
|
411
|
-
return await this.signAndSendTxn(tx);
|
|
416
|
+
return await this.signAndSendTxn({ tx, onSuccess, onError });
|
|
412
417
|
};
|
|
413
418
|
|
|
414
419
|
#read = async (
|
|
@@ -1144,6 +1149,10 @@ export class Dubhe {
|
|
|
1144
1149
|
name,
|
|
1145
1150
|
key1,
|
|
1146
1151
|
key2,
|
|
1152
|
+
is_removed,
|
|
1153
|
+
last_update_checkpoint,
|
|
1154
|
+
last_update_digest,
|
|
1155
|
+
value,
|
|
1147
1156
|
first,
|
|
1148
1157
|
after,
|
|
1149
1158
|
orderBy,
|
|
@@ -1151,6 +1160,10 @@ export class Dubhe {
|
|
|
1151
1160
|
name?: string;
|
|
1152
1161
|
key1?: string;
|
|
1153
1162
|
key2?: string;
|
|
1163
|
+
is_removed?: boolean;
|
|
1164
|
+
last_update_checkpoint?: string;
|
|
1165
|
+
last_update_digest?: string;
|
|
1166
|
+
value?: any;
|
|
1154
1167
|
first?: number;
|
|
1155
1168
|
after?: string;
|
|
1156
1169
|
orderBy?: string[];
|
|
@@ -1159,6 +1172,10 @@ export class Dubhe {
|
|
|
1159
1172
|
name,
|
|
1160
1173
|
key1,
|
|
1161
1174
|
key2,
|
|
1175
|
+
is_removed,
|
|
1176
|
+
last_update_checkpoint,
|
|
1177
|
+
last_update_digest,
|
|
1178
|
+
value,
|
|
1162
1179
|
first,
|
|
1163
1180
|
after,
|
|
1164
1181
|
orderBy,
|
|
@@ -1169,6 +1186,10 @@ export class Dubhe {
|
|
|
1169
1186
|
name,
|
|
1170
1187
|
key1,
|
|
1171
1188
|
key2,
|
|
1189
|
+
is_removed,
|
|
1190
|
+
last_update_checkpoint,
|
|
1191
|
+
last_update_digest,
|
|
1192
|
+
value,
|
|
1172
1193
|
first,
|
|
1173
1194
|
after,
|
|
1174
1195
|
orderBy,
|
|
@@ -1176,6 +1197,10 @@ export class Dubhe {
|
|
|
1176
1197
|
name?: string;
|
|
1177
1198
|
key1?: string;
|
|
1178
1199
|
key2?: string;
|
|
1200
|
+
is_removed?: boolean;
|
|
1201
|
+
last_update_checkpoint?: string;
|
|
1202
|
+
last_update_digest?: string;
|
|
1203
|
+
value?: any;
|
|
1179
1204
|
first?: number;
|
|
1180
1205
|
after?: string;
|
|
1181
1206
|
orderBy?: string[];
|
|
@@ -1184,6 +1209,10 @@ export class Dubhe {
|
|
|
1184
1209
|
name,
|
|
1185
1210
|
key1,
|
|
1186
1211
|
key2,
|
|
1212
|
+
is_removed,
|
|
1213
|
+
last_update_checkpoint,
|
|
1214
|
+
last_update_digest,
|
|
1215
|
+
value,
|
|
1187
1216
|
first,
|
|
1188
1217
|
after,
|
|
1189
1218
|
orderBy,
|
|
@@ -1194,15 +1223,27 @@ export class Dubhe {
|
|
|
1194
1223
|
name,
|
|
1195
1224
|
key1,
|
|
1196
1225
|
key2,
|
|
1226
|
+
is_removed,
|
|
1227
|
+
last_update_checkpoint,
|
|
1228
|
+
last_update_digest,
|
|
1229
|
+
value,
|
|
1197
1230
|
}: {
|
|
1198
1231
|
name: string;
|
|
1199
1232
|
key1?: string;
|
|
1200
1233
|
key2?: string;
|
|
1234
|
+
is_removed?: boolean;
|
|
1235
|
+
last_update_checkpoint?: string;
|
|
1236
|
+
last_update_digest?: string;
|
|
1237
|
+
value?: any;
|
|
1201
1238
|
}): Promise<StorageItemResponse<IndexerSchema> | undefined> {
|
|
1202
1239
|
const response = await this.suiIndexerClient.getStorageItem({
|
|
1203
1240
|
name,
|
|
1204
1241
|
key1,
|
|
1205
1242
|
key2,
|
|
1243
|
+
is_removed,
|
|
1244
|
+
last_update_checkpoint,
|
|
1245
|
+
last_update_digest,
|
|
1246
|
+
value,
|
|
1206
1247
|
});
|
|
1207
1248
|
return response;
|
|
1208
1249
|
}
|
|
@@ -1385,12 +1426,39 @@ export class Dubhe {
|
|
|
1385
1426
|
return await keyPair.signTransaction(txBytes);
|
|
1386
1427
|
}
|
|
1387
1428
|
|
|
1388
|
-
async signAndSendTxn(
|
|
1389
|
-
tx
|
|
1390
|
-
derivePathParams
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1429
|
+
async signAndSendTxn({
|
|
1430
|
+
tx,
|
|
1431
|
+
derivePathParams,
|
|
1432
|
+
onSuccess,
|
|
1433
|
+
onError,
|
|
1434
|
+
}: {
|
|
1435
|
+
tx: Uint8Array | Transaction | SuiTx;
|
|
1436
|
+
derivePathParams?: DerivePathParams;
|
|
1437
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
1438
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
1439
|
+
}): Promise<SuiTransactionBlockResponse> {
|
|
1440
|
+
try {
|
|
1441
|
+
const { bytes, signature } = await this.signTxn(tx, derivePathParams);
|
|
1442
|
+
const result = await this.sendTx(bytes, signature);
|
|
1443
|
+
|
|
1444
|
+
if (result.effects?.status.status === 'success') {
|
|
1445
|
+
if (onSuccess) {
|
|
1446
|
+
await onSuccess(result);
|
|
1447
|
+
}
|
|
1448
|
+
} else {
|
|
1449
|
+
if (onError) {
|
|
1450
|
+
await onError(
|
|
1451
|
+
new Error(`Transaction failed: ${result.effects?.status.error}`)
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
return result;
|
|
1456
|
+
} catch (error) {
|
|
1457
|
+
if (onError) {
|
|
1458
|
+
await onError(error as Error);
|
|
1459
|
+
}
|
|
1460
|
+
throw error;
|
|
1461
|
+
}
|
|
1394
1462
|
}
|
|
1395
1463
|
|
|
1396
1464
|
async sendTx(
|
|
@@ -1417,7 +1485,7 @@ export class Dubhe {
|
|
|
1417
1485
|
) {
|
|
1418
1486
|
const tx = new SuiTx();
|
|
1419
1487
|
tx.transferSui(recipient, amount);
|
|
1420
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1488
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1421
1489
|
}
|
|
1422
1490
|
|
|
1423
1491
|
/**
|
|
@@ -1433,7 +1501,7 @@ export class Dubhe {
|
|
|
1433
1501
|
) {
|
|
1434
1502
|
const tx = new SuiTx();
|
|
1435
1503
|
tx.transferSuiToMany(recipients, amounts);
|
|
1436
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1504
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1437
1505
|
}
|
|
1438
1506
|
|
|
1439
1507
|
/**
|
|
@@ -1463,7 +1531,7 @@ export class Dubhe {
|
|
|
1463
1531
|
recipients,
|
|
1464
1532
|
amounts
|
|
1465
1533
|
);
|
|
1466
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1534
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1467
1535
|
}
|
|
1468
1536
|
|
|
1469
1537
|
async transferCoin(
|
|
@@ -1487,7 +1555,7 @@ export class Dubhe {
|
|
|
1487
1555
|
) {
|
|
1488
1556
|
const tx = new SuiTx();
|
|
1489
1557
|
tx.transferObjects(objects, recipient);
|
|
1490
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1558
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1491
1559
|
}
|
|
1492
1560
|
|
|
1493
1561
|
async moveCall(callParams: {
|
|
@@ -1504,7 +1572,7 @@ export class Dubhe {
|
|
|
1504
1572
|
} = callParams;
|
|
1505
1573
|
const tx = new SuiTx();
|
|
1506
1574
|
tx.moveCall(target, args, typeArguments);
|
|
1507
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1575
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1508
1576
|
}
|
|
1509
1577
|
|
|
1510
1578
|
/**
|
|
@@ -1542,7 +1610,7 @@ export class Dubhe {
|
|
|
1542
1610
|
) {
|
|
1543
1611
|
const tx = new SuiTx();
|
|
1544
1612
|
tx.stakeSui(amount, validatorAddr);
|
|
1545
|
-
return this.signAndSendTxn(tx, derivePathParams);
|
|
1613
|
+
return this.signAndSendTxn({ tx, derivePathParams });
|
|
1546
1614
|
}
|
|
1547
1615
|
|
|
1548
1616
|
/**
|
|
@@ -116,11 +116,37 @@ export class SuiIndexerClient {
|
|
|
116
116
|
name?: string;
|
|
117
117
|
key1?: string;
|
|
118
118
|
key2?: string;
|
|
119
|
+
is_removed?: boolean;
|
|
120
|
+
last_update_checkpoint?: string;
|
|
121
|
+
last_update_digest?: string;
|
|
122
|
+
value?: any;
|
|
119
123
|
orderBy?: string[];
|
|
120
124
|
}): Promise<ConnectionResponse<IndexerSchema>> {
|
|
121
125
|
const query = `
|
|
122
|
-
query GetSchemas(
|
|
123
|
-
|
|
126
|
+
query GetSchemas(
|
|
127
|
+
$first: Int,
|
|
128
|
+
$after: String,
|
|
129
|
+
$name: String,
|
|
130
|
+
$key1: String,
|
|
131
|
+
$key2: String,
|
|
132
|
+
$is_removed: Boolean,
|
|
133
|
+
$last_update_checkpoint: String,
|
|
134
|
+
$last_update_digest: String,
|
|
135
|
+
$value: JSON,
|
|
136
|
+
$orderBy: [SchemaOrderField!]
|
|
137
|
+
) {
|
|
138
|
+
schemas(
|
|
139
|
+
first: $first,
|
|
140
|
+
after: $after,
|
|
141
|
+
name: $name,
|
|
142
|
+
key1: $key1,
|
|
143
|
+
key2: $key2,
|
|
144
|
+
is_removed: $is_removed,
|
|
145
|
+
last_update_checkpoint: $last_update_checkpoint,
|
|
146
|
+
last_update_digest: $last_update_digest,
|
|
147
|
+
value: $value,
|
|
148
|
+
orderBy: $orderBy
|
|
149
|
+
) {
|
|
124
150
|
edges {
|
|
125
151
|
cursor
|
|
126
152
|
node {
|
|
@@ -191,6 +217,10 @@ export class SuiIndexerClient {
|
|
|
191
217
|
name,
|
|
192
218
|
key1,
|
|
193
219
|
key2,
|
|
220
|
+
is_removed = false,
|
|
221
|
+
last_update_checkpoint,
|
|
222
|
+
last_update_digest,
|
|
223
|
+
value,
|
|
194
224
|
first,
|
|
195
225
|
after,
|
|
196
226
|
orderBy,
|
|
@@ -198,6 +228,10 @@ export class SuiIndexerClient {
|
|
|
198
228
|
name?: string;
|
|
199
229
|
key1?: string;
|
|
200
230
|
key2?: string;
|
|
231
|
+
is_removed?: boolean;
|
|
232
|
+
last_update_checkpoint?: string;
|
|
233
|
+
last_update_digest?: string;
|
|
234
|
+
value?: any;
|
|
201
235
|
first?: number;
|
|
202
236
|
after?: string;
|
|
203
237
|
orderBy?: string[];
|
|
@@ -206,15 +240,19 @@ export class SuiIndexerClient {
|
|
|
206
240
|
name,
|
|
207
241
|
key1,
|
|
208
242
|
key2,
|
|
243
|
+
is_removed,
|
|
244
|
+
last_update_checkpoint,
|
|
245
|
+
last_update_digest,
|
|
246
|
+
value,
|
|
209
247
|
first,
|
|
210
248
|
after,
|
|
211
249
|
orderBy,
|
|
212
250
|
});
|
|
213
251
|
const data = schemas.edges.map((edge) => edge.node);
|
|
214
|
-
const
|
|
252
|
+
const result = data.map((item) => parseValue(item.value));
|
|
215
253
|
return {
|
|
216
254
|
data,
|
|
217
|
-
value,
|
|
255
|
+
value: result,
|
|
218
256
|
pageInfo: schemas.pageInfo,
|
|
219
257
|
totalCount: schemas.totalCount,
|
|
220
258
|
};
|
|
@@ -224,25 +262,37 @@ export class SuiIndexerClient {
|
|
|
224
262
|
name,
|
|
225
263
|
key1,
|
|
226
264
|
key2,
|
|
265
|
+
is_removed,
|
|
266
|
+
last_update_checkpoint,
|
|
267
|
+
last_update_digest,
|
|
268
|
+
value,
|
|
227
269
|
}: {
|
|
228
270
|
name: string;
|
|
229
271
|
key1?: string;
|
|
230
272
|
key2?: string;
|
|
273
|
+
is_removed?: boolean;
|
|
274
|
+
last_update_checkpoint?: string;
|
|
275
|
+
last_update_digest?: string;
|
|
276
|
+
value?: any;
|
|
231
277
|
}): Promise<StorageItemResponse<IndexerSchema> | undefined> {
|
|
232
278
|
const schemas = await this.getSchemas({
|
|
233
279
|
name,
|
|
234
280
|
key1,
|
|
235
281
|
key2,
|
|
282
|
+
is_removed,
|
|
283
|
+
last_update_checkpoint,
|
|
284
|
+
last_update_digest,
|
|
285
|
+
value,
|
|
236
286
|
first: 1,
|
|
237
287
|
});
|
|
238
288
|
const data = schemas.edges[0]?.node;
|
|
239
289
|
if (!data) {
|
|
240
290
|
return undefined;
|
|
241
291
|
}
|
|
242
|
-
const
|
|
292
|
+
const result = parseValue(data.value);
|
|
243
293
|
return {
|
|
244
294
|
data,
|
|
245
|
-
value,
|
|
295
|
+
value: result,
|
|
246
296
|
};
|
|
247
297
|
}
|
|
248
298
|
|
package/src/types/index.ts
CHANGED
|
@@ -111,11 +111,15 @@ export interface ContractTx extends MessageMeta {
|
|
|
111
111
|
params,
|
|
112
112
|
typeArguments,
|
|
113
113
|
isRaw,
|
|
114
|
+
onSuccess,
|
|
115
|
+
onError,
|
|
114
116
|
}: {
|
|
115
117
|
tx: Transaction;
|
|
116
118
|
params?: (TransactionArgument | SerializedBcs<any>)[];
|
|
117
119
|
typeArguments?: string[];
|
|
118
120
|
isRaw?: boolean;
|
|
121
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
122
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
119
123
|
}): Promise<SuiTransactionBlockResponse | TransactionResult>;
|
|
120
124
|
}
|
|
121
125
|
|