@t2000/cli 0.36.3 → 0.37.0

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.
@@ -56597,6 +56597,48 @@ function checkOverlayFeeConfig(overlayFeeRate, overlayFeeReceiver) {
56597
56597
  // ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
56598
56598
  var import_index = __toESM(require_eventemitter3(), 1);
56599
56599
 
56600
+ // ../../node_modules/.pnpm/@mysten+payment-kit@0.1.6_@mysten+sui@2.11.0_typescript@5.9.3_/node_modules/@mysten/payment-kit/dist/error.mjs
56601
+ var PaymentKitClientError = class extends Error {
56602
+ };
56603
+ var PaymentKitUriError = class extends PaymentKitClientError {
56604
+ };
56605
+
56606
+ // ../../node_modules/.pnpm/@mysten+payment-kit@0.1.6_@mysten+sui@2.11.0_typescript@5.9.3_/node_modules/@mysten/payment-kit/dist/constants.mjs
56607
+ init_utils2();
56608
+ var SUI_COIN_TYPE = normalizeStructTag(SUI_TYPE_ARG);
56609
+ var SUI_PAYMENT_KIT_PROTOCOL = "sui:pay";
56610
+
56611
+ // ../../node_modules/.pnpm/@mysten+payment-kit@0.1.6_@mysten+sui@2.11.0_typescript@5.9.3_/node_modules/@mysten/payment-kit/dist/uri.mjs
56612
+ init_utils2();
56613
+ var isValidNonce = (nonce) => {
56614
+ return nonce.length <= 36;
56615
+ };
56616
+ var isValidAmount = (amount) => {
56617
+ return amount > 0n;
56618
+ };
56619
+ var isValidCoinType = (coinType) => {
56620
+ return isValidNamedType(coinType);
56621
+ };
56622
+ var createPaymentTransactionUri = (params) => {
56623
+ const { receiverAddress, amount, coinType, nonce, registryId, registryName } = params;
56624
+ const uri = new URL(SUI_PAYMENT_KIT_PROTOCOL);
56625
+ if (isValidSuiAddress(receiverAddress)) uri.searchParams.append("receiver", receiverAddress);
56626
+ else throw new PaymentKitUriError("Invalid Sui address");
56627
+ if (isValidAmount(amount)) uri.searchParams.append("amount", amount.toString());
56628
+ else throw new PaymentKitUriError("Amount must be a positive numeric string");
56629
+ if (isValidCoinType(coinType)) uri.searchParams.append("coinType", coinType);
56630
+ else throw new PaymentKitUriError("Invalid Coin Type");
56631
+ if (isValidNonce(nonce)) uri.searchParams.append("nonce", nonce);
56632
+ else throw new PaymentKitUriError("Nonce length exceeds maximum of 36 characters");
56633
+ if (registryId) if (isValidSuiObjectId(registryId)) uri.searchParams.append("registry", registryId);
56634
+ else throw new PaymentKitUriError("Invalid Sui Object Id for Registry Id");
56635
+ if (registryName) uri.searchParams.append("registry", registryName);
56636
+ if (params.label) uri.searchParams.append("label", params.label);
56637
+ if (params.message) uri.searchParams.append("message", params.message);
56638
+ if (params.iconUrl) uri.searchParams.append("iconUrl", params.iconUrl);
56639
+ return uri.toString();
56640
+ };
56641
+
56600
56642
  // ../../node_modules/.pnpm/@mysten+sui@2.11.0_typescript@5.9.3/node_modules/@mysten/sui/dist/jsonRpc/errors.mjs
56601
56643
  var CODE_TO_ERROR_TYPE = {
56602
56644
  "-32700": "ParseError",
@@ -66011,8 +66053,8 @@ var T2000 = class _T2000 extends import_index.default {
66011
66053
  async pay(options) {
66012
66054
  this.enforcer.assertNotLocked();
66013
66055
  this.enforcer.check({ operation: "pay", amount: options.maxPrice ?? 1 });
66014
- const { Mppx } = await import("./client-KQCHOXLV.js");
66015
- const { sui } = await import("./client-2MUO6VAJ.js");
66056
+ const { Mppx } = await import("./client-IXUBQ3HM.js");
66057
+ const { sui } = await import("./client-YNWQPUC5.js");
66016
66058
  const client = this.client;
66017
66059
  const signer = this._signer;
66018
66060
  const signerAddress = signer.getAddress();
@@ -66320,13 +66362,28 @@ var T2000 = class _T2000 extends import_index.default {
66320
66362
  const currency = params?.currency ?? "USDC";
66321
66363
  const memo = params?.memo ?? null;
66322
66364
  const label = params?.label ?? null;
66323
- const qrParts = [`sui:${this._address}`];
66324
- const queryParams = [];
66325
- if (amount != null) queryParams.push(`amount=${amount}`);
66326
- if (currency !== "SUI") queryParams.push(`currency=${currency}`);
66327
- if (memo) queryParams.push(`memo=${encodeURIComponent(memo)}`);
66328
- if (label) queryParams.push(`label=${encodeURIComponent(label)}`);
66329
- const qrUri = queryParams.length > 0 ? `${qrParts[0]}?${queryParams.join("&")}` : qrParts[0];
66365
+ const nonce = crypto.randomUUID();
66366
+ let qrUri;
66367
+ if (amount != null && amount > 0) {
66368
+ const decimals = currency === "SUI" ? 9 : 6;
66369
+ const coinType = currency === "SUI" ? "0x2::sui::SUI" : SUPPORTED_ASSETS.USDC.type;
66370
+ const rawAmount = BigInt(Math.floor(amount * 10 ** decimals));
66371
+ qrUri = createPaymentTransactionUri({
66372
+ receiverAddress: this._address,
66373
+ amount: rawAmount,
66374
+ coinType,
66375
+ nonce,
66376
+ ...label ? { label } : {},
66377
+ ...memo ? { message: memo } : {}
66378
+ });
66379
+ } else {
66380
+ const qrParts = [`sui:${this._address}`];
66381
+ const queryParams = [];
66382
+ if (currency !== "SUI") queryParams.push(`currency=${currency}`);
66383
+ if (memo) queryParams.push(`memo=${encodeURIComponent(memo)}`);
66384
+ if (label) queryParams.push(`label=${encodeURIComponent(label)}`);
66385
+ qrUri = queryParams.length > 0 ? `${qrParts[0]}?${queryParams.join("&")}` : qrParts[0];
66386
+ }
66330
66387
  const amountStr = amount != null ? `$${amount.toFixed(2)} ` : "";
66331
66388
  const displayParts = [`Send ${amountStr}${currency} to ${truncateAddress(this._address)}`];
66332
66389
  if (memo) displayParts.push(`Memo: ${memo}`);
@@ -66337,6 +66394,7 @@ var T2000 = class _T2000 extends import_index.default {
66337
66394
  currency,
66338
66395
  memo,
66339
66396
  label,
66397
+ nonce,
66340
66398
  qrUri,
66341
66399
  displayText: displayParts.join("\n")
66342
66400
  };
@@ -67586,4 +67644,4 @@ axios/dist/node/axios.cjs:
67586
67644
  @scure/bip39/index.js:
67587
67645
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
67588
67646
  */
67589
- //# sourceMappingURL=chunk-FSSTF3LM.js.map
67647
+ //# sourceMappingURL=chunk-7PIRCLKI.js.map