import { PoolName } from '@alphafi/alphafi-sdk'; import { SuiAddress, TransactionType, CreateStreamIntentionData, SetAutoClaimIntentionData, ClaimStreamIntentionData, ClaimByProxyStreamIntentionData, CancelStreamIntentionData } from '@msafe/sui3-utils'; import { NumStr } from '@firefly-exchange/library-sui'; import { Pool, Position, Trade } from 'turbos-clmm-sdk'; import { Transaction } from '@mysten/sui/transactions'; import { IdentifierString, WalletAccount, SuiSignTransactionBlockInput } from '@mysten/wallet-standard'; import * as _mysten_sui_client from '@mysten/sui/client'; import { SuiGrpcClient } from '@mysten/sui/grpc'; type AlphaFiIntentionData = DepositDoubleAssetIntentionData | DepositSingleAssetIntentionData | WithdrawAlphaIntentionData | WithdrawIntentionData$2 | EmptyIntentionData; interface EmptyIntentionData { } interface DepositDoubleAssetIntentionData { poolName: PoolName; amount: string; isAmountA: boolean; } interface DepositSingleAssetIntentionData { poolName: PoolName; amount: string; } interface WithdrawIntentionData$2 { xTokensAmount: string; poolName: PoolName; } interface WithdrawAlphaIntentionData { xTokensAmount: string; withdrawFromLocked: boolean; } interface Token { address: string; name: string; symbol: string; decimals: number; logoURI: string; totalSupply: string; circulatingSupply: string; isVerified: boolean; hasBluefinPools: boolean; rfqSupported: boolean; } type FeeTokens = [string, string]; type RewardTokens = Array; type CollectTokens = { collectFeeTokens: FeeTokens; collectRewardTokens: RewardTokens; }; type OpenPositionIntentionData = { pool: SuiAddress; lowerTick: number; upperTick: number; tokenAmount: string; maxAmountTokenA: string; maxAmountTokenB: string; isTokenAFixed: boolean; }; type ClosePositionIntentionData = { pool: SuiAddress; position: SuiAddress; transferTokensTo?: SuiAddress; } & CollectTokens; type ProvideLiquidityIntentionData = { pool: SuiAddress; position: SuiAddress; lowerTick: number; upperTick: number; tokenAmount: string; maxAmountTokenA: string; maxAmountTokenB: string; isTokenAFixed: boolean; }; type RemoveLiquidityIntentionData$1 = { pool: SuiAddress; position: SuiAddress; liquidity: string; maxAmountTokenA: string; maxAmountTokenB: string; transferTokensTo?: SuiAddress; } & CollectTokens; type CollectRewardsAndFeeIntentionData = { pool: SuiAddress; position: SuiAddress; } & CollectTokens; type CollectRewardsIntentionData = { pool: SuiAddress; position: SuiAddress; collectRewardTokens: RewardTokens; }; type CollectFeeIntentionData$1 = { pool: SuiAddress; position: SuiAddress; collectFeeTokens: FeeTokens; }; type Aggregator7KSwapIntentionData = { tokenIn: Token | undefined; tokenOut: Token | undefined; amountIn: string; maxSlippage: string; }; type BluefinIntentionData = OpenPositionIntentionData | ClosePositionIntentionData | ProvideLiquidityIntentionData | RemoveLiquidityIntentionData$1 | CollectRewardsIntentionData | CollectFeeIntentionData$1 | CollectRewardsAndFeeIntentionData | Aggregator7KSwapIntentionData; type SuiNetworks = 'sui:devnet' | 'sui:testnet' | 'sui:localnet' | 'sui:mainnet'; interface CloseIntentionData { collateralType: string; recipient: string; strapId?: string; } interface BorrowIntentionData$2 { collateralType: string; collateralAmount: string; borrowAmount: string; insertionPlace?: string; strapId?: string; } interface WithdrawIntentionData$1 { collateralType: string; withdrawAmount: string; insertionPlace?: string; strapId?: string; } interface RepayIntentionData$2 { collateralType: string; repayAmount: string; withdrawAmount: string; isSurplus: boolean; insertionPlace?: string; strapId?: string; } interface PsmIntentionData { coinType: string; amount: string; buckToCoin: boolean; } interface SBUCKDepositIntentionData { coinType: string; amount: string; isStake: boolean; } interface SBUCKUnstakeIntentionData { stakeProofs: string[]; amount: string; isStake: boolean; toBuck: boolean; } interface SBUCKWithdrawIntentionData { amount: string; } interface SBUCKClaimIntentionData { stakeProofs: string[]; } interface TankDepositIntentionData { coinType: string; amount: string; } interface TankWithdrawIntentionData { coinType: string; amount: string; } interface TankClaimIntentionData { coinType: string; } interface LockClaimIntentionData { coinType: string; proofCount: number; } type BucketIntentionData = PsmIntentionData | BorrowIntentionData$2 | WithdrawIntentionData$1 | RepayIntentionData$2 | CloseIntentionData | TankDepositIntentionData | TankWithdrawIntentionData | TankClaimIntentionData | SBUCKDepositIntentionData | SBUCKWithdrawIntentionData | SBUCKUnstakeIntentionData | SBUCKClaimIntentionData | LockClaimIntentionData; interface CetusIntentionData { txbParams: any; action: string; } type DepositAssetIntentionData = { vaultID: SuiAddress; amount: NumStr; }; type MintSharesIntentionData = { vaultID: SuiAddress; numShares: NumStr; }; type RedeemSharesIntentionData = { vaultID: SuiAddress; numShares: NumStr; }; type CancelPendingWithdrawalRequestIntentionData = { vaultID: SuiAddress; sequenceNumber: NumStr; }; type EmberIntentionData = DepositAssetIntentionData | MintSharesIntentionData | RedeemSharesIntentionData | CancelPendingWithdrawalRequestIntentionData; type MMTDEXIntentionData = { action: TransactionSubType; params: any; }; declare enum TransactionSubType { AddLiquidity = "AddLiquidity", AddLiquiditySingleSide = "AddLiquiditySingleSide", ClaimAllRewards = "ClaimAllRewards", ClaimRewards = "ClaimRewards", ClaimRewardsAs = "ClaimRewardsAs", RemoveLiquidity = "RemoveLiquidity", Swap = "Swap", ManageLiquidity = "ManageLiquidity", ManageLiquiditySingleSide = "ManageLiquiditySingleSide", StakeXSui = "StakeXSui", UnstakeXSui = "UnstakeXSui", Bond = "Bond", Extend = "Extend", Merge = "Merge", Unbond = "Unbond" } interface IAppHelperInternalGrpc { application: string; supportSDK: '@mysten/sui-v2'; deserialize(input: { transaction: Transaction; chain: IdentifierString; network: SuiNetworks; suiGrpcClient: SuiGrpcClient; account: WalletAccount; appContext?: any; }): Promise<{ txType: TransactionType; txSubType: string; intentionData: T; }>; build(input: { network: SuiNetworks; txType: TransactionType; txSubType: string; intentionData: T; suiGrpcClient: SuiGrpcClient; account: WalletAccount; }): Promise; } /** * Local client/response shapes used by app-store helpers. * Kept independent of @mysten/sui/jsonRpc so runtime code does not depend on JSON-RPC typings. */ type CoinStruct = { coinType: string; coinObjectId: string; version: string; digest: string; balance: string; previousTransaction: string; }; type PaginatedCoins = { data: CoinStruct[]; hasNextPage: boolean; nextCursor: string | null; }; /** Subset of the former JSON-RPC DevInspectResults shape used by decoders. */ type DevInspectEvent = { type: string; parsedJson?: unknown; packageId?: string; transactionModule?: string; sender?: string; bcs?: string; id?: { txDigest: string; eventSeq: string; }; }; type DevInspectResults = { error?: string | null; effects: { status: { status: 'success' | 'failure'; error?: string; }; }; events: DevInspectEvent[]; results?: Array<{ returnValues?: Array<[number[], string]>; }> | null; }; type SuiNetworkName = 'mainnet' | 'testnet' | 'devnet' | 'localnet'; type MPayIntentionData = CreateStreamIntentionData | SetAutoClaimIntentionData | ClaimStreamIntentionData | ClaimByProxyStreamIntentionData | CancelStreamIntentionData; interface CoinTransferIntentionData { recipient: string; coinType: string; amount: string; } interface ObjectTransferIntentionData { receiver: string; objectType: string; objectId: string; } type CoreIntentionData = CoinTransferIntentionData | ObjectTransferIntentionData; type SuiClientOptions = { network?: SuiNetworkName; /** @deprecated Prefer baseUrl. Accepted for existing call sites. */ url?: string; baseUrl?: string; }; declare class SuiClient extends SuiGrpcClient { constructor(options: SuiClientOptions); getCoins(input: { owner: string; coinType?: string; cursor?: string | null; limit?: number; }): Promise; /** * Legacy JSON-RPC-shaped getOwnedObjects for third-party SDKs (e.g. bucket-protocol-sdk). * Backed by gRPC listOwnedObjects. */ getOwnedObjects(input: { owner: string; cursor?: string | null; limit?: number | null; filter?: { StructType?: string; Package?: string; MatchAll?: unknown[]; MatchAny?: unknown[]; } | null; options?: { showContent?: boolean; showType?: boolean; showDisplay?: boolean; showOwner?: boolean; } | null; }): Promise<{ data: { data: { objectId: string; version: string; digest: string; type: string; owner: _mysten_sui_client.SuiClientTypes.ObjectOwner; content: { dataType: "moveObject"; type: string; fields: never; hasPublicTransfer: boolean; }; }; }[]; hasNextPage: boolean; nextCursor: string; }>; devInspectTransactionBlock(input: { sender: string; transactionBlock: Transaction | Uint8Array | string; }): Promise; } interface IAppHelperInternal { application: string; supportSDK: '@mysten/sui'; deserialize(input: { transaction: Transaction; chain: IdentifierString; network: SuiNetworks; suiClient: SuiClient; account: WalletAccount; appContext?: any; }): Promise<{ txType: TransactionType; txSubType: string; intentionData: T; }>; build(input: { network: SuiNetworks; txType: TransactionType; txSubType: string; intentionData: T; suiClient: SuiClient; account: WalletAccount; }): Promise; } interface ClaimRewardIntentionData { type: string; } interface ClaimSupplyIntentionData { type: string; } interface EntryBorrowIntentionData { amount: number; assetId: number; } interface EntryDepositIntentionData { amount: number; assetId: number; } interface EntryRepayIntentionData { amount: number; assetId: number; } interface EntryWithdrawIntentionData { amount: number; assetId: number; } interface EntryMultiDepositIntentionData { list: { amount: number; assetId: number; }[]; } interface PlainTransactionIntentionData { content: string; scene: string; } type NAVIIntentionData = EntryDepositIntentionData | EntryBorrowIntentionData | EntryRepayIntentionData | EntryWithdrawIntentionData | EntryMultiDepositIntentionData | ClaimRewardIntentionData | ClaimSupplyIntentionData | PlainTransactionIntentionData; type PlainTransactionData = { content: string; }; interface BorrowIntentionData$1 { coinName: string; amount: number | string; obligationId: string; obligationKey: string; } interface BorrowWithBoostIntentionData { coinName: string; amount: number | string; obligationId: string; obligationKey: string; veScaKey: string; } interface BorrowWithReferralIntentionData { coinName: string; amount: number | string; obligationId: string; obligationKey: string; veScaKey: string | undefined; } interface DepositCollateralIntentionData { collateralCoinName: string; amount: number | string; obligationId: string; } interface MigrateAndClaimIntentionData { obligationKey: string; obligationId: string; rewardCoinName: string; veScaKey?: string; } interface MigrateScoinIntentionData { } interface OpenObligationIntentionData { } interface RepayIntentionData$1 { coinName: string; amount: number | string; obligationId: string; obligationKey: string; } interface RepayWithBoostIntentionData { coinName: string; amount: number | string; obligationId: string; veScaKey: string; } interface SupplyLendingIntentionData { amount: number | string; coinName: string; } interface UnstakeSpoolIntentionData { amount: number | string; marketCoinName: string; stakeAccountId: string | null; } interface WithdrawAndUnstakeLendingIntentionData { amount: number | undefined; coinName: string; stakeAccountId: { id: string; coin: number; }[]; } interface WithdrawCollateralIntentionData { collateralCoinName: string; amount: number | string; obligationId: string; obligationKey: string; } interface WithdrawLendingIntentionData { amount: string | number; coinName: string; } interface BindReferralIntentionData { veScaKey: string; } interface ClaimRevenueReferralIntentionData { veScaKey: string; coins: string[]; } interface CreateReferralLinkIntentionData { } interface ExtendPeriodAndStakeMoreIntentionData { amount: number; veScaKey: string; unlockTime: number; obligationId: string | undefined; obligationKey: string | undefined; isOldBorrowIncentive: boolean; isObligationLocked: boolean; } interface ExtendStakePeriodIntentionData { isObligationLocked: boolean; isOldBorrowIncentive: boolean; obligationId: string | undefined; obligationKey: string | undefined; unlockTime: number | undefined; veScaKey: string | undefined; } interface MergeVeScaIntentionData { targetVeScaKey: string; sourceVeScaKey: string; obligationDatas: { obligationKey: string; obligationId: string; }[]; } interface RedeemScaIntentionData { veScaKey: string; } interface RenewExpStakePeriodIntentionData { amount: number; unlockTime: number; veScaKey: string; isHaveRedeem: boolean; obligation?: string; obligationKey?: string; isObligationLocked: boolean; isOldBorrowIncentive: boolean; } interface SplitVeScaIntentionData { targetVeScaKey: string; splitAmount: number; } interface StakeScaIntentionData { amount: number; isObligationLocked: boolean; isOldBorrowIncentive: boolean; obligationId: string | undefined; obligationKey: string | undefined; unlockTime: number | undefined; veScaKey: string | undefined; } interface SupplyAndStakeLendingIntentionData { amount: number | string; coinName: string; stakeAccountId?: string | null; } /** * Represents possible actions in the system */ type Action = 'stake' | 'unstake' | 'deactivate'; /** * Type mapping from Action to its required arguments */ type Args = T extends 'stake' ? StakeArgs : T extends 'unstake' ? UnstakeArgs : T extends 'deactivate' ? DeactivateArgs : never; /** * Arguments required for the 'stake' action */ interface StakeArgs { veScaKey: string; obligationId: string; obligationKey: string; } /** * Arguments required for the 'unstake' action */ interface UnstakeArgs { obligationId: string; obligationKey: string; } /** * Arguments required for the 'deactivate' action */ interface DeactivateArgs { veScaKey: string; obligationId: string; } type BindingDatas = { action: 'deactivate'; args: Args<'deactivate'>; } | { action: 'stake'; args: Args<'stake'>; } | { action: 'unstake'; args: Args<'unstake'>; }; interface VeScaObligationBindingsIntentData { bindingDatas: BindingDatas[]; } interface TransferVeScaKeysIntentionData { veScaKeys: { objectId: string; version: string; digest: string; }[]; } interface WithdrawStakedScaIntentionData { vescaKey?: string; } type ScallopIntentionData = SupplyLendingIntentionData | WithdrawLendingIntentionData | BorrowIntentionData$1 | RepayIntentionData$1 | DepositCollateralIntentionData | WithdrawCollateralIntentionData | OpenObligationIntentionData | UnstakeSpoolIntentionData | BorrowWithBoostIntentionData | StakeScaIntentionData | ExtendStakePeriodIntentionData | ExtendPeriodAndStakeMoreIntentionData | RenewExpStakePeriodIntentionData | WithdrawStakedScaIntentionData | SupplyAndStakeLendingIntentionData | WithdrawAndUnstakeLendingIntentionData | RedeemScaIntentionData | MigrateAndClaimIntentionData | BorrowWithReferralIntentionData | CreateReferralLinkIntentionData | ClaimRevenueReferralIntentionData | BindReferralIntentionData | MigrateScoinIntentionData | RepayWithBoostIntentionData | MergeVeScaIntentionData | SplitVeScaIntentionData | VeScaObligationBindingsIntentData | TransferVeScaKeysIntentionData; interface StakeIntentionData$1 { amount: string; outCoinType: string; } interface StakeAndDepositIntentionData { amount: string; outCoinType: string; } interface ConvertIntentionData { amount: string; inCoinType: string; outCoinType: string; } interface ConvertAndDepositIntentionData { amount: string; inCoinType: string; outCoinType: string; } interface UnstakeIntentionData { amount: string; inCoinType: string; } type SpringSuiIntentionData = StakeIntentionData$1 | StakeAndDepositIntentionData | ConvertIntentionData | ConvertAndDepositIntentionData | UnstakeIntentionData; interface MintIntentionData { amount: string; } interface RedeemIntentionData { amount: string; } type StSuiIntentionData = MintIntentionData | RedeemIntentionData; type SuilendIntentionData = DepositIntentionData | WithdrawIntentionData | BorrowIntentionData | RepayIntentionData | ClaimIntentionData | ClaimAndDepositIntentionData; interface WithdrawIntentionData { coinType: string; value: string; } interface BorrowIntentionData { coinType: string; value: string; } interface ClaimIntentionData { value: Record; } interface ClaimAndDepositIntentionData { value: Record; } interface DepositIntentionData { coinType: string; value: string; } interface RepayIntentionData { coinType: string; value: string; } type TURBOSIntentionData = CreatePoolIntentionData | AddLiquidityIntentionData | IncreaseLiquidityIntentionData | DecreaseLiquidityIntentionData | DecreaseLiquidityWithReturnIntentionData | CollectFeeIntentionData | CollectRewardIntentionData | RemoveLiquidityIntentionData | RemoveLiquidityWithReturnIntentionData | BurnIntentionData | SwapIntentionData | PrixJoinIntentionData | PrixClaimIntentionData | SwapExactQuoteForBaseIntentionData | SwapExactBaseForQuoteIntentionData; type CreatePoolIntentionData = Pool.CreatePoolOptions; type AddLiquidityIntentionData = Pool.AddLiquidityOptions; type BurnIntentionData = Position.BurnOptions; type CollectFeeIntentionData = Pool.CollectFeeOptions; type CollectRewardIntentionData = Pool.CollectRewardOptions; type DecreaseLiquidityIntentionData = Pool.DecreaseLiquidityOptions; type DecreaseLiquidityWithReturnIntentionData = Pool.DecreaseLiquidityOptions; type IncreaseLiquidityIntentionData = Pool.IncreaseLiquidityOptions; interface PrixClaimIntentionData { } interface PrixJoinIntentionData { } type RemoveLiquidityIntentionData = Pool.RemoveLiquidityOptions; type RemoveLiquidityWithReturnIntentionData = Pool.RemoveLiquidityOptions; type SwapIntentionData = Trade.SwapOptions; interface SwapExactBaseForQuoteIntentionData { token1: string; token2: string; poolId: string; amountIn: number; } interface SwapExactQuoteForBaseIntentionData { token1: string; token2: string; poolId: string; amountIn: number; } interface ClaimTicketIntentionData { ticketId: string; } interface StakeIntentionData { amount: number; } interface UnStakeIntentionData { amount: number; } type VoloIntentionData = StakeIntentionData | UnStakeIntentionData | ClaimTicketIntentionData; /** * Maps each registered application name to its intention data type. * Add new apps here when registering helpers in `src/index.ts`. */ interface AppRegistry { alphafi: AlphaFiIntentionData; bluefin: BluefinIntentionData; bucket: BucketIntentionData; cetus: CetusIntentionData; ember: EmberIntentionData; 'mmt-dex': MMTDEXIntentionData; mpay: MPayIntentionData; 'msafe-core': CoreIntentionData; 'msafe-plain-tx': PlainTransactionData; navi: NAVIIntentionData; scallop: ScallopIntentionData; SpringSui: SpringSuiIntentionData; stsui: StSuiIntentionData; Suilend: SuilendIntentionData; turbos: TURBOSIntentionData; volo: VoloIntentionData; } type AppName = keyof AppRegistry; type AppIntentionData = AppRegistry[K]; interface IAppHelper { deserialize(input: SuiSignTransactionBlockInput & { network: SuiNetworks; clientUrl: string; account: WalletAccount; appContext?: any; }): Promise<{ txType: TransactionType; txSubType: string; intentionData: T; }>; build(input: { network: SuiNetworks; txType: TransactionType; txSubType: string; intentionData: T; clientUrl: string; account: WalletAccount; }): Promise; } type InternalAppHelper = IAppHelperInternal | IAppHelperInternalGrpc; type RegisteredAppHelper = IAppHelper; declare class MSafeApps { apps: Map; private constructor(); static fromHelpers(apps: InternalAppHelper[]): MSafeApps; addHelper(app: IAppHelperInternal): void; addGrpcHelper(app: IAppHelperInternalGrpc): void; getAppHelper(appName: K): IAppHelper; getAppHelper(appName: string): IAppHelper; private setApp; } declare const appHelpers: MSafeApps; export { type AppIntentionData, type AppName, type AppRegistry, appHelpers };