@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.
@@ -3,9 +3,9 @@ import {
3
3
  Credential_exports,
4
4
  Method_exports,
5
5
  zod_exports
6
- } from "./chunk-HGA6AHN5.js";
6
+ } from "./chunk-TYYJRUQI.js";
7
7
  import "./chunk-NGS6K3I3.js";
8
- import "./chunk-77SWBATH.js";
8
+ import "./chunk-EI3GHTKX.js";
9
9
  import "./chunk-7LGHVVIJ.js";
10
10
  import {
11
11
  Transaction,
@@ -14,7 +14,7 @@ import {
14
14
  import "./chunk-3XUF7GM3.js";
15
15
  import "./chunk-YPWSCLE3.js";
16
16
 
17
- // ../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/dist/client.js
17
+ // ../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_c2ad5be151eba2374dc924cfe6dd724c/node_modules/@suimpp/mpp/dist/client.js
18
18
  var suiCharge = Method_exports.from({
19
19
  intent: "charge",
20
20
  name: "sui",
@@ -81,4 +81,4 @@ export {
81
81
  sui,
82
82
  suiCharge
83
83
  };
84
- //# sourceMappingURL=client-2MUO6VAJ.js.map
84
+ //# sourceMappingURL=client-YNWQPUC5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/method.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/utils.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/constants.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/client.ts"],"sourcesContent":["import { Method, z } from 'mppx';\n\nexport const suiCharge = Method.from({\n intent: 'charge',\n name: 'sui',\n schema: {\n credential: {\n payload: z.object({\n digest: z.string(),\n }),\n },\n request: z.object({\n amount: z.string(),\n currency: z.string(),\n recipient: z.string(),\n }),\n },\n});\n","/**\n * Parse a string amount to raw bigint units without floating-point math.\n * \"0.01\" with 6 decimals → 10000n\n */\nexport function parseAmountToRaw(amount: string, decimals: number): bigint {\n const [whole = '0', frac = ''] = amount.split('.');\n const paddedFrac = frac.padEnd(decimals, '0').slice(0, decimals);\n return BigInt(whole + paddedFrac);\n}\n\n/**\n * Retry an async function with linear backoff.\n * Throws the last error if all attempts fail.\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n { attempts = 5, baseDelayMs = 1000 }: { attempts?: number; baseDelayMs?: number } = {},\n): Promise<T> {\n let lastError: unknown;\n for (let i = 0; i < attempts; i++) {\n try {\n return await fn();\n } catch (err) {\n lastError = err;\n if (i < attempts - 1) {\n await new Promise((r) => setTimeout(r, baseDelayMs * (i + 1)));\n }\n }\n }\n throw lastError;\n}\n","export const SUI_USDC_TYPE =\n '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';\n","import { Method, Credential } from 'mppx';\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\nimport type { Signer } from '@mysten/sui/cryptography';\nimport { coinWithBalance, Transaction } from '@mysten/sui/transactions';\nimport { suiCharge } from './method.js';\nimport { parseAmountToRaw } from './utils.js';\n\nexport { suiCharge } from './method.js';\nexport { SUI_USDC_TYPE } from './constants.js';\n\nexport interface SuiChargeOptions {\n client: ClientWithCoreApi;\n signer: Signer;\n /** Number of decimal places for the currency (default: 6, e.g. USDC). */\n decimals?: number;\n /** Override transaction execution (e.g. to route through a gas manager). */\n execute?: (tx: Transaction) => Promise<{ digest: string }>;\n}\n\nexport function sui(options: SuiChargeOptions) {\n const address = options.signer.toSuiAddress();\n const decimals = options.decimals ?? 6;\n\n return Method.toClient(suiCharge, {\n async createCredential({ challenge }) {\n const { amount, currency, recipient } = challenge.request;\n const amountRaw = parseAmountToRaw(amount, decimals);\n\n const tx = new Transaction();\n tx.setSender(address);\n\n const payment = coinWithBalance({ balance: amountRaw, type: currency });\n tx.transferObjects([payment], recipient);\n\n let result;\n try {\n if (options.execute) {\n result = await options.execute(tx);\n } else {\n const built = await tx.build({ client: options.client });\n const { signature } = await options.signer.signTransaction(built);\n const execResult = await options.client.core.executeTransaction({\n transaction: built,\n signatures: [signature],\n include: { effects: true },\n });\n if (execResult.FailedTransaction) {\n throw new Error(execResult.FailedTransaction.status.error?.message ?? 'Transaction failed');\n }\n result = execResult.Transaction!;\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new Error(`Payment transaction failed: ${msg}`);\n }\n\n return Credential.serialize({\n challenge,\n payload: { digest: result.digest },\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEO,IAAM,YAAY,eAAO,KAAK;EACnC,QAAQ;EACR,MAAM;EACN,QAAQ;IACN,YAAY;MACV,SAAS,YAAE,OAAO;QAChB,QAAQ,YAAE,OAAA;MAAO,CAClB;IAAA;IAEH,SAAS,YAAE,OAAO;MAChB,QAAQ,YAAE,OAAA;MACV,UAAU,YAAE,OAAA;MACZ,WAAW,YAAE,OAAA;IAAO,CACrB;EAAA;AAEL,CAAC;ACbM,SAAS,iBAAiB,QAAgB,UAA0B;AACzE,Q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mBAAW,UAAU;QAC1B;QACA,SAAS,EAAE,QAAQ,OAAO,OAAA;MAAO,CAClC;IACH;EAAA,CACD;AACH;","names":["Method"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_c2ad5be151eba2374dc924cfe6dd724c/node_modules/@suimpp/mpp/src/method.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_c2ad5be151eba2374dc924cfe6dd724c/node_modules/@suimpp/mpp/src/utils.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_c2ad5be151eba2374dc924cfe6dd724c/node_modules/@suimpp/mpp/src/constants.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_c2ad5be151eba2374dc924cfe6dd724c/node_modules/@suimpp/mpp/src/client.ts"],"sourcesContent":["import { Method, z } from 'mppx';\n\nexport const suiCharge = Method.from({\n intent: 'charge',\n name: 'sui',\n schema: {\n credential: {\n payload: z.object({\n digest: z.string(),\n }),\n },\n request: z.object({\n amount: z.string(),\n currency: z.string(),\n recipient: z.string(),\n }),\n },\n});\n","/**\n * Parse a string amount to raw bigint units without floating-point math.\n * \"0.01\" with 6 decimals → 10000n\n */\nexport function parseAmountToRaw(amount: string, decimals: number): bigint {\n const [whole = '0', frac = ''] = amount.split('.');\n const paddedFrac = frac.padEnd(decimals, '0').slice(0, decimals);\n return BigInt(whole + paddedFrac);\n}\n\n/**\n * Retry an async function with linear backoff.\n * Throws the last error if all attempts fail.\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n { attempts = 5, baseDelayMs = 1000 }: { attempts?: number; baseDelayMs?: number } = {},\n): Promise<T> {\n let lastError: unknown;\n for (let i = 0; i < attempts; i++) {\n try {\n return await fn();\n } catch (err) {\n lastError = err;\n if (i < attempts - 1) {\n await new Promise((r) => setTimeout(r, baseDelayMs * (i + 1)));\n }\n }\n }\n throw lastError;\n}\n","export const SUI_USDC_TYPE =\n '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';\n","import { Method, Credential } from 'mppx';\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\nimport type { Signer } from '@mysten/sui/cryptography';\nimport { coinWithBalance, Transaction } from '@mysten/sui/transactions';\nimport { suiCharge } from './method.js';\nimport { parseAmountToRaw } from './utils.js';\n\nexport { suiCharge } from './method.js';\nexport { SUI_USDC_TYPE } from './constants.js';\n\nexport interface SuiChargeOptions {\n client: ClientWithCoreApi;\n signer: Signer;\n /** Number of decimal places for the currency (default: 6, e.g. USDC). */\n decimals?: number;\n /** Override transaction execution (e.g. to route through a gas manager). */\n execute?: (tx: Transaction) => Promise<{ digest: string }>;\n}\n\nexport function sui(options: SuiChargeOptions) {\n const address = options.signer.toSuiAddress();\n const decimals = options.decimals ?? 6;\n\n return Method.toClient(suiCharge, {\n async createCredential({ challenge }) {\n const { amount, currency, recipient } = challenge.request;\n const amountRaw = parseAmountToRaw(amount, decimals);\n\n const tx = new Transaction();\n tx.setSender(address);\n\n const payment = coinWithBalance({ balance: amountRaw, type: currency });\n tx.transferObjects([payment], recipient);\n\n let result;\n try {\n if (options.execute) {\n result = await options.execute(tx);\n } else {\n const built = await tx.build({ client: options.client });\n const { signature } = await options.signer.signTransaction(built);\n const execResult = await options.client.core.executeTransaction({\n transaction: built,\n signatures: [signature],\n include: { effects: true },\n });\n if (execResult.FailedTransaction) {\n throw new Error(execResult.FailedTransaction.status.error?.message ?? 'Transaction failed');\n }\n result = execResult.Transaction!;\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new Error(`Payment transaction failed: ${msg}`);\n }\n\n return Credential.ser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gBAAM,aAAa,MAAM,QAAQ,OAAO,KAAK,mBAAmB;YAC9D,aAAa;YACb,YAAY,CAAC,SAAS;YACtB,SAAS,EAAE,SAAS,KAAA;UAAK,CAC1B;AACD,cAAI,WAAW,mBAAmB;AAChC,kBAAM,IAAI,MAAM,WAAW,kBAAkB,OAAO,OAAO,WAAW,oBAAoB;UAC5F;AACA,mBAAS,WAAW;QACtB;MACF,SAAS,KAAc;AACrB,cAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,cAAM,IAAI,MAAM,+BAA+B,GAAG,EAAE;MACtD;AAEA,aAAO,mBAAW,UAAU;QAC1B;QACA,SAAS,EAAE,QAAQ,OAAO,OAAA;MAAO,CAClC;IACH;EAAA,CACD;AACH;","names":["Method"]}
@@ -105,7 +105,7 @@ import {
105
105
  validateAddress,
106
106
  verifyScopedIntent,
107
107
  walletExists
108
- } from "./chunk-FSSTF3LM.js";
108
+ } from "./chunk-7PIRCLKI.js";
109
109
  import "./chunk-V7PXDEKG.js";
110
110
  import "./chunk-Q2LY5BHK.js";
111
111
  import "./chunk-3XUF7GM3.js";
@@ -217,4 +217,4 @@ export {
217
217
  verifyScopedIntent,
218
218
  walletExists
219
219
  };
220
- //# sourceMappingURL=dist-4JQX7CWE.js.map
220
+ //# sourceMappingURL=dist-EDYMBYNA.js.map
@@ -7,7 +7,7 @@ import {
7
7
  ZodOptional,
8
8
  external_exports,
9
9
  objectType
10
- } from "./chunk-FSSTF3LM.js";
10
+ } from "./chunk-7PIRCLKI.js";
11
11
  import "./chunk-V7PXDEKG.js";
12
12
  import "./chunk-Q2LY5BHK.js";
13
13
  import "./chunk-3XUF7GM3.js";
@@ -17155,7 +17155,7 @@ function registerReadTools(server, agent) {
17155
17155
  );
17156
17156
  server.tool(
17157
17157
  "t2000_receive",
17158
- "Generate a payment request \u2014 returns wallet address, QR-ready URI, and optional amount/memo. Use when the user wants to receive a payment, create a payment request, or share their address for receiving funds.",
17158
+ "Generate a payment request \u2014 returns wallet address, Payment Kit URI (sui:pay?\u2026), nonce, and optional amount/memo. The URI is scannable by any Sui wallet. Use when the user wants to receive a payment, create a payment request, or share their address for receiving funds.",
17159
17159
  {
17160
17160
  amount: external_exports.number().optional().describe("Amount to request (omit for open amount)"),
17161
17161
  currency: external_exports.string().optional().describe("Currency symbol (default: USDC)"),
@@ -18330,4 +18330,4 @@ async function startMcpServer(opts) {
18330
18330
  export {
18331
18331
  startMcpServer
18332
18332
  };
18333
- //# sourceMappingURL=dist-55H37ULN.js.map
18333
+ //# sourceMappingURL=dist-NREODDWO.js.map