@t2000/sdk 0.38.0 → 0.40.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.
package/dist/index.d.cts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset, an as AllowanceFeature } from './token-registry-DEZbGh2r.cjs';
5
- export { ao as ALLOWANCE_FEATURES, A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, ap as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aq as OPERATION_ASSETS, O as OUTBOUND_OPS, ar as Operation, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, as as assertAllowedAsset, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, at as isAllowedAsset, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, au as simulateTransaction, ah as stableToRaw, ai as suiToMist, av as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-DEZbGh2r.cjs';
4
+ import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-B9ei_Kd-.cjs';
5
+ export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, ao as OPERATION_ASSETS, O as OUTBOUND_OPS, ap as Operation, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, aq as assertAllowedAsset, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, ar as isAllowedAsset, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, as as simulateTransaction, ah as stableToRaw, ai as suiToMist, at as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-B9ei_Kd-.cjs';
6
6
  import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DkKhitk_.cjs';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DkKhitk_.cjs';
8
- import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, n as PaymentRequest, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, o as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, p as AllowanceInfo, q as FinancialSummary } from './types-C6z5Pk_d.cjs';
9
- export { r as AllowanceCreateResult, s as AllowanceDeductResult, t as AllowanceDepositResult, u as AllowanceWithdrawResult, A as AssetRates, G as GasMethod, b as GasReserve, v as HFAlertLevel, f as PositionEntry } from './types-C6z5Pk_d.cjs';
10
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
8
+ import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, n as PaymentRequest, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, o as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, p as FinancialSummary } from './types-DxNs-mLT.cjs';
9
+ export { A as AssetRates, G as GasMethod, b as GasReserve, q as HFAlertLevel, f as PositionEntry } from './types-DxNs-mLT.cjs';
11
10
  import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
11
+ import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
12
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.cjs';
13
13
 
14
14
  interface Contact {
@@ -216,66 +216,19 @@ declare function getAddress(keypair: Ed25519Keypair): string;
216
216
 
217
217
  declare function solveHashcash(challenge: string): string;
218
218
 
219
- interface CreateAllowanceOptions {
220
- permittedFeatures?: bigint;
221
- expiresAt?: bigint;
222
- dailyLimit?: bigint;
223
- }
224
- /**
225
- * Build a PTB that creates a new shared Allowance<USDC> for the signer.
226
- */
227
- declare function buildCreateAllowanceTx(options?: CreateAllowanceOptions): Transaction;
228
- /**
229
- * Add an owner deposit call to an existing PTB.
230
- * The caller must provide a coin reference (e.g. from `tx.splitCoins`).
231
- */
232
- declare function addDepositAllowanceTx(tx: Transaction, allowanceId: string, paymentCoin: TransactionObjectArgument): void;
233
- /**
234
- * Build a standalone deposit PTB that splits `amount` (raw USDC) from
235
- * the given USDC coin and deposits into the allowance.
236
- */
237
- declare function buildDepositAllowanceTx(allowanceId: string, usdcCoin: string, amount: bigint): Transaction;
238
- /**
239
- * Build an admin-sponsored deposit PTB. Requires AdminCap in the signer's wallet.
240
- */
241
- declare function buildAdminDepositAllowanceTx(allowanceId: string, usdcCoin: string, amount: bigint): Transaction;
242
- /**
243
- * Build a deduct PTB. Only callable by the AdminCap holder (server/cron).
244
- * Enforces on-chain: feature permission, expiry, daily limit.
245
- */
246
- declare function buildDeductAllowanceTx(allowanceId: string, amount: bigint, feature: AllowanceFeature): Transaction;
247
- /**
248
- * Build a full-withdrawal PTB. Returns entire remaining balance to the owner.
249
- */
250
- declare function buildWithdrawAllowanceTx(allowanceId: string): Transaction;
251
- /**
252
- * Build a partial-withdrawal PTB. Returns `amount` (raw USDC) to the owner.
253
- */
254
- declare function buildWithdrawAmountAllowanceTx(allowanceId: string, amount: bigint): Transaction;
255
- /**
256
- * Fetch the full allowance state from an on-chain Allowance<T> shared object.
257
- */
258
- declare function getAllowance(client: SuiJsonRpcClient, allowanceId: string): Promise<AllowanceInfo>;
259
- /**
260
- * Shorthand: get just the USDC balance of an allowance.
261
- */
262
- declare function getAllowanceBalance(client: SuiJsonRpcClient, allowanceId: string): Promise<bigint>;
263
-
264
219
  declare const HF_WARN_THRESHOLD = 1.8;
265
220
  declare const HF_CRITICAL_THRESHOLD = 1.3;
266
221
  interface FinancialSummaryOptions {
267
- allowanceId?: string;
268
222
  }
269
223
  /**
270
224
  * Fetch a complete financial snapshot for one wallet in parallel.
271
- * Designed for the notification cron one call returns everything
272
- * a briefing, HF alert, or rate alert needs.
225
+ * Designed for the indexer HF hook + chain-memory cron.
273
226
  *
274
227
  * Every sub-call has a fallback so a single RPC failure doesn't
275
228
  * crash the entire batch. Callers can check individual zero values
276
229
  * to detect degraded data.
277
230
  */
278
- declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, options?: FinancialSummaryOptions): Promise<FinancialSummary>;
231
+ declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, _options?: FinancialSummaryOptions): Promise<FinancialSummary>;
279
232
 
280
233
  declare function getRates(client: SuiJsonRpcClient): Promise<RatesResult>;
281
234
  declare function getPendingRewards(client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
@@ -350,48 +303,4 @@ declare function buildStakeVSuiTx(_client: SuiJsonRpcClient, address: string, am
350
303
  */
351
304
  declare function buildUnstakeVSuiTx(client: SuiJsonRpcClient, address: string, amountMist: bigint | 'all'): Promise<Transaction>;
352
305
 
353
- /**
354
- * Short-lived signed authorization for a single autonomous cron execution.
355
- * Built off-chain, verified off-chain before any on-chain PTB is constructed.
356
- *
357
- * Security properties:
358
- * - 60s TTL (configurable) — expired intents rejected before execution
359
- * - Single-use nonce — stored in IntentLog, duplicate rejected immediately
360
- * - Ed25519 signature by admin key — tamper-proof envelope
361
- * - maxAmount ceiling — PTB builder must not exceed this
362
- */
363
- interface ScopedIntent {
364
- version: 1;
365
- userId: string;
366
- walletAddress: string;
367
- allowanceObjectId: string;
368
- featureCode: AllowanceFeature;
369
- maxAmount: number;
370
- issuedAt: number;
371
- expiresAt: number;
372
- nonce: string;
373
- signature: string;
374
- }
375
- type ScopedIntentPayload = Omit<ScopedIntent, 'signature'>;
376
-
377
- interface BuildIntentParams {
378
- userId: string;
379
- walletAddress: string;
380
- allowanceObjectId: string;
381
- featureCode: AllowanceFeature;
382
- maxAmount: number;
383
- ttlMs?: number;
384
- }
385
- /**
386
- * Build a ScopedIntent signed by the admin keypair.
387
- * Generates a cryptographically random 32-byte nonce and signs the canonical payload.
388
- */
389
- declare function buildScopedIntent(adminKeypair: Ed25519Keypair, params: BuildIntentParams): Promise<ScopedIntent>;
390
- /**
391
- * Verify a ScopedIntent:
392
- * 1. Check TTL — reject expired intents immediately (fast path)
393
- * 2. Verify Ed25519 signature over canonical payload
394
- */
395
- declare function verifyScopedIntent(intent: ScopedIntent, adminPublicKeyBytes: Uint8Array): Promise<boolean>;
396
-
397
- export { AllowanceFeature, AllowanceInfo, BalanceResponse, BorrowResult, type BuildIntentParams, ClaimRewardsResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, RepayResult, SafeguardEnforcer, SaveResult, type ScopedIntent, type ScopedIntentPayload, SendResult, StakeVSuiResult, SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, ZkLoginProof, addDepositAllowanceTx, buildAdminDepositAllowanceTx, buildCreateAllowanceTx, buildDeductAllowanceTx, buildDepositAllowanceTx, buildScopedIntent, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, buildWithdrawAllowanceTx, buildWithdrawAmountAllowanceTx, exportPrivateKey, findSwapRoute, generateKeypair, getAddress, getAllowance, getAllowanceBalance, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, solveHashcash, verifyScopedIntent, walletExists };
306
+ export { BalanceResponse, BorrowResult, ClaimRewardsResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, RepayResult, SafeguardEnforcer, SaveResult, SendResult, StakeVSuiResult, SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, ZkLoginProof, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, exportPrivateKey, findSwapRoute, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, solveHashcash, walletExists };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset, an as AllowanceFeature } from './token-registry-DkNy5t19.js';
5
- export { ao as ALLOWANCE_FEATURES, A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, ap as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aq as OPERATION_ASSETS, O as OUTBOUND_OPS, ar as Operation, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, as as assertAllowedAsset, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, at as isAllowedAsset, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, au as simulateTransaction, ah as stableToRaw, ai as suiToMist, av as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-DkNy5t19.js';
4
+ import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-DN059Xcp.js';
5
+ export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, ao as OPERATION_ASSETS, O as OUTBOUND_OPS, ap as Operation, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, aq as assertAllowedAsset, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, ar as isAllowedAsset, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, as as simulateTransaction, ah as stableToRaw, ai as suiToMist, at as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-DN059Xcp.js';
6
6
  import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DkKhitk_.js';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DkKhitk_.js';
8
- import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, n as PaymentRequest, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, o as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, p as AllowanceInfo, q as FinancialSummary } from './types-C6z5Pk_d.js';
9
- export { r as AllowanceCreateResult, s as AllowanceDeductResult, t as AllowanceDepositResult, u as AllowanceWithdrawResult, A as AssetRates, G as GasMethod, b as GasReserve, v as HFAlertLevel, f as PositionEntry } from './types-C6z5Pk_d.js';
10
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
8
+ import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, n as PaymentRequest, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, o as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, p as FinancialSummary } from './types-DxNs-mLT.js';
9
+ export { A as AssetRates, G as GasMethod, b as GasReserve, q as HFAlertLevel, f as PositionEntry } from './types-DxNs-mLT.js';
11
10
  import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
11
+ import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
12
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.js';
13
13
 
14
14
  interface Contact {
@@ -216,66 +216,19 @@ declare function getAddress(keypair: Ed25519Keypair): string;
216
216
 
217
217
  declare function solveHashcash(challenge: string): string;
218
218
 
219
- interface CreateAllowanceOptions {
220
- permittedFeatures?: bigint;
221
- expiresAt?: bigint;
222
- dailyLimit?: bigint;
223
- }
224
- /**
225
- * Build a PTB that creates a new shared Allowance<USDC> for the signer.
226
- */
227
- declare function buildCreateAllowanceTx(options?: CreateAllowanceOptions): Transaction;
228
- /**
229
- * Add an owner deposit call to an existing PTB.
230
- * The caller must provide a coin reference (e.g. from `tx.splitCoins`).
231
- */
232
- declare function addDepositAllowanceTx(tx: Transaction, allowanceId: string, paymentCoin: TransactionObjectArgument): void;
233
- /**
234
- * Build a standalone deposit PTB that splits `amount` (raw USDC) from
235
- * the given USDC coin and deposits into the allowance.
236
- */
237
- declare function buildDepositAllowanceTx(allowanceId: string, usdcCoin: string, amount: bigint): Transaction;
238
- /**
239
- * Build an admin-sponsored deposit PTB. Requires AdminCap in the signer's wallet.
240
- */
241
- declare function buildAdminDepositAllowanceTx(allowanceId: string, usdcCoin: string, amount: bigint): Transaction;
242
- /**
243
- * Build a deduct PTB. Only callable by the AdminCap holder (server/cron).
244
- * Enforces on-chain: feature permission, expiry, daily limit.
245
- */
246
- declare function buildDeductAllowanceTx(allowanceId: string, amount: bigint, feature: AllowanceFeature): Transaction;
247
- /**
248
- * Build a full-withdrawal PTB. Returns entire remaining balance to the owner.
249
- */
250
- declare function buildWithdrawAllowanceTx(allowanceId: string): Transaction;
251
- /**
252
- * Build a partial-withdrawal PTB. Returns `amount` (raw USDC) to the owner.
253
- */
254
- declare function buildWithdrawAmountAllowanceTx(allowanceId: string, amount: bigint): Transaction;
255
- /**
256
- * Fetch the full allowance state from an on-chain Allowance<T> shared object.
257
- */
258
- declare function getAllowance(client: SuiJsonRpcClient, allowanceId: string): Promise<AllowanceInfo>;
259
- /**
260
- * Shorthand: get just the USDC balance of an allowance.
261
- */
262
- declare function getAllowanceBalance(client: SuiJsonRpcClient, allowanceId: string): Promise<bigint>;
263
-
264
219
  declare const HF_WARN_THRESHOLD = 1.8;
265
220
  declare const HF_CRITICAL_THRESHOLD = 1.3;
266
221
  interface FinancialSummaryOptions {
267
- allowanceId?: string;
268
222
  }
269
223
  /**
270
224
  * Fetch a complete financial snapshot for one wallet in parallel.
271
- * Designed for the notification cron one call returns everything
272
- * a briefing, HF alert, or rate alert needs.
225
+ * Designed for the indexer HF hook + chain-memory cron.
273
226
  *
274
227
  * Every sub-call has a fallback so a single RPC failure doesn't
275
228
  * crash the entire batch. Callers can check individual zero values
276
229
  * to detect degraded data.
277
230
  */
278
- declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, options?: FinancialSummaryOptions): Promise<FinancialSummary>;
231
+ declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, _options?: FinancialSummaryOptions): Promise<FinancialSummary>;
279
232
 
280
233
  declare function getRates(client: SuiJsonRpcClient): Promise<RatesResult>;
281
234
  declare function getPendingRewards(client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
@@ -350,48 +303,4 @@ declare function buildStakeVSuiTx(_client: SuiJsonRpcClient, address: string, am
350
303
  */
351
304
  declare function buildUnstakeVSuiTx(client: SuiJsonRpcClient, address: string, amountMist: bigint | 'all'): Promise<Transaction>;
352
305
 
353
- /**
354
- * Short-lived signed authorization for a single autonomous cron execution.
355
- * Built off-chain, verified off-chain before any on-chain PTB is constructed.
356
- *
357
- * Security properties:
358
- * - 60s TTL (configurable) — expired intents rejected before execution
359
- * - Single-use nonce — stored in IntentLog, duplicate rejected immediately
360
- * - Ed25519 signature by admin key — tamper-proof envelope
361
- * - maxAmount ceiling — PTB builder must not exceed this
362
- */
363
- interface ScopedIntent {
364
- version: 1;
365
- userId: string;
366
- walletAddress: string;
367
- allowanceObjectId: string;
368
- featureCode: AllowanceFeature;
369
- maxAmount: number;
370
- issuedAt: number;
371
- expiresAt: number;
372
- nonce: string;
373
- signature: string;
374
- }
375
- type ScopedIntentPayload = Omit<ScopedIntent, 'signature'>;
376
-
377
- interface BuildIntentParams {
378
- userId: string;
379
- walletAddress: string;
380
- allowanceObjectId: string;
381
- featureCode: AllowanceFeature;
382
- maxAmount: number;
383
- ttlMs?: number;
384
- }
385
- /**
386
- * Build a ScopedIntent signed by the admin keypair.
387
- * Generates a cryptographically random 32-byte nonce and signs the canonical payload.
388
- */
389
- declare function buildScopedIntent(adminKeypair: Ed25519Keypair, params: BuildIntentParams): Promise<ScopedIntent>;
390
- /**
391
- * Verify a ScopedIntent:
392
- * 1. Check TTL — reject expired intents immediately (fast path)
393
- * 2. Verify Ed25519 signature over canonical payload
394
- */
395
- declare function verifyScopedIntent(intent: ScopedIntent, adminPublicKeyBytes: Uint8Array): Promise<boolean>;
396
-
397
- export { AllowanceFeature, AllowanceInfo, BalanceResponse, BorrowResult, type BuildIntentParams, ClaimRewardsResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, RepayResult, SafeguardEnforcer, SaveResult, type ScopedIntent, type ScopedIntentPayload, SendResult, StakeVSuiResult, SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, ZkLoginProof, addDepositAllowanceTx, buildAdminDepositAllowanceTx, buildCreateAllowanceTx, buildDeductAllowanceTx, buildDepositAllowanceTx, buildScopedIntent, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, buildWithdrawAllowanceTx, buildWithdrawAmountAllowanceTx, exportPrivateKey, findSwapRoute, generateKeypair, getAddress, getAllowance, getAllowanceBalance, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, solveHashcash, verifyScopedIntent, walletExists };
306
+ export { BalanceResponse, BorrowResult, ClaimRewardsResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, RepayResult, SafeguardEnforcer, SaveResult, SendResult, StakeVSuiResult, SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, ZkLoginProof, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, exportPrivateKey, findSwapRoute, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, solveHashcash, walletExists };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { EventEmitter } from 'eventemitter3';
4
4
  import { createPaymentTransactionUri } from '@mysten/payment-kit';
5
5
  import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
6
6
  import { normalizeSuiAddress, isValidSuiAddress, normalizeStructTag } from '@mysten/sui/utils';
7
- import { Ed25519Keypair, Ed25519PublicKey } from '@mysten/sui/keypairs/ed25519';
7
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
8
8
  import { decodeSuiPrivateKey } from '@mysten/sui/cryptography';
9
9
  import { createHash, randomBytes, createCipheriv, createDecipheriv, scryptSync } from 'crypto';
10
10
  import { access, mkdir, writeFile, readFile } from 'fs/promises';
@@ -892,7 +892,6 @@ function assertAllowedAsset(op, asset) {
892
892
  }
893
893
  var T2000_PACKAGE_ID = process.env.T2000_PACKAGE_ID ?? "0xd775fcc66eae26797654d435d751dea56b82eeb999de51fd285348e573b968ad";
894
894
  var T2000_CONFIG_ID = process.env.T2000_CONFIG_ID ?? "0x08ba26f0d260b5edf6a19c71492b3eb914906a7419baf2df1426765157e5862a";
895
- var T2000_ADMIN_CAP_ID = "0xa97bfff140f5a2c268a03fe5422d382c228057deb7bcfdaf2967ca18b9bdbbd9";
896
895
  var T2000_TREASURY_ID = process.env.T2000_TREASURY_ID ?? "0xf420ec0dcad44433042fb56e1413fb88d3ff65be94fcf425ef9ff750164590e8";
897
896
  var DEFAULT_NETWORK = "mainnet";
898
897
  var DEFAULT_RPC_URL = "https://fullnode.mainnet.sui.io:443";
@@ -900,17 +899,6 @@ var DEFAULT_KEY_PATH = "~/.t2000/wallet.key";
900
899
  var API_BASE_URL = process.env.T2000_API_URL ?? "https://api.t2000.ai";
901
900
  var CETUS_USDC_SUI_POOL = "0x51e883ba7c0b566a26cbc8a94cd33eb0abd418a77cc1e60ad22fd9b1f29cd2ab";
902
901
  var GAS_RESERVE_MIN = 0.05;
903
- var ALLOWANCE_FEATURES = {
904
- BRIEFING: 0,
905
- YIELD_ALERT: 1,
906
- PAYMENT_ALERT: 2,
907
- ACTION_REMIND: 3,
908
- SESSION: 4,
909
- AUTO_COMPOUND: 5,
910
- DCA: 6,
911
- HF_ALERT: 7
912
- };
913
- var FEATURES_ALL = 255;
914
902
 
915
903
  // src/utils/sui.ts
916
904
  init_errors();
@@ -7169,7 +7157,7 @@ var T2000 = class _T2000 extends EventEmitter {
7169
7157
  async compoundRewards(options = {}) {
7170
7158
  this.enforcer.assertNotLocked();
7171
7159
  const minValue = options.minValueUsd ?? 0.1;
7172
- const USDC_TYPE3 = SUPPORTED_ASSETS.USDC.type;
7160
+ const USDC_TYPE2 = SUPPORTED_ASSETS.USDC.type;
7173
7161
  const USDC_DEC = SUPPORTED_ASSETS.USDC.decimals;
7174
7162
  const pending = await this.getPendingRewards();
7175
7163
  const nonTrivial = pending.filter((r) => r.amount > 0);
@@ -7196,7 +7184,7 @@ var T2000 = class _T2000 extends EventEmitter {
7196
7184
  totalGasCost: 0
7197
7185
  };
7198
7186
  }
7199
- const preUsdcCoins = await this._fetchCoins(USDC_TYPE3);
7187
+ const preUsdcCoins = await this._fetchCoins(USDC_TYPE2);
7200
7188
  const preUsdcRaw = preUsdcCoins.reduce((s, c) => s + BigInt(c.balance), 0n);
7201
7189
  const claimResult = await this.claimRewards();
7202
7190
  if (!claimResult.tx) {
@@ -7215,7 +7203,7 @@ var T2000 = class _T2000 extends EventEmitter {
7215
7203
  let totalGasCost = claimResult.gasCost;
7216
7204
  for (const reward of nonTrivial) {
7217
7205
  if (!reward.coinType) continue;
7218
- if (reward.coinType === USDC_TYPE3) continue;
7206
+ if (reward.coinType === USDC_TYPE2) continue;
7219
7207
  try {
7220
7208
  const decimals = getDecimalsForCoinType(reward.coinType) ?? 9;
7221
7209
  const rawAmount = BigInt(Math.floor(reward.amount * 10 ** decimals));
@@ -7225,7 +7213,7 @@ var T2000 = class _T2000 extends EventEmitter {
7225
7213
  const route = await findSwapRoute2({
7226
7214
  walletAddress: this._address,
7227
7215
  from: reward.coinType,
7228
- to: USDC_TYPE3,
7216
+ to: USDC_TYPE2,
7229
7217
  amount: rawAmount,
7230
7218
  byAmountIn: true
7231
7219
  });
@@ -7253,7 +7241,7 @@ var T2000 = class _T2000 extends EventEmitter {
7253
7241
  console.warn(`[compound] Failed to swap ${reward.symbol}:`, err instanceof Error ? err.message : err);
7254
7242
  }
7255
7243
  }
7256
- const postUsdcCoins = await this._fetchCoins(USDC_TYPE3);
7244
+ const postUsdcCoins = await this._fetchCoins(USDC_TYPE2);
7257
7245
  const postUsdcRaw = postUsdcCoins.reduce((s, c) => s + BigInt(c.balance), 0n);
7258
7246
  const gainedRaw = postUsdcRaw > preUsdcRaw ? postUsdcRaw - preUsdcRaw : 0n;
7259
7247
  const depositUsdc = Number(gainedRaw) / 10 ** USDC_DEC;
@@ -7264,7 +7252,7 @@ var T2000 = class _T2000 extends EventEmitter {
7264
7252
  const depositResult = await executeWithGas(this.client, this._signer, async () => {
7265
7253
  const tx = new Transaction();
7266
7254
  tx.setSender(this._address);
7267
- const coins = await this._fetchCoins(USDC_TYPE3);
7255
+ const coins = await this._fetchCoins(USDC_TYPE2);
7268
7256
  if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", "No USDC coins after swap");
7269
7257
  const merged = this._mergeCoinsInTx(tx, coins);
7270
7258
  const [inputCoin] = tx.splitCoins(merged, [gainedRaw]);
@@ -7418,122 +7406,6 @@ async function callSponsorApi(address, name) {
7418
7406
 
7419
7407
  // src/index.ts
7420
7408
  init_errors();
7421
- var USDC_TYPE2 = SUPPORTED_ASSETS.USDC.type;
7422
- function buildCreateAllowanceTx(options = {}) {
7423
- const tx = new Transaction();
7424
- tx.moveCall({
7425
- target: `${T2000_PACKAGE_ID}::allowance::create`,
7426
- typeArguments: [USDC_TYPE2],
7427
- arguments: [
7428
- tx.pure.u64(options.permittedFeatures ?? BigInt(FEATURES_ALL)),
7429
- tx.pure.u64(options.expiresAt ?? 0n),
7430
- tx.pure.u64(options.dailyLimit ?? 0n),
7431
- tx.object(CLOCK_ID)
7432
- ]
7433
- });
7434
- return tx;
7435
- }
7436
- function addDepositAllowanceTx(tx, allowanceId, paymentCoin) {
7437
- tx.moveCall({
7438
- target: `${T2000_PACKAGE_ID}::allowance::deposit`,
7439
- typeArguments: [USDC_TYPE2],
7440
- arguments: [tx.object(allowanceId), paymentCoin]
7441
- });
7442
- }
7443
- function buildDepositAllowanceTx(allowanceId, usdcCoin, amount) {
7444
- const tx = new Transaction();
7445
- const [split] = tx.splitCoins(tx.object(usdcCoin), [tx.pure.u64(amount)]);
7446
- addDepositAllowanceTx(tx, allowanceId, split);
7447
- return tx;
7448
- }
7449
- function buildAdminDepositAllowanceTx(allowanceId, usdcCoin, amount) {
7450
- const tx = new Transaction();
7451
- const [split] = tx.splitCoins(tx.object(usdcCoin), [tx.pure.u64(amount)]);
7452
- tx.moveCall({
7453
- target: `${T2000_PACKAGE_ID}::allowance::admin_deposit`,
7454
- typeArguments: [USDC_TYPE2],
7455
- arguments: [
7456
- tx.object(allowanceId),
7457
- tx.object(T2000_ADMIN_CAP_ID),
7458
- split
7459
- ]
7460
- });
7461
- return tx;
7462
- }
7463
- function buildDeductAllowanceTx(allowanceId, amount, feature) {
7464
- const tx = new Transaction();
7465
- tx.moveCall({
7466
- target: `${T2000_PACKAGE_ID}::allowance::deduct`,
7467
- typeArguments: [USDC_TYPE2],
7468
- arguments: [
7469
- tx.object(allowanceId),
7470
- tx.object(T2000_CONFIG_ID),
7471
- tx.object(T2000_ADMIN_CAP_ID),
7472
- tx.pure.u64(amount),
7473
- tx.pure.u8(feature),
7474
- tx.object(CLOCK_ID)
7475
- ]
7476
- });
7477
- return tx;
7478
- }
7479
- function buildWithdrawAllowanceTx(allowanceId) {
7480
- const tx = new Transaction();
7481
- tx.moveCall({
7482
- target: `${T2000_PACKAGE_ID}::allowance::withdraw`,
7483
- typeArguments: [USDC_TYPE2],
7484
- arguments: [tx.object(allowanceId)]
7485
- });
7486
- return tx;
7487
- }
7488
- function buildWithdrawAmountAllowanceTx(allowanceId, amount) {
7489
- const tx = new Transaction();
7490
- tx.moveCall({
7491
- target: `${T2000_PACKAGE_ID}::allowance::withdraw_amount`,
7492
- typeArguments: [USDC_TYPE2],
7493
- arguments: [tx.object(allowanceId), tx.pure.u64(amount)]
7494
- });
7495
- return tx;
7496
- }
7497
- async function getAllowance(client, allowanceId) {
7498
- const obj = await client.getObject({
7499
- id: allowanceId,
7500
- options: { showContent: true, showType: true }
7501
- });
7502
- if (!obj.data?.content || obj.data.content.dataType !== "moveObject") {
7503
- throw new Error(`Allowance ${allowanceId} not found or is not a Move object`);
7504
- }
7505
- const fields = obj.data.content.fields;
7506
- const coinType = extractCoinType(obj.data.content.type);
7507
- return {
7508
- id: allowanceId,
7509
- owner: fields.owner,
7510
- balance: parseU64Field(fields.balance),
7511
- totalDeposited: parseU64Field(fields.total_deposited),
7512
- totalSpent: parseU64Field(fields.total_spent),
7513
- createdAt: Number(fields.created_at),
7514
- coinType,
7515
- permittedFeatures: parseU64Field(fields.permitted_features),
7516
- expiresAt: Number(fields.expires_at),
7517
- dailyLimit: parseU64Field(fields.daily_limit),
7518
- dailySpent: parseU64Field(fields.daily_spent),
7519
- windowStart: Number(fields.window_start)
7520
- };
7521
- }
7522
- async function getAllowanceBalance(client, allowanceId) {
7523
- const info = await getAllowance(client, allowanceId);
7524
- return info.balance;
7525
- }
7526
- function parseU64Field(raw) {
7527
- if (typeof raw === "string" || typeof raw === "number") return BigInt(raw);
7528
- if (typeof raw === "object" && raw !== null && "value" in raw) {
7529
- return BigInt(raw.value);
7530
- }
7531
- return 0n;
7532
- }
7533
- function extractCoinType(objectType) {
7534
- const match = objectType.match(/<(.+)>/);
7535
- return match ? match[1] : "unknown";
7536
- }
7537
7409
 
7538
7410
  // src/protocols/financialSummary.ts
7539
7411
  var HF_WARN_THRESHOLD = 1.8;
@@ -7571,14 +7443,13 @@ async function fetchSuiPriceUsd(client) {
7571
7443
  }
7572
7444
  return 1;
7573
7445
  }
7574
- async function getFinancialSummary(client, walletAddress, options = {}) {
7575
- const [usdcBal, suiBal, hf, rates, suiPrice, allowance] = await Promise.all([
7446
+ async function getFinancialSummary(client, walletAddress, _options = {}) {
7447
+ const [usdcBal, suiBal, hf, rates, suiPrice] = await Promise.all([
7576
7448
  client.getBalance({ owner: walletAddress, coinType: SUPPORTED_ASSETS.USDC.type }).catch(() => ({ totalBalance: "0" })),
7577
7449
  client.getBalance({ owner: walletAddress, coinType: SUPPORTED_ASSETS.SUI.type }).catch(() => ({ totalBalance: "0" })),
7578
7450
  getHealthFactor(client, walletAddress).catch(() => HF_FALLBACK),
7579
7451
  getRates(client),
7580
- fetchSuiPriceUsd(client),
7581
- options.allowanceId ? getAllowanceBalance(client, options.allowanceId).catch(() => null) : Promise.resolve(null)
7452
+ fetchSuiPriceUsd(client)
7582
7453
  ]);
7583
7454
  const usdcAvailable = Number(usdcBal.totalBalance) / 10 ** SUPPORTED_ASSETS.USDC.decimals;
7584
7455
  const gasReserveSui = Number(suiBal.totalBalance) / Number(MIST_PER_SUI);
@@ -7598,7 +7469,6 @@ async function getFinancialSummary(client, walletAddress, options = {}) {
7598
7469
  dailyYield,
7599
7470
  gasReserveSui,
7600
7471
  gasReserveUsd: gasReserveSui * suiPrice,
7601
- allowanceBalance: allowance,
7602
7472
  fetchedAt: Date.now()
7603
7473
  };
7604
7474
  }
@@ -7713,64 +7583,12 @@ async function getSwapQuote(params) {
7713
7583
  init_cetus_swap();
7714
7584
  init_token_registry();
7715
7585
  init_volo();
7716
- var DEFAULT_TTL_MS = 6e4;
7717
- async function buildScopedIntent(adminKeypair, params) {
7718
- const now = Date.now();
7719
- const nonceBytes = new Uint8Array(32);
7720
- crypto.getRandomValues(nonceBytes);
7721
- const nonce = Buffer.from(nonceBytes).toString("hex");
7722
- const payload = {
7723
- version: 1,
7724
- userId: params.userId,
7725
- walletAddress: params.walletAddress,
7726
- allowanceObjectId: params.allowanceObjectId,
7727
- featureCode: params.featureCode,
7728
- maxAmount: params.maxAmount,
7729
- issuedAt: now,
7730
- expiresAt: now + (params.ttlMs ?? DEFAULT_TTL_MS),
7731
- nonce
7732
- };
7733
- const message = canonicalIntentBytes(payload);
7734
- const signature = await adminKeypair.sign(message);
7735
- return {
7736
- ...payload,
7737
- signature: Buffer.from(signature).toString("hex")
7738
- };
7739
- }
7740
- async function verifyScopedIntent(intent, adminPublicKeyBytes) {
7741
- if (Date.now() > intent.expiresAt) return false;
7742
- const payload = {
7743
- version: intent.version,
7744
- userId: intent.userId,
7745
- walletAddress: intent.walletAddress,
7746
- allowanceObjectId: intent.allowanceObjectId,
7747
- featureCode: intent.featureCode,
7748
- maxAmount: intent.maxAmount,
7749
- issuedAt: intent.issuedAt,
7750
- expiresAt: intent.expiresAt,
7751
- nonce: intent.nonce
7752
- };
7753
- const message = canonicalIntentBytes(payload);
7754
- const signatureBytes = Buffer.from(intent.signature, "hex");
7755
- try {
7756
- const publicKey = new Ed25519PublicKey(adminPublicKeyBytes);
7757
- return await publicKey.verify(message, signatureBytes);
7758
- } catch {
7759
- return false;
7760
- }
7761
- }
7762
- function canonicalIntentBytes(payload) {
7763
- const sorted = Object.fromEntries(
7764
- Object.entries(payload).sort(([a], [b2]) => a.localeCompare(b2))
7765
- );
7766
- return new TextEncoder().encode(JSON.stringify(sorted));
7767
- }
7768
7586
  /*! Bundled license information:
7769
7587
 
7770
7588
  @scure/base/index.js:
7771
7589
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
7772
7590
  */
7773
7591
 
7774
- export { ALLOWANCE_FEATURES, ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, KeypairSigner, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, addDepositAllowanceTx, allDescriptors, assertAllowedAsset, buildAdminDepositAllowanceTx, buildCreateAllowanceTx, buildDeductAllowanceTx, buildDepositAllowanceTx, buildScopedIntent, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, buildWithdrawAllowanceTx, buildWithdrawAmountAllowanceTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getAllowance, getAllowanceBalance, getDecimals, getDecimalsForCoinType, getFinancialSummary, getGasStatus, getPendingRewards, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, verifyScopedIntent, walletExists };
7592
+ export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, KeypairSigner, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, assertAllowedAsset, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getDecimalsForCoinType, getFinancialSummary, getGasStatus, getPendingRewards, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
7775
7593
  //# sourceMappingURL=index.js.map
7776
7594
  //# sourceMappingURL=index.js.map