Skip to content

Commit 47c69f9

Browse files
authored
Remove Defender Deploy modal (#588)
1 parent d743b83 commit 47c69f9

File tree

7 files changed

+2
-246
lines changed

7 files changed

+2
-246
lines changed

packages/ui/src/common/icons/ArrowsLeft.svelte

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/ui/src/common/icons/ArrowsRight.svelte

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/ui/src/common/post-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type DownloadAction =
1313
| 'download-scaffold'
1414
| 'download-rust-stellar';
1515

16-
export type Action = 'copy' | 'remix' | DownloadAction | 'defender';
16+
export type Action = 'copy' | 'remix' | DownloadAction;
1717

1818
export async function postConfig(opts: Partial<LanguagesOptions>, action: Action, language: Language) {
1919
window.gtag?.('event', 'wizard_action', { ...opts, action, wizard_lang: language });
Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import type { SolcInputSources } from '@openzeppelin/wizard/get-imports';
2-
3-
export type Message = ResizeMessage | TabChangeMessage | UnsupportedVersionMessage | DefenderDeployMessage;
1+
export type Message = ResizeMessage | TabChangeMessage | UnsupportedVersionMessage;
42

53
export interface ResizeMessage {
64
kind: 'oz-wizard-resize';
@@ -16,29 +14,8 @@ export interface UnsupportedVersionMessage {
1614
kind: 'oz-wizard-unsupported-version';
1715
}
1816

19-
export interface DefenderDeployMessage {
20-
kind: 'oz-wizard-defender-deploy';
21-
sources: SolcInputSources;
22-
enforceDeterministicReason?: string;
23-
groupNetworksBy?: 'superchain';
24-
}
25-
2617
export function postMessage(msg: Message) {
2718
if (parent) {
2819
parent.postMessage(msg, '*');
2920
}
3021
}
31-
32-
export function postMessageToIframe(id: 'defender-deploy', msg: Message) {
33-
const iframe: HTMLIFrameElement | null = document.getElementById(id) as HTMLIFrameElement;
34-
if (iframe) {
35-
iframe.contentWindow?.postMessage(msg, '*');
36-
// in case the iframe is still loading, waits
37-
// a second to fully load and tries again
38-
iframe.onload = () => {
39-
setTimeout(() => {
40-
iframe?.contentWindow?.postMessage(msg, '*');
41-
}, 1000);
42-
};
43-
}
44-
}

packages/ui/src/solidity/App.svelte

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
import DownloadIcon from '../common/icons/DownloadIcon.svelte';
1818
import ZipIcon from '../common/icons/ZipIcon.svelte';
1919
import FileIcon from '../common/icons/FileIcon.svelte';
20-
import ArrowsLeft from '../common/icons/ArrowsLeft.svelte';
21-
import ArrowsRight from '../common/icons/ArrowsRight.svelte';
2220
import Dropdown from '../common/Dropdown.svelte';
2321
import OverflowMenu from '../common/OverflowMenu.svelte';
2422
import Tooltip from '../common/Tooltip.svelte';
25-
import DefenderDeployModal from './DefenderDeployModal.svelte';
2623
2724
import type { KindedOptions, Kind, Contract, OptionsErrorMessages } from '@openzeppelin/wizard';
2825
import { ContractBuilder, buildGeneric, printContract, sanitizeKind, OptionsError } from '@openzeppelin/wizard';
@@ -33,7 +30,6 @@
3330
import { saveAs } from 'file-saver';
3431
import { injectHyperlinks } from './inject-hyperlinks';
3532
import type { InitialOptions } from '../common/initial-options';
36-
import { postMessageToIframe } from '../common/post-message';
3733
import type { AiFunctionCall } from '../../api/ai-assistant/types/assistant';
3834
import ErrorDisabledActionButtons from '../common/ErrorDisabledActionButtons.svelte';
3935
import { createWiz, mergeAiAssistanceOptions } from '../common/Wiz.svelte';
@@ -60,8 +56,6 @@
6056
export let initialOpts: InitialOptions = {};
6157
let initialValuesSet = false;
6258
63-
let showDeployModal = false;
64-
6559
let allOpts: { [k in Kind]?: Required<KindedOptions[k]> } = {};
6660
let errors: { [k in Kind]?: OptionsErrorMessages } = {};
6761
@@ -108,29 +102,6 @@
108102
$: highlightedCode = injectHyperlinks(hljs.highlight('solidity', code).value);
109103
110104
$: hasErrors = errors[tab] !== undefined;
111-
$: showDeployModal = !hasErrors && showDeployModal;
112-
113-
$: if (showDeployModal) {
114-
let enforceDeterministicReason: string | undefined;
115-
let groupNetworksBy: 'superchain' | undefined;
116-
117-
const isSuperchainERC20 =
118-
opts !== undefined &&
119-
(opts.kind === 'ERC20' || opts.kind === 'Stablecoin' || opts.kind === 'RealWorldAsset') &&
120-
opts.crossChainBridging === 'superchain';
121-
if (isSuperchainERC20) {
122-
enforceDeterministicReason =
123-
'SuperchainERC20 requires deploying your contract to the same address on every chain in the Superchain.';
124-
groupNetworksBy = 'superchain';
125-
}
126-
127-
postMessageToIframe('defender-deploy', {
128-
kind: 'oz-wizard-defender-deploy',
129-
sources: getSolcSources(contract),
130-
enforceDeterministicReason,
131-
groupNetworksBy,
132-
});
133-
}
134105
135106
$: showButtons = getButtonVisibilities(opts);
136107
@@ -376,123 +347,18 @@
376347
</div>
377348

378349
<div class="output rounded-r-3xl flex flex-col grow overflow-auto h-[calc(100vh-84px)] relative">
379-
{#if !hasErrors}
380-
<div class="absolute p-px right-6 rounded-full top-4 z-10 {showDeployModal ? 'hide-deploy' : ''}">
381-
<button
382-
class="text-sm border-solid border p-2 pr-4 rounded-full cursor-pointer flex items-center gap-2 transition-all pl-2 bg-white border-white"
383-
on:click={() => (showDeployModal = !showDeployModal)}
384-
>
385-
<ArrowsRight />
386-
</button>
387-
</div>
388-
<div class="button-bg absolute p-px right-4 rounded-full top-4 z-10">
389-
<button
390-
class="text-sm border-solid border p-2 pr-4 rounded-full cursor-pointer flex items-center gap-2 transition-all pl-4 bg-indigo-600 border-indigo-600 text-white"
391-
on:click={async () => {
392-
if (opts) {
393-
await postConfig(opts, 'defender', language);
394-
}
395-
showDeployModal = !showDeployModal;
396-
}}
397-
>
398-
<ArrowsLeft /> Deploy
399-
</button>
400-
</div>
401-
{/if}
402350
<pre class="flex flex-col grow basis-0 overflow-auto">
403351
{#if showCode}
404352
<code class="hljs -solidity grow overflow-auto p-4 {hasErrors ? 'no-select' : ''}"
405353
>{@html highlightedCode}</code
406354
>
407355
{/if}
408356
</pre>
409-
<DefenderDeployModal isOpen={showDeployModal} />
410357
</div>
411358
</div>
412359
</div>
413360

414361
<style lang="postcss">
415-
/* deploy with defender button border animation start*/
416-
@property --angle {
417-
syntax: '<angle>';
418-
inherits: false;
419-
initial-value: 40deg;
420-
}
421-
@property --spread {
422-
syntax: '<angle>';
423-
inherits: false;
424-
initial-value: 0deg;
425-
}
426-
@property --x {
427-
syntax: '<length>';
428-
inherits: false;
429-
initial-value: 0px;
430-
}
431-
@property --y {
432-
syntax: '<length>';
433-
inherits: false;
434-
initial-value: 0px;
435-
}
436-
@property --blur {
437-
syntax: '<length>';
438-
inherits: false;
439-
initial-value: 0px;
440-
}
441-
@keyframes conic-effect {
442-
0% {
443-
--angle: 40deg;
444-
--spread: 0deg;
445-
--x: 0px;
446-
--y: 0px;
447-
--blur: 0px;
448-
}
449-
10% {
450-
--x: 2px;
451-
--y: -2px;
452-
}
453-
20% {
454-
--blur: 15px;
455-
--spread: 80deg;
456-
}
457-
458-
30% {
459-
--x: -2px;
460-
--y: -2px;
461-
}
462-
40% {
463-
--angle: 320deg;
464-
--spread: 00deg;
465-
--x: 0px;
466-
--y: 0px;
467-
--blur: 0px;
468-
}
469-
100% {
470-
--angle: 320deg;
471-
--spread: 0deg;
472-
--x: 0px;
473-
--y: 0px;
474-
--blur: 0px;
475-
}
476-
}
477-
478-
.no-select {
479-
user-select: none;
480-
}
481-
482-
.button-bg {
483-
animation: conic-effect 12s ease-in-out infinite;
484-
animation-delay: 4.2s;
485-
background: conic-gradient(
486-
#4f46e5 calc(var(--angle) - var(--spread)),
487-
#7e7ada var(--angle),
488-
rgb(79, 70, 229) calc(var(--angle) + var(--spread))
489-
);
490-
box-shadow: var(--x) var(--y) var(--blur) #9793da45;
491-
display: inline-flex;
492-
transition: transform 300ms;
493-
}
494-
/* end deploy with defender button border animation */
495-
496362
.button-bg:hover {
497363
transform: translateX(-2px);
498364
transition: transform 300ms;

packages/ui/src/solidity/DefenderDeployModal.svelte

Lines changed: 0 additions & 46 deletions
This file was deleted.

packages/ui/src/standalone.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,6 @@ footer a:focus {
171171
text-decoration: underline;
172172
}
173173

174-
@media screen and (max-width: 768px) {
175-
.defender {
176-
margin-left: 1rem;
177-
margin-right: 1rem;
178-
padding: 3rem;
179-
text-align: left;
180-
}
181-
.defender a {
182-
margin: 0 auto 0 0;
183-
width: max-content;
184-
}
185-
}
186-
187174
/* To reset HubSpot Popup Banner's default animation effect */
188175
body .leadinModal.leadinModal-theme-top {
189176
top: auto;

0 commit comments

Comments
 (0)