whales-pre-market-aptos-sdk
Version:
TypeScript SDK for Whales Pre-Market on Aptos blockchain
112 lines (111 loc) • 5.26 kB
TypeScript
import { Aptos, type AccountAddressInput, type AptosSettings, type AnyRawTransaction } from "@aptos-labs/ts-sdk";
import type { Role, SettleDiscount, OfferType, ConfigData, TokenConfigData, OfferData, OrderData } from "./type";
import { EventCrawler } from "./eventCrawler";
import { InputTransactionData } from "@aptos-labs/wallet-adapter-react";
import { GraphQLConfig } from "./graphqlClient";
export declare class PreMarketAptos {
aptos: Aptos;
packageId: string;
eventCrawler: EventCrawler;
constructor(aptosConfig?: AptosSettings, graphQlConfig?: GraphQLConfig);
getConfig(): Promise<ConfigData>;
getTokenConfig(tokenConfigId: AccountAddressInput): Promise<TokenConfigData>;
getOffer(offerId: AccountAddressInput): Promise<OfferData>;
getOrder(orderId: AccountAddressInput): Promise<OrderData>;
getRole(user: AccountAddressInput): Promise<Role>;
isTokenAccepted(token: AccountAddressInput): Promise<boolean>;
buildUpdateConfig(owner: AccountAddressInput, params: {
discountVerifierPubkey?: Uint8Array;
pledgeRate?: number;
feeSettle?: number;
feeRefund?: number;
feeWallet?: AccountAddressInput;
}): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildMigrate(owner: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildAddRole(admin: AccountAddressInput, user: AccountAddressInput, role: Role): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildRemoveRole(admin: AccountAddressInput, user: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildAcceptExToken(operator: AccountAddressInput, token: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildRemoveExToken(operator: AccountAddressInput, token: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildCreateToken(admin: AccountAddressInput, tokenIndex: number, settleDuration: number): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildTokenToSettlePhase(operator: AccountAddressInput, tokenConfig: AccountAddressInput, token: AccountAddressInput, settleRate: number): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildUpdateSettleDuration(operator: AccountAddressInput, tokenConfig: AccountAddressInput, newDuration: number): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildTokenForceCancelSettlePhase(admin: AccountAddressInput, tokenConfig: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildCancelToken(admin: AccountAddressInput, tokenConfig: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildToggleTokenStatus(admin: AccountAddressInput, tokenConfig: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildForceCancelOrder(operator: AccountAddressInput, order: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildForceCancelOrders(operator: AccountAddressInput, orderList: AccountAddressInput[]): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildCreateOffer(sender: AccountAddressInput, tokenConfig: AccountAddressInput, exToken: AccountAddressInput, offerType: OfferType, amount: number | bigint, value: number | bigint, fullMatch: boolean): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildFillOffer(sender: AccountAddressInput, offer: AccountAddressInput, amount: number | bigint): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildCancelOffer(sender: AccountAddressInput, offer: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildCancelOfferWithDiscount(sender: AccountAddressInput, offer: AccountAddressInput, discount: SettleDiscount): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildSettleFilled(sender: AccountAddressInput, order: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildSettleFilledWithDiscount(sender: AccountAddressInput, order: AccountAddressInput, discount: SettleDiscount): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildSettleCancelled(sender: AccountAddressInput, order: AccountAddressInput): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
buildSettleCancelledWithDiscount(sender: AccountAddressInput, order: AccountAddressInput, discount: SettleDiscount): Promise<{
rawTx: AnyRawTransaction;
txData: InputTransactionData;
}>;
}