-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DCA dapp using userOpbuilder Service (#686)
* handle userOp building using UserOpBuilderService * refactor dashboard * refactored wc cosigner service * updated USEROP_BUILDER_SERVICE_BASE_URL * chores: text change * chores: run prettier, move const to constantUtils * update CoSignResponse type * remove NEXT_PUBLIC_APPLICATION_PRIVATE_KEY * add .env.example
- Loading branch information
1 parent
4fec2f0
commit efa0ddd
Showing
18 changed files
with
446 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NEXT_PUBLIC_PROJECT_ID= | ||
NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.org | ||
NEXT_PUBLIC_SECURE_SITE_SDK_URL= | ||
APPLICATION_PRIVATE_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
advanced/dapps/dca-dapp-demo/src/components/AddressDisplay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useState } from "react"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Copy, Check } from "lucide-react"; | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from "@/components/ui/tooltip"; | ||
|
||
interface AddressDisplayProps { | ||
address: string; | ||
} | ||
|
||
export default function AddressDisplay({ address }: AddressDisplayProps) { | ||
const [copied, setCopied] = useState(false); | ||
|
||
function shortenAddress(address: string) { | ||
return `${address.slice(0, 6)}...${address.slice(-4)}`; | ||
} | ||
|
||
function copyToClipboard() { | ||
navigator.clipboard.writeText(address).then(() => { | ||
setCopied(true); | ||
setTimeout(() => setCopied(false), 2000); // Reset after 2 seconds | ||
}); | ||
} | ||
|
||
return ( | ||
<div className="flex justify-between items-center border-b pb-2"> | ||
<p className="font-semibold">Address</p> | ||
<div className="flex items-center space-x-2"> | ||
<p className="text-sm">{shortenAddress(address)}</p> | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<Button variant="outline" size="icon" onClick={copyToClipboard}> | ||
{copied ? ( | ||
<Check className="h-4 w-4" /> | ||
) : ( | ||
<Copy className="h-4 w-4" /> | ||
)} | ||
</Button> | ||
</TooltipTrigger> | ||
<TooltipContent> | ||
<p>{copied ? "Copied!" : "Copy"}</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
</div> | ||
</div> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
advanced/dapps/dca-dapp-demo/src/components/AssetBalance.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react"; | ||
|
||
interface AssetBalanceProps { | ||
assetName: string; | ||
balance: string | undefined; | ||
isLoading: boolean; | ||
} | ||
|
||
export default function AssetBalance({ | ||
assetName, | ||
balance, | ||
isLoading, | ||
}: AssetBalanceProps) { | ||
return ( | ||
<> | ||
<div className="flex justify-between border-b pb-2"> | ||
<p className="font-semibold">Asset</p> | ||
<p className="font-semibold">Balance</p> | ||
</div> | ||
<div className="flex justify-between items-center"> | ||
<p>{assetName}</p> | ||
{isLoading ? <p>...</p> : <p>{balance}</p>} | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
advanced/dapps/dca-dapp-demo/src/components/ui/tooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
const TooltipProvider = TooltipPrimitive.Provider; | ||
|
||
const Tooltip = TooltipPrimitive.Root; | ||
|
||
const TooltipTrigger = TooltipPrimitive.Trigger; | ||
|
||
const TooltipContent = React.forwardRef< | ||
React.ElementRef<typeof TooltipPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> | ||
>(({ className, sideOffset = 4, ...props }, ref) => ( | ||
<TooltipPrimitive.Content | ||
ref={ref} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)); | ||
TooltipContent.displayName = TooltipPrimitive.Content.displayName; | ||
|
||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.