UNPKG

brahma-trade-widget

Version:

A React component for trade automation within the Brahma ecosystem.

71 lines (62 loc) 1.48 kB
import { Hex } from "viem" import { Address, AutomationSubscription } from "brahma-console-kit" import { SupportedChainIds, TAsset } from "@/types" // types.ts export enum SwapAgentTab { NEW_AGENT = "new_agent", ACTIVE = "active", HISTORY = "history", } export type NewSwapAgentStep = | "SELECT_AGENT" | "LOADING_SELECT_AGENT_ANIMATION" | "ONE" | "TWO" | "THREE" | "FOUR" | "RUNNING" export type AutomationAgent = "SURGE" | "PURGE" export type AutomationAgentData = { primaryToken: TAsset | null secondaryToken: TAsset | null amount: string duration: number slippage: string tradeSizeAmount: number selectedSlippage: "AUTO" | "CUSTOM" } export type AutomationsAgentData = Record<AutomationAgent, AutomationAgentData> export type AutomationAgentMetadata = { buyToken: string chainId: SupportedChainIds every: string limitMarketCap: number limitThresholdPrice: number orderType: "BUY" | "SELL" // surge - BUY, purge - SELL perIterationAmountMax: string perIterationAmountMin: string sellToken: string ownerAddress: string totalAmountIn: string duration: string consoleAddress: string } export type AutomationAgentSubscription = Omit< AutomationSubscription, "metadata" > & { metadata: AutomationAgentMetadata } export type Trade = { txnHash: Hex date: string tokenInData: { asset: TAsset amount: string } tokenOutData: { asset: TAsset amount: string } sentToWalletAmount: string }