/// import { PublicKey, TransactionSignature } from "@solana/web3.js"; import { AssetDetails, AssetType, SdxClient } from "../SdxClient"; import { BN } from "@project-serum/anchor"; /** * Deposits a specified amount of an asset to the trading account. If the trading account is not initialized, * it will be initialized in this function. Associated token accounts and trading token account for the asset * will be created if they do not exist. If the asset is a EURO_TOKEN, OptionChain must be provided in the * optional param. * * @public * @param {AssetType} asset - The type of the asset to deposit. * @param {BN} amount - The amount of the asset to deposit. * @param {AssetDetails} [optionalAssetDetails] - Optional asset details for EURO_TOKEN deposits. * * @returns {Promise} A promise that resolves to the transaction signature of the deposit operation. * @todo Add a rent checker for account creation cost. */ export declare function depositToTradingImpl(this: SdxClient, asset: AssetType, amount: BN, optionalAssetDetails?: AssetDetails): Promise; /** * Withdraws a specified amount of an asset from the trading account. If the trading account is not initialized, * an error is thrown. If the asset is a EURO_TOKEN, OptionChain must be provided in the optional param. * * @public * @param {AssetType} asset - The type of the asset to withdraw. * @param {BN} amount - The amount of the asset to withdraw. * @param {AssetDetails} [optionalAssetDetails] - Optional asset details for EURO_TOKEN withdrawals. * * @returns {Promise} A promise that resolves to the transaction signature of the withdrawal operation. * * @throws {Error} Throws an error if the trading account is not initialized. * @todo Add a rent checker for account creation cost. * @todo Add CloseTokenAccount instruction if token account is zeroed out. */ export declare function withdrawFromTradingImpl(this: SdxClient, asset: AssetType, amount: BN, optionalAssetDetails?: AssetDetails): Promise; /** * Sells an amount of options by a specific series ID. The trading account must be initialized before this operation. * * @public * @param {AssetType} asset - The type of the asset for the option. * @param {number} seriesId - The series ID of the option to sell. * @param {BN} optionAmount - The amount of the option to sell. * @param {BN} minAmountToReceive - The minimum amount to receive from the sell operation. * @param {boolean} splitTx - Flag indicating if sell ix should be sent separately to isolate compute units. * @param onTxConfirmed - Callback to pass txId to the consumer once resolved * * @returns {Promise} A promise that resolves to the transaction signature of the sell operation. * * @throws {Error} Throws an error if the trading account is not initialized. * @todo Change priority fee to use SdxClient value. */ export declare function sellOptionBySeriesIdImpl(this: SdxClient, asset: AssetType, seriesId: number, optionAmount: BN, minAmountToReceive: BN, splitTx?: boolean, onTxConfirmed?: (txId: TransactionSignature, completedTxs: number, totalTxs: number) => void): Promise; /** * Buys a specified amount of options by a specific series ID. The trading account must be initialized before this operation. * * @public * @param {AssetType} asset - The type of the asset for the option. * @param {number} seriesId - The series ID of the option to buy. * @param {BN} optionAmount - The amount of the option to buy. * @param {BN} maxAmountToPay - The maximum amount to pay for the buy operation. * @param {boolean} splitTx - Flag indicating if sell ix should be sent separately to isolate compute units. * @param onTxConfirmed - Callback to pass txId to the consumer once resolved * @throws {Error} Throws an error if the trading account is not initialized. * * @returns {Promise} A promise that resolves to the transaction signature of the buy operation. */ export declare function buyOptionBySeriesIdImpl(this: SdxClient, asset: AssetType, seriesId: number, optionAmount: BN, maxAmountToPay: BN, splitTx?: boolean, onTxConfirmed?: (txId: TransactionSignature, completedTxs: number, totalTxs: number) => void): Promise; /** * Settles an expired position for a specific series ID. This would fail if the position is already * removed from OptionChain.euroMetaHistory, * * @public * @param {AssetType} asset - The type of the asset for the position. * @param {number} seriesId - The series ID of the position to settle. * @param {PublicKey} [tradingAccount] - The public key of the optional trading account to use for the settle operation. * If not provided, the provider's associated account will be used. * * @returns {Promise} A promise that resolves to the transaction signature of the settle operation. */ export declare function settleExpiredPositionImpl(this: SdxClient, asset: AssetType, seriesId: number, tradingAccount?: PublicKey): Promise; /** * Closes the user's trading account. This would fail if the user has any open positions, * remaining balance in token accounts, or has spent any complimentary tickets. * * @returns {Promise} A promise that resolves to the transaction signature of the settle operation. */ export declare function closeTradingAccountImpl(this: SdxClient): Promise; export declare function tradingAccountSwapImpl(this: SdxClient, fromAsset: AssetType, toAsset: AssetType, amount: BN, walletKey: string, onTxConfirmed?: (txId: TransactionSignature, completedTxs: number, totalTxs: number) => void, optionalAssetDetails?: AssetDetails): Promise; export declare function setupTradingAccountImpl(this: SdxClient): Promise; //# sourceMappingURL=tradingOperations.d.ts.map