tronsave-sdk
Version:
TypeScript SDK for Tronsave API to manage TRON blockchain resources
85 lines (84 loc) • 2.43 kB
TypeScript
import { ResourceType } from "./common";
type DelegateSmartMatchingInfo = {
refundAmount: number;
};
type DelegateExtendInfo = {
extraAmount: number;
extendAmount: number;
extendDuration: number;
buyAmountDuration: number;
extendPrice: number;
extraBuyPrice: number;
extendTo: number;
oldDelegatedResourceInSun: number;
oldExpiredAt: number;
};
/**
* Smart matching type
* @param autoBuyMoreMaximumDurationPercent - Auto buy more maximum duration percent
* @param totalSmartMatchingOrderCount - Total smart matching order count
* @param totalSmartMatchingOrderAmount - Total smart matching order amount
* @param totalRefundSmartMatchingAmount - Total refund smart matching amount
*/
type SmartMatching = {
autoBuyMoreMaximumDurationPercent: number;
totalSmartMatchingOrderCount: number;
totalSmartMatchingOrderAmount: number;
totalRefundSmartMatchingAmount: number;
};
/**
* Delegate type
* @param delegator - Delegator address
* @param amount - Amount
* @param txid - Transaction id
*/
type DelegateType = {
delegator: string;
amount: number;
txid: string;
extendInfo?: DelegateExtendInfo;
smartMatchingInfo?: DelegateSmartMatchingInfo;
};
type OrderType = "NORMAL" | "FAST" | "EXTEND";
/**
* Order
* @param id - Order id
* @param requester - Requester buy resource address
* @param receiver - Receiver resource address
* @param resourceAmount - Resource amount
* @param resourceType - "ENERGY" | "BANDWIDTH" - {@link ResourceType}
* @param remainAmount - Remain amount
* @param price - Price
* @param durationSec - Duration
* @param orderType - "NORMAL" | "FAST" | "EXTEND" - {@link OrderType}
* @param allowPartialFill - Allow partial fill
* @param payoutAmount - Payout amount
* @param fulfilledPercent - Fulfilled percent
*/
export type Order = {
id: string;
requester: string;
receiver: string;
resourceAmount: number;
resourceType: ResourceType;
remainAmount: number;
price: number;
durationSec: number;
orderType: OrderType;
allowPartialFill: boolean;
payoutAmount: number;
fulfilledPercent: number;
smartMatching?: SmartMatching;
delegates: DelegateType[];
};
export type OrderResponse = Order;
/**
* Orders response
* @param total - Total orders
* @param orders - Orders
*/
export type OrdersResponse = {
total: number;
orders: Order[];
};
export {};