-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: cleanup contract references in auth-server and nft-quest #37
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * as Nft from "./nft"; | ||
export * as Paymaster from "./paymaster"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { AddressByChain } from "./types"; | ||
|
||
export const addressByChain: AddressByChain = { | ||
300: "0x60eef092977DF2738480a6986e2aCD10236b1FA7", | ||
260: "0x4B5DF730c2e6b28E17013A1485E5d9BC41Efe021", | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { Address } from "viem"; | ||
|
||
export type AddressByChain = { | ||
[k in SupportedChainId]: Address; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,25 @@ import { waitForTransactionReceipt, writeContract } from "@wagmi/core"; | |
import type { Address } from "viem"; | ||
import { getGeneralPaymasterInput } from "viem/zksync"; | ||
|
||
import { Nft, Paymaster } from "~/abi"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think abi folder should just store contract abi's, not other information. |
||
import type { SupportedChainId } from "~/stores/connector"; | ||
|
||
export const useMintNft = async (_address: MaybeRef<Address>) => { | ||
const address = toRef(_address); | ||
|
||
return await useAsyncData("mintZeek", async () => { | ||
const runtimeConfig = useRuntimeConfig(); | ||
const { wagmiConfig } = storeToRefs(useConnectorStore()); | ||
const chainId = runtimeConfig.public.defaultChainId as SupportedChainId; | ||
|
||
const mintingForAddress = address.value; | ||
|
||
const transactionHash = await writeContract(wagmiConfig.value, { | ||
address: runtimeConfig.public.contracts.nft as Address, | ||
abi: nftAbi, | ||
address: Nft.addressByChain[chainId] as Address, | ||
abi: Nft.Abi, | ||
functionName: "mint", | ||
args: [mintingForAddress], | ||
paymaster: runtimeConfig.public.contracts.paymaster as Address, | ||
paymaster: Paymaster.addressByChain[chainId] as Address, | ||
paymasterInput: getGeneralPaymasterInput({ innerInput: "0x" }), | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,7 @@ export default defineNuxtConfig({ | |
$production: { | ||
runtimeConfig: { | ||
public: { | ||
chain: zksyncSepoliaTestnet, | ||
contracts: { | ||
nft: "0x4D533d3B20b50b57268f189F93bFaf8B39c36AB6", | ||
paymaster: "0x60eef092977DF2738480a6986e2aCD10236b1FA7", | ||
}, | ||
defaultChainId: zksyncSepoliaTestnet.id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's just do same as in auth server, use default chain env by default or testnet if the env is missing. I thought that was the idea of this PR, but env isn't used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Runtimeconfig vars will automatically get replaced if it follows the naming scheme: "NUXT_PUBLIC_{public runtime config prop}". Writing it in is redundant and ignored if the env var is defined. |
||
baseUrl: "https://nft.zksync.dev", | ||
authServerUrl: "https://auth-test.zksync.dev/confirm", | ||
explorerUrl: "https://sepolia.explorer.zksync.io", | ||
|
@@ -57,11 +53,7 @@ export default defineNuxtConfig({ | |
}, | ||
runtimeConfig: { | ||
public: { | ||
chain: zksyncInMemoryNode, | ||
contracts: { | ||
nft: "0x111C3E89Ce80e62EE88318C2804920D4c96f92bb", | ||
paymaster: "0x4B5DF730c2e6b28E17013A1485E5d9BC41Efe021", | ||
}, | ||
defaultChainId: zksyncInMemoryNode.id, | ||
baseUrl: "http://localhost:3006", | ||
authServerUrl: "http://localhost:3002/confirm", | ||
explorerUrl: "http://localhost:3010", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * as NFTQuest from "./nft-quest"; | ||
export * as SSO from "./sso"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * as Nft from "./nft"; | ||
export * as Paymaster from "./paymaster"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to store addresses in the same way as we do in auth-server. Less files, everything is in one place and less repetitive code