@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 +14 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -47
- package/dist/index.mjs.map +1 -1
- package/dist/libs/suiInteractor/suiInteractor.d.ts +1 -0
- package/dist/libs/suiTxBuilder/index.d.ts +29 -220
- package/dist/libs/suiTxBuilder/util.d.ts +2 -2
- package/dist/obelisk.d.ts +2 -2
- package/dist/types/index.d.ts +2 -0
- package/package.json +7 -7
- package/src/libs/suiInteractor/suiInteractor.ts +2 -0
- package/src/libs/suiTxBuilder/index.ts +22 -21
- package/src/libs/suiTxBuilder/util.ts +2 -4
- package/src/obelisk.ts +13 -41
- package/src/types/index.ts +5 -2
package/dist/index.mjs
CHANGED
|
@@ -285,17 +285,11 @@ var SuiTx = class {
|
|
|
285
285
|
get blockData() {
|
|
286
286
|
return this.tx.blockData;
|
|
287
287
|
}
|
|
288
|
-
autoPure(value, type) {
|
|
289
|
-
if (type === void 0) {
|
|
290
|
-
return convertArgs(this.tx, [value]);
|
|
291
|
-
}
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
288
|
address(value) {
|
|
295
289
|
return this.tx.pure.address(value);
|
|
296
290
|
}
|
|
297
291
|
get pure() {
|
|
298
|
-
return this.tx.pure
|
|
292
|
+
return this.tx.pure;
|
|
299
293
|
}
|
|
300
294
|
object(value) {
|
|
301
295
|
return this.tx.object(value);
|
|
@@ -367,7 +361,7 @@ var SuiTx = class {
|
|
|
367
361
|
splitCoins(coin, amounts) {
|
|
368
362
|
const res = this.tx.splitCoins(
|
|
369
363
|
convertObjArg(this.tx, coin),
|
|
370
|
-
|
|
364
|
+
convertAmounts(this.tx, amounts)
|
|
371
365
|
);
|
|
372
366
|
return amounts.map((_, i) => res[i]);
|
|
373
367
|
}
|
|
@@ -428,13 +422,14 @@ var SuiTx = class {
|
|
|
428
422
|
if (coins.length > 1) {
|
|
429
423
|
this.tx.mergeCoins(mergedCoin, coinObjects.slice(1));
|
|
430
424
|
}
|
|
431
|
-
const [sendCoin] = this.tx.splitCoins(
|
|
432
|
-
|
|
433
|
-
|
|
425
|
+
const [sendCoin] = this.tx.splitCoins(
|
|
426
|
+
mergedCoin,
|
|
427
|
+
convertAmounts(this.tx, [amount])
|
|
428
|
+
);
|
|
434
429
|
return [sendCoin, mergedCoin];
|
|
435
430
|
}
|
|
436
431
|
splitSUIFromGas(amounts) {
|
|
437
|
-
return this.tx.splitCoins(this.tx.gas,
|
|
432
|
+
return this.tx.splitCoins(this.tx.gas, convertAmounts(this.tx, amounts));
|
|
438
433
|
}
|
|
439
434
|
splitMultiCoins(coins, amounts) {
|
|
440
435
|
const coinObjects = coins.map((coin) => convertObjArg(this.tx, coin));
|
|
@@ -769,7 +764,8 @@ var SuiInteractor = class {
|
|
|
769
764
|
selectedCoins.push({
|
|
770
765
|
objectId: coinData.coinObjectId,
|
|
771
766
|
digest: coinData.digest,
|
|
772
|
-
version: coinData.version
|
|
767
|
+
version: coinData.version,
|
|
768
|
+
balance: coinData.balance
|
|
773
769
|
});
|
|
774
770
|
totalAmount = totalAmount + parseInt(coinData.balance);
|
|
775
771
|
if (totalAmount >= amount) {
|
|
@@ -979,6 +975,7 @@ var Obelisk = class {
|
|
|
979
975
|
u256: bcs2.u256(),
|
|
980
976
|
bool: bcs2.bool(),
|
|
981
977
|
"0x1::ascii::String": bcs2.string(),
|
|
978
|
+
"0x1::string::String": bcs2.string(),
|
|
982
979
|
"0x1::option::Option<address>": bcs2.option(
|
|
983
980
|
bcs2.bytes(32).transform({
|
|
984
981
|
// To change the input type, you need to provide a type definition for the input
|
|
@@ -1498,9 +1495,9 @@ var Obelisk = class {
|
|
|
1498
1495
|
async getEntity(worldId, schemaName, entityId) {
|
|
1499
1496
|
const schemaModuleName = `${schemaName}_schema`;
|
|
1500
1497
|
const tx = new Transaction2();
|
|
1501
|
-
const params = [tx.
|
|
1498
|
+
const params = [tx.object(worldId)];
|
|
1502
1499
|
if (entityId !== void 0) {
|
|
1503
|
-
params.push(tx.
|
|
1500
|
+
params.push(tx.object(entityId));
|
|
1504
1501
|
}
|
|
1505
1502
|
const dryResult = await this.query[schemaModuleName].get(
|
|
1506
1503
|
tx,
|
|
@@ -1511,9 +1508,9 @@ var Obelisk = class {
|
|
|
1511
1508
|
async containEntity(worldId, schemaName, entityId) {
|
|
1512
1509
|
const schemaModuleName = `${schemaName}_schema`;
|
|
1513
1510
|
const tx = new Transaction2();
|
|
1514
|
-
const params = [tx.
|
|
1511
|
+
const params = [tx.object(worldId)];
|
|
1515
1512
|
if (entityId !== void 0) {
|
|
1516
|
-
params.push(tx.
|
|
1513
|
+
params.push(tx.object(entityId));
|
|
1517
1514
|
}
|
|
1518
1515
|
const dryResult = await this.query[schemaModuleName].contains(
|
|
1519
1516
|
tx,
|
|
@@ -1521,36 +1518,6 @@ var Obelisk = class {
|
|
|
1521
1518
|
);
|
|
1522
1519
|
return this.view(dryResult);
|
|
1523
1520
|
}
|
|
1524
|
-
// async getEntities(
|
|
1525
|
-
// worldId: string,
|
|
1526
|
-
// schemaName: string,
|
|
1527
|
-
// cursor?: string,
|
|
1528
|
-
// limit?: number
|
|
1529
|
-
// ) {
|
|
1530
|
-
// let schemaModuleName = `${schemaName}_schema`;
|
|
1531
|
-
// const tx = new TransactionBlock();
|
|
1532
|
-
// let params = [tx.pure(worldId)] as SuiTxArgument[];
|
|
1533
|
-
// const tableResult = (await this.query[schemaonentModuleName].entities(
|
|
1534
|
-
// tx,
|
|
1535
|
-
// params
|
|
1536
|
-
// )) as DevInspectResults;
|
|
1537
|
-
// const entities = tableResult.results as SuiReturnValues;
|
|
1538
|
-
// const bcs = new BCS(getSuiMoveConfig());
|
|
1539
|
-
// let value = Uint8Array.from(entities[0].returnValues[0][0]);
|
|
1540
|
-
// let tableId = '0x' + bcs.de('address', value);
|
|
1541
|
-
// let dynamicFields = await this.suiInteractor.getDynamicFields(
|
|
1542
|
-
// tableId,
|
|
1543
|
-
// cursor,
|
|
1544
|
-
// limit
|
|
1545
|
-
// );
|
|
1546
|
-
// let objectIds = dynamicFields.data.map((field) => field.objectId);
|
|
1547
|
-
// let objectDatas = await this.suiInteractor.getEntitiesObjects(objectIds);
|
|
1548
|
-
// return {
|
|
1549
|
-
// data: objectDatas,
|
|
1550
|
-
// nextCursor: dynamicFields.nextCursor,
|
|
1551
|
-
// hasNextPage: dynamicFields.hasNextPage,
|
|
1552
|
-
// };
|
|
1553
|
-
// }
|
|
1554
1521
|
async getOwnedObjects(owner, cursor, limit) {
|
|
1555
1522
|
const ownedObjects = await this.suiInteractor.getOwnedObjects(
|
|
1556
1523
|
owner,
|