zic-tron-sdk
Version:
An sdk for interacting with tron zebec card sdk
118 lines (117 loc) • 3.25 kB
TypeScript
import { Types } from "tronweb";
export type Transaction = Types.Transaction;
export type SignedTransaction = Types.SignedTransaction;
export type ContractAbiInterface = Types.ContractAbiInterface;
export type FunctionFragment = Types.FunctionFragment;
export type EventFragment = Types.EventFragment;
export type NoConstructorAbiFragment = Types.FunctionFragment | Types.EventFragment | Types.ErrorFragment | Types.FallbackFragment | Types.ReceiveFragment;
export type HexString = string;
export type Base58String = string;
export interface CallOptions {
feeLimit?: number;
callValue?: number;
callTokenValue?: number;
callTokenId?: number;
userFeePercentage?: number;
shouldPollResponse?: boolean;
from?: string | false;
rawParameter?: string;
_isConstant?: true;
}
export interface SendOptions {
feeLimit?: number;
callValue?: number;
shouldPollResponse?: boolean;
pollTimes?: number;
rawResponse?: boolean;
}
export type Extras = {
callValue?: number;
};
export type TransactionInfo = Types.TransactionInfo;
export type TransactionInfoDecoded = TransactionInfo & {
decodedContractResult: any[];
};
export type TransactionResult = TransactionInfo | TransactionInfoDecoded | {
id: string;
};
/**
* Zebec Instant Card configs
*/
export type CardConfig = {
nativeFeePercent: string;
nonNativeFeePercent: string;
revenueFeePercent: string;
totalCardSold: bigint;
cardVault: string;
revenueVault: string;
usdcAddress: string;
minCardAmount: string;
maxCardAmount: string;
dailyCardPurchaseLimit: string;
};
export type FeeTier = {
minRange: string;
maxRange: string;
fee: string;
};
export type FeeTiers = FeeTier[];
export type CardPurchaseOfDay = {
totalCardPurchased: string;
cardPurchasedTimestamp: number;
};
export type QuoteInfo = {
amountIn: string;
amountOut: string;
inUsd: string;
outUsd: string;
impact: string;
fee: string;
tokens: Base58String[];
symbols: string[];
poolFees: string[];
poolVersions: string[];
stepAmountsOut: string[];
};
export type QuoteInfoWithVersionLen = QuoteInfo & {
versionLen: number[];
};
export type SwapData = QuoteInfoWithVersionLen & {
slippagePercent: number;
};
/**
* Contract type used in wallet adapter
*/
export type WalletAdapterContract = {
parameter: {
type_url: string;
value: Record<string, unknown>;
};
type: string;
};
/**
* Transaction type used in wallet adapter
*/
export type WalletAdapterTransaction = {
visible: boolean;
txID: string;
raw_data: {
contract: WalletAdapterContract[];
ref_block_bytes: string;
ref_block_hash: string;
expiration: number;
fee_limit: number;
timestamp: number;
data?: unknown;
};
raw_data_hex: string;
signature?: string[];
[key: string]: unknown;
};
/**
* SignedTransaction type used in wallet adapeter
*/
export type WalletAdapterSignedTransaction = WalletAdapterTransaction & {
signature: string[];
};
export type WalletAdapterSignTransactionFunc = (transaction: WalletAdapterTransaction, privateKey?: string) => Promise<WalletAdapterSignedTransaction>;