@t2000/sdk 10.21.0 → 10.21.2

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.
@@ -889,6 +889,17 @@ interface PayOptions {
889
889
  maxPrice?: number;
890
890
  /** Bypass the spending-limit gate for this call (caller owns consent). */
891
891
  force?: boolean;
892
+ /**
893
+ * Attributed x402.paid activity reporting (B2) — after a successful pay,
894
+ * the settlement digest is fire-and-forgotten to the t2000.ai report
895
+ * endpoint (chain-verified server-side; never affects the payment).
896
+ * Default ON with source 'pay'; hosts override the source ('connect',
897
+ * 'try-it') or URL, or pass `false` to opt out.
898
+ */
899
+ activityReport?: {
900
+ url?: string;
901
+ source?: 'pay' | 'try-it' | 'connect';
902
+ } | false;
892
903
  }
893
904
  interface PayResult {
894
905
  status: number;
@@ -933,6 +944,26 @@ declare function payWithMpp(args: {
933
944
  options: PayOptions;
934
945
  }): Promise<PayResult>;
935
946
 
947
+ declare const DEFAULT_ACTIVITY_REPORT_URL = "https://t2000.ai/api/activity/x402";
948
+ type ActivityReportSource = 'pay' | 'try-it' | 'connect';
949
+ /** Per-call reporting config on PayOptions: override the URL/source, or
950
+ * `false` to opt out entirely. */
951
+ type ActivityReportConfig = {
952
+ url?: string;
953
+ source?: ActivityReportSource;
954
+ } | false;
955
+ interface X402ActivityPayload {
956
+ digest: string;
957
+ payTo: string;
958
+ payer?: string;
959
+ amountMicroUsdc: number;
960
+ network: string;
961
+ route?: string;
962
+ source: ActivityReportSource;
963
+ }
964
+ /** Fire-and-forget report — short timeout, every failure swallowed. */
965
+ declare function reportX402Activity(payload: X402ActivityPayload, url?: string): void;
966
+
936
967
  type SuiTransactionEffects = SuiClientTypes.TransactionEffects;
937
968
  type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
938
969
  declare function executeTx(client: SuiCoreClient, signer: TransactionSigner, buildTx: () => Promise<Transaction> | Transaction, options?: {
@@ -1525,4 +1556,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
1525
1556
  * the store is untrusted; the chain hash is the authority). */
1526
1557
  declare function getJobSpec(base: string, hash: string): Promise<string>;
1527
1558
 
1528
- export { TOKEN_MAP as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_COMMERCE_API_BASE as D, ETH_TYPE as E, type SendResult as F, GAS_RESERVE_MIN as G, type ServiceListing as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SimulationResult as Q, type StableAsset as R, STABLE_ASSETS as S, type SuiHolding as T, type SuiRpcTxBlock as U, type SupportedAsset as V, type SwapRouteResult as W, T2000Error as X, type T2000ErrorCode as Y, type T2000ErrorData as Z, T2000_OVERLAY_FEE_WALLET as _, A2A_ESCROW_PACKAGE_ID as a, verifyJobForSeller as a$, type TransactionLeg as a0, type TransactionRecord as a1, type TransactionSigner as a2, type TxDirection as a3, USDC_DECIMALS as a4, USDC_TYPE as a5, USDE_TYPE as a6, USDSUI_TYPE as a7, USDT_TYPE as a8, WAL_TYPE as a9, getDecimals as aA, getDecimalsForCoinType as aB, getJob as aC, getJobSpec as aD, jobActionsFor as aE, listServices as aF, mapMoveAbortCode as aG, mapWalletError as aH, mistToSui as aI, parseSuiRpcTx as aJ, payWithMpp as aK, preflightCreateJob as aL, preflightFail as aM, preflightPay as aN, preflightSend as aO, preflightSwap as aP, putJobSpec as aQ, rawToStable as aR, rawToUsdc as aS, refineLendingLabel as aT, resolveSymbol as aU, resolveTokenType as aV, stableToRaw as aW, suiToMist as aX, truncateAddress as aY, usdcToRaw as aZ, validateAddress as a_, WBTC_TYPE as aa, type ZkLoginProof as ab, ZkLoginSigner as ac, buildCreateJobTx as ad, buildDeliverJobTx as ae, buildRefundJobTx as af, buildRejectJobTx as ag, buildReleaseJobTx as ah, buildSendTx as ai, buildSwapTx as aj, checkPositiveAmount as ak, checkSuiAddress as al, classifyAction as am, classifyLabel as an, classifyTransaction as ao, executeTx as ap, extractAllUserLegs as aq, extractTransferDetails as ar, extractTxCommands as as, extractTxSender as at, fallbackLabel as au, fetchService as av, findSwapRoute as aw, formatAssetAmount as ax, formatSui as ay, formatUsd as az, COIN_REGISTRY as b, type T2000Options as b0, type SwapResult as b1, type SwapQuoteResult as b2, type PaymentRequest as b3, type SuiCoreClient as b4, type SponsoredCoinMergeCache as b5, type SendableAsset as b6, CETUS_USDC_SUI_POOL as b7, type CoinPage as b8, DEFAULT_GRPC_URL as b9, selectAndSplitCoin as bA, selectSuiCoin as bB, serializeCetusRoute as bC, simulateTransaction as bD, throwIfSimulationFailed as bE, verifyCetusRouteCoinMatch as bF, GASLESS_MIN_STABLE_AMOUNT as ba, GASLESS_STABLE_TYPES as bb, OPERATION_ASSETS as bc, type Operation as bd, SENDABLE_ASSETS as be, type SelectAndSplitResult as bf, type SerializedCetusRoute as bg, type SerializedCetusRoutePath as bh, type SerializedRouterDataV3 as bi, addSendToTx as bj, addSwapToTx as bk, assertAllowedAsset as bl, assertBuyerRequirements as bm, buildDeclineJobTx as bn, deserializeCetusRoute as bo, fetchAllCoins as bp, getCoinMeta as bq, getSuiClient as br, getSuiGrpcClient as bs, isAllowedAsset as bt, isCetusRouteFresh as bu, isInRegistry as bv, normalizeAsset as bw, normalizeCoinType as bx, queryHistory as by, queryTransaction as bz, type ClassifyBalanceChange as c, type ClassifyResult as d, type CoinMeta as e, DEFAULT_NETWORK as f, type DepositInfo as g, type ExtractedTransfer as h, type Job as i, type JobState as j, type JobTerms as k, type JobVerification as l, KeypairSigner as m, LOFI_TYPE as n, MAX_DELIVER_HORIZON_MS as o, MAX_JOB_USDC as p, MAX_REVIEW_WINDOW_MS as q, MIST_PER_SUI as r, type OverlayFeeConfig as s, PREFLIGHT_OK as t, type PayOptions as u, type PayResult as v, type PreflightResult as w, SUI_DECIMALS as x, SUI_TYPE as y, SUPPORTED_ASSETS as z };
1559
+ export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithMpp as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type SwapResult as b5, type SwapQuoteResult as b6, type PaymentRequest as b7, type SuiCoreClient as b8, type SponsoredCoinMergeCache as b9, normalizeAsset as bA, normalizeCoinType as bB, queryHistory as bC, queryTransaction as bD, selectAndSplitCoin as bE, selectSuiCoin as bF, serializeCetusRoute as bG, simulateTransaction as bH, throwIfSimulationFailed as bI, verifyCetusRouteCoinMatch as bJ, type SendableAsset as ba, CETUS_USDC_SUI_POOL as bb, type CoinPage as bc, DEFAULT_GRPC_URL as bd, GASLESS_MIN_STABLE_AMOUNT as be, GASLESS_STABLE_TYPES as bf, OPERATION_ASSETS as bg, type Operation as bh, SENDABLE_ASSETS as bi, type SelectAndSplitResult as bj, type SerializedCetusRoute as bk, type SerializedCetusRoutePath as bl, type SerializedRouterDataV3 as bm, addSendToTx as bn, addSwapToTx as bo, assertAllowedAsset as bp, assertBuyerRequirements as bq, buildDeclineJobTx as br, deserializeCetusRoute as bs, fetchAllCoins as bt, getCoinMeta as bu, getSuiClient as bv, getSuiGrpcClient as bw, isAllowedAsset as bx, isCetusRouteFresh as by, isInRegistry as bz, COIN_REGISTRY as c, type ClassifyBalanceChange as d, type ClassifyResult as e, type CoinMeta as f, DEFAULT_COMMERCE_API_BASE as g, DEFAULT_NETWORK as h, type DepositInfo as i, type ExtractedTransfer as j, type Job as k, type JobState as l, type JobTerms as m, type JobVerification as n, KeypairSigner as o, LOFI_TYPE as p, MAX_DELIVER_HORIZON_MS as q, MAX_JOB_USDC as r, MAX_REVIEW_WINDOW_MS as s, MIST_PER_SUI as t, type OverlayFeeConfig as u, PREFLIGHT_OK as v, type PayOptions as w, type PayResult as x, type PreflightResult as y, SUI_DECIMALS as z };
@@ -889,6 +889,17 @@ interface PayOptions {
889
889
  maxPrice?: number;
890
890
  /** Bypass the spending-limit gate for this call (caller owns consent). */
891
891
  force?: boolean;
892
+ /**
893
+ * Attributed x402.paid activity reporting (B2) — after a successful pay,
894
+ * the settlement digest is fire-and-forgotten to the t2000.ai report
895
+ * endpoint (chain-verified server-side; never affects the payment).
896
+ * Default ON with source 'pay'; hosts override the source ('connect',
897
+ * 'try-it') or URL, or pass `false` to opt out.
898
+ */
899
+ activityReport?: {
900
+ url?: string;
901
+ source?: 'pay' | 'try-it' | 'connect';
902
+ } | false;
892
903
  }
893
904
  interface PayResult {
894
905
  status: number;
@@ -933,6 +944,26 @@ declare function payWithMpp(args: {
933
944
  options: PayOptions;
934
945
  }): Promise<PayResult>;
935
946
 
947
+ declare const DEFAULT_ACTIVITY_REPORT_URL = "https://t2000.ai/api/activity/x402";
948
+ type ActivityReportSource = 'pay' | 'try-it' | 'connect';
949
+ /** Per-call reporting config on PayOptions: override the URL/source, or
950
+ * `false` to opt out entirely. */
951
+ type ActivityReportConfig = {
952
+ url?: string;
953
+ source?: ActivityReportSource;
954
+ } | false;
955
+ interface X402ActivityPayload {
956
+ digest: string;
957
+ payTo: string;
958
+ payer?: string;
959
+ amountMicroUsdc: number;
960
+ network: string;
961
+ route?: string;
962
+ source: ActivityReportSource;
963
+ }
964
+ /** Fire-and-forget report — short timeout, every failure swallowed. */
965
+ declare function reportX402Activity(payload: X402ActivityPayload, url?: string): void;
966
+
936
967
  type SuiTransactionEffects = SuiClientTypes.TransactionEffects;
937
968
  type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
938
969
  declare function executeTx(client: SuiCoreClient, signer: TransactionSigner, buildTx: () => Promise<Transaction> | Transaction, options?: {
@@ -1525,4 +1556,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
1525
1556
  * the store is untrusted; the chain hash is the authority). */
1526
1557
  declare function getJobSpec(base: string, hash: string): Promise<string>;
1527
1558
 
1528
- export { TOKEN_MAP as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_COMMERCE_API_BASE as D, ETH_TYPE as E, type SendResult as F, GAS_RESERVE_MIN as G, type ServiceListing as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SimulationResult as Q, type StableAsset as R, STABLE_ASSETS as S, type SuiHolding as T, type SuiRpcTxBlock as U, type SupportedAsset as V, type SwapRouteResult as W, T2000Error as X, type T2000ErrorCode as Y, type T2000ErrorData as Z, T2000_OVERLAY_FEE_WALLET as _, A2A_ESCROW_PACKAGE_ID as a, verifyJobForSeller as a$, type TransactionLeg as a0, type TransactionRecord as a1, type TransactionSigner as a2, type TxDirection as a3, USDC_DECIMALS as a4, USDC_TYPE as a5, USDE_TYPE as a6, USDSUI_TYPE as a7, USDT_TYPE as a8, WAL_TYPE as a9, getDecimals as aA, getDecimalsForCoinType as aB, getJob as aC, getJobSpec as aD, jobActionsFor as aE, listServices as aF, mapMoveAbortCode as aG, mapWalletError as aH, mistToSui as aI, parseSuiRpcTx as aJ, payWithMpp as aK, preflightCreateJob as aL, preflightFail as aM, preflightPay as aN, preflightSend as aO, preflightSwap as aP, putJobSpec as aQ, rawToStable as aR, rawToUsdc as aS, refineLendingLabel as aT, resolveSymbol as aU, resolveTokenType as aV, stableToRaw as aW, suiToMist as aX, truncateAddress as aY, usdcToRaw as aZ, validateAddress as a_, WBTC_TYPE as aa, type ZkLoginProof as ab, ZkLoginSigner as ac, buildCreateJobTx as ad, buildDeliverJobTx as ae, buildRefundJobTx as af, buildRejectJobTx as ag, buildReleaseJobTx as ah, buildSendTx as ai, buildSwapTx as aj, checkPositiveAmount as ak, checkSuiAddress as al, classifyAction as am, classifyLabel as an, classifyTransaction as ao, executeTx as ap, extractAllUserLegs as aq, extractTransferDetails as ar, extractTxCommands as as, extractTxSender as at, fallbackLabel as au, fetchService as av, findSwapRoute as aw, formatAssetAmount as ax, formatSui as ay, formatUsd as az, COIN_REGISTRY as b, type T2000Options as b0, type SwapResult as b1, type SwapQuoteResult as b2, type PaymentRequest as b3, type SuiCoreClient as b4, type SponsoredCoinMergeCache as b5, type SendableAsset as b6, CETUS_USDC_SUI_POOL as b7, type CoinPage as b8, DEFAULT_GRPC_URL as b9, selectAndSplitCoin as bA, selectSuiCoin as bB, serializeCetusRoute as bC, simulateTransaction as bD, throwIfSimulationFailed as bE, verifyCetusRouteCoinMatch as bF, GASLESS_MIN_STABLE_AMOUNT as ba, GASLESS_STABLE_TYPES as bb, OPERATION_ASSETS as bc, type Operation as bd, SENDABLE_ASSETS as be, type SelectAndSplitResult as bf, type SerializedCetusRoute as bg, type SerializedCetusRoutePath as bh, type SerializedRouterDataV3 as bi, addSendToTx as bj, addSwapToTx as bk, assertAllowedAsset as bl, assertBuyerRequirements as bm, buildDeclineJobTx as bn, deserializeCetusRoute as bo, fetchAllCoins as bp, getCoinMeta as bq, getSuiClient as br, getSuiGrpcClient as bs, isAllowedAsset as bt, isCetusRouteFresh as bu, isInRegistry as bv, normalizeAsset as bw, normalizeCoinType as bx, queryHistory as by, queryTransaction as bz, type ClassifyBalanceChange as c, type ClassifyResult as d, type CoinMeta as e, DEFAULT_NETWORK as f, type DepositInfo as g, type ExtractedTransfer as h, type Job as i, type JobState as j, type JobTerms as k, type JobVerification as l, KeypairSigner as m, LOFI_TYPE as n, MAX_DELIVER_HORIZON_MS as o, MAX_JOB_USDC as p, MAX_REVIEW_WINDOW_MS as q, MIST_PER_SUI as r, type OverlayFeeConfig as s, PREFLIGHT_OK as t, type PayOptions as u, type PayResult as v, type PreflightResult as w, SUI_DECIMALS as x, SUI_TYPE as y, SUPPORTED_ASSETS as z };
1559
+ export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithMpp as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type SwapResult as b5, type SwapQuoteResult as b6, type PaymentRequest as b7, type SuiCoreClient as b8, type SponsoredCoinMergeCache as b9, normalizeAsset as bA, normalizeCoinType as bB, queryHistory as bC, queryTransaction as bD, selectAndSplitCoin as bE, selectSuiCoin as bF, serializeCetusRoute as bG, simulateTransaction as bH, throwIfSimulationFailed as bI, verifyCetusRouteCoinMatch as bJ, type SendableAsset as ba, CETUS_USDC_SUI_POOL as bb, type CoinPage as bc, DEFAULT_GRPC_URL as bd, GASLESS_MIN_STABLE_AMOUNT as be, GASLESS_STABLE_TYPES as bf, OPERATION_ASSETS as bg, type Operation as bh, SENDABLE_ASSETS as bi, type SelectAndSplitResult as bj, type SerializedCetusRoute as bk, type SerializedCetusRoutePath as bl, type SerializedRouterDataV3 as bm, addSendToTx as bn, addSwapToTx as bo, assertAllowedAsset as bp, assertBuyerRequirements as bq, buildDeclineJobTx as br, deserializeCetusRoute as bs, fetchAllCoins as bt, getCoinMeta as bu, getSuiClient as bv, getSuiGrpcClient as bw, isAllowedAsset as bx, isCetusRouteFresh as by, isInRegistry as bz, COIN_REGISTRY as c, type ClassifyBalanceChange as d, type ClassifyResult as e, type CoinMeta as f, DEFAULT_COMMERCE_API_BASE as g, DEFAULT_NETWORK as h, type DepositInfo as i, type ExtractedTransfer as j, type Job as k, type JobState as l, type JobTerms as m, type JobVerification as n, KeypairSigner as o, LOFI_TYPE as p, MAX_DELIVER_HORIZON_MS as q, MAX_JOB_USDC as r, MAX_REVIEW_WINDOW_MS as s, MIST_PER_SUI as t, type OverlayFeeConfig as u, PREFLIGHT_OK as v, type PayOptions as w, type PayResult as x, type PreflightResult as y, SUI_DECIMALS as z };
package/dist/index.cjs CHANGED
@@ -1097,6 +1097,27 @@ async function executeTx(client, signer, buildTx, options = {}) {
1097
1097
 
1098
1098
  // src/wallet/pay.ts
1099
1099
  init_errors();
1100
+
1101
+ // src/wallet/activity-report.ts
1102
+ var DEFAULT_ACTIVITY_REPORT_URL = "https://t2000.ai/api/activity/x402";
1103
+ function resolveActivityReportUrl(override) {
1104
+ if (override) return override;
1105
+ const env = typeof process !== "undefined" && process.env ? process.env.T2000_ACTIVITY_REPORT_URL?.trim() : void 0;
1106
+ return env && env.length > 0 ? env : DEFAULT_ACTIVITY_REPORT_URL;
1107
+ }
1108
+ function reportX402Activity(payload, url) {
1109
+ try {
1110
+ void fetch(resolveActivityReportUrl(url), {
1111
+ method: "POST",
1112
+ headers: { "content-type": "application/json" },
1113
+ body: JSON.stringify(payload),
1114
+ signal: AbortSignal.timeout(1500)
1115
+ }).catch(() => void 0);
1116
+ } catch {
1117
+ }
1118
+ }
1119
+
1120
+ // src/wallet/pay.ts
1100
1121
  init_preflight();
1101
1122
  function preflightPay(input) {
1102
1123
  if (typeof input.url !== "string" || input.url.trim() === "") {
@@ -1239,6 +1260,21 @@ async function payViaX402(args) {
1239
1260
  }
1240
1261
  const result = await finalize(res, { paid });
1241
1262
  if (!paid) return { ...result, dialect: "x402" };
1263
+ if (digest && options.activityReport !== false) {
1264
+ const report = options.activityReport || {};
1265
+ reportX402Activity(
1266
+ {
1267
+ digest,
1268
+ payTo: requirements.payTo,
1269
+ payer: signer.getAddress(),
1270
+ amountMicroUsdc: Number(amountRaw),
1271
+ network: requirements.network,
1272
+ route: options.url,
1273
+ source: report.source ?? "pay"
1274
+ },
1275
+ report.url
1276
+ );
1277
+ }
1242
1278
  return {
1243
1279
  ...result,
1244
1280
  dialect: "x402",
@@ -4535,6 +4571,7 @@ exports.CETUS_POOLS_ID = CETUS_POOLS_ID;
4535
4571
  exports.CETUS_POSITION_TYPE = CETUS_POSITION_TYPE;
4536
4572
  exports.CETUS_USDC_SUI_POOL = CETUS_USDC_SUI_POOL;
4537
4573
  exports.CLOCK_ID = CLOCK_ID;
4574
+ exports.DEFAULT_ACTIVITY_REPORT_URL = DEFAULT_ACTIVITY_REPORT_URL;
4538
4575
  exports.DEFAULT_API_BASE = DEFAULT_API_BASE;
4539
4576
  exports.DEFAULT_COMMERCE_API_BASE = DEFAULT_COMMERCE_API_BASE;
4540
4577
  exports.DEFAULT_GRPC_URL = DEFAULT_GRPC_URL;
@@ -4676,6 +4713,7 @@ exports.readLimitsFile = readLimitsFile;
4676
4713
  exports.recordDailySpend = recordDailySpend;
4677
4714
  exports.refineLendingLabel = refineLendingLabel;
4678
4715
  exports.refundOpenJob = refundOpenJob;
4716
+ exports.reportX402Activity = reportX402Activity;
4679
4717
  exports.resolveAddressToSuinsViaRpc = resolveAddressToSuinsViaRpc;
4680
4718
  exports.resolveSuinsViaRpc = resolveSuinsViaRpc;
4681
4719
  exports.resolveSymbol = resolveSymbol;