@mysten/kiosk 0.7.0 → 0.7.1

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.mjs CHANGED
@@ -258,6 +258,7 @@ function getNormalizedRuleType(rule) {
258
258
  }
259
259
 
260
260
  // src/tx/kiosk.ts
261
+ import { bcs as bcs2 } from "@mysten/sui.js/bcs";
261
262
  function createKiosk(tx) {
262
263
  const [kiosk, kioskOwnerCap] = tx.moveCall({
263
264
  target: `${KIOSK_MODULE}::new`
@@ -294,7 +295,7 @@ function take(tx, itemType, kiosk, kioskCap, itemId) {
294
295
  const [item] = tx.moveCall({
295
296
  target: `${KIOSK_MODULE}::take`,
296
297
  typeArguments: [itemType],
297
- arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")]
298
+ arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)]
298
299
  });
299
300
  return item;
300
301
  }
@@ -305,8 +306,8 @@ function list(tx, itemType, kiosk, kioskCap, itemId, price) {
305
306
  arguments: [
306
307
  objArg(tx, kiosk),
307
308
  objArg(tx, kioskCap),
308
- tx.pure(itemId, "address"),
309
- tx.pure(price, "u64")
309
+ tx.pure.address(itemId),
310
+ tx.pure.u64(price)
310
311
  ]
311
312
  });
312
313
  }
@@ -314,26 +315,26 @@ function delist(tx, itemType, kiosk, kioskCap, itemId) {
314
315
  tx.moveCall({
315
316
  target: `${KIOSK_MODULE}::delist`,
316
317
  typeArguments: [itemType],
317
- arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")]
318
+ arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)]
318
319
  });
319
320
  }
320
321
  function placeAndList(tx, itemType, kiosk, kioskCap, item, price) {
321
322
  tx.moveCall({
322
323
  target: `${KIOSK_MODULE}::place_and_list`,
323
324
  typeArguments: [itemType],
324
- arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure(price, "u64")]
325
+ arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure.u64(price)]
325
326
  });
326
327
  }
327
328
  function purchase(tx, itemType, kiosk, itemId, payment) {
328
329
  const [item, transferRequest] = tx.moveCall({
329
330
  target: `${KIOSK_MODULE}::purchase`,
330
331
  typeArguments: [itemType],
331
- arguments: [objArg(tx, kiosk), tx.pure(itemId, "address"), objArg(tx, payment)]
332
+ arguments: [objArg(tx, kiosk), tx.pure.address(itemId), objArg(tx, payment)]
332
333
  });
333
334
  return [item, transferRequest];
334
335
  }
335
336
  function withdrawFromKiosk(tx, kiosk, kioskCap, amount) {
336
- const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>");
337
+ const amountArg = bcs2.option(bcs2.u64()).serialize(amount);
337
338
  const [coin] = tx.moveCall({
338
339
  target: `${KIOSK_MODULE}::withdraw`,
339
340
  arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), amountArg]
@@ -344,7 +345,7 @@ function borrowValue(tx, itemType, kiosk, kioskCap, itemId) {
344
345
  const [item, promise] = tx.moveCall({
345
346
  target: `${KIOSK_MODULE}::borrow_val`,
346
347
  typeArguments: [itemType],
347
- arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")]
348
+ arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)]
348
349
  });
349
350
  return [item, promise];
350
351
  }
@@ -734,8 +735,8 @@ function attachRoyaltyRuleTx(tx, type, policy, policyCap, percentageBps, minAmou
734
735
  arguments: [
735
736
  objArg(tx, policy),
736
737
  objArg(tx, policyCap),
737
- tx.pure(percentageBps, "u16"),
738
- tx.pure(minAmount, "u64")
738
+ tx.pure.u16(Number(percentageBps)),
739
+ tx.pure.u64(minAmount)
739
740
  ]
740
741
  });
741
742
  }
@@ -750,11 +751,12 @@ function attachFloorPriceRuleTx(tx, type, policy, policyCap, minPrice, packageId
750
751
  tx.moveCall({
751
752
  target: `${packageId}::floor_price_rule::add`,
752
753
  typeArguments: [type],
753
- arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure(minPrice, "u64")]
754
+ arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure.u64(minPrice)]
754
755
  });
755
756
  }
756
757
 
757
758
  // src/tx/transfer-policy.ts
759
+ import { bcs as bcs3 } from "@mysten/sui.js/bcs";
758
760
  function createTransferPolicy(tx, itemType, publisher) {
759
761
  const [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing(
760
762
  tx,
@@ -780,7 +782,7 @@ function shareTransferPolicy(tx, itemType, transferPolicy) {
780
782
  });
781
783
  }
782
784
  function withdrawFromPolicy(tx, itemType, policy, policyCap, amount) {
783
- const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>");
785
+ const amountArg = bcs3.option(bcs3.u64()).serialize(amount);
784
786
  const [profits] = tx.moveCall({
785
787
  target: `${TRANSFER_POLICY_MODULE}::withdraw`,
786
788
  typeArguments: [itemType],
@@ -842,7 +844,7 @@ var TransferPolicyTransaction = class {
842
844
  throw new Error("There's already transfer policy for this Type.");
843
845
  }
844
846
  const cap = createTransferPolicy(this.transactionBlock, type, publisher);
845
- this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address"));
847
+ this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address));
846
848
  }
847
849
  /**
848
850
  * A convenient function to create a Transfer Policy and attach some rules
@@ -882,7 +884,7 @@ var TransferPolicyTransaction = class {
882
884
  shareTransferPolicy(this.transactionBlock, this.type, this.policy);
883
885
  this.transactionBlock.transferObjects(
884
886
  [this.policyCap],
885
- this.transactionBlock.pure(address, "address")
887
+ this.transactionBlock.pure.address(address)
886
888
  );
887
889
  }
888
890
  /**
@@ -907,7 +909,7 @@ var TransferPolicyTransaction = class {
907
909
  this.policyCap,
908
910
  amount
909
911
  );
910
- this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address"));
912
+ this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address));
911
913
  return this;
912
914
  }
913
915
  /**
@@ -1175,7 +1177,7 @@ var KioskTransaction = class {
1175
1177
  createAndShare(address) {
1176
1178
  __privateMethod(this, _validateFinalizedStatus, validateFinalizedStatus_fn).call(this);
1177
1179
  const cap = createKioskAndShare(this.transactionBlock);
1178
- this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address"));
1180
+ this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address));
1179
1181
  }
1180
1182
  /**
1181
1183
  * Shares the kiosk.
@@ -1196,7 +1198,7 @@ var KioskTransaction = class {
1196
1198
  this.share();
1197
1199
  this.transactionBlock.transferObjects(
1198
1200
  [this.kioskCap],
1199
- this.transactionBlock.pure(address, "address")
1201
+ this.transactionBlock.pure.address(address)
1200
1202
  );
1201
1203
  }
1202
1204
  /**
@@ -1254,7 +1256,7 @@ var KioskTransaction = class {
1254
1256
  this.kioskCap,
1255
1257
  amount
1256
1258
  );
1257
- this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address"));
1259
+ this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address));
1258
1260
  return this;
1259
1261
  }
1260
1262
  /**
@@ -1319,7 +1321,7 @@ var KioskTransaction = class {
1319
1321
  transfer({ itemType, itemId, address }) {
1320
1322
  __privateMethod(this, _validateKioskIsSet, validateKioskIsSet_fn).call(this);
1321
1323
  const item = this.take({ itemType, itemId });
1322
- this.transactionBlock.transferObjects([item], this.transactionBlock.pure(address, "address"));
1324
+ this.transactionBlock.transferObjects([item], this.transactionBlock.pure.address(address));
1323
1325
  return this;
1324
1326
  }
1325
1327
  /**
@@ -1350,7 +1352,7 @@ var KioskTransaction = class {
1350
1352
  sellerKiosk
1351
1353
  }) {
1352
1354
  const coin = this.transactionBlock.splitCoins(this.transactionBlock.gas, [
1353
- this.transactionBlock.pure(price, "u64")
1355
+ this.transactionBlock.pure.u64(price)
1354
1356
  ]);
1355
1357
  return purchase(this.transactionBlock, itemType, sellerKiosk, itemId, coin);
1356
1358
  }