@0xobelisk/sui-client 1.0.2 → 1.0.4

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 CHANGED
@@ -6,6 +6,7 @@ import { SuiInteractor } from './libs/suiInteractor';
6
6
  import { MapObjectStruct } from './types';
7
7
  import { SuiContractFactory } from './libs/suiContractFactory';
8
8
  import { SuiMoveMoudleFuncType } from './libs/suiContractFactory/types';
9
+ import { NetworkConfig } from './libs/suiInteractor';
9
10
  import { DerivePathParams, FaucetNetworkType, MapMoudleFuncQuery, MapMoudleFuncTx, DubheParams, SuiTxArg, SuiObjectArg, SuiVecTxArg } from './types';
10
11
  export declare function isUndefined(value?: unknown): value is undefined;
11
12
  export declare function withMeta<T extends {
@@ -39,20 +40,23 @@ export declare class Dubhe {
39
40
  get tx(): MapMoudleFuncTx;
40
41
  get object(): MapObjectStruct;
41
42
  view(dryResult: DevInspectResults): any[];
42
- state({ schema, struct, objectId, storageType, params, }: {
43
+ state({ tx, schema, params, }: {
44
+ tx: Transaction;
45
+ schema: string;
46
+ params: any[];
47
+ }): Promise<any[] | undefined>;
48
+ parseState({ schema, objectId, storageType, params, }: {
43
49
  schema: string;
44
- struct: string;
45
50
  objectId: string;
46
51
  storageType: string;
47
52
  params: any[];
48
- }): Promise<any[]>;
53
+ }): Promise<any[] | undefined>;
49
54
  /**
50
- * if derivePathParams is not provided or mnemonics is empty, it will return the keypair.
51
55
  * else:
52
56
  * it will generate signer from the mnemonic with the given derivePathParams.
53
57
  * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
54
58
  */
55
- getKeypair(derivePathParams?: DerivePathParams): import("@mysten/sui/dist/cjs/keypairs/ed25519").Ed25519Keypair;
59
+ getSigner(derivePathParams?: DerivePathParams): import("@mysten/sui/dist/cjs/keypairs/ed25519").Ed25519Keypair;
56
60
  /**
57
61
  * @description Switch the current account with the given derivePathParams
58
62
  * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
@@ -67,6 +71,10 @@ export declare class Dubhe {
67
71
  getPackageId(): string;
68
72
  getMetadata(): SuiMoveNormalizedModules | undefined;
69
73
  getNetwork(): import("./types").NetworkType | undefined;
74
+ getNetworkConfig(): NetworkConfig;
75
+ getTxExplorerUrl(txHash: string): string;
76
+ getAccountExplorerUrl(address: string): string;
77
+ getExplorerUrl(): string;
70
78
  /**
71
79
  * Request some SUI from faucet
72
80
  * @Returns {Promise<boolean>}, true if the request is successful, false otherwise.
@@ -79,7 +87,8 @@ export declare class Dubhe {
79
87
  getObjects(objectIds: string[]): Promise<SuiObjectData[]>;
80
88
  signTxn(tx: Uint8Array | Transaction | SuiTx, derivePathParams?: DerivePathParams): Promise<import("@mysten/sui/dist/cjs/cryptography").SignatureWithBytes>;
81
89
  signAndSendTxn(tx: Uint8Array | Transaction | SuiTx, derivePathParams?: DerivePathParams): Promise<SuiTransactionBlockResponse>;
82
- sendTxn(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
90
+ sendTx(transaction: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
91
+ waitForTransaction(digest: string): Promise<SuiTransactionBlockResponse>;
83
92
  /**
84
93
  * Transfer the given amount of SUI to the recipient
85
94
  * @param recipient
package/dist/index.js CHANGED
@@ -641,6 +641,27 @@ var SuiInteractor = class {
641
641
  }
642
642
  throw new Error("Failed to send transaction with all fullnodes");
643
643
  }
644
+ async waitForTransaction({
645
+ digest,
646
+ timeout = 60 * 1e3,
647
+ pollInterval = 2 * 1e3
648
+ }) {
649
+ for (const clientIdx in this.clients) {
650
+ try {
651
+ return await this.clients[clientIdx].waitForTransaction({
652
+ digest,
653
+ timeout,
654
+ pollInterval
655
+ });
656
+ } catch (err) {
657
+ console.warn(
658
+ `Failed to wait for transaction with fullnode ${this.fullNodes[clientIdx]}: ${err}`
659
+ );
660
+ await delay(2e3);
661
+ }
662
+ }
663
+ throw new Error("Failed to wait for transaction with all fullnodes");
664
+ }
644
665
  async getObjects(ids, options) {
645
666
  const opts = options ?? {
646
667
  showContent: true,
@@ -853,6 +874,56 @@ var SuiInteractor = class {
853
874
  }
854
875
  };
855
876
 
877
+ // src/libs/suiInteractor/defaultConfig.ts
878
+ var getDefaultURL = (networkType = "testnet") => {
879
+ switch (networkType) {
880
+ case "localnet":
881
+ return {
882
+ fullNode: "http://127.0.0.1:9000",
883
+ graphql: "http://127.0.0.1:9125",
884
+ network: "localnet",
885
+ txExplorer: "https://explorer.polymedia.app/txblock/:txHash?network=local",
886
+ accountExplorer: "https://explorer.polymedia.app/address/:address?network=local",
887
+ explorer: "https://explorer.polymedia.app?network=local"
888
+ };
889
+ case "devnet":
890
+ return {
891
+ fullNode: "https://fullnode.devnet.sui.io:443",
892
+ network: "devnet",
893
+ txExplorer: "https://suiscan.xyz/devnet/tx/:txHash",
894
+ accountExplorer: "https://suiscan.xyz/devnet/address/:address",
895
+ explorer: "https://suiscan.xyz/devnet"
896
+ };
897
+ case "testnet":
898
+ return {
899
+ fullNode: "https://fullnode.testnet.sui.io:443",
900
+ graphql: "https://sui-testnet.mystenlabs.com/graphql",
901
+ network: "testnet",
902
+ txExplorer: "https://suiscan.xyz/testnet/tx/:txHash",
903
+ accountExplorer: "https://suiscan.xyz/testnet/address/:address",
904
+ explorer: "https://suiscan.xyz/testnet"
905
+ };
906
+ case "mainnet":
907
+ return {
908
+ fullNode: "https://fullnode.mainnet.sui.io:443",
909
+ graphql: "https://sui-mainnet.mystenlabs.com/graphql",
910
+ network: "mainnet",
911
+ txExplorer: "https://suiscan.xyz/mainnet/tx/:txHash",
912
+ accountExplorer: "https://suiscan.xyz/mainnet/address/:address",
913
+ explorer: "https://suiscan.xyz/mainnet"
914
+ };
915
+ default:
916
+ return {
917
+ fullNode: "https://fullnode.testnet.sui.io:443",
918
+ graphql: "https://sui-testnet.mystenlabs.com/graphql",
919
+ network: "testnet",
920
+ txExplorer: "https://suiscan.xyz/testnet/tx/:txHash",
921
+ accountExplorer: "https://suiscan.xyz/testnet/address/:address",
922
+ explorer: "https://suiscan.xyz/testnet"
923
+ };
924
+ }
925
+ };
926
+
856
927
  // src/libs/suiContractFactory/index.ts
857
928
  var SuiContractFactory = class {
858
929
  // readonly #query: MapMessageQuery<ApiTypes> = {};
@@ -1010,7 +1081,7 @@ function createTx(meta, fn) {
1010
1081
  }
1011
1082
  );
1012
1083
  }
1013
- var _query, _tx, _object, _exec, _read, _bcs, _processKeyParameter, processKeyParameter_fn;
1084
+ var _query, _tx, _object, _exec, _read, _getVectorDepth, _bcs, _bcsenum, _processKeyParameter, processKeyParameter_fn;
1014
1085
  var Dubhe = class {
1015
1086
  /**
1016
1087
  * Support the following ways to init the DubheClient:
@@ -1153,6 +1224,12 @@ var Dubhe = class {
1153
1224
  });
1154
1225
  return await this.inspectTxn(tx);
1155
1226
  });
1227
+ __privateAdd(this, _getVectorDepth, (field) => {
1228
+ if (typeof field === "object" && "Vector" in field) {
1229
+ return 1 + __privateGet(this, _getVectorDepth).call(this, field.Vector);
1230
+ }
1231
+ return 0;
1232
+ });
1156
1233
  __privateAdd(this, _bcs, (bcsmeta) => {
1157
1234
  let loopFlag = false;
1158
1235
  const bcsJson = {};
@@ -1230,39 +1307,64 @@ var Dubhe = class {
1230
1307
  }
1231
1308
  return;
1232
1309
  case "Vector":
1233
- switch (value) {
1234
- case "U8":
1235
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u8());
1236
- return;
1237
- case "U16":
1238
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u16());
1239
- return;
1240
- case "U32":
1241
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u32());
1242
- return;
1243
- case "U64":
1244
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u64());
1245
- return;
1246
- case "U128":
1247
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u128());
1248
- return;
1249
- case "U256":
1250
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u256());
1251
- return;
1252
- case "Bool":
1253
- bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.bool());
1254
- return;
1255
- case "Address":
1256
- bcsJson[objName] = import_bcs3.bcs.vector(
1257
- import_bcs3.bcs.bytes(32).transform({
1258
- // To change the input type, you need to provide a type definition for the input
1259
- input: (val) => (0, import_bcs3.fromHEX)(val),
1260
- output: (val) => (0, import_bcs3.toHEX)(val)
1261
- })
1262
- );
1310
+ if (typeof value === "string") {
1311
+ switch (value) {
1312
+ case "U8":
1313
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u8());
1314
+ return;
1315
+ case "U16":
1316
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u16());
1317
+ return;
1318
+ case "U32":
1319
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u32());
1320
+ return;
1321
+ case "U64":
1322
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u64());
1323
+ return;
1324
+ case "U128":
1325
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u128());
1326
+ return;
1327
+ case "U256":
1328
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u256());
1329
+ return;
1330
+ case "Bool":
1331
+ bcsJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.bool());
1332
+ return;
1333
+ case "Address":
1334
+ bcsJson[objName] = import_bcs3.bcs.vector(
1335
+ import_bcs3.bcs.bytes(32).transform({
1336
+ // To change the input type, you need to provide a type definition for the input
1337
+ input: (val) => (0, import_bcs3.fromHEX)(val),
1338
+ output: (val) => (0, import_bcs3.toHEX)(val)
1339
+ })
1340
+ );
1341
+ return;
1342
+ default:
1343
+ }
1344
+ }
1345
+ if (typeof value === "object") {
1346
+ const vectorDepth = __privateGet(this, _getVectorDepth).call(this, value);
1347
+ let innerType = value;
1348
+ for (let i = 0; i < vectorDepth; i++) {
1349
+ innerType = innerType.Vector;
1350
+ }
1351
+ if ("Struct" in innerType) {
1352
+ const structType2 = innerType.Struct;
1353
+ const structId = `${structType2.address}::${structType2.module}::${structType2.name}`;
1354
+ let bcsType = __privateGet(this, _object)[structId];
1355
+ if (!bcsType) {
1356
+ loopFlag = true;
1357
+ return;
1358
+ }
1359
+ let baseType = bcsType;
1360
+ for (let i = 0; i <= vectorDepth; i++) {
1361
+ baseType = import_bcs3.bcs.vector(baseType);
1362
+ }
1363
+ bcsJson[objName] = baseType;
1263
1364
  return;
1264
- default:
1365
+ }
1265
1366
  }
1367
+ return;
1266
1368
  case "TypeParameter":
1267
1369
  bcsJson[objName] = import_bcs3.bcs.u128();
1268
1370
  return;
@@ -1313,6 +1415,174 @@ var Dubhe = class {
1313
1415
  loopFlag
1314
1416
  };
1315
1417
  });
1418
+ __privateAdd(this, _bcsenum, (bcsmeta) => {
1419
+ let loopFlag = false;
1420
+ const variantJson = {};
1421
+ Object.entries(bcsmeta.objectType.variants).forEach(([name, type]) => {
1422
+ if (type.length > 0) {
1423
+ Object.entries(type).forEach(([index, value]) => {
1424
+ const objType = value.type;
1425
+ const objName = value.name;
1426
+ switch (typeof objType) {
1427
+ case "object":
1428
+ for (const [key, value2] of Object.entries(objType)) {
1429
+ switch (key) {
1430
+ case "Struct":
1431
+ const structType = value2;
1432
+ if (structType.address === "0x1" && structType.module === "ascii" && structType.name === "String") {
1433
+ variantJson[objName] = import_bcs3.bcs.string();
1434
+ return;
1435
+ } else if (structType.address === "0x2" && structType.module === "object" && structType.name === "UID") {
1436
+ variantJson[objName] = import_bcs3.bcs.fixedArray(32, import_bcs3.bcs.u8()).transform({
1437
+ input: (id) => (0, import_bcs3.fromHEX)(id),
1438
+ output: (id) => (0, import_bcs3.toHEX)(Uint8Array.from(id))
1439
+ });
1440
+ return;
1441
+ } else if (structType.address === "0x2" && structType.module === "object" && structType.name === "ID") {
1442
+ variantJson[objName] = import_bcs3.bcs.fixedArray(32, import_bcs3.bcs.u8()).transform({
1443
+ input: (id) => (0, import_bcs3.fromHEX)(id),
1444
+ output: (id) => (0, import_bcs3.toHEX)(Uint8Array.from(id))
1445
+ });
1446
+ return;
1447
+ } else if (structType.address === "0x2" && structType.module === "bag" && structType.name === "Bag") {
1448
+ variantJson[objName] = import_bcs3.bcs.fixedArray(32, import_bcs3.bcs.u8()).transform({
1449
+ input: (id) => (0, import_bcs3.fromHEX)(id),
1450
+ output: (id) => (0, import_bcs3.toHEX)(Uint8Array.from(id))
1451
+ });
1452
+ return;
1453
+ } else if (structType.address === "0x1" && structType.module === "option" && structType.name === "Option") {
1454
+ switch (structType.typeArguments[0]) {
1455
+ case "U8":
1456
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u8());
1457
+ return;
1458
+ case "U16":
1459
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u16());
1460
+ return;
1461
+ case "U32":
1462
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u32());
1463
+ return;
1464
+ case "U64":
1465
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u64());
1466
+ return;
1467
+ case "U128":
1468
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u128());
1469
+ return;
1470
+ case "U256":
1471
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.u256());
1472
+ return;
1473
+ case "Bool":
1474
+ variantJson[objName] = import_bcs3.bcs.option(import_bcs3.bcs.bool());
1475
+ return;
1476
+ case "Address":
1477
+ variantJson[objName] = import_bcs3.bcs.option(
1478
+ import_bcs3.bcs.bytes(32).transform({
1479
+ // To change the input type, you need to provide a type definition for the input
1480
+ input: (val) => (0, import_bcs3.fromHEX)(val),
1481
+ output: (val) => (0, import_bcs3.toHEX)(val)
1482
+ })
1483
+ );
1484
+ return;
1485
+ default:
1486
+ }
1487
+ } else {
1488
+ if (this.object[`${structType.address}::${structType.module}::${structType.name}`] === void 0) {
1489
+ loopFlag = true;
1490
+ } else {
1491
+ variantJson[objName] = this.object[`${structType.address}::${structType.module}::${structType.name}`];
1492
+ return;
1493
+ }
1494
+ }
1495
+ return;
1496
+ case "Vector":
1497
+ if (typeof value2 === "string") {
1498
+ switch (value2) {
1499
+ case "U8":
1500
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u8());
1501
+ return;
1502
+ case "U16":
1503
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u16());
1504
+ return;
1505
+ case "U32":
1506
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u32());
1507
+ return;
1508
+ case "U64":
1509
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u64());
1510
+ return;
1511
+ case "U128":
1512
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u128());
1513
+ return;
1514
+ case "U256":
1515
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.u256());
1516
+ return;
1517
+ case "Bool":
1518
+ variantJson[objName] = import_bcs3.bcs.vector(import_bcs3.bcs.bool());
1519
+ return;
1520
+ case "Address":
1521
+ variantJson[objName] = import_bcs3.bcs.vector(
1522
+ import_bcs3.bcs.bytes(32).transform({
1523
+ // To change the input type, you need to provide a type definition for the input
1524
+ input: (val) => (0, import_bcs3.fromHEX)(val),
1525
+ output: (val) => (0, import_bcs3.toHEX)(val)
1526
+ })
1527
+ );
1528
+ return;
1529
+ default:
1530
+ }
1531
+ }
1532
+ case "TypeParameter":
1533
+ variantJson[objName] = import_bcs3.bcs.u128();
1534
+ return;
1535
+ default:
1536
+ throw new Error("Unsupported type");
1537
+ }
1538
+ }
1539
+ return;
1540
+ case "string":
1541
+ switch (objType) {
1542
+ case "U8":
1543
+ variantJson[objName] = import_bcs3.bcs.u8();
1544
+ return;
1545
+ case "U16":
1546
+ variantJson[objName] = import_bcs3.bcs.u16();
1547
+ return;
1548
+ case "U32":
1549
+ variantJson[objName] = import_bcs3.bcs.u32();
1550
+ return;
1551
+ case "U64":
1552
+ variantJson[objName] = import_bcs3.bcs.u64();
1553
+ return;
1554
+ case "U128":
1555
+ variantJson[objName] = import_bcs3.bcs.u128();
1556
+ return;
1557
+ case "U256":
1558
+ variantJson[objName] = import_bcs3.bcs.u256();
1559
+ return;
1560
+ case "Bool":
1561
+ variantJson[objName] = import_bcs3.bcs.bool();
1562
+ return;
1563
+ case "Address":
1564
+ variantJson[objName] = import_bcs3.bcs.bytes(32).transform({
1565
+ // To change the input type, you need to provide a type definition for the input
1566
+ input: (val) => (0, import_bcs3.fromHEX)(val),
1567
+ output: (val) => (0, import_bcs3.toHEX)(val)
1568
+ });
1569
+ return;
1570
+ default:
1571
+ return;
1572
+ }
1573
+ default:
1574
+ throw new Error("Unsupported type");
1575
+ }
1576
+ });
1577
+ } else {
1578
+ variantJson[name] = null;
1579
+ }
1580
+ });
1581
+ return {
1582
+ bcs: import_bcs3.bcs.enum(bcsmeta.objectName, variantJson),
1583
+ loopFlag
1584
+ };
1585
+ });
1316
1586
  this.accountManager = new SuiAccountManager({ mnemonics, secretKey });
1317
1587
  fullnodeUrls = fullnodeUrls || [(0, import_client2.getFullnodeUrl)(networkType ?? "mainnet")];
1318
1588
  this.suiInteractor = new SuiInteractor(fullnodeUrls, networkType);
@@ -1329,6 +1599,30 @@ var Dubhe = class {
1329
1599
  const data = moudlevalue;
1330
1600
  const moduleName = data.name;
1331
1601
  const objMoudleId = `${packageId}::${moduleName}`;
1602
+ if (data.enums) {
1603
+ Object.entries(data.enums).forEach(([enumName, enumType]) => {
1604
+ const objectId = `${objMoudleId}::${enumName}`;
1605
+ const bcsmeta = {
1606
+ objectId,
1607
+ objectName: enumName,
1608
+ objectType: enumType
1609
+ };
1610
+ let bcsObj = __privateGet(this, _bcsenum).call(this, bcsmeta);
1611
+ if (bcsObj.loopFlag === true) {
1612
+ loopFlag = bcsObj.loopFlag;
1613
+ }
1614
+ if (__privateGet(this, _object)[objectId] === void 0) {
1615
+ __privateGet(this, _object)[objectId] = bcsObj.bcs;
1616
+ __privateGet(this, _object)[`vector<${objectId}>`] = import_bcs3.bcs.vector(bcsObj.bcs);
1617
+ __privateGet(this, _object)[`vector<vector<${objectId}>>`] = import_bcs3.bcs.vector(
1618
+ import_bcs3.bcs.vector(bcsObj.bcs)
1619
+ );
1620
+ __privateGet(this, _object)[`0x1::option::Option<${objectId}>`] = import_bcs3.bcs.option(
1621
+ bcsObj.bcs
1622
+ );
1623
+ }
1624
+ });
1625
+ }
1332
1626
  Object.entries(data.structs).forEach(([objectName, objectType]) => {
1333
1627
  const objectId = `${objMoudleId}::${objectName}`;
1334
1628
  const bcsmeta = {
@@ -1502,15 +1796,33 @@ var Dubhe = class {
1502
1796
  }
1503
1797
  }
1504
1798
  async state({
1799
+ tx,
1800
+ schema,
1801
+ params
1802
+ }) {
1803
+ const moduleName = `schema`;
1804
+ const functionName = `get_${schema}`;
1805
+ let queryResponse = void 0;
1806
+ try {
1807
+ queryResponse = await this.query[moduleName][functionName]({
1808
+ tx,
1809
+ params
1810
+ });
1811
+ if (queryResponse.effects.status.status !== "success") {
1812
+ return void 0;
1813
+ }
1814
+ } catch {
1815
+ return void 0;
1816
+ }
1817
+ return this.view(queryResponse);
1818
+ }
1819
+ async parseState({
1505
1820
  schema,
1506
- struct,
1507
1821
  objectId,
1508
1822
  storageType,
1509
1823
  params
1510
1824
  }) {
1511
1825
  const tx = new import_transactions3.Transaction();
1512
- const moduleName = `${schema}_schema`;
1513
- const functionName = `get_${struct}`;
1514
1826
  const schemaObject = tx.object(objectId);
1515
1827
  const storageValueMatch = storageType.match(/^StorageValue<(.+)>$/);
1516
1828
  const storageMapMatch = storageType.match(/^StorageMap<(.+),\s*(.+)>$/);
@@ -1545,19 +1857,18 @@ var Dubhe = class {
1545
1857
  `Invalid storage type: ${storageType}. Must be StorageValue<V>, StorageMap<K,V>, or StorageDoubleMap<K1,K2,V>`
1546
1858
  );
1547
1859
  }
1548
- const queryResponse = await this.query[moduleName][functionName]({
1860
+ return this.state({
1549
1861
  tx,
1862
+ schema,
1550
1863
  params: processedParams
1551
1864
  });
1552
- return this.view(queryResponse);
1553
1865
  }
1554
1866
  /**
1555
- * if derivePathParams is not provided or mnemonics is empty, it will return the keypair.
1556
1867
  * else:
1557
1868
  * it will generate signer from the mnemonic with the given derivePathParams.
1558
1869
  * @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
1559
1870
  */
1560
- getKeypair(derivePathParams) {
1871
+ getSigner(derivePathParams) {
1561
1872
  return this.accountManager.getKeyPair(derivePathParams);
1562
1873
  }
1563
1874
  /**
@@ -1586,6 +1897,18 @@ var Dubhe = class {
1586
1897
  getNetwork() {
1587
1898
  return this.suiInteractor.network;
1588
1899
  }
1900
+ getNetworkConfig() {
1901
+ return getDefaultURL(this.getNetwork());
1902
+ }
1903
+ getTxExplorerUrl(txHash) {
1904
+ return this.getNetworkConfig().txExplorer.replace(":txHash", txHash);
1905
+ }
1906
+ getAccountExplorerUrl(address) {
1907
+ return this.getNetworkConfig().accountExplorer.replace(":address", address);
1908
+ }
1909
+ getExplorerUrl() {
1910
+ return this.getNetworkConfig().explorer;
1911
+ }
1589
1912
  /**
1590
1913
  * Request some SUI from faucet
1591
1914
  * @Returns {Promise<boolean>}, true if the request is successful, false otherwise.
@@ -1625,15 +1948,18 @@ var Dubhe = class {
1625
1948
  }
1626
1949
  const txBlock = tx instanceof SuiTx ? tx.tx : tx;
1627
1950
  const txBytes = txBlock instanceof import_transactions3.Transaction ? await txBlock.build({ client: this.client() }) : txBlock;
1628
- const keyPair = this.getKeypair(derivePathParams);
1951
+ const keyPair = this.getSigner(derivePathParams);
1629
1952
  return await keyPair.signTransaction(txBytes);
1630
1953
  }
1631
1954
  async signAndSendTxn(tx, derivePathParams) {
1632
1955
  const { bytes, signature } = await this.signTxn(tx, derivePathParams);
1633
- return this.suiInteractor.sendTx(bytes, signature);
1956
+ return this.sendTx(bytes, signature);
1957
+ }
1958
+ async sendTx(transaction, signature) {
1959
+ return this.suiInteractor.sendTx(transaction, signature);
1634
1960
  }
1635
- async sendTxn(transactionBlock, signature) {
1636
- return this.suiInteractor.sendTx(transactionBlock, signature);
1961
+ async waitForTransaction(digest) {
1962
+ return this.suiInteractor.waitForTransaction({ digest });
1637
1963
  }
1638
1964
  /**
1639
1965
  * Transfer the given amount of SUI to the recipient
@@ -1817,7 +2143,9 @@ _tx = new WeakMap();
1817
2143
  _object = new WeakMap();
1818
2144
  _exec = new WeakMap();
1819
2145
  _read = new WeakMap();
2146
+ _getVectorDepth = new WeakMap();
1820
2147
  _bcs = new WeakMap();
2148
+ _bcsenum = new WeakMap();
1821
2149
  _processKeyParameter = new WeakSet();
1822
2150
  processKeyParameter_fn = function(tx, keyType, value) {
1823
2151
  switch (keyType.toLowerCase()) {