@t2000/sdk 9.1.0 → 9.3.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.
@@ -924,6 +924,19 @@ declare function payWithMpp(args: {
924
924
  client: SuiGrpcClient;
925
925
  options: PayOptions;
926
926
  }): Promise<PayResult>;
927
+ /**
928
+ * Parse the MPP header dialect from a 402 response: the
929
+ * `WWW-Authenticate: Payment …` challenge(s), looking for `method="sui"`.
930
+ * Returns the decoded `{ amount, currency, recipient }` request (amount is a
931
+ * decimal string, e.g. "0.02") or `undefined` when the response carries no
932
+ * sui challenge. Exported for the CLI's `t2 pay --estimate`.
933
+ */
934
+ declare function parseMppSuiChallenge(response: Response): Promise<{
935
+ amount: string;
936
+ currency: string;
937
+ recipient: string;
938
+ description?: string;
939
+ } | undefined>;
927
940
 
928
941
  type SuiTransactionEffects = SuiClientTypes.TransactionEffects;
929
942
  type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
@@ -1343,4 +1356,4 @@ declare function buildSendTx({ client, address, to, amount, asset, }: {
1343
1356
  */
1344
1357
  declare function addSendToTx(tx: Transaction, coin: TransactionObjectArgument, recipient: string): void;
1345
1358
 
1346
- export { type ZkLoginProof as $, T2000_OVERLAY_FEE_WALLET as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, TOKEN_MAP as F, GAS_RESERVE_MIN as G, type TransactionLeg as H, IKA_TYPE as I, type TransactionRecord 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 TransactionSigner as Q, type TxDirection as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, USDC_TYPE as V, USDE_TYPE as W, USDSUI_TYPE as X, USDT_TYPE as Y, WAL_TYPE as Z, WBTC_TYPE as _, COIN_REGISTRY as a, getCoinMeta as a$, ZkLoginSigner as a0, buildSendTx as a1, buildSwapTx as a2, checkPositiveAmount as a3, checkSuiAddress as a4, classifyAction as a5, classifyLabel as a6, classifyTransaction as a7, executeTx as a8, extractAllUserLegs as a9, truncateAddress as aA, usdcToRaw as aB, validateAddress as aC, type T2000Options as aD, type SwapResult as aE, type SwapQuoteResult as aF, type PaymentRequest as aG, type SuiCoreClient as aH, type SponsoredCoinMergeCache as aI, type SendableAsset as aJ, CETUS_USDC_SUI_POOL as aK, type CoinPage as aL, DEFAULT_GRPC_URL as aM, GASLESS_MIN_STABLE_AMOUNT as aN, GASLESS_STABLE_TYPES as aO, OPERATION_ASSETS as aP, type Operation as aQ, SENDABLE_ASSETS as aR, type SelectAndSplitResult as aS, type SerializedCetusRoute as aT, type SerializedCetusRoutePath as aU, type SerializedRouterDataV3 as aV, addSendToTx as aW, addSwapToTx as aX, assertAllowedAsset as aY, deserializeCetusRoute as aZ, fetchAllCoins as a_, extractTransferDetails as aa, extractTxCommands as ab, extractTxSender as ac, fallbackLabel as ad, findSwapRoute as ae, formatAssetAmount as af, formatSui as ag, formatUsd as ah, getDecimals as ai, getDecimalsForCoinType as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseSuiRpcTx as an, payWithMpp as ao, preflightFail as ap, preflightPay as aq, preflightSend as ar, preflightSwap as as, rawToStable as at, rawToUsdc as au, refineLendingLabel as av, resolveSymbol as aw, resolveTokenType as ax, stableToRaw as ay, suiToMist as az, type ClassifyBalanceChange as b, getSuiClient as b0, getSuiGrpcClient as b1, isAllowedAsset as b2, isCetusRouteFresh as b3, isInRegistry as b4, normalizeAsset as b5, normalizeCoinType as b6, queryHistory as b7, queryTransaction as b8, selectAndSplitCoin as b9, selectSuiCoin as ba, serializeCetusRoute as bb, simulateTransaction as bc, throwIfSimulationFailed as bd, verifyCetusRouteCoinMatch as be, type ClassifyResult as c, type CoinMeta as d, type DepositInfo as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE as h, MIST_PER_SUI as i, type OverlayFeeConfig as j, PREFLIGHT_OK as k, type PayOptions as l, type PayResult as m, type PreflightResult as n, SUI_DECIMALS as o, SUI_TYPE as p, SUPPORTED_ASSETS as q, type SendResult as r, type SimulationResult as s, type StableAsset as t, type SuiHolding as u, type SuiRpcTxBlock as v, type SupportedAsset as w, type SwapRouteResult as x, type T2000ErrorCode as y, type T2000ErrorData as z };
1359
+ export { type ZkLoginProof as $, T2000_OVERLAY_FEE_WALLET as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, TOKEN_MAP as F, GAS_RESERVE_MIN as G, type TransactionLeg as H, IKA_TYPE as I, type TransactionRecord 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 TransactionSigner as Q, type TxDirection as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, USDC_TYPE as V, USDE_TYPE as W, USDSUI_TYPE as X, USDT_TYPE as Y, WAL_TYPE as Z, WBTC_TYPE as _, COIN_REGISTRY as a, fetchAllCoins as a$, ZkLoginSigner as a0, buildSendTx as a1, buildSwapTx as a2, checkPositiveAmount as a3, checkSuiAddress as a4, classifyAction as a5, classifyLabel as a6, classifyTransaction as a7, executeTx as a8, extractAllUserLegs as a9, suiToMist as aA, truncateAddress as aB, usdcToRaw as aC, validateAddress as aD, type T2000Options as aE, type SwapResult as aF, type SwapQuoteResult as aG, type PaymentRequest as aH, type SuiCoreClient as aI, type SponsoredCoinMergeCache as aJ, type SendableAsset as aK, CETUS_USDC_SUI_POOL as aL, type CoinPage as aM, DEFAULT_GRPC_URL as aN, GASLESS_MIN_STABLE_AMOUNT as aO, GASLESS_STABLE_TYPES as aP, OPERATION_ASSETS as aQ, type Operation as aR, SENDABLE_ASSETS as aS, type SelectAndSplitResult as aT, type SerializedCetusRoute as aU, type SerializedCetusRoutePath as aV, type SerializedRouterDataV3 as aW, addSendToTx as aX, addSwapToTx as aY, assertAllowedAsset as aZ, deserializeCetusRoute as a_, extractTransferDetails as aa, extractTxCommands as ab, extractTxSender as ac, fallbackLabel as ad, findSwapRoute as ae, formatAssetAmount as af, formatSui as ag, formatUsd as ah, getDecimals as ai, getDecimalsForCoinType as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseMppSuiChallenge as an, parseSuiRpcTx as ao, payWithMpp as ap, preflightFail as aq, preflightPay as ar, preflightSend as as, preflightSwap as at, rawToStable as au, rawToUsdc as av, refineLendingLabel as aw, resolveSymbol as ax, resolveTokenType as ay, stableToRaw as az, type ClassifyBalanceChange as b, getCoinMeta as b0, getSuiClient as b1, getSuiGrpcClient as b2, isAllowedAsset as b3, isCetusRouteFresh as b4, isInRegistry as b5, normalizeAsset as b6, normalizeCoinType as b7, queryHistory as b8, queryTransaction as b9, selectAndSplitCoin as ba, selectSuiCoin as bb, serializeCetusRoute as bc, simulateTransaction as bd, throwIfSimulationFailed as be, verifyCetusRouteCoinMatch as bf, type ClassifyResult as c, type CoinMeta as d, type DepositInfo as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE as h, MIST_PER_SUI as i, type OverlayFeeConfig as j, PREFLIGHT_OK as k, type PayOptions as l, type PayResult as m, type PreflightResult as n, SUI_DECIMALS as o, SUI_TYPE as p, SUPPORTED_ASSETS as q, type SendResult as r, type SimulationResult as s, type StableAsset as t, type SuiHolding as u, type SuiRpcTxBlock as v, type SupportedAsset as w, type SwapRouteResult as x, type T2000ErrorCode as y, type T2000ErrorData as z };
@@ -924,6 +924,19 @@ declare function payWithMpp(args: {
924
924
  client: SuiGrpcClient;
925
925
  options: PayOptions;
926
926
  }): Promise<PayResult>;
927
+ /**
928
+ * Parse the MPP header dialect from a 402 response: the
929
+ * `WWW-Authenticate: Payment …` challenge(s), looking for `method="sui"`.
930
+ * Returns the decoded `{ amount, currency, recipient }` request (amount is a
931
+ * decimal string, e.g. "0.02") or `undefined` when the response carries no
932
+ * sui challenge. Exported for the CLI's `t2 pay --estimate`.
933
+ */
934
+ declare function parseMppSuiChallenge(response: Response): Promise<{
935
+ amount: string;
936
+ currency: string;
937
+ recipient: string;
938
+ description?: string;
939
+ } | undefined>;
927
940
 
928
941
  type SuiTransactionEffects = SuiClientTypes.TransactionEffects;
929
942
  type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
@@ -1343,4 +1356,4 @@ declare function buildSendTx({ client, address, to, amount, asset, }: {
1343
1356
  */
1344
1357
  declare function addSendToTx(tx: Transaction, coin: TransactionObjectArgument, recipient: string): void;
1345
1358
 
1346
- export { type ZkLoginProof as $, T2000_OVERLAY_FEE_WALLET as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, TOKEN_MAP as F, GAS_RESERVE_MIN as G, type TransactionLeg as H, IKA_TYPE as I, type TransactionRecord 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 TransactionSigner as Q, type TxDirection as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, USDC_TYPE as V, USDE_TYPE as W, USDSUI_TYPE as X, USDT_TYPE as Y, WAL_TYPE as Z, WBTC_TYPE as _, COIN_REGISTRY as a, getCoinMeta as a$, ZkLoginSigner as a0, buildSendTx as a1, buildSwapTx as a2, checkPositiveAmount as a3, checkSuiAddress as a4, classifyAction as a5, classifyLabel as a6, classifyTransaction as a7, executeTx as a8, extractAllUserLegs as a9, truncateAddress as aA, usdcToRaw as aB, validateAddress as aC, type T2000Options as aD, type SwapResult as aE, type SwapQuoteResult as aF, type PaymentRequest as aG, type SuiCoreClient as aH, type SponsoredCoinMergeCache as aI, type SendableAsset as aJ, CETUS_USDC_SUI_POOL as aK, type CoinPage as aL, DEFAULT_GRPC_URL as aM, GASLESS_MIN_STABLE_AMOUNT as aN, GASLESS_STABLE_TYPES as aO, OPERATION_ASSETS as aP, type Operation as aQ, SENDABLE_ASSETS as aR, type SelectAndSplitResult as aS, type SerializedCetusRoute as aT, type SerializedCetusRoutePath as aU, type SerializedRouterDataV3 as aV, addSendToTx as aW, addSwapToTx as aX, assertAllowedAsset as aY, deserializeCetusRoute as aZ, fetchAllCoins as a_, extractTransferDetails as aa, extractTxCommands as ab, extractTxSender as ac, fallbackLabel as ad, findSwapRoute as ae, formatAssetAmount as af, formatSui as ag, formatUsd as ah, getDecimals as ai, getDecimalsForCoinType as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseSuiRpcTx as an, payWithMpp as ao, preflightFail as ap, preflightPay as aq, preflightSend as ar, preflightSwap as as, rawToStable as at, rawToUsdc as au, refineLendingLabel as av, resolveSymbol as aw, resolveTokenType as ax, stableToRaw as ay, suiToMist as az, type ClassifyBalanceChange as b, getSuiClient as b0, getSuiGrpcClient as b1, isAllowedAsset as b2, isCetusRouteFresh as b3, isInRegistry as b4, normalizeAsset as b5, normalizeCoinType as b6, queryHistory as b7, queryTransaction as b8, selectAndSplitCoin as b9, selectSuiCoin as ba, serializeCetusRoute as bb, simulateTransaction as bc, throwIfSimulationFailed as bd, verifyCetusRouteCoinMatch as be, type ClassifyResult as c, type CoinMeta as d, type DepositInfo as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE as h, MIST_PER_SUI as i, type OverlayFeeConfig as j, PREFLIGHT_OK as k, type PayOptions as l, type PayResult as m, type PreflightResult as n, SUI_DECIMALS as o, SUI_TYPE as p, SUPPORTED_ASSETS as q, type SendResult as r, type SimulationResult as s, type StableAsset as t, type SuiHolding as u, type SuiRpcTxBlock as v, type SupportedAsset as w, type SwapRouteResult as x, type T2000ErrorCode as y, type T2000ErrorData as z };
1359
+ export { type ZkLoginProof as $, T2000_OVERLAY_FEE_WALLET as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, TOKEN_MAP as F, GAS_RESERVE_MIN as G, type TransactionLeg as H, IKA_TYPE as I, type TransactionRecord 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 TransactionSigner as Q, type TxDirection as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, USDC_TYPE as V, USDE_TYPE as W, USDSUI_TYPE as X, USDT_TYPE as Y, WAL_TYPE as Z, WBTC_TYPE as _, COIN_REGISTRY as a, fetchAllCoins as a$, ZkLoginSigner as a0, buildSendTx as a1, buildSwapTx as a2, checkPositiveAmount as a3, checkSuiAddress as a4, classifyAction as a5, classifyLabel as a6, classifyTransaction as a7, executeTx as a8, extractAllUserLegs as a9, suiToMist as aA, truncateAddress as aB, usdcToRaw as aC, validateAddress as aD, type T2000Options as aE, type SwapResult as aF, type SwapQuoteResult as aG, type PaymentRequest as aH, type SuiCoreClient as aI, type SponsoredCoinMergeCache as aJ, type SendableAsset as aK, CETUS_USDC_SUI_POOL as aL, type CoinPage as aM, DEFAULT_GRPC_URL as aN, GASLESS_MIN_STABLE_AMOUNT as aO, GASLESS_STABLE_TYPES as aP, OPERATION_ASSETS as aQ, type Operation as aR, SENDABLE_ASSETS as aS, type SelectAndSplitResult as aT, type SerializedCetusRoute as aU, type SerializedCetusRoutePath as aV, type SerializedRouterDataV3 as aW, addSendToTx as aX, addSwapToTx as aY, assertAllowedAsset as aZ, deserializeCetusRoute as a_, extractTransferDetails as aa, extractTxCommands as ab, extractTxSender as ac, fallbackLabel as ad, findSwapRoute as ae, formatAssetAmount as af, formatSui as ag, formatUsd as ah, getDecimals as ai, getDecimalsForCoinType as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseMppSuiChallenge as an, parseSuiRpcTx as ao, payWithMpp as ap, preflightFail as aq, preflightPay as ar, preflightSend as as, preflightSwap as at, rawToStable as au, rawToUsdc as av, refineLendingLabel as aw, resolveSymbol as ax, resolveTokenType as ay, stableToRaw as az, type ClassifyBalanceChange as b, getCoinMeta as b0, getSuiClient as b1, getSuiGrpcClient as b2, isAllowedAsset as b3, isCetusRouteFresh as b4, isInRegistry as b5, normalizeAsset as b6, normalizeCoinType as b7, queryHistory as b8, queryTransaction as b9, selectAndSplitCoin as ba, selectSuiCoin as bb, serializeCetusRoute as bc, simulateTransaction as bd, throwIfSimulationFailed as be, verifyCetusRouteCoinMatch as bf, type ClassifyResult as c, type CoinMeta as d, type DepositInfo as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE as h, MIST_PER_SUI as i, type OverlayFeeConfig as j, PREFLIGHT_OK as k, type PayOptions as l, type PayResult as m, type PreflightResult as n, SUI_DECIMALS as o, SUI_TYPE as p, SUPPORTED_ASSETS as q, type SendResult as r, type SimulationResult as s, type StableAsset as t, type SuiHolding as u, type SuiRpcTxBlock as v, type SupportedAsset as w, type SwapRouteResult as x, type T2000ErrorCode as y, type T2000ErrorData as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2000/sdk",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "description": "TypeScript SDK for Agent Wallets on Sui — gasless USDC + USDsui transfers, Cetus swap routing, NAVI lending (programmatic), MPP paid API access, zkLogin compatible.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -52,7 +52,8 @@
52
52
  "@phala/dcap-qvl": "^0.5.2",
53
53
  "@suimpp/mpp": "^0.8.1",
54
54
  "bn.js": "^5.2.1",
55
- "eventemitter3": "^5"
55
+ "eventemitter3": "^5",
56
+ "mppx": "^0.4.9"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/bn.js": "^5.1.5",