import { DryRunTransactionBlockResponse, SuiClient, SuiObjectResponse, SuiTransactionBlockResponseOptions } from "@mysten/sui/client"; import { SuiTransactionBlockResponse } from "@mysten/sui/client"; import { SignatureWithBytes, Signer } from "@mysten/sui/cryptography"; import BigNumber from "bignumber.js"; import { BankAccountDetails, Operator, Order, PerpCreationMarketDetails, UserPosition, ZkPayload } from "../interfaces"; import { address, BigNumberable, OnChainCallResponse, TransactionBlock } from "../types"; import { TransactionObjectArgument } from "@mysten/sui/transactions"; import { TRANSFERABLE_COINS } from "../enums"; import { OnChainCalls as SpotOnChainCalls } from "../spot"; import { UserCalls as ProUserOnChainCalls } from "../v3"; export declare class OnChainCalls { signer: Signer; settlementCap: string | undefined; deployment: any; private suiClient; private is_zkLogin; private maxEpoch?; private proof?; private decodedJWT?; private salt?; private walletAddress?; private is_wallet_extension; private sequentialExecutors; constructor(_signer: Signer, _deployment: any, suiClient: SuiClient, isZkLogin?: boolean, zkPayload?: ZkPayload, walletAddress?: string, is_wallet_extension?: boolean, settlementCap?: string); setExchangeAdmin(args: { address: string; adminID?: string; gasBudget?: number; }, signer?: Signer): Promise; setExchangeGuardian(args: { address: string; adminID?: string; safeID?: string; gasBudget?: number; }, signer?: Signer): Promise; setFundingRateOperator(args: { operator: string; adminID?: string; safeID?: string; gasBudget?: number; }, signer?: Signer): Promise; setPreLaunchMarketStatus(args: { status: boolean; market: string; adminID?: string; gasBudget?: number; }, signer?: Signer): Promise; setPreLaunchOraclePriceOperator(args: { operator: string; adminID?: string; safeID?: string; gasBudget?: number; }, signer?: Signer): Promise; setPreLaunchMarketOraclePrice(args: { price: number; market?: string; safeID?: string; gasBudget?: number; coinObjectId?: string; }, signer?: Signer): Promise; createPerpetual(args: PerpCreationMarketDetails, signer?: Signer, gasBudget?: number): Promise; setMinPrice(args: { adminID?: string; market?: string; minPrice: number; gasBudget?: number; }, signer?: Signer): Promise; setMaxPrice(args: { adminID?: string; market?: string; maxPrice: number; gasBudget?: number; }, signer?: Signer): Promise; setStepSize(args: { adminID?: string; market?: string; stepSize: number; gasBudget?: number; }, signer?: Signer): Promise; setTickSize(args: { adminID?: string; market?: string; tickSize: number; gasBudget?: number; }, signer?: Signer): Promise; setMTBLong(args: { adminID?: string; market?: string; mtbLong: number; gasBudget?: number; }, signer?: Signer): Promise; setMTBShort(args: { adminID?: string; market?: string; mtbShort: number; gasBudget?: number; }, signer?: Signer): Promise; setMaxQtyLimit(args: { adminID?: string; market?: string; maxQtyLimit: number; gasBudget?: number; }, signer?: Signer): Promise; setMaxQtyMarket(args: { adminID?: string; market?: string; maxQtyMarket: number; gasBudget?: number; }, signer?: Signer): Promise; setMinQty(args: { adminID?: string; market?: string; minQty: number; gasBudget?: number; }, signer?: Signer): Promise; setMaxAllowedOIOpen(args: { adminID?: string; market?: string; maxLimit: string[]; gasBudget?: number; }, signer?: Signer): Promise; setMaintenanceMarginRequired(args: { adminID?: string; market?: string; mmr: string; gasBudget?: number; }, signer?: Signer): Promise; setInitialMarginRequired(args: { adminID?: string; market?: string; imr: string; }, options?: { gasBudget?: number; signer?: Signer; multiSig?: address; }): Promise; createSettlementOperator(args: { operator: string; adminID?: string; safeID?: string; gasBudget?: number; }, options?: { gasBudget?: number; signer?: Signer; multiSig?: address; }): Promise; removeSettlementOperator(args: { capID: string; adminID?: string; safeID?: string; gasBudget?: number; }, signer?: Signer): Promise; setFeePoolAddress(args: { adminID?: string; market?: string; address: string; gasBudget?: number; }, signer?: Signer): Promise; setInsurancePoolAddress(args: { adminID?: string; market?: string; address: string; gasBudget?: number; }, signer?: Signer): Promise; setInsurancePoolPercentage(args: { adminID?: string; market?: string; percentage: number; gasBudget?: number; }, signer?: Signer): Promise; setMaxAllowedFundingRate(args: { adminID?: string; market?: string; maxFundingRate: number; gasBudget?: number; }, signer?: Signer): Promise; trade(args: { makerOrder: Order; makerSignature: string; makerPublicKey: string; takerOrder: Order; takerSignature: string; takerPublicKey: string; settlementCapID?: string; fillPrice?: BigNumber; fillQuantity?: BigNumber; perpID?: string; safeID?: string; bankID?: string; subAccountsMapID?: string; gasBudget?: number; market?: string; txHash?: string; }, signer?: Signer): Promise; batchTrade(args: { makerOrder: Order; makerSignature: string; makerPublicKey: string; takerOrder: Order; takerSignature: string; takerPublicKey: string; settlementCapID?: string; fillPrice?: BigNumber; fillQuantity?: BigNumber; perpID?: string; safeID?: string; bankID?: string; subAccountsMapID?: string; market?: string; txHash?: string; }[], options?: { gasBudget?: number; signer?: Signer; transactionBlock?: TransactionBlock; }): Promise; batchTradeUsingExecutors(args: { makerOrder: Order; makerSignature: string; makerPublicKey: string; takerOrder: Order; takerSignature: string; takerPublicKey: string; settlementCapID?: string; fillPrice?: BigNumber; fillQuantity?: BigNumber; perpID?: string; safeID?: string; bankID?: string; subAccountsMapID?: string; market?: string; txHash?: string; }[], options?: { gasBudget?: number; transactionBlock?: TransactionBlock; }): Promise; buildBatchTradeTxBlock(args: { makerOrder: Order; makerSignature: string; makerPublicKey: string; takerOrder: Order; takerSignature: string; takerPublicKey: string; settlementCapID?: string; fillPrice?: BigNumber; fillQuantity?: BigNumber; perpID?: string; safeID?: string; bankID?: string; subAccountsMapID?: string; market?: string; txHash?: string; }[], gasBudget?: number): Promise; liquidate(args: { perpID?: string; liquidatee: string; quantity: string; leverage: string; liquidator?: string; allOrNothing?: boolean; subAccountsMapID?: string; gasBudget?: number; market?: string; txHash?: string; }, signer?: Signer): Promise; getBatchLiquidationTransactionBlock(args: { perpID?: string; liquidatee: string; quantity: string; leverage: string; liquidator?: string; allOrNothing?: boolean; subAccountsMapID?: string; gasBudget?: number; market?: string; txHash?: string; }[], gasBudget?: number, signer?: Signer): Promise; batchLiquidate(args: { perpID?: string; liquidatee: string; quantity: string; leverage: string; liquidator?: string; allOrNothing?: boolean; subAccountsMapID?: string; gasBudget?: number; market?: string; }[], gasBudget?: number, signer?: Signer): Promise; dryRun(txBlock: TransactionBlock, signer: Signer): Promise; deleverage(args: { maker: string; taker: string; quantity: string; allOrNothing?: boolean; perpID?: string; deleveragingCapID?: string; safeID?: string; gasBudget?: number; market?: string; txHash?: string; }, signer?: Signer): Promise; getBatchDeleveragingTransactionBlock(args: { maker: string; taker: string; quantity: string; allOrNothing?: boolean; perpID?: string; deleveragingCapID?: string; safeID?: string; gasBudget?: number; market?: string; txHash?: string; }[], gasBudget?: number, signer?: Signer): Promise; batchDeleverage(args: { maker: string; taker: string; quantity: string; allOrNothing?: boolean; perpID?: string; deleveragingCapID?: string; safeID?: string; gasBudget?: number; market?: string; txHash?: string; }[], gasBudget?: number, signer?: Signer): Promise; addMargin(args: { amount: number; account?: string; perpID?: string; subAccountsMapID?: string; market?: string; gasBudget?: number; txHash?: string; sponsor?: boolean; }, signer?: Signer): Promise; removeMargin(args: { amount: number; account?: string; perpID?: string; subAccountsMapID?: string; market?: string; gasBudget?: number; txHash?: string; sponsor?: boolean; }, signer?: Signer): Promise; adjustLeverage(args: { leverage: number; account?: string; perpID?: string; subAccountsMapID?: string; market?: string; gasBudget?: number; txHash?: string; sponsor?: boolean; }, signer?: Signer): Promise; signAdjustLeverage(args: { leverage: number; account?: string; perpID?: string; subAccountsMapID?: string; market?: string; gasBudget?: number; txHash?: string; }, signer?: Signer): Promise; /** * Create signed transaction for whitelisting/removing of the subaccounts on-chain */ signUpsertSubAccount(args: { account?: string; accountsToRemove?: Array; subAccountsMapID?: string; gasBudget?: number; sponsor?: boolean; }, signer?: Signer): Promise; cancelOrder(args: { order: Order; signature: string; publicKey: string; subAccountsMapID?: string; gasBudget?: number; txHash?: string; }, signer?: Signer): Promise; setFundingRate(args: { rate: BigNumber; safeID?: string; updateFRCapID?: string; perpID?: string; market?: string; gasBudget?: number; }, signer?: Signer): Promise; setDeleveragingOperator(args: { operator: string; adminID?: string; safeID?: string; gasBudget?: number; }, signer?: Signer): Promise; setSubAccount(args: { account: string; status: boolean; subAccountsMapID?: string; gasBudget?: number; sponsor?: boolean; }, signer?: Signer): Promise; depositToBank(args: { coinID: string; amount: string; txHash?: string; accountAddress?: string; bankID?: string; gasBudget?: number; sponsor?: boolean; }, signer?: Signer): Promise; setBankWithdrawalStatus(args: { isAllowed: boolean; bankID?: string; safeID?: string; guardianCap?: string; gasBudget?: number; }, signer?: Signer): Promise; setPerpetualTradingPermit(args: { isPermitted: boolean; market?: string; safeID?: string; guardianCap?: string; gasBudget?: number; }, signer?: Signer): Promise; withdrawFromBank(args: { amount: string; accountAddress?: string; txHash?: string; bankID?: string; gasBudget?: number; sponsor?: boolean; }, signer?: Signer): Promise; withdrawAllMarginFromBank(signer?: Signer, walletAddress?: string, gasBudget?: number, bankID?: string, txHash?: string): Promise; attachWithdrawCall(tx: TransactionBlock, userAddress: string): { balanceT: { $kind: "NestedResult"; NestedResult: [number, number]; }; amount: { $kind: "NestedResult"; NestedResult: [number, number]; }; }; attachWithdrawCallWithoutBalance(tx: TransactionBlock, userAddress: string): void; attachClosePositionCall(tx: TransactionBlock, symbol: string, userAddress: string): void; attachSwapCall(tx: TransactionBlock, inspectTx: TransactionBlock, userAddress: string, amountNumber: number, spotOnChain: SpotOnChainCalls, withdrawTxResult?: any, swapVia7k?: boolean, slippage?: number, defaultSlippage?: number, returnOnlyQuote?: boolean): Promise; attachDepositToProCall(tx: TransactionBlock, userAddress: string, coinOut: TransactionObjectArgument, proUserOnChain: ProUserOnChainCalls): Promise; closeAllPositionsAndWithdrawMarginPTB(delistedMarketPositions: string[], walletAddress?: string, args?: { gasBudget?: number; sponsor?: boolean; dryRunOnly?: boolean; }, signer?: Signer): Promise; swapAndDepositToProPTB(amount: number, spotOnChain: SpotOnChainCalls, proUserOnChain: ProUserOnChainCalls, walletAddress?: string, args?: { gasBudget?: number; sponsor?: boolean; use7k?: boolean; slippage?: number; defaultSlippage?: number; dryRunOnly?: boolean; }, signer?: Signer): Promise; withdrawAllSwapAndDepositToProPTB(spotOnChain: SpotOnChainCalls, proUserOnChain: ProUserOnChainCalls, walletAddress?: string, args?: { gasBudget?: number; sponsor?: boolean; use7k?: boolean; slippage?: number; dryRunOnly?: boolean; defaultSlippage?: number; }, signer?: Signer): Promise; closeAllPositionsWithdrawSwapAndDepositToProPTB(delistedMarketPositions: string[], spotOnChain: SpotOnChainCalls, proUserOnChain: ProUserOnChainCalls, walletAddress?: string, args?: { gasBudget?: number; sponsor?: boolean; use7k?: boolean; slippage?: number; dryRunOnly?: boolean; defaultSlippage?: number; }, signer?: Signer): Promise; inspectWithdrawAllAndGetEstimatedSwapAmount(delistedMarketPositions: string[], spotOnChain: SpotOnChainCalls, walletAddress?: string, args?: { gasBudget?: number; slippage?: number; dryRunOnly?: boolean; defaultSlippage?: number; }, signer?: Signer): Promise; delistPerpetual(args: { price: string; market?: string; adminID?: string; gasBudget?: number; }, signer?: Signer): Promise; closePosition(args?: { bankID?: string; perpID?: string; gasBudget?: number; }, signer?: Signer): Promise; removeEmptyPositions(args: { market: string; users: string[]; gasBudget?: number; }, signer?: Signer): Promise; /** * @notice Allows admin to update the default maker fee of a perpetual * @param args: * market: name of the perpetual/market * fee: the maker fee to be charged from user on each tx NOTE: should be in bps 1.5/2.5 */ setMakerFee(args: { market: string; fee: number; gasBudget?: number; }, signer?: Signer): Promise; /** * @notice Allows admin to update the default taker fee of a perpetual * @param args: * market: name of the perpetual/market * fee: the taker fee to be charged from user on each tx NOTE: should be in bps 1.5/2.5 */ setTakerFee(args: { market: string; fee: number; gasBudget?: number; }, signer?: Signer): Promise; setSpecialFee(args: { adminID?: string; marketName?: string; account: string; status: boolean; makerFee: number; takerFee: number; gasBudget?: number; }, options?: { gasBudget?: number; signer?: Signer; multiSig?: address; }): Promise; executeTxBlock(transactionBlock: TransactionBlock, signer?: Signer, options?: SuiTransactionBlockResponseOptions): Promise; executeTxBlockWithLocalExecution(transactionBlock: TransactionBlock, signer?: Signer, options?: SuiTransactionBlockResponseOptions): Promise; /** * Executes provided signed transaction block * @param blockBytes bytes of the tx block * @param signature signature of the block * @returns */ executeSignedTxBlock(blockBytes: string | Uint8Array, signature: string, options?: SuiTransactionBlockResponseOptions): Promise; createOracleObjects(signer?: Signer): Promise; createBank(usdcAddress: string, gasBudget?: number, signer?: Signer): Promise; createSequencer(signer?: Signer): Promise; setOraclePrice(args: { price: number; confidence?: string; market?: string; }, signer?: Signer): Promise; /** * Returns price of oracle * @param market name of the market for which oracle price is to be fetched * @returns oracle price in base number */ getOraclePrice(market?: string): Promise; mintUSDC(args?: { amount?: string; to?: string; treasuryCapID?: string; gasBudget?: number; }, signer?: Signer): Promise; getUSDCCoins(args?: { address?: string; currencyType?: string; limit?: number; cursor?: string; }, signer?: Signer): Promise; /** * Merges All USDC Coins to single coin * @param coinType [optional] coinType of USDC coin , if not provided will get from deployment json * @param signer the signer object of the wallet that owns USDC coins * @returns transaction result */ mergeAllUsdcCoins(coinType?: string, signer?: Signer | any, address?: string, sponsor?: boolean): Promise; Z: any; /** * Prepare trasaction block for transferring SUI * @param to recipient wallet address * @param balance amount to transfer * @returns transaction block */ prepareTransactionForSUITransfer(to: string, balance: number, signer?: Signer | any): Promise; transferCoinObjects(to: string, balance: number, coinObject: { balance: string; coinObjectIds: string[]; coinType: string; decimals: number; }, signer?: Signer | any, dryRun?: boolean): Promise; /** * Transfers Sui Balance to given wallet address * @param args.to destination wallet address * @param args.balance sui balance in normal base to transfer to destination wallet address * @param signer the signer object of the wallet that owns sui to transfer * @returns transaction Result */ transferSuiBalance(args: { to: string; balance: number; }, signer?: Signer | any): Promise; getUSDCBalance(args?: { address?: string; currencyID?: string; limit?: number; cursor?: string; }, signer?: Signer): Promise; getUSDCoinHavingBalance(args: { amount: BigNumberable; address?: string; currencyID?: string; limit?: number; cursor?: string; }, signer?: Signer): Promise; private executeZkTransaction; private executeWalletTransaction; signAndCall(signer: Signer | any, method: string, callArgs: any[], moduleName: string, gasBudget?: number, packageId?: string, typeArguments?: string[]): Promise; buildTxBlock(method: string, moduleName: string, callArgs: any[], signer: Signer | any, packageId?: string, typeArguments?: string[]): Promise; setSettlementCap(id: string): void; /** * Get Sui Balance of given wallet address * @param user wallet address to get the sui balance of * @returns sui balance of user in base 9 */ getUserSuiBalance(user?: string): Promise; getOnChainObject(id: string): Promise; getOwnedObjects(objType: string, ownerAddr?: string): Promise; getUserPosition(perpetual: string, user?: string): Promise; getUserPositionFromID(id: string): Promise; getPerpDetails(id: string): Promise; getBankAccountDetailsUsingID(id: string): Promise; getUserBankBalance(user?: string, bankID?: string): Promise; executeTransactionBlock(caller: Signer, tx: TransactionBlock): Promise; private prepareTransactionBlock; estimateGasFee(txb: TransactionBlock): Promise; estimateGasForSuiTransfer(args: { to: string; balance: number; }): Promise; prepareTransactionForUSDCTransfer(to: string, balance: number): Promise; transferUSDC(args: { to: string; balance: number; }, signer?: Signer | any): Promise; /** * Transfers Sui Balance to given wallet address * @param args.to destination wallet address * @param args.balance sui balance in normal base to transfer to destination wallet address * @param signer the signer object of the wallet that owns sui to transfer * @param coin which coin to transfer * @returns transaction Result */ transferCoins(args: { to: string; balance: number; coin: TRANSFERABLE_COINS; }, signer?: Signer | any): Promise; estimateGasForUSDCTransfer(args: { to: string; balance: number; }): Promise; getPriceOracleObjectId(market?: string): string; getPriceOracleFeedId(market?: string): string; getPythPkgId(market?: string): string; getSettlementOperators(): Operator[]; getBankID(): string; getUpgradeCapID(): string; getSafeID(): string; getGuardianCap(): string; getFROperatorCapID(): string; getDeleveragingCapID(): string; getSettlementOperatorTable(): string; getPackageID(): string; getExchangeAdminCap(): string; getSubAccountsID(): string; getPriceOracleOperatorCap(): string; getPublicSettlementCap(): string; getPerpetualID(market?: string): string; getOrdersTableID(): string; getPositionsTableID(market?: string): string; getBankTableID(): string; getDeployerAddress(): string; getCurrencyID(): string; getCoinType(): string; getBankType(): string; getCurrencyType(): string; getTreasuryCapID(): string; getSequencer(): string; _parseAccountDetails(obj: any): BankAccountDetails; getZkPayload: () => ZkPayload; }