@shogun-sdk/money-legos
Version:
Shogun Money Legos: clients and types for quotes, memes, prices, balances, fees, validations, etc.
50 lines • 2.61 kB
TypeScript
import type { TokenBalanceResults } from '../types/index.js';
export declare const MAX_AFFILIATE_FEE_PERCENT = 5;
export declare const TURNKEY_TX_COST_USD = 0.11;
export declare class AffiliateFeeService {
/**
* Calculates minimum allowed USD value for a token to keep total fees under 5%
* @param network The blockchain network
* @param excludeAffiliateFees Whether to exclude affiliate fees from calculation
* @returns Minimum USD value required to keep fees under 5%
*/
static calculateMinAllowedUsdValue(systemFeePercent: number, chainId: number, excludeAffiliateFees: boolean, isEoaAccount: boolean | undefined, externalServiceTxCostUsd: number | undefined, isSameChainTransfer: boolean | undefined, // just transfer without swap
additionalAffiliateFee: number): number;
private static getChainFee;
/**
* Calculates the minimum required amount in token's smallest unit based on its USD price
*/
/**
* Calculates total fee percentage based on input amount and token price
*/
static calculateTotalFeePercentage(chainId: number, systemFeePercent: number, excludeAffiliateFees: boolean, amountInTokens: bigint, decimals: number, tokenUsdPrice?: number, isEoaAccount?: boolean, additionalAffiliateFee?: number): number;
static isOverMaxAffiliateFee(totalFeePercent: number): boolean;
/**
* Validates transaction size and returns total fee percentage
*/
static validateAffiliateFeeWithServiceFees: ({ systemFeePercent, additionalAffiliateFee, balances, excludeAffiliateFee, isTransfer, tokenInAddress, tokeinInDecimals, sourceNetwork, amountBigInt, errorBuilder, isEoaAccount, externalServiceTxCostUsd, }: {
systemFeePercent: number;
additionalAffiliateFee: number;
balances: TokenBalanceResults[];
excludeAffiliateFee: boolean;
isTransfer: boolean;
tokenInAddress: string;
tokeinInDecimals: number;
sourceNetwork: number;
amountBigInt: string;
errorBuilder: (network: string, tokenSymbol?: string, minAmountValue?: number, minUsdValue?: number) => string;
isEoaAccount: boolean;
externalServiceTxCostUsd: number;
}) => {
isValid: boolean;
error?: string;
totalFeePercent?: number;
};
static getAffiliateFeeTokenForQuote: (balances: TokenBalanceResults[], tokenAddress: string, sourceNetwork: number) => {
tokenUsdPrice: number;
decimals: number;
symbol: string;
tokenAddress: string;
} | undefined;
}
//# sourceMappingURL=AffiliateFeeService.d.ts.map