diff --git a/packages/front-end/src/assets/CardTab.svg b/packages/front-end/src/assets/CardTab.svg index 7cca3e4f7..75e327cde 100644 --- a/packages/front-end/src/assets/CardTab.svg +++ b/packages/front-end/src/assets/CardTab.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/packages/front-end/src/components/LPStats.tsx b/packages/front-end/src/components/LPStats.tsx index ada05d79f..69f006e47 100644 --- a/packages/front-end/src/components/LPStats.tsx +++ b/packages/front-end/src/components/LPStats.tsx @@ -94,19 +94,21 @@ export const LPStats = () => { )} - + {depositedCollateral && ( + + )} ); }; diff --git a/packages/front-end/src/components/OTC/OTCPageContent.tsx b/packages/front-end/src/components/OTC/OTCPageContent.tsx index 8775f03c7..bbefce991 100644 --- a/packages/front-end/src/components/OTC/OTCPageContent.tsx +++ b/packages/front-end/src/components/OTC/OTCPageContent.tsx @@ -28,6 +28,7 @@ export const OTCPageContent = () => { const [orderId, setOrderId] = useState(null); const [order, setOrder] = useState(null); + const [isBuyer, setIsBuyer] = useState(false); const [optionSeriesContract, setOptionContract] = useState(null); @@ -163,12 +164,12 @@ export const OTCPageContent = () => { ]); useEffect(() => { - if (account && order) { - if (account.toLowerCase() !== order.buyer.toLowerCase()) { - setError(`❌ Please connect with account ${order.buyer}`); - } + if (account && (order || strangle)) { + // NOTE: this presumes buyer of call/put in strangle is same + const buyerAddress = order?.buyer ?? strangle?.call.buyer; + setIsBuyer(account.toLowerCase() === buyerAddress?.toLowerCase()); } - }, [account, order]); + }, [account, order, strangle]); // Regular order handlers const handleApprove = useCallback(async () => { @@ -512,48 +513,50 @@ export const OTCPageContent = () => { -
- - -
+ {isBuyer && ( +
+ + +
+ )} ) : (
diff --git a/packages/front-end/src/components/VaultTrades.tsx b/packages/front-end/src/components/VaultTrades.tsx index 78307b1b2..aa4174180 100644 --- a/packages/front-end/src/components/VaultTrades.tsx +++ b/packages/front-end/src/components/VaultTrades.tsx @@ -68,7 +68,7 @@ export const VaultTrades = () => { ? CHAINID.ARBITRUM_RINKEBY : CHAINID.ARBITRUM_MAINNET; - const { fetchMore, data, loading } = useQuery( + const { fetchMore, data, loading, error } = useQuery( gql` query ($timestamp1: Int, $timestamp2: Int) { writeOptionsActions( @@ -160,11 +160,9 @@ export const VaultTrades = () => { } }, [isVisible]); - console.log("trades length:", trades.length); - return (
- + @@ -394,6 +392,11 @@ export const VaultTrades = () => { )}
+ {error && ( +
+

{error.message.slice(0, 100)}

+
+ )}
); diff --git a/packages/front-end/src/components/dashboard/UserOptionsList.tsx b/packages/front-end/src/components/dashboard/UserOptionsList.tsx index 746b74984..7a723e91c 100644 --- a/packages/front-end/src/components/dashboard/UserOptionsList.tsx +++ b/packages/front-end/src/components/dashboard/UserOptionsList.tsx @@ -115,42 +115,46 @@ export const UserOptionsList = () => { // TODO: Add typings here useQuery( gql` - query($account: String) { - positions(first: 1000, where: { account_contains: "${account?.toLowerCase()}" }) { - id - amount - oToken { - id - symbol - expiryTimestamp - strikePrice - isPut - underlyingAsset { - id - } - } - writeOptionsTransactions { + query ($account: String) { + positions(first: 1000, where: { account_contains: $account }) { id amount - premium - timestamp - } - account { - balances { - balance - token { + oToken { + id + symbol + expiryTimestamp + strikePrice + isPut + underlyingAsset { id } } + writeOptionsTransactions { + id + amount + premium + timestamp + } + account { + balances { + balance + token { + id + } + } + } } } - } - `, + `, { onCompleted: parsePositions, onError: (err) => { console.log(err); }, + variables: { + account: account?.toLowerCase(), + }, + skip: !account, } ); diff --git a/packages/front-end/src/components/vault/VaultContent.tsx b/packages/front-end/src/components/vault/VaultContent.tsx index fcbcc6a6d..8175014ef 100644 --- a/packages/front-end/src/components/vault/VaultContent.tsx +++ b/packages/front-end/src/components/vault/VaultContent.tsx @@ -55,7 +55,7 @@ export const VaultContent = () => { return ( <> -
+
{envChainID && (