mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-23 15:10:42 +00:00
move types and created actions
This commit is contained in:
@@ -16,11 +16,7 @@ import {
|
||||
fetchOraclePrice,
|
||||
createPerpClient,
|
||||
} from "../utils/flashUtils";
|
||||
|
||||
export interface FlashCloseTradeParams {
|
||||
token: string;
|
||||
side: "long" | "short";
|
||||
}
|
||||
import { FlashCloseTradeParams } from "../types";
|
||||
|
||||
/**
|
||||
* Closes an existing position on Flash.Trade
|
||||
@@ -64,7 +60,10 @@ export async function flashCloseTrade(
|
||||
]);
|
||||
|
||||
// Initialize pool configuration and perpClient
|
||||
const poolConfig = PoolConfig.fromIdsByName(marketData.pool, "mainnet-beta");
|
||||
const poolConfig = PoolConfig.fromIdsByName(
|
||||
marketData.pool,
|
||||
"mainnet-beta",
|
||||
);
|
||||
const perpClient = createPerpClient(agent.connection, agent.wallet);
|
||||
|
||||
// Calculate price after slippage
|
||||
|
||||
@@ -19,13 +19,7 @@ import {
|
||||
fetchOraclePrice,
|
||||
createPerpClient,
|
||||
} from "../utils/flashUtils";
|
||||
|
||||
export interface FlashTradeParams {
|
||||
token: string;
|
||||
side: "long" | "short";
|
||||
collateralUsd: number;
|
||||
leverage: number;
|
||||
}
|
||||
import { FlashTradeParams } from "../types";
|
||||
|
||||
/**
|
||||
* Opens a new position on Flash.Trade
|
||||
@@ -77,7 +71,10 @@ export async function flashOpenTrade(
|
||||
]);
|
||||
|
||||
// Initialize pool configuration and perpClient
|
||||
const poolConfig = PoolConfig.fromIdsByName(marketData.pool, "mainnet-beta");
|
||||
const poolConfig = PoolConfig.fromIdsByName(
|
||||
marketData.pool,
|
||||
"mainnet-beta",
|
||||
);
|
||||
const perpClient = createPerpClient(agent.connection, agent.wallet);
|
||||
|
||||
// Calculate position parameters
|
||||
|
||||
Reference in New Issue
Block a user