chore: cleanup contract references in auth-server and nft-quest#37
chore: cleanup contract references in auth-server and nft-quest#37itsacoyote wants to merge 1 commit intomainfrom
Conversation
|
Visit the preview URL for this PR (updated for commit b7bb3f6): https://zksync-auth-server-staging--pr37-refactor-chain-data-001eutsg.web.app (expires Tue, 17 Dec 2024 18:51:28 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 509a9c9ea42583076f531c53cf2979c544d5d0b7 |
75145e7 to
caa900e
Compare
caa900e to
b7bb3f6
Compare
JackHamer09
left a comment
There was a problem hiding this comment.
I'm not really in favor of these changes. Looks like overcomplication to me and against usual standard practices.
Except just storing defaultChainId in runtime config and using env to set it, that's good (it just doesn't use the env now as far as I can see).
| @@ -0,0 +1,6 @@ | |||
| import type { AddressByChain } from "./types"; | |||
|
|
|||
| export const addressByChain: AddressByChain = { | |||
There was a problem hiding this comment.
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
| import type { Address } from "viem"; | ||
| import { getGeneralPaymasterInput } from "viem/zksync"; | ||
|
|
||
| import { Nft, Paymaster } from "~/abi"; |
There was a problem hiding this comment.
I think abi folder should just store contract abi's, not other information.
| nft: "0x4D533d3B20b50b57268f189F93bFaf8B39c36AB6", | ||
| paymaster: "0x60eef092977DF2738480a6986e2aCD10236b1FA7", | ||
| }, | ||
| defaultChainId: zksyncSepoliaTestnet.id, |
There was a problem hiding this comment.
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.
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.
| @@ -0,0 +1,351 @@ | |||
| import type { AddressByChain } from "../types"; | |||
|
|
|||
| export const addressByChain: AddressByChain = { | |||
There was a problem hiding this comment.
Why split all addresses to different files? Now if you need to change an address or just find them you'll have to go through all these files..
Description
Refactors reference of contract ABIs and addresses in auth-server and nft-quest.
.env.local. Removed to prevent confusion over what was being used in runtime during dev.nuxt.config.ts, instead use the abi folders.defaultChainIdas runtimeConfig var to use for setting the chain id in auth-server and nft-quest. This should allow overriding with env variables work on things like dev. example:NUXT_PUBLIC_DEFAULT_CHAIN_ID=300 pnpm nx dev nft-quest