@mean-dao/ddca
Version:
Typescript library to interact with the Decentralized DCA program
86 lines (85 loc) • 2.19 kB
TypeScript
import { AccountMeta, PublicKey } from '@solana/web3.js';
export declare const SOL_MINT: PublicKey;
export declare const SOL_MINT_DECIMALS = 9;
export declare const MAX_FEE_PER_SWAP_IN_LAMPORTS: number;
export interface DdcaAccount {
ddcaAccountAddress: string;
fromMint: string;
toMint: string;
totalDepositsAmount: number;
startTs: number;
createdSlot: number;
amountPerSwap: number;
intervalInSeconds: number;
wakeAccountAddress: string;
startUtc: string;
lastCompletedSwapTs?: number;
lastCompletedSwapUtc: string;
isPaused: boolean;
}
export interface DdcaDetails extends DdcaAccount {
fromBalance: number;
toBalance: number;
fromBalanceWillRunOutByUtc: string;
nextScheduledSwapUtc: string;
swapCount: number;
swapAvgRate: number;
lastDepositTs?: number;
lastDepositSlot: number;
lastDepositedtUtc: string;
}
/**
* DDCA Instructions types
*/
export declare enum DDCA_ACTIONS {
create = 1,
addFunds = 2,
withdraw = 3,
close = 4
}
/**
* Transaction fees
*/
export declare type TransactionFees = {
maxBlockchainFee: number;
totalScheduledSwapsFees: number;
flatFee: number;
percentFee: number;
maxFeePerSwap: number;
};
/**
* Transaction fees parameters
*/
export declare type TransactionFeesParams = {
instruction: DDCA_ACTIONS;
swapsCount: number;
signaturesAmount: number;
};
export declare type HlaInfo = {
exchangeRate: number;
protocolFees: number;
aggregatorPercentFees: number;
remainingAccounts: AccountMeta[];
};
export declare type DdcaAction = 'exchanged' | 'deposited' | 'withdrew' | 'unknown';
/**
* DDCA activity
*/
export declare type DdcaActivity = {
succeeded: boolean;
transactionSignature: string;
action: DdcaAction;
fromMint: string | null;
fromAmount: number | null;
toMint: string | null;
toAmount: number | null;
networkFeeInLamports?: number;
dateUtc: string;
};
export declare const tempoHeaders: Headers;
export declare type CrankAccount = {
crankAddress: string;
};
export declare type UpdateTransactionResponse = {
base64CloseTransaction: string;
};