|
17 | 17 | import DownloadIcon from '../common/icons/DownloadIcon.svelte';
|
18 | 18 | import ZipIcon from '../common/icons/ZipIcon.svelte';
|
19 | 19 | import FileIcon from '../common/icons/FileIcon.svelte';
|
20 |
| - import ArrowsLeft from '../common/icons/ArrowsLeft.svelte'; |
21 |
| - import ArrowsRight from '../common/icons/ArrowsRight.svelte'; |
22 | 20 | import Dropdown from '../common/Dropdown.svelte';
|
23 | 21 | import OverflowMenu from '../common/OverflowMenu.svelte';
|
24 | 22 | import Tooltip from '../common/Tooltip.svelte';
|
25 |
| - import DefenderDeployModal from './DefenderDeployModal.svelte'; |
26 | 23 |
|
27 | 24 | import type { KindedOptions, Kind, Contract, OptionsErrorMessages } from '@openzeppelin/wizard';
|
28 | 25 | import { ContractBuilder, buildGeneric, printContract, sanitizeKind, OptionsError } from '@openzeppelin/wizard';
|
|
33 | 30 | import { saveAs } from 'file-saver';
|
34 | 31 | import { injectHyperlinks } from './inject-hyperlinks';
|
35 | 32 | import type { InitialOptions } from '../common/initial-options';
|
36 |
| - import { postMessageToIframe } from '../common/post-message'; |
37 | 33 | import type { AiFunctionCall } from '../../api/ai-assistant/types/assistant';
|
38 | 34 | import ErrorDisabledActionButtons from '../common/ErrorDisabledActionButtons.svelte';
|
39 | 35 | import { createWiz, mergeAiAssistanceOptions } from '../common/Wiz.svelte';
|
|
60 | 56 | export let initialOpts: InitialOptions = {};
|
61 | 57 | let initialValuesSet = false;
|
62 | 58 |
|
63 |
| - let showDeployModal = false; |
64 |
| -
|
65 | 59 | let allOpts: { [k in Kind]?: Required<KindedOptions[k]> } = {};
|
66 | 60 | let errors: { [k in Kind]?: OptionsErrorMessages } = {};
|
67 | 61 |
|
|
108 | 102 | $: highlightedCode = injectHyperlinks(hljs.highlight('solidity', code).value);
|
109 | 103 |
|
110 | 104 | $: 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 |
| - } |
134 | 105 |
|
135 | 106 | $: showButtons = getButtonVisibilities(opts);
|
136 | 107 |
|
|
376 | 347 | </div>
|
377 | 348 |
|
378 | 349 | <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} |
402 | 350 | <pre class="flex flex-col grow basis-0 overflow-auto">
|
403 | 351 | {#if showCode}
|
404 | 352 | <code class="hljs -solidity grow overflow-auto p-4 {hasErrors ? 'no-select' : ''}"
|
405 | 353 | >{@html highlightedCode}</code
|
406 | 354 | >
|
407 | 355 | {/if}
|
408 | 356 | </pre>
|
409 |
| - <DefenderDeployModal isOpen={showDeployModal} /> |
410 | 357 | </div>
|
411 | 358 | </div>
|
412 | 359 | </div>
|
413 | 360 |
|
414 | 361 | <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 |
| -
|
496 | 362 | .button-bg:hover {
|
497 | 363 | transform: translateX(-2px);
|
498 | 364 | transition: transform 300ms;
|
|
0 commit comments