28 lines
683 B
TypeScript
28 lines
683 B
TypeScript
/**
|
|
* USDT-only wallet capabilities for deposits and Candle Predict stakes.
|
|
*/
|
|
|
|
import { WalletType } from '../models';
|
|
|
|
export const USDT_WALLET_CODE = 'USDT_TRC20';
|
|
|
|
export type WalletTypeCapabilities = WalletType & {
|
|
depositEnabled: boolean;
|
|
predictionEnabled: boolean;
|
|
};
|
|
|
|
export function enrichWalletType(walletType: WalletType): WalletTypeCapabilities {
|
|
const enabled = walletType.code === USDT_WALLET_CODE;
|
|
return {
|
|
...walletType,
|
|
depositEnabled: enabled,
|
|
predictionEnabled: enabled,
|
|
};
|
|
}
|
|
|
|
export function assertUsdtWalletType(code: string): void {
|
|
if (code !== USDT_WALLET_CODE) {
|
|
throw new Error(`Only ${USDT_WALLET_CODE} is supported`);
|
|
}
|
|
}
|