Skip to content

Commit

Permalink
Trying to fix github test and acomodating menus
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Oct 20, 2024
1 parent 9d75925 commit a744105
Show file tree
Hide file tree
Showing 8 changed files with 395 additions and 146 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Install dependencies
run: yarn install --immutable

- name: Install foundry-toolchain
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -38,10 +38,11 @@ jobs:
- name: Run foundry node, deploy contracts (& generate contracts typescript output)
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
PUNKSOCIETY_RPC_URL: ${{ secrets.PUNKSOCIETY_RPC_URL }}
run: yarn chain & yarn deploy

- name: Run nextjs lint
run: yarn next:lint --max-warnings=0

- name: Check typings on nextjs
run: yarn next:check-types
run: yarn next:check-types
255 changes: 255 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/7615243/run-1729408395.json

Large diffs are not rendered by default.

150 changes: 75 additions & 75 deletions packages/foundry/broadcast/Deploy.s.sol/7615243/run-latest.json

Large diffs are not rendered by default.

This file was deleted.

4 changes: 0 additions & 4 deletions packages/nextjs/components/punk-society/ConfigMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
// @refresh reset
import { AddressInfoDropdown } from "./AddressInfoDropdown";
import { AddressQRCodeModal } from "./AddressQRCodeModal";
import { BridgeUSDCModal } from "./BridgeUSDCModal";
import { LoadPrivateKeyModal } from "./LoadPrivateKeyModal";
import { PrivateKeyModal } from "./PrivateKeyModal";
import { SendUSDCModal } from "./SendUSDCModal";
import { SwitchLanguageModal } from "./SwitchLanguageModal";
import { WrongNetworkDropdown } from "./WrongNetworkDropdown";
import { ConnectButton } from "@rainbow-me/rainbowkit";
Expand Down Expand Up @@ -62,8 +60,6 @@ export const ConfigMenu = () => {
<PrivateKeyModal modalId="private-key-modal" />
<LoadPrivateKeyModal modalId="load-private-key-modal" />
<SwitchLanguageModal modalId="switch-language-modal" />
<SendUSDCModal modalId="send-usdc-modal" />
<BridgeUSDCModal modalId="bridge-usdc-modal" />
</>
);
})()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
import Image from "next/image";
import { useState } from "react";
import { useAccount } from "wagmi";
import { InputBase } from "~~/components/scaffold-eth";
import { useScaffoldWriteContract } from "~~/hooks/scaffold-eth";
import { notification } from "~~/utils/scaffold-eth";

type SendUSDCModalProps = {
modalId: string;
};

export const SendUSDCModal = ({ modalId }: SendUSDCModalProps) => {
const handleSendUSDCClick = () => {
window.open("https://core.app/es/", "_blank");
const [amount, setAmount] = useState("");
const [receiver, setReceiver] = useState("");
const { address: connectedAddress } = useAccount();
const { writeContractAsync } = useScaffoldWriteContract("SimpleFaucet");

const handleTransfer = async () => {
if (!connectedAddress) {
notification.error("Please connect your wallet");
return;
}

try {
const contractResponse = await writeContractAsync({
functionName: "transfer",
args: [receiver],
value: BigInt(amount),
});

if (contractResponse) {
notification.success("Transfered successfully!");
}
} catch (error) {
console.error("Error during transfering:", error);
notification.error("Transfering failed, please try again.");
} finally {
}
};

return (
<>
<div>
<input type="checkbox" id={`${modalId}`} className="modal-toggle" />
<label htmlFor={`${modalId}`} className="modal cursor-pointer">
<label className="modal-box relative" htmlFor="">
<div className="flex flex-col justify-center items-center text-center">
<h2 className="text-xl font-bold mb-4 text-red-600">Sorry, we can&apos;t send USDC yet.</h2>
<h2 className="text-xl font-bold mb-4 text-red-600">
Import your private key to Core Wallet and send them there
</h2>
<button
onClick={handleSendUSDCClick}
className="btn btn-primary border-0 flex items-center bg-black hover:bg-green-600 active:bg-green-600"
>
<Image src="/corewallet.png" alt="Import your key in Core!" width={40} height={40} className="mr-2" />
Send USDC with Core!
<div className="flex flex-col justify-center items-center text-center gap-3">
<h2 className="text-xl">Transfer USDC to other address</h2>
<InputBase value={receiver} onChange={setReceiver} placeholder="Enter amount" />
<InputBase value={amount} onChange={setAmount} placeholder="Enter amount" />
<button className="btn btn-primary" onClick={handleTransfer}>
Transfer
</button>
<label
htmlFor={`${modalId}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// @refresh reset
import { AddressInfoDropdown } from "./AddressInfoDropdown";
import { AddressQRCodeModal } from "./AddressQRCodeModal";
import { LoadPrivateKeyModal } from "./LoadPrivateKeyModal";
import { PrivateKeyModal } from "./PrivateKeyModal";
import { SwitchLanguageModal } from "./SwitchLanguageModal";
import { SendUSDCModal } from "./SendUSDCModal";
import { WrongNetworkDropdown } from "./WrongNetworkDropdown";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { Address } from "viem";
Expand Down Expand Up @@ -50,9 +48,7 @@ export const PunkConnectButton = () => {
blockExplorerAddressLink={blockExplorerAddressLink}
/>
<AddressQRCodeModal address={account.address as Address} modalId="qrcode-modal" />
<PrivateKeyModal modalId="private-key-modal" />
<LoadPrivateKeyModal modalId="load-private-key-modal" />
<SwitchLanguageModal modalId="switch-language-modal" />
<SendUSDCModal modalId="send-usdc-modal" />
</>
);
})()}
Expand Down
26 changes: 22 additions & 4 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ const deployedContracts = {
},
7615243: {
PunkPosts: {
address: "0xF5f1f185cF359dC48469e410Aeb6983cD4DC5812",
address: "0xa3Acaa140222047317D19F682C7C920E9540A91E",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -2282,7 +2282,7 @@ const deployedContracts = {
},
},
PunkProfile: {
address: "0x768AF58E63775354938e9F3FEdB764F601c038b4",
address: "0xf606475e888A22d85b43DF58b0aB6b2EAf7ac1c1",
abi: [
{
type: "function",
Expand Down Expand Up @@ -2444,7 +2444,7 @@ const deployedContracts = {
inheritedFunctions: {},
},
PunkSociety: {
address: "0x97C0FE6aB595cbFD50ad3860DA5B2017d8B35c2E",
address: "0x4475A8FBeF5Cf4a92a484B6f5602A91F3abC72D8",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -3185,7 +3185,7 @@ const deployedContracts = {
inheritedFunctions: {},
},
SimpleFaucet: {
address: "0xBBfCE55AD100b5bEd880083fCE366120347Af872",
address: "0x049d189BB264FE7FBF38BfBAba83562Fbb6d7DEb",
abi: [
{
type: "receive",
Expand Down Expand Up @@ -3237,6 +3237,24 @@ const deployedContracts = {
],
stateMutability: "view",
},
{
type: "function",
name: "transfer",
inputs: [
{
name: "receiver",
type: "address",
internalType: "address",
},
],
outputs: [],
stateMutability: "payable",
},
{
type: "error",
name: "FailedToTransfer",
inputs: [],
},
],
inheritedFunctions: {},
},
Expand Down

0 comments on commit a744105

Please sign in to comment.