brahma-trade-widget
Version:
A React component for trade automation within the Brahma ecosystem.
179 lines (165 loc) • 3.41 kB
text/typescript
import { SupportedChainIds, TAsset } from "@/types"
import { Address } from "../shared/types"
export type MorphoTokensOptions = "usdc" | "weth"
export type Token = {
asset: TAsset | null
amount: string
}
export type DepositBuilderParams = {
amount: string
registryId: string
duration: number
chainId: SupportedChainIds
automationId: string
tokenLimits: Record<Address, string> // non decimal formatted
tokenInputs: Record<Address, string> // decimal formatted
consoleAddress: Address
feeToken: string
feeAmount: string
metadata: {
baseToken: Address
every: string
}
}
export type MorphoYieldAutomation = {
chainId: SupportedChainIds
commitHash: string
createdAt: string
duration: number
feeAmount: string
feeToken: Address
id: string
metadata: {
baseToken: string
every: string
type: string
}
registryId: string
status: number // 2 === active status
subAccountAddress: Address
tokenInputs: Record<Address, string>
tokenLimits: Record<Address, string>
}
export type MorphoYieldVaultPosition = {
assets: string
assetsUsd: number
id: string
shares: string
vaultName?: string
curator: null | { name: string; image: string; url: string }
vault: {
address: Address
asset: {
address: Address
chain: {
id: SupportedChainIds
}
decimals: number
}
id: string
symbol: string
}
}
export type MorphoYieldUserPosition = MorphoYieldAutomation & {
vaultPositionData: MorphoYieldVaultPosition | null
history: MorphoYieldAutomationLog[]
tokenData: {
asset: TAsset
amount: string
}
}
export type WhitelistedExecutorAddress = {
address: string
name: string
}
export type MorphoYieldAutomationLogResponse = {
id: string
subaccount_address: Address
chain_id: SupportedChainIds
metadata: {
req: {
to: string
data: string
value: string
chainID: SupportedChainIds
operation: number
subaccount: Address
}
taskID: string
transitionState: {
prev: {
feesAmount: string
inputAmount: string
targetVault: Address
generatedYield: string
} | null
current: {
feesAmount: "1000"
inputAmount: "7999"
targetVault: Address
generatedYield: "-1"
}
}
}
message: string
sub_id: string
createdAt: string
outputTxHash: string
}
export type MorphoYieldAutomationLog = {
id: string
name: string
asset: TAsset
amount: string
toVault: Address | null
fromVault: Address
time: string
outputTxHash: string
underlyingVault: Address
}
export type PartialChainConfig<T> = Partial<{
[K in SupportedChainIds]: T
}>
export type MorphoVault = {
id: string
name: string
address: Address
symbol: string
liquidity: {
underlying: string
}
supply: {
underlying: string
usd: number
}
metadata: {
description: string
image: string
curators?: {
name: string
image: string
url: string
}[]
} | null
asset: MorphoVaultAsset
state: {
apy: number
netApy: number
}
}
type MorphoVaultAsset = {
chain: {
id: SupportedChainIds
}
decimals: number
address: Address
image: string
symbol: string
}
export type AiResponseToDetect = {
preferredVaults: Address[]
every: number
baseToken: string
chainId: number
amount: number
}