aftermath-ts-sdk
Version:
Aftermath TypeScript SDK
235 lines • 9.74 kB
TypeScript
import { TransactionArgument, Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
import { AftermathApi } from "../../../general/providers/aftermathApi";
import { CoinType, PerpetualsAddresses, ObjectId, SuiAddress, OracleAddresses, AnyObjectType, IFixed, Balance, ObjectVersion, PackageId } from "../../../types";
import { ApiPerpetualsDepositCollateralBody, ApiPerpetualsCreateAccountBody, PerpetualsMarketId, PerpetualsAccountId, PerpetualsOrderId, ApiPerpetualsSLTPOrderBody, PerpetualsOrderSide, PerpetualsOrderType, ApiPerpetualsCancelOrdersBody, ApiPerpetualsCancelOrderBody, ApiPerpetualsReduceOrdersBody } from "../perpetualsTypes";
import { MoveErrors, MoveErrorsInterface } from "../../../general/types/moveErrorsInterface";
export declare class PerpetualsApi implements MoveErrorsInterface {
private readonly Provider;
private static readonly constants;
readonly addresses: {
perpetuals: PerpetualsAddresses;
oracle: OracleAddresses;
};
readonly eventTypes: {
withdrewCollateral: AnyObjectType;
depositedCollateral: AnyObjectType;
settledFunding: AnyObjectType;
allocatedCollateral: AnyObjectType;
deallocatedCollateral: AnyObjectType;
liquidated: AnyObjectType;
createdAccount: AnyObjectType;
canceledOrder: AnyObjectType;
postedOrder: AnyObjectType;
postedOrderReceipt: AnyObjectType;
filledMakerOrder: AnyObjectType;
filledTakerOrder: AnyObjectType;
updatedPremiumTwap: AnyObjectType;
updatedSpreadTwap: AnyObjectType;
updatedFunding: AnyObjectType;
updatedMarketVersion: AnyObjectType;
filledTakerOrderLiquidator: AnyObjectType;
reducedOrder: AnyObjectType;
};
readonly moveErrors: MoveErrors;
constructor(Provider: AftermathApi);
depositCollateralTx: (inputs: {
tx: Transaction;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
} & ({
coinId: ObjectId | TransactionArgument;
} | {
coinBytes: Uint8Array;
})) => import("@mysten/sui/transactions").TransactionResult;
allocateCollateralTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
amount: Balance;
}) => import("@mysten/sui/transactions").TransactionResult;
deallocateCollateralTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId;
basePriceFeedId: ObjectId;
collateralPriceFeedId: ObjectId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
amount: Balance;
}) => import("@mysten/sui/transactions").TransactionResult;
createMarketPositionTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
}) => import("@mysten/sui/transactions").TransactionResult;
shareClearingHouseTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
marketId: PerpetualsMarketId | TransactionArgument;
}) => import("@mysten/sui/transactions").TransactionResult;
startSessionTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
basePriceFeedId: ObjectId;
collateralPriceFeedId: ObjectId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
}) => import("@mysten/sui/transactions").TransactionResult;
endSessionTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
sessionPotatoId: ObjectId | TransactionArgument;
}) => import("@mysten/sui/transactions").TransactionResult;
placeMarketOrderTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
sessionPotatoId: ObjectId | TransactionArgument;
side: PerpetualsOrderSide;
size: bigint;
}) => import("@mysten/sui/transactions").TransactionResult;
placeLimitOrderTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
sessionPotatoId: ObjectId | TransactionArgument;
side: PerpetualsOrderSide;
size: bigint;
price: bigint;
orderType: PerpetualsOrderType;
}) => import("@mysten/sui/transactions").TransactionResult;
cancelOrdersTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
orderIds: PerpetualsOrderId[];
}) => import("@mysten/sui/transactions").TransactionResult;
reduceOrdersTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
orderIds: PerpetualsOrderId[];
sizesToSubtract: bigint[];
}) => import("@mysten/sui/transactions").TransactionResult;
withdrawCollateralTx: (inputs: {
tx: Transaction;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
amount: Balance;
}) => TransactionObjectArgument;
createAccountTx: (inputs: {
tx: Transaction;
collateralCoinType: CoinType;
}) => import("@mysten/sui/transactions").TransactionResult;
placeSLTPOrderTx: (inputs: ApiPerpetualsSLTPOrderBody & {
tx: Transaction;
sessionPotatoId: TransactionObjectArgument;
}) => never;
getPositionTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountId: PerpetualsAccountId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
}) => import("@mysten/sui/transactions").TransactionResult;
getOrderbookTx: (inputs: {
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
marketId: PerpetualsMarketId;
}) => import("@mysten/sui/transactions").TransactionResult;
getBookPriceTx: (inputs: {
tx: Transaction;
packageId: PackageId;
marketId: PerpetualsMarketId;
collateralCoinType: CoinType;
}) => import("@mysten/sui/transactions").TransactionResult;
getBestPriceTx: (inputs: {
tx: Transaction;
packageId: PackageId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
side: PerpetualsOrderSide;
collateralCoinType: CoinType;
}) => import("@mysten/sui/transactions").TransactionResult;
inspectOrdersTx: (inputs: {
tx: Transaction;
packageId: PackageId;
orderbookId: ObjectId | TransactionArgument;
side: PerpetualsOrderSide;
fromPrice: IFixed;
toPrice: IFixed;
}) => import("@mysten/sui/transactions").TransactionResult;
getOrderSizeTx: (inputs: {
tx: Transaction;
packageId: PackageId;
orderbookId: ObjectId | TransactionArgument;
orderId: PerpetualsOrderId;
}) => import("@mysten/sui/transactions").TransactionResult;
fetchBuildDepositCollateralTx: (inputs: ApiPerpetualsDepositCollateralBody) => Promise<Transaction>;
buildCancelOrderTx: (inputs: ApiPerpetualsCancelOrderBody) => Transaction;
buildCancelOrdersTx: (inputs: ApiPerpetualsCancelOrdersBody) => Transaction;
buildWithdrawCollateralTx: (inputs: {
walletAddress: SuiAddress;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
amount: Balance;
}) => Transaction;
buildCreateAccountTx: (inputs: ApiPerpetualsCreateAccountBody) => Transaction;
fetchBuildPlaceSLTPOrderTx: (inputs: ApiPerpetualsSLTPOrderBody) => Promise<Transaction>;
buildTransferCollateralTx: (inputs: {
walletAddress: SuiAddress;
collateralCoinType: CoinType;
fromAccountCapId: ObjectId | TransactionArgument;
toAccountCapId: ObjectId | TransactionArgument;
amount: Balance;
}) => Transaction;
buildAllocateCollateralTx: (inputs: {
walletAddress: SuiAddress;
} & Omit<{
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId | TransactionArgument;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
amount: Balance;
}, "tx">) => Transaction;
buildDeallocateCollateralTx: (inputs: {
walletAddress: SuiAddress;
} & Omit<{
tx: Transaction;
packageId: PackageId;
collateralCoinType: CoinType;
accountCapId: ObjectId;
basePriceFeedId: ObjectId;
collateralPriceFeedId: ObjectId;
marketId: PerpetualsMarketId;
marketInitialSharedVersion: ObjectVersion;
amount: Balance;
}, "tx">) => Transaction;
buildReduceOrdersTx: (inputs: ApiPerpetualsReduceOrdersBody) => Transaction;
getAccountCapType: (inputs: {
collateralCoinType: CoinType;
}) => string;
private eventType;
}
//# sourceMappingURL=perpetualsApi.d.ts.map