@0xobelisk/sui-client 0.5.21 → 0.5.23

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/index.js CHANGED
@@ -318,17 +318,11 @@ var SuiTx = class {
318
318
  get blockData() {
319
319
  return this.tx.blockData;
320
320
  }
321
- autoPure(value, type) {
322
- if (type === void 0) {
323
- return convertArgs(this.tx, [value]);
324
- }
325
- return;
326
- }
327
321
  address(value) {
328
322
  return this.tx.pure.address(value);
329
323
  }
330
324
  get pure() {
331
- return this.tx.pure.bind(this.tx);
325
+ return this.tx.pure;
332
326
  }
333
327
  object(value) {
334
328
  return this.tx.object(value);
@@ -400,7 +394,7 @@ var SuiTx = class {
400
394
  splitCoins(coin, amounts) {
401
395
  const res = this.tx.splitCoins(
402
396
  convertObjArg(this.tx, coin),
403
- convertArgs(this.tx, amounts)
397
+ convertAmounts(this.tx, amounts)
404
398
  );
405
399
  return amounts.map((_, i) => res[i]);
406
400
  }
@@ -461,13 +455,14 @@ var SuiTx = class {
461
455
  if (coins.length > 1) {
462
456
  this.tx.mergeCoins(mergedCoin, coinObjects.slice(1));
463
457
  }
464
- const [sendCoin] = this.tx.splitCoins(mergedCoin, [
465
- typeof amount === "number" || typeof amount === "bigint" ? amount : convertArgs(this.tx, [amount])[0]
466
- ]);
458
+ const [sendCoin] = this.tx.splitCoins(
459
+ mergedCoin,
460
+ convertAmounts(this.tx, [amount])
461
+ );
467
462
  return [sendCoin, mergedCoin];
468
463
  }
469
464
  splitSUIFromGas(amounts) {
470
- return this.tx.splitCoins(this.tx.gas, convertArgs(this.tx, amounts));
465
+ return this.tx.splitCoins(this.tx.gas, convertAmounts(this.tx, amounts));
471
466
  }
472
467
  splitMultiCoins(coins, amounts) {
473
468
  const coinObjects = coins.map((coin) => convertObjArg(this.tx, coin));
@@ -802,7 +797,8 @@ var SuiInteractor = class {
802
797
  selectedCoins.push({
803
798
  objectId: coinData.coinObjectId,
804
799
  digest: coinData.digest,
805
- version: coinData.version
800
+ version: coinData.version,
801
+ balance: coinData.balance
806
802
  });
807
803
  totalAmount = totalAmount + parseInt(coinData.balance);
808
804
  if (totalAmount >= amount) {
@@ -1012,6 +1008,7 @@ var Obelisk = class {
1012
1008
  u256: import_bcs2.bcs.u256(),
1013
1009
  bool: import_bcs2.bcs.bool(),
1014
1010
  "0x1::ascii::String": import_bcs2.bcs.string(),
1011
+ "0x1::string::String": import_bcs2.bcs.string(),
1015
1012
  "0x1::option::Option<address>": import_bcs2.bcs.option(
1016
1013
  import_bcs2.bcs.bytes(32).transform({
1017
1014
  // To change the input type, you need to provide a type definition for the input
@@ -1531,9 +1528,9 @@ var Obelisk = class {
1531
1528
  async getEntity(worldId, schemaName, entityId) {
1532
1529
  const schemaModuleName = `${schemaName}_schema`;
1533
1530
  const tx = new import_transactions3.Transaction();
1534
- const params = [tx.pure.address(worldId)];
1531
+ const params = [tx.object(worldId)];
1535
1532
  if (entityId !== void 0) {
1536
- params.push(tx.pure.address(entityId));
1533
+ params.push(tx.object(entityId));
1537
1534
  }
1538
1535
  const dryResult = await this.query[schemaModuleName].get(
1539
1536
  tx,
@@ -1544,9 +1541,9 @@ var Obelisk = class {
1544
1541
  async containEntity(worldId, schemaName, entityId) {
1545
1542
  const schemaModuleName = `${schemaName}_schema`;
1546
1543
  const tx = new import_transactions3.Transaction();
1547
- const params = [tx.pure.address(worldId)];
1544
+ const params = [tx.object(worldId)];
1548
1545
  if (entityId !== void 0) {
1549
- params.push(tx.pure.address(entityId));
1546
+ params.push(tx.object(entityId));
1550
1547
  }
1551
1548
  const dryResult = await this.query[schemaModuleName].contains(
1552
1549
  tx,
@@ -1554,36 +1551,6 @@ var Obelisk = class {
1554
1551
  );
1555
1552
  return this.view(dryResult);
1556
1553
  }
1557
- // async getEntities(
1558
- // worldId: string,
1559
- // schemaName: string,
1560
- // cursor?: string,
1561
- // limit?: number
1562
- // ) {
1563
- // let schemaModuleName = `${schemaName}_schema`;
1564
- // const tx = new TransactionBlock();
1565
- // let params = [tx.pure(worldId)] as SuiTxArgument[];
1566
- // const tableResult = (await this.query[schemaonentModuleName].entities(
1567
- // tx,
1568
- // params
1569
- // )) as DevInspectResults;
1570
- // const entities = tableResult.results as SuiReturnValues;
1571
- // const bcs = new BCS(getSuiMoveConfig());
1572
- // let value = Uint8Array.from(entities[0].returnValues[0][0]);
1573
- // let tableId = '0x' + bcs.de('address', value);
1574
- // let dynamicFields = await this.suiInteractor.getDynamicFields(
1575
- // tableId,
1576
- // cursor,
1577
- // limit
1578
- // );
1579
- // let objectIds = dynamicFields.data.map((field) => field.objectId);
1580
- // let objectDatas = await this.suiInteractor.getEntitiesObjects(objectIds);
1581
- // return {
1582
- // data: objectDatas,
1583
- // nextCursor: dynamicFields.nextCursor,
1584
- // hasNextPage: dynamicFields.hasNextPage,
1585
- // };
1586
- // }
1587
1554
  async getOwnedObjects(owner, cursor, limit) {
1588
1555
  const ownedObjects = await this.suiInteractor.getOwnedObjects(
1589
1556
  owner,