File tree Expand file tree Collapse file tree 9 files changed +38
-23
lines changed Expand file tree Collapse file tree 9 files changed +38
-23
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222 WidgetState ,
2323 Placement ,
2424 ObligatedToken ,
25+ SuccessDetails ,
2526} from "./src/types" ;
2627
2728type WidgetProps = WidgetComponentProps & {
@@ -170,4 +171,5 @@ export type {
170171 Placement ,
171172 ObligatedToken ,
172173 SystemConfig ,
174+ SuccessDetails ,
173175} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @ensofinance/shortcuts-widget" ,
3- "version" : " 1.0.54 " ,
3+ "version" : " 1.0.60 " ,
44 "type" : " module" ,
55 "homepage" : " https://www.enso.build/" ,
66 "repository" : {
Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ import {
1010import { ChevronsRight } from "lucide-react" ;
1111import { type Address , isAddress } from "viem" ;
1212import { type RouteData } from "@ensofinance/sdk" ;
13- import { type Token , useTokenFromList } from "@/util/common" ;
13+ import { useTokenFromList } from "@/util/common" ;
1414import { useEnsoToken } from "@/util/enso" ;
1515import { TokenIcon } from "@/components/TokenIndicator" ;
16+ import { Token } from "@/types" ;
1617
1718const TokenBadge = ( {
1819 address,
Original file line number Diff line number Diff line change 11import { Box , Flex , Text } from "@chakra-ui/react" ;
2- import { type Token } from "@/util/common" ;
32import {
43 MOCK_IMAGE_URL ,
54 SupportedChainId ,
65 STARGATE_CHAIN_NAMES ,
76} from "@/constants" ;
87import { formatCompactUsd } from "@/util" ;
8+ import { Token } from "@/types" ;
99
1010const GECKO_HOSTNAME = "coingecko" ;
1111
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
1111import { useMemo } from "react" ;
1212import { Address , isAddress } from "viem" ;
1313import { FixedSizeList as List } from "react-window" ;
14- import { Token , useCurrentChainList } from "@/util/common" ;
14+ import { useCurrentChainList } from "@/util/common" ;
1515import { formatNumber , normalizeValue } from "@/util" ;
1616import { useEnsoBalances , useEnsoToken } from "@/util/enso" ;
1717import { SupportedChainId } from "@/constants" ;
@@ -25,7 +25,7 @@ import {
2525import { TokenIndicator } from "@/components/TokenIndicator" ;
2626import ChainSelector from "./ChainSelector" ;
2727import ProjectSelector from "./ProjectSelector" ;
28- import { ProjectFilter } from "@/types" ;
28+ import { ProjectFilter , Token } from "@/types" ;
2929
3030type TokenWithBalance = Token & {
3131 balance ?: string ;
Original file line number Diff line number Diff line change 11import { Address } from "viem" ;
2- import { Token } from "@/util/common " ;
2+ import { Token } from "@/types " ;
33
44export const ERROR_MSG =
55 "Swap not found for a required underlying of defi route, please make sure your amount is within an acceptable range" ;
Original file line number Diff line number Diff line change 1+ import { RouteData } from "@ensofinance/sdk" ;
12import { Address } from "viem" ;
23
4+ export type Token = {
5+ address : Address ;
6+ name : string ;
7+ symbol : string ;
8+ decimals : number ;
9+ logoURI : string ;
10+ underlyingTokens ?: Token [ ] ;
11+ type ?: string ;
12+ apy ?: number ;
13+ tvl ?: number ;
14+ } ;
15+
16+ export type SuccessDetails = {
17+ amountIn : string ;
18+ tokenIn : Token ;
19+ tokenOut : Token ;
20+ slippage : number ;
21+ routerData : RouteData ;
22+ } ;
23+
324export type Placement =
425 | "top-start"
526 | "top"
@@ -22,7 +43,7 @@ export type ProjectFilter = {
2243} ;
2344
2445export type WidgetComponentProps = {
25- onSuccess ?: ( hash : string , details ?: any ) => void ;
46+ onSuccess ?: ( hash : string , details ?: SuccessDetails ) => void ;
2647 adaptive ?: boolean ;
2748 tokenOut ?: Address ;
2849 tokenIn ?: Address ;
Original file line number Diff line number Diff line change @@ -9,18 +9,7 @@ import {
99 SupportedChainId ,
1010} from "@/constants" ;
1111import { useStore } from "@/store" ;
12-
13- export type Token = {
14- address : Address ;
15- name : string ;
16- symbol : string ;
17- decimals : number ;
18- logoURI : string ;
19- underlyingTokens ?: Token [ ] ;
20- type ?: string ;
21- apy ?: number ;
22- tvl ?: number ;
23- } ;
12+ import { Token } from "@/types" ;
2413
2514export const compareCaseInsensitive = ( a : string , b : string ) => {
2615 return ! ! ( a && b && a ?. toLowerCase ( ) === b ?. toLowerCase ( ) ) ;
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ import {
77 type BundleAction ,
88 type BundleParams ,
99 BundleActionType ,
10+ type RouteData ,
1011} from "@ensofinance/sdk" ;
1112import { type Address , isAddress } from "viem" ;
1213import {
13- type Token ,
1414 usePriorityChainId ,
1515 useOutChainId ,
1616 useTokenFromList ,
@@ -25,6 +25,7 @@ import {
2525} from "@/constants" ;
2626import { formatNumber , normalizeValue } from "." ;
2727import { useTxTracker } from "./useTracker" ;
28+ import { SuccessDetails , Token } from "@/types" ;
2829
2930let ensoClient : EnsoClient | null = null ;
3031
@@ -322,7 +323,7 @@ export const useEnsoData = (
322323 tokenOut : Address ,
323324 slippage : number ,
324325 referralCode ?: string ,
325- onSuccess ?: ( hash : string , details ?: any ) => void
326+ onSuccess ?: ( hash : string , details ?: SuccessDetails ) => void
326327) => {
327328 const { address = VITALIK_ADDRESS } = useAccount ( ) ;
328329 const chainId = usePriorityChainId ( ) ;
@@ -386,8 +387,9 @@ export const useEnsoData = (
386387 } ) ;
387388
388389 const details = {
389- tokenIn : tokenToData ,
390- tokenOut : tokenFromData ,
390+ amountIn,
391+ tokenIn : tokenFromData ,
392+ tokenOut : tokenToData ,
391393 slippage,
392394 routerData : routerData . data ,
393395 } ;
You can’t perform that action at this time.
0 commit comments