Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/BatchReviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,11 @@ const hasTenderlyFailed = computed(() => Boolean(tenderlyUrl.value && tenderlyEr
const simulateOnTenderly = () => simulateBatchOnTenderly(preparedExecution.value ?? undefined)

const isConfirmDisabled = computed(() =>
isSpyMode.value || isExecuting.value || hasPendingDetachedExecution.value || isPreparing.value || isSimulating.value || !canExecuteBatch.value || !!prepareError.value,
isSpyMode.value || preparedExecution.value?.readOnly === true || isExecuting.value || hasPendingDetachedExecution.value || isPreparing.value || isSimulating.value || !canExecuteBatch.value || !!prepareError.value,
)
const blockedReason = computed(() => {
if (isSpyMode.value) return 'Connect a wallet to execute — disabled in spy mode'
if (preparedExecution.value?.readOnly) return 'This read-only review cannot be executed'
if (hasFailedOps.value) return 'Resolve the reverting operation to execute'
if (hasInsufficientBalance.value) return insufficientBalanceMessage.value || 'Not enough balance to execute this batch'
if (simError.value) return 'This batch would revert — resolve the flagged error'
Expand All @@ -451,7 +452,7 @@ let executionHandle: TrackedExecutionHandle | null = null
const handleExecute = async () => {
if (isConfirmDisabled.value) return
const prepared = preparedExecution.value
if (!prepared) return
if (!prepared || prepared.readOnly) return
// Latch the wallet classification at submission time; the single-slot gate
// rejects new submissions while a detached proposal is pending.
const handle = beginTrackedExecution({ safeAtSubmit: prepared.execution.requestSet.wallet.walletKind === 'safe' })
Expand Down
7 changes: 6 additions & 1 deletion components/entities/asset/AssetInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const props = withDefaults(defineProps<{
assetSelectorPlaceholder?: string
assetSelectorSelected?: boolean
selectedSource?: string // Matches CollateralOption.type (e.g. 'wallet' / 'saving' / 'vault') for the source-chip indicator
selectedOptionId?: string // Stable internal identity for otherwise identical modal rows
selectedSubAccount?: string // Disambiguates between multiple savings positions on different sub-accounts
selectedVaultAddress?: string // Disambiguates same sub-account positions across different vaults (e.g. wallet rows)
maxHandler?: () => void // When provided, replaces the default "Max" button behavior
Expand Down Expand Up @@ -81,6 +82,10 @@ const matchesSelectedVault = (a?: string, b?: string) => {
return a.toLowerCase() === b.toLowerCase()
}
const getSelectedIdx = () => {
if (props.selectedOptionId && props.collateralOptions?.length) {
const exact = props.collateralOptions.findIndex(option => option.selectionId === props.selectedOptionId)
if (exact >= 0) return exact
}
if (props.selectedSource && props.collateralOptions?.length) {
// Prefer the option that matches BOTH type and the optional disambiguators
// (sub-account for savings rows, vault address for wallet rows). Without
Expand All @@ -99,7 +104,7 @@ const getSelectedIdx = () => {
}
const selectedIdx = ref(getSelectedIdx())
watch(
[() => props.selectedSource, () => props.selectedSubAccount, () => props.selectedVaultAddress, () => props.collateralOptions],
[() => props.selectedOptionId, () => props.selectedSource, () => props.selectedSubAccount, () => props.selectedVaultAddress, () => props.collateralOptions],
() => { selectedIdx.value = getSelectedIdx() },
)
const friendlyBalance = computed(() => nanoToValue(props.balance ?? 0n, props.asset?.decimals || 18))
Expand Down
7 changes: 5 additions & 2 deletions components/entities/operation/OperationReviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface REULUnlockInfo {
daysUntilMaturity: number
}

const { type, asset, assetIconUrl, reulUnlockInfo, amount, reviewId, reviewDigest, reviewedAccount, reviewedWalletKind, reviewedRequests, reviewedSignatureSlots, externalSubmitting, plan, prepared, calldataPrepared, calldataUsesPlaceholderSignatures, calldataWrapCalls, tenderlyPrepared, tenderlyPlan, tenderlyStateOverrides, displayPlan, signatureSteps: providedSignatureSteps, postSteps, swapFromAsset, swapFromAmount, swapToAsset, swapToAmount, swapMode, swapEstimatedSide, supplyingAssetForBorrow, supplyingAmount, transferAmounts, vaultAmounts, knownAssets, swapQuoteOutputs, confirmLabel: providedConfirmLabel, submittingLabel, quoteFetchedAt, hideExecute, subAccount, marketLabel, allowConfirmWithoutPlan } = defineProps<{
const { type, asset, assetIconUrl, reulUnlockInfo, amount, reviewId, reviewDigest, reviewedAccount, reviewedWalletKind, reviewedRequests, reviewedSignatureSlots, externalSubmitting, plan, prepared, calldataPrepared, calldataUsesPlaceholderSignatures, calldataWrapCalls, tenderlyPrepared, tenderlyPlan, tenderlyStateOverrides, displayPlan, signatureSteps: providedSignatureSteps, postSteps, swapFromAsset, swapFromAmount, swapToAsset, swapToAmount, swapMode, swapEstimatedSide, supplyingAssetForBorrow, supplyingAmount, transferAmounts, vaultAmounts, knownAssets, swapQuoteOutputs, confirmLabel: providedConfirmLabel, submittingLabel, quoteFetchedAt, hideExecute, readOnly, subAccount, marketLabel, allowConfirmWithoutPlan } = defineProps<{
type?: 'supply' | 'withdraw' | 'borrow' | 'repay' | 'swap' | 'transfer' | 'refinance' | 'migration' | 'reward' | 'brevis-reward' | 'fuul-reward' | 'turtle-reward' | 'reul-unlock' | 'disableCollateral' | 'swap-supply' | 'swap-withdraw' | 'swap-borrow'
asset: VaultAsset
assetIconUrl?: string
Expand Down Expand Up @@ -86,6 +86,8 @@ const { type, asset, assetIconUrl, reulUnlockInfo, amount, reviewId, reviewDiges
quoteFetchedAt?: number | null
/** Read-only review (e.g. opened from a batch item): hides the execute button. */
hideExecute?: boolean
/** Prepared without a live wallet binding; it can be inspected but not submitted. */
readOnly?: boolean
/** Overrides the inferred Euler product name for non-product contexts, such as Earn vaults. */
marketLabel?: string
/** Allow display-step-only reviews when the executable plan needs a confirm-time wallet authorization first. */
Expand Down Expand Up @@ -414,10 +416,11 @@ const isSwapQuoteStale = computed(() => {

const permit2DisclaimerText = 'You are granting the Permit2 contract an unlimited token allowance. Permit2 is a Uniswap contract used to authorize future transfers with signatures. Each future transfer still requires your explicit signature and can be limited by amount and duration.'
const hasDisplayOnlyConfirmation = computed(() => allowConfirmWithoutPlan && (displaySteps.value.length > 0 || signatureSteps.value.length > 0))
const isConfirmDisabled = computed(() => isSpyMode.value || internalSubmitting.value || hasPendingDetachedExecution.value || isPreparingPlan.value || isResolvingStateOverrideHints.value || !!prepareError.value || (!reviewPlan.value?.length && !hasDisplayOnlyConfirmation.value))
const isConfirmDisabled = computed(() => readOnly || isSpyMode.value || internalSubmitting.value || hasPendingDetachedExecution.value || isPreparingPlan.value || isResolvingStateOverrideHints.value || !!prepareError.value || (!reviewPlan.value?.length && !hasDisplayOnlyConfirmation.value))
const isTenderlyPreparing = computed(() => isTenderlySimulating.value || isBuildingTenderlyPayload.value)
const confirmLabel = computed(() => {
if (isSpyMode.value) return 'Spy mode (read-only)'
if (readOnly) return 'Read-only review'
if (hasPendingDetachedExecution.value && !internalSubmitting.value) return 'Awaiting Safe signatures…'
if (isPreparingPlan.value || isResolvingStateOverrideHints.value) return 'Preparing...'
return internalSubmitting.value && submittingLabel ? submittingLabel : (providedConfirmLabel || btnLabel.value)
Expand Down
Loading
Loading